diff options
author | Bram Moolenaar <Bram@vim.org> | 2019-09-01 16:24:56 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2019-09-01 16:24:56 +0200 |
commit | c33083592846c8d4b2d6fae499536b9d578fe10d (patch) | |
tree | 8b45ae73958c1702ac0f05f976e8ace86fee91cb /src/vim.h | |
parent | da6c03342117fb7f4a8110bd9e8627b612a05a64 (diff) | |
download | vim-git-c33083592846c8d4b2d6fae499536b9d578fe10d.tar.gz |
patch 8.1.1958: old style comments taking up spacev8.1.1958
Problem: Old style comments taking up space.
Solution: Change to new style comments.
Diffstat (limited to 'src/vim.h')
-rw-r--r-- | src/vim.h | 1370 |
1 files changed, 683 insertions, 687 deletions
@@ -21,9 +21,9 @@ # include "vimio.h" #endif -/* ============ the header file puzzle (ca. 50-100 pieces) ========= */ +// ============ the header file puzzle: order matters ========= -#ifdef HAVE_CONFIG_H /* GNU autoconf (or something else) was here */ +#ifdef HAVE_CONFIG_H // GNU autoconf (or something else) was here # include "auto/config.h" # define HAVE_PATHDEF @@ -47,22 +47,22 @@ # undef HAVE_FCHDIR # endif -/* We may need to define the uint32_t on non-Unix system, but using the same - * identifier causes conflicts. Therefore use UINT32_T. */ +// We may need to define the uint32_t on non-Unix system, but using the same +// identifier causes conflicts. Therefore use UINT32_T. # define UINT32_TYPEDEF uint32_t #endif #if !defined(UINT32_TYPEDEF) -# if defined(uint32_t) /* this doesn't catch typedefs, unfortunately */ +# if defined(uint32_t) // this doesn't catch typedefs, unfortunately # define UINT32_TYPEDEF uint32_t # else - /* Fall back to assuming unsigned int is 32 bit. If this is wrong then the - * test in blowfish.c will fail. */ + // Fall back to assuming unsigned int is 32 bit. If this is wrong then the + // test in blowfish.c will fail. # define UINT32_TYPEDEF unsigned int # endif #endif -/* user ID of root is usually zero, but not for everybody */ +// user ID of root is usually zero, but not for everybody #ifdef __TANDEM # ifndef _TANDEM_SOURCE # define _TANDEM_SOURCE @@ -84,7 +84,7 @@ #if defined(MACOS_X_DARWIN) && !defined(MACOS_X) # define MACOS_X #endif -/* Unless made through the Makefile enforce GUI on Mac */ +// Unless made through the Makefile enforce GUI on Mac #if defined(MACOS_X) && !defined(HAVE_CONFIG_H) # define UNIX # define FEAT_GUI_MAC @@ -96,20 +96,20 @@ || defined(FEAT_GUI_MAC) \ || defined(FEAT_GUI_MSWIN) \ || defined(FEAT_GUI_PHOTON) -# define FEAT_GUI_ENABLED /* also defined with NO_X11_INCLUDES */ +# define FEAT_GUI_ENABLED // also defined with NO_X11_INCLUDES # if !defined(FEAT_GUI) && !defined(NO_X11_INCLUDES) # define FEAT_GUI # endif #endif -/* Check support for rendering options */ +// Check support for rendering options #ifdef FEAT_GUI # if defined(FEAT_DIRECTX) # define FEAT_RENDER_OPTIONS # endif #endif -/* Visual Studio 2005 has 'deprecated' many of the standard CRT functions */ +// Visual Studio 2005 has 'deprecated' many of the standard CRT functions #if _MSC_VER >= 1400 # define _CRT_SECURE_NO_DEPRECATE # define _CRT_NONSTDC_NO_DEPRECATE @@ -124,8 +124,8 @@ #endif #ifdef AMIGA - /* Be conservative about sizeof(int). It could be 4 too. */ -# ifndef FEAT_GUI_GTK /* avoid problems when generating prototypes */ + // Be conservative about sizeof(int). It could be 4 too. +# ifndef FEAT_GUI_GTK // avoid problems when generating prototypes # ifdef __GNUC__ # define VIM_SIZEOF_INT 4 # else @@ -156,14 +156,14 @@ # endif #endif -/* +x11 is only enabled when it's both available and wanted. */ +// +x11 is only enabled when it's both available and wanted. #if defined(HAVE_X11) && defined(WANT_X11) # define FEAT_X11 #endif #ifdef NO_X11_INCLUDES - /* In os_mac_conv.c and os_macosx.m NO_X11_INCLUDES is defined to avoid - * X11 headers. Disable all X11 related things to avoid conflicts. */ + // In os_mac_conv.c and os_macosx.m NO_X11_INCLUDES is defined to avoid + // X11 headers. Disable all X11 related things to avoid conflicts. # ifdef FEAT_X11 # undef FEAT_X11 # endif @@ -193,12 +193,12 @@ # endif #endif -/* The Mac conversion stuff doesn't work under X11. */ +// The Mac conversion stuff doesn't work under X11. #if defined(MACOS_X_DARWIN) # define MACOS_CONVERT #endif -/* Can't use "PACKAGE" here, conflicts with a Perl include file. */ +// Can't use "PACKAGE" here, conflicts with a Perl include file. #ifndef VIMPACKAGE # define VIMPACKAGE "vim" #endif @@ -224,32 +224,31 @@ #if (defined(UNIX) || defined(VMS)) \ && (!defined(MACOS_X) || defined(HAVE_CONFIG_H)) -# include "os_unix.h" /* bring lots of system header files */ +# include "os_unix.h" // bring lots of system header files #endif -/* Mark unused function arguments with UNUSED, so that gcc -Wunused-parameter - * can be used to check for mistakes. */ +// Mark unused function arguments with UNUSED, so that gcc -Wunused-parameter +// can be used to check for mistakes. #ifdef HAVE_ATTRIBUTE_UNUSED # define UNUSED __attribute__((unused)) #else # define UNUSED #endif -/* Used to check for "sun", "__sun" is used by newer compilers. */ +// Used to check for "sun", "__sun" is used by newer compilers. #if defined(__sun) # define SUN_SYSTEM #endif -/* If we're compiling in C++ (currently only KVim), the system - * headers must have the correct prototypes or nothing will build. - * Conversely, our prototypes might clash due to throw() specifiers and - * cause compilation failures even though the headers are correct. For - * a concrete example, gcc-3.2 enforces exception specifications, and - * glibc-2.2.5 has them in their system headers. - */ +// If we're compiling in C++ (currently only KVim), the system +// headers must have the correct prototypes or nothing will build. +// Conversely, our prototypes might clash due to throw() specifiers and +// cause compilation failures even though the headers are correct. For +// a concrete example, gcc-3.2 enforces exception specifications, and +// glibc-2.2.5 has them in their system headers. #if !defined(__cplusplus) && defined(UNIX) \ - && !defined(MACOS_X) /* MACOS_X doesn't yet support osdef.h */ -# include "auto/osdef.h" /* bring missing declarations in */ + && !defined(MACOS_X) // MACOS_X doesn't yet support osdef.h +# include "auto/osdef.h" // bring missing declarations in #endif #ifdef AMIGA @@ -295,7 +294,7 @@ # define PATH_ESC_CHARS ((char_u *)" \t\n*?[{`%#'\"|!<") #else # ifdef VMS - /* VMS allows a lot of characters in the file name */ + // VMS allows a lot of characters in the file name # define PATH_ESC_CHARS ((char_u *)" \t\n*?{`\\%#'\"|!") # define SHELL_ESC_CHARS ((char_u *)" \t\n*?{`\\%#'|!()&") # else @@ -304,15 +303,15 @@ # endif #endif -/* length of a buffer to store a number in ASCII (64 bits binary + NUL) */ +// length of a buffer to store a number in ASCII (64 bits binary + NUL) #define NUMBUFLEN 65 -/* flags for vim_str2nr() */ +// flags for vim_str2nr() #define STR2NR_BIN 1 #define STR2NR_OCT 2 #define STR2NR_HEX 4 #define STR2NR_ALL (STR2NR_BIN + STR2NR_OCT + STR2NR_HEX) -#define STR2NR_FORCE 8 /* only when ONE of the above is used */ +#define STR2NR_FORCE 8 // only when ONE of the above is used /* * Shorthand for unsigned variables. Many systems, but not all, have u_char @@ -322,8 +321,8 @@ typedef unsigned char char_u; typedef unsigned short short_u; typedef unsigned int int_u; -/* Older systems do not have support for long long - * use a typedef instead of hadcoded long long */ +// Older systems do not have support for long long +// use a typedef instead of hadcoded long long #ifdef HAVE_NO_LONG_LONG typedef long long_long_T; typedef long unsigned long_long_u_T; @@ -332,9 +331,9 @@ typedef unsigned int int_u; typedef long long unsigned long_long_u_T; #endif -/* Make sure long_u is big enough to hold a pointer. - * On Win64, longs are 32 bits and pointers are 64 bits. - * For printf() and scanf(), we need to take care of long_u specifically. */ +// Make sure long_u is big enough to hold a pointer. +// On Win64, longs are 32 bits and pointers are 64 bits. +// For printf() and scanf(), we need to take care of long_u specifically. #ifdef _WIN64 typedef unsigned __int64 long_u; typedef __int64 long_i; @@ -342,11 +341,10 @@ typedef __int64 long_i; # define SCANF_DECIMAL_LONG_U "%Iu" # define PRINTF_HEX_LONG_U "0x%Ix" #else - /* Microsoft-specific. The __w64 keyword should be specified on any typedefs - * that change size between 32-bit and 64-bit platforms. For any such type, - * __w64 should appear only on the 32-bit definition of the typedef. - * Define __w64 as an empty token for everything but MSVC 7.x or later. - */ + // Microsoft-specific. The __w64 keyword should be specified on any typedefs + // that change size between 32-bit and 64-bit platforms. For any such type, + // __w64 should appear only on the 32-bit definition of the typedef. + // Define __w64 as an empty token for everything but MSVC 7.x or later. # if !defined(_MSC_VER) || (_MSC_VER < 1300) # define __w64 # endif @@ -415,7 +413,7 @@ typedef unsigned short sattr_T; */ typedef unsigned int u8char_T; // int is 32 bits or more -#ifndef UNIX /* For Unix this is included in os_unix.h */ +#ifndef UNIX // For Unix this is included in os_unix.h # include <stdio.h> # include <ctype.h> #endif @@ -445,8 +443,8 @@ typedef unsigned int u8char_T; // int is 32 bits or more * These are also in os_unix.h, because osdef.sh needs them there. */ #ifndef UNIX -/* Note: Some systems need both string.h and strings.h (Savage). If the - * system can't handle this, define NO_STRINGS_WITH_STRING_H. */ +// Note: Some systems need both string.h and strings.h (Savage). If the +// system can't handle this, define NO_STRINGS_WITH_STRING_H. # ifdef HAVE_STRING_H # include <string.h> # endif @@ -459,7 +457,7 @@ typedef unsigned int u8char_T; // int is 32 bits or more # ifdef HAVE_STDLIB_H # include <stdlib.h> # endif -#endif /* NON-UNIX */ +#endif // NON-UNIX #include <assert.h> @@ -474,7 +472,7 @@ typedef unsigned int u8char_T; // int is 32 bits or more #endif #include <stdarg.h> -/* for offsetof() */ +// for offsetof() #include <stddef.h> #if defined(HAVE_SYS_SELECT_H) && \ @@ -494,7 +492,7 @@ typedef unsigned int u8char_T; // int is 32 bits or more # endif #endif -/* ================ end of the header file puzzle =============== */ +// ================ end of the header file puzzle =============== /* * For dynamically loaded imm library. Currently, only for Win32. @@ -512,7 +510,7 @@ typedef unsigned int u8char_T; // int is 32 bits or more # ifndef FEAT_GETTEXT # define FEAT_GETTEXT # endif -/* These are in os_win32.c */ +// These are in os_win32.c extern char *(*dyn_libintl_gettext)(const char *msgid); extern char *(*dyn_libintl_ngettext)(const char *msgid, const char *msgid_plural, unsigned long n); extern char *(*dyn_libintl_bindtextdomain)(const char *domainname, const char *dirname); @@ -559,31 +557,31 @@ extern int (*dyn_libintl_wputenv)(const wchar_t *envstring); # ifdef bindtextdomain # undef bindtextdomain # endif -# define bindtextdomain(x, y) /* empty */ +# define bindtextdomain(x, y) // empty # ifdef bind_textdomain_codeset # undef bind_textdomain_codeset # endif -# define bind_textdomain_codeset(x, y) /* empty */ +# define bind_textdomain_codeset(x, y) // empty # ifdef textdomain # undef textdomain # endif -# define textdomain(x) /* empty */ +# define textdomain(x) // empty #endif /* * flags for update_screen() * The higher the value, the higher the priority */ -#define VALID_NO_UPDATE 5 /* no new changes, keep the command line if - possible */ -#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 VALID_NO_UPDATE 5 // no new changes, keep the command line if + // possible +#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 /* * Flags for w_valid. @@ -646,7 +644,7 @@ extern int (*dyn_libintl_wputenv)(const wchar_t *envstring); #define HL_STRIKETHROUGH 0x80 #define HL_ALL 0xff -/* special attribute addition: Put message in history */ +// special attribute addition: Put message in history #define MSG_HIST 0x1000 /* @@ -657,50 +655,50 @@ extern int (*dyn_libintl_wputenv)(const wchar_t *envstring); * these bits are set, no mapping is done. * The upper bits are used to distinguish between other states. */ -#define NORMAL 0x01 /* Normal mode, command expected */ -#define VISUAL 0x02 /* Visual mode - use get_real_state() */ -#define OP_PENDING 0x04 /* Normal mode, operator is pending - use - get_real_state() */ -#define CMDLINE 0x08 /* Editing command line */ -#define INSERT 0x10 /* Insert mode */ -#define LANGMAP 0x20 /* Language mapping, can be combined with - INSERT and CMDLINE */ - -#define REPLACE_FLAG 0x40 /* Replace mode flag */ +#define NORMAL 0x01 // Normal mode, command expected +#define VISUAL 0x02 // Visual mode - use get_real_state() +#define OP_PENDING 0x04 // Normal mode, operator is pending - use + // get_real_state() +#define CMDLINE 0x08 // Editing command line +#define INSERT 0x10 // Insert mode +#define LANGMAP 0x20 // Language mapping, can be combined with + // INSERT and CMDLINE + +#define REPLACE_FLAG 0x40 // Replace mode flag #define REPLACE (REPLACE_FLAG + INSERT) -#define VREPLACE_FLAG 0x80 /* Virtual-replace mode flag */ +#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 */ -#define HITRETURN (0x200 + NORMAL) /* waiting for return or command */ -#define ASKMORE 0x300 /* Asking if you want --more-- */ -#define SETWSIZE 0x400 /* window size has changed */ -#define ABBREV 0x500 /* abbreviation instead of mapping */ -#define EXTERNCMD 0x600 /* executing an external command */ -#define SHOWMATCH (0x700 + INSERT) /* show matching paren */ -#define CONFIRM 0x800 /* ":confirm" prompt */ -#define SELECTMODE 0x1000 /* Select mode, only for mappings */ -#define TERMINAL 0x2000 /* Terminal mode */ - -/* all mode bits used for mapping */ +#define NORMAL_BUSY (0x100 + NORMAL) // Normal mode, busy with a command +#define HITRETURN (0x200 + NORMAL) // waiting for return or command +#define ASKMORE 0x300 // Asking if you want --more-- +#define SETWSIZE 0x400 // window size has changed +#define ABBREV 0x500 // abbreviation instead of mapping +#define EXTERNCMD 0x600 // executing an external command +#define SHOWMATCH (0x700 + INSERT) // show matching paren +#define CONFIRM 0x800 // ":confirm" prompt +#define SELECTMODE 0x1000 // Select mode, only for mappings +#define TERMINAL 0x2000 // Terminal mode + +// all mode bits used for mapping #define MAP_ALL_MODES (0x3f | SELECTMODE | TERMINAL) -/* directions */ +// directions #define FORWARD 1 #define BACKWARD (-1) #define FORWARD_FILE 3 #define BACKWARD_FILE (-3) -/* return values for functions */ +// return values for functions #if !(defined(OK) && (OK == 1)) -/* OK already defined to 1 in MacOS X curses, skip this */ +// OK already defined to 1 in MacOS X curses, skip this # define OK 1 #endif #define FAIL 0 -#define NOTDONE 2 /* not OK or FAIL but skipped */ +#define NOTDONE 2 // not OK or FAIL but skipped -/* flags for b_flags */ +// flags for b_flags #define BF_RECOVERED 0x01 // buffer has been recovered #define BF_CHECK_RO 0x02 // need to check readonly when loading file // into buffer (set by ":e", may be reset by @@ -718,7 +716,7 @@ extern int (*dyn_libintl_wputenv)(const wchar_t *envstring); #define BF_SYN_SET 0x200 // 'syntax' option was set #define BF_NO_SEA 0x400 // no swap_exists_action (ATTENTION prompt) -/* Mask to check for flags that prevent normal writing */ +// Mask to check for flags that prevent normal writing #define BF_WRITE_MASK (BF_NOTEDITED + BF_NEW + BF_READERR) /* @@ -776,11 +774,11 @@ extern int (*dyn_libintl_wputenv)(const wchar_t *envstring); #define EXPAND_MAPCLEAR 47 #define EXPAND_ARGLIST 48 -/* Values for exmode_active (0 is no exmode) */ +// Values for exmode_active (0 is no exmode) #define EXMODE_NORMAL 1 #define EXMODE_VIM 2 -/* 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 @@ -824,10 +822,10 @@ extern int (*dyn_libintl_wputenv)(const wchar_t *envstring); #define EW_EMPTYOK 0x8000 // no matches is not an error #define EW_NOTENV 0x10000 // do not expand environment variables -/* 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 #define W_ENDCOL(wp) (wp->w_wincol + wp->w_width) #ifdef FEAT_MENU @@ -840,7 +838,7 @@ extern int (*dyn_libintl_wputenv)(const wchar_t *envstring); # define gen_expand_wildcards mch_expand_wildcards #endif -/* 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 @@ -852,47 +850,47 @@ extern int (*dyn_libintl_wputenv)(const wchar_t *envstring); #define ACTION_EXPAND 5 #ifdef FEAT_SYN_HL -# 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 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 */ -#endif - -/* Values for 'options' argument in do_search() and searchit() */ -#define SEARCH_REV 0x01 /* go in reverse of previous dir. */ -#define SEARCH_ECHO 0x02 /* echo the search command and handle options */ -#define SEARCH_MSG 0x0c /* give messages (yes, it's not 0x04) */ -#define SEARCH_NFMSG 0x08 /* give all messages except not found */ -#define SEARCH_OPT 0x10 /* interpret optional flags */ -#define SEARCH_HIS 0x20 /* put search pattern in history */ -#define SEARCH_END 0x40 /* put cursor at end of match */ -#define SEARCH_NOOF 0x80 /* don't add offset to position */ -#define SEARCH_START 0x100 /* start search without col offset */ -#define SEARCH_MARK 0x200 /* set previous context mark */ -#define SEARCH_KEEP 0x400 /* keep previous search pattern */ -#define SEARCH_PEEK 0x800 /* peek for typed char, cancel search */ -#define SEARCH_COL 0x1000 /* start at specified column instead of zero */ +# 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 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 +#endif + +// Values for 'options' argument in do_search() and searchit() +#define SEARCH_REV 0x01 // go in reverse of previous dir. +#define SEARCH_ECHO 0x02 // echo the search command and handle options +#define SEARCH_MSG 0x0c // give messages (yes, it's not 0x04) +#define SEARCH_NFMSG 0x08 // give all messages except not found +#define SEARCH_OPT 0x10 // interpret optional flags +#define SEARCH_HIS 0x20 // put search pattern in history +#define SEARCH_END 0x40 // put cursor at end of match +#define SEARCH_NOOF 0x80 // don't add offset to position +#define SEARCH_START 0x100 // start search without col offset +#define SEARCH_MARK 0x200 // set previous context mark +#define SEARCH_KEEP 0x400 // keep previous search pattern +#define SEARCH_PEEK 0x800 // peek for typed char, cancel search +#define SEARCH_COL 0x1000 // start at specified column instead of zero // Values for find_ident_under_cursor() #define FIND_IDENT 1 // find identifier (word) @@ -900,25 +898,25 @@ extern int (*dyn_libintl_wputenv)(const wchar_t *envstring); #define FIND_EVAL 4 // include "->", "[]" and "." #define FIND_NOERROR 8 // no error when no word found -/* 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 */ - -/* Values for buflist_getfile() */ -#define GETF_SETMARK 0x01 /* set pcmark before jumping */ -#define GETF_ALT 0x02 /* jumping to alternate file (not buf num) */ -#define GETF_SWITCH 0x04 /* respect 'switchbuf' settings when jumping */ - -/* Return values of getfile() */ -#define GETFILE_ERROR 1 /* normal error */ -#define GETFILE_NOT_WRITTEN 2 /* "not written" error */ -#define GETFILE_SAME_FILE 0 /* success, same file */ -#define GETFILE_OPEN_OTHER -1 /* success, opened another file */ +// 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 + +// Values for buflist_getfile() +#define GETF_SETMARK 0x01 // set pcmark before jumping +#define GETF_ALT 0x02 // jumping to alternate file (not buf num) +#define GETF_SWITCH 0x04 // respect 'switchbuf' settings when jumping + +// Return values of getfile() +#define GETFILE_ERROR 1 // normal error +#define GETFILE_NOT_WRITTEN 2 // "not written" error +#define GETFILE_SAME_FILE 0 // success, same file +#define GETFILE_OPEN_OTHER -1 // success, opened another file #define GETFILE_UNUSED 8 #define GETFILE_SUCCESS(x) ((x) <= 0) @@ -931,52 +929,52 @@ extern int (*dyn_libintl_wputenv)(const wchar_t *envstring); #define BLN_DUMMY_OK 32 // also find an existing dummy buffer #define BLN_REUSE 64 // may re-use number from buf_reuse -/* 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 "noremap" argument of ins_typebuf(). Also used for - * map->m_noremap and menu->noremap[]. */ -#define REMAP_YES 0 /* allow remapping */ -#define REMAP_NONE -1 /* no remapping */ -#define REMAP_SCRIPT -2 /* remap script-local mappings only */ -#define REMAP_SKIP -3 /* no remapping for first char */ - -/* Values for mch_call_shell() second argument */ -#define SHELL_FILTER 1 /* filtering text */ -#define SHELL_EXPAND 2 /* expanding wildcards */ -#define SHELL_COOKED 4 /* set term to cooked mode */ -#define SHELL_DOOUT 8 /* redirecting output */ -#define SHELL_SILENT 16 /* don't print error returned by command */ -#define SHELL_READ 32 /* read lines and insert into buffer */ -#define SHELL_WRITE 64 /* write lines from buffer */ - -/* Values returned by mch_nodetype() */ -#define NODE_NORMAL 0 /* file or directory, check with mch_isdir()*/ -#define NODE_WRITABLE 1 /* something we can write to (character - device, fifo, socket, ..) */ -#define NODE_OTHER 2 /* non-writable thing (e.g., block device) */ - -/* Values for readfile() flags */ -#define READ_NEW 0x01 /* read a file into a new buffer */ -#define READ_FILTER 0x02 /* read filter output */ -#define READ_STDIN 0x04 /* read from stdin */ -#define READ_BUFFER 0x08 /* read from curbuf (converting stdin) */ -#define READ_DUMMY 0x10 /* reading into a dummy buffer */ -#define READ_KEEP_UNDO 0x20 /* keep undo info */ -#define READ_FIFO 0x40 /* read from fifo or socket */ - -/* Values for change_indent() */ -#define INDENT_SET 1 /* set indent */ -#define INDENT_INC 2 /* increase indent */ -#define INDENT_DEC 3 /* decrease indent */ - -/* 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 */ +#define KEY_COMPLETE 0x103 // end of completion + +// Values for "noremap" argument of ins_typebuf(). Also used for +// map->m_noremap and menu->noremap[]. +#define REMAP_YES 0 // allow remapping +#define REMAP_NONE -1 // no remapping +#define REMAP_SCRIPT -2 // remap script-local mappings only +#define REMAP_SKIP -3 // no remapping for first char + +// Values for mch_call_shell() second argument +#define SHELL_FILTER 1 // filtering text +#define SHELL_EXPAND 2 // expanding wildcards +#define SHELL_COOKED 4 // set term to cooked mode +#define SHELL_DOOUT 8 // redirecting output +#define SHELL_SILENT 16 // don't print error returned by command +#define SHELL_READ 32 // read lines and insert into buffer +#define SHELL_WRITE 64 // write lines from buffer + +// Values returned by mch_nodetype() +#define NODE_NORMAL 0 // file or directory, check with mch_isdir() +#define NODE_WRITABLE 1 // something we can write to (character + // device, fifo, socket, ..) +#define NODE_OTHER 2 // non-writable thing (e.g., block device) + +// Values for readfile() flags +#define READ_NEW 0x01 // read a file into a new buffer +#define READ_FILTER 0x02 // read filter output +#define READ_STDIN 0x04 // read from stdin +#define READ_BUFFER 0x08 // read from curbuf (converting stdin) +#define READ_DUMMY 0x10 // reading into a dummy buffer +#define READ_KEEP_UNDO 0x20 // keep undo info +#define READ_FIFO 0x40 // read from fifo or socket + +// Values for change_indent() +#define INDENT_SET 1 // set indent +#define INDENT_INC 2 // increase indent +#define INDENT_DEC 3 // decrease indent + +// 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 action argument for do_buffer() and close_buffer() #define DOBUF_GOTO 0 // go to specified buffer @@ -986,115 +984,113 @@ extern int (*dyn_libintl_wputenv)(const wchar_t *envstring); #define DOBUF_WIPE 4 // delete specified buffer(s) really #define DOBUF_WIPE_REUSE 5 // like DOBUF_WIPE an keep number for reuse -/* Values for start argument for do_buffer() */ -#define DOBUF_CURRENT 0 /* "count" buffer from current buffer */ -#define DOBUF_FIRST 1 /* "count" buffer from first buffer */ -#define DOBUF_LAST 2 /* "count" buffer from last buffer */ -#define DOBUF_MOD 3 /* "count" mod. buffer from current buffer */ - -/* 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 */ - -/* Second argument for vim_regcomp(). */ -#define RE_MAGIC 1 /* 'magic' option */ -#define RE_STRING 2 /* match in string instead of buffer text */ -#define RE_STRICT 4 /* don't allow [abc] without ] */ -#define RE_AUTO 8 /* automatic engine selection */ +// Values for start argument for do_buffer() +#define DOBUF_CURRENT 0 // "count" buffer from current buffer +#define DOBUF_FIRST 1 // "count" buffer from first buffer +#define DOBUF_LAST 2 // "count" buffer from last buffer +#define DOBUF_MOD 3 // "count" mod. buffer from current buffer + +// 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 + +// Second argument for vim_regcomp(). +#define RE_MAGIC 1 // 'magic' option +#define RE_STRING 2 // match in string instead of buffer text +#define RE_STRICT 4 // don't allow [abc] without ] +#define RE_AUTO 8 // automatic engine selection #ifdef FEAT_SYN_HL -/* values for reg_do_extmatch */ -# define REX_SET 1 /* to allow \z\(...\), */ -# define REX_USE 2 /* to allow \z\1 et al. */ +// values for reg_do_extmatch +# define REX_SET 1 // to allow \z\(...\), +# define REX_USE 2 // to allow \z\1 et al. # define REX_ALL (REX_SET | REX_USE) #endif -/* Return values for fullpathcmp() */ -/* Note: can use (fullpathcmp() & FPC_SAME) to check for equal files */ -#define FPC_SAME 1 /* both exist and are the same file. */ -#define FPC_DIFF 2 /* both exist and are different files. */ -#define FPC_NOTX 4 /* both don't exist. */ -#define FPC_DIFFX 6 /* one of them doesn't exist. */ -#define FPC_SAMEX 7 /* both don't exist and file names are same. */ - -/* flags for do_ecmd() */ -#define ECMD_HIDE 0x01 /* don't free the current buffer */ -#define ECMD_SET_HELP 0x02 /* set b_help flag of (new) buffer before - opening file */ -#define ECMD_OLDBUF 0x04 /* use existing buffer if it exists */ -#define ECMD_FORCEIT 0x08 /* ! used in Ex command */ -#define ECMD_ADDBUF 0x10 /* don't edit, just add to buffer list */ - -/* 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 */ - -/* flags for do_cmdline() */ -#define DOCMD_VERBOSE 0x01 /* included command in error message */ -#define DOCMD_NOWAIT 0x02 /* don't call wait_return() and friends */ -#define DOCMD_REPEAT 0x04 /* repeat exec. until getline() returns NULL */ -#define DOCMD_KEYTYPED 0x08 /* don't reset KeyTyped */ -#define DOCMD_EXCRESET 0x10 /* reset exception environment (for debugging)*/ -#define DOCMD_KEEPLINE 0x20 /* keep typed line for repeating with "." */ - -/* flags for 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 mf_sync() */ -#define MFS_ALL 1 /* also sync blocks with negative numbers */ -#define MFS_STOP 2 /* stop syncing when a character is available */ -#define MFS_FLUSH 4 /* flushed file to disk */ -#define MFS_ZERO 8 /* only write block 0 */ - -/* 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 do_put() */ -#define PUT_FIXINDENT 1 /* make indent look nice */ -#define PUT_CURSEND 2 /* leave cursor after end of new text */ -#define PUT_CURSLINE 4 /* leave cursor on last line of new text */ -#define PUT_LINE 8 /* put register as lines */ -#define PUT_LINE_SPLIT 16 /* split line for linewise register */ -#define PUT_LINE_FORWARD 32 /* put linewise register below Visual sel. */ - -/* flags for set_indent() */ -#define SIN_CHANGED 1 /* call changed_bytes() when line changed */ -#define SIN_INSERT 2 /* insert indent before existing text */ -#define SIN_UNDO 4 /* save line for undo before changing it */ - -/* flags for insertchar() */ -#define INSCHAR_FORMAT 1 /* force formatting */ -#define INSCHAR_DO_COM 2 /* format comments */ -#define INSCHAR_CTRLV 4 /* char typed just after CTRL-V */ -#define INSCHAR_NO_FEX 8 /* don't use 'formatexpr' */ -#define INSCHAR_COM_LIST 16 /* format comments with list/2nd line indent */ - -/* flags for 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 */ - -/* - * There are five history tables: - */ -#define HIST_CMD 0 /* colon commands */ -#define HIST_SEARCH 1 /* search commands */ -#define HIST_EXPR 2 /* expressions (from entering = register) */ -#define HIST_INPUT 3 /* input() lines */ -#define HIST_DEBUG 4 /* debug commands */ -#define HIST_COUNT 5 /* number of history tables */ - -/* The type numbers are fixed for backwards compatibility. */ +// Return values for fullpathcmp() +// Note: can use (fullpathcmp() & FPC_SAME) to check for equal files +#define FPC_SAME 1 // both exist and are the same file. +#define FPC_DIFF 2 // both exist and are different files. +#define FPC_NOTX 4 // both don't exist. +#define FPC_DIFFX 6 // one of them doesn't exist. +#define FPC_SAMEX 7 // both don't exist and file names are same. + +// flags for do_ecmd() +#define ECMD_HIDE 0x01 // don't free the current buffer +#define ECMD_SET_HELP 0x02 // set b_help flag of (new) buffer before + // opening file +#define ECMD_OLDBUF 0x04 // use existing buffer if it exists +#define ECMD_FORCEIT 0x08 // ! used in Ex command +#define ECMD_ADDBUF 0x10 // don't edit, just add to buffer list + +// 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 + +// flags for do_cmdline() +#define DOCMD_VERBOSE 0x01 // included command in error message +#define DOCMD_NOWAIT 0x02 // don't call wait_return() and friends +#define DOCMD_REPEAT 0x04 // repeat exec. until getline() returns NULL +#define DOCMD_KEYTYPED 0x08 // don't reset KeyTyped +#define DOCMD_EXCRESET 0x10 // reset exception environment (for debugging) +#define DOCMD_KEEPLINE 0x20 // keep typed line for repeating with "." + +// flags for 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 mf_sync() +#define MFS_ALL 1 // also sync blocks with negative numbers +#define MFS_STOP 2 // stop syncing when a character is available +#define MFS_FLUSH 4 // flushed file to disk +#define MFS_ZERO 8 // only write block 0 + +// 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 do_put() +#define PUT_FIXINDENT 1 // make indent look nice +#define PUT_CURSEND 2 // leave cursor after end of new text +#define PUT_CURSLINE 4 // leave cursor on last line of new text +#define PUT_LINE 8 // put register as lines +#define PUT_LINE_SPLIT 16 // split line for linewise register +#define PUT_LINE_FORWARD 32 // put linewise register below Visual sel. + +// flags for set_indent() +#define SIN_CHANGED 1 // call changed_bytes() when line changed +#define SIN_INSERT 2 // insert indent before existing text +#define SIN_UNDO 4 // save line for undo before changing it + +// flags for insertchar() +#define INSCHAR_FORMAT 1 // force formatting +#define INSCHAR_DO_COM 2 // format comments +#define INSCHAR_CTRLV 4 // char typed just after CTRL-V +#define INSCHAR_NO_FEX 8 // don't use 'formatexpr' +#define INSCHAR_COM_LIST 16 // format comments with list/2nd line indent + +// flags for 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 + +// There are five history tables: +#define HIST_CMD 0 // colon commands +#define HIST_SEARCH 1 // search commands +#define HIST_EXPR 2 // expressions (from entering = register) +#define HIST_INPUT 3 // input() lines +#define HIST_DEBUG 4 // debug commands +#define HIST_COUNT 5 // number of history tables + +// The type numbers are fixed for backwards compatibility. #define BARTYPE_VERSION 1 #define BARTYPE_HISTORY 2 #define BARTYPE_REGISTER 3 @@ -1115,25 +1111,25 @@ typedef struct { btype_T bv_type; long bv_nr; char_u *bv_string; - int bv_len; /* length of bv_string */ - int bv_allocated; /* bv_string was allocated */ + int bv_len; // length of bv_string + int bv_allocated; // bv_string was allocated } bval_T; /* * 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(). @@ -1161,7 +1157,7 @@ typedef struct { #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 gui_yesnocancel() @@ -1175,57 +1171,57 @@ typedef struct { /* * 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 /* * arguments for gui_set_shellsize() */ -#define RESIZE_VERT 1 /* resize vertically */ -#define RESIZE_HOR 2 /* resize horizontally */ -#define RESIZE_BOTH 15 /* resize in both directions */ +#define RESIZE_VERT 1 // resize vertically +#define RESIZE_HOR 2 // resize horizontally +#define RESIZE_BOTH 15 // resize in both directions /* * flags for check_changed() */ -#define CCGD_AW 1 /* do autowrite if buffer was changed */ -#define CCGD_MULTWIN 2 /* check also when several wins for the buf */ -#define CCGD_FORCEIT 4 /* ! used */ -#define CCGD_ALLBUF 8 /* may write all buffers */ -#define CCGD_EXCMD 16 /* may suggest using ! */ +#define CCGD_AW 1 // do autowrite if buffer was changed +#define CCGD_MULTWIN 2 // check also when several wins for the buf +#define CCGD_FORCEIT 4 // ! used +#define CCGD_ALLBUF 8 // may write all buffers +#define CCGD_EXCMD 16 // may suggest using ! /* * "flags" values for option-setting functions. * When OPT_GLOBAL and OPT_LOCAL are both missing, set both local and global * values, get local value. */ -#define OPT_FREE 1 /* free old value if it was allocated */ -#define OPT_GLOBAL 2 /* use global value */ -#define OPT_LOCAL 4 /* use local value */ -#define OPT_MODELINE 8 /* option in modeline */ -#define OPT_WINONLY 16 /* only set window-local options */ -#define OPT_NOWIN 32 /* don't set window-local options */ - -/* Magic chars used in confirm dialog strings */ +#define OPT_FREE 1 // free old value if it was allocated +#define OPT_GLOBAL 2 // use global value +#define OPT_LOCAL 4 // use local value +#define OPT_MODELINE 8 // option in modeline +#define OPT_WINONLY 16 // only set window-local options +#define OPT_NOWIN 32 // don't set window-local options + +// Magic chars used in confirm dialog strings #define DLG_BUTTON_SEP '\n' #define DLG_HOTKEY_CHAR '&' -/* Values for "starting" */ -#define NO_SCREEN 2 /* no screen updating yet */ -#define NO_BUFFERS 1 /* not all buffers loaded yet */ -/* 0 not starting anymore */ +// Values for "starting" +#define NO_SCREEN 2 // no screen updating yet +#define NO_BUFFERS 1 // not all buffers loaded yet +// 0 not starting anymore -/* Values for swap_exists_action: what to do when swap file already exists */ -#define SEA_NONE 0 /* don't use dialog */ -#define SEA_DIALOG 1 /* use dialog when possible */ -#define SEA_QUIT 2 /* quit editing the file */ -#define SEA_RECOVER 3 /* recover the file */ +// Values for swap_exists_action: what to do when swap file already exists +#define SEA_NONE 0 // don't use dialog +#define SEA_DIALOG 1 // use dialog when possible +#define SEA_QUIT 2 // quit editing the file +#define SEA_RECOVER 3 // recover the file /* * Minimal size for block 0 of a swap file. @@ -1236,13 +1232,13 @@ typedef struct { #define MIN_SWAP_PAGE_SIZE 1048 #define MAX_SWAP_PAGE_SIZE 50000 -/* Special values for current_sctx.sc_sid. */ -#define SID_MODELINE -1 /* when using a modeline */ -#define SID_CMDARG -2 /* for "--cmd" argument */ -#define SID_CARG -3 /* for "-c" argument */ -#define SID_ENV -4 /* for sourcing environment variable */ -#define SID_ERROR -5 /* option was reset because of an error */ -#define SID_NONE -6 /* don't set scriptID */ +// Special values for current_sctx.sc_sid. +#define SID_MODELINE -1 // when using a modeline +#define SID_CMDARG -2 // for "--cmd" argument +#define SID_CARG -3 // for "-c" argument +#define SID_ENV -4 // for sourcing environment variable +#define SID_ERROR -5 // option was reset because of an error +#define SID_NONE -6 // don't set scriptID /* * Events for autocommands. @@ -1361,59 +1357,59 @@ typedef enum auto_event event_T; */ typedef enum { - HLF_8 = 0 /* Meta & special keys listed with ":map", text that is - displayed different from what it is */ - , HLF_EOB /* after the last line in the buffer */ - , HLF_AT /* @ characters at end of screen, characters that - don't really exist in the text */ - , HLF_D /* directories in CTRL-D listing */ - , HLF_E /* error messages */ - , HLF_H /* obsolete, ignored */ - , HLF_I /* incremental search */ - , HLF_L /* last search string */ - , HLF_M /* "--More--" message */ - , HLF_CM /* Mode (e.g., "-- INSERT --") */ - , HLF_N /* line number for ":number" and ":#" commands */ - , HLF_CLN /* current line number */ - , HLF_R /* return to continue message and yes/no questions */ - , HLF_S /* status lines */ - , HLF_SNC /* status lines of not-current windows */ - , HLF_C /* column to separate vertically split windows */ - , HLF_T /* Titles for output from ":set all", ":autocmd" etc. */ - , HLF_V /* Visual mode */ - , HLF_VNC /* Visual mode, autoselecting and not clipboard owner */ - , HLF_W /* warning messages */ - , HLF_WM /* Wildmenu highlight */ - , HLF_FL /* Folded line */ - , HLF_FC /* Fold column */ - , HLF_ADD /* Added diff line */ - , HLF_CHD /* Changed diff line */ - , HLF_DED /* Deleted diff line */ - , HLF_TXD /* Text Changed in diff line */ - , HLF_CONCEAL /* Concealed text */ - , HLF_SC /* Sign column */ - , HLF_SPB /* SpellBad */ - , HLF_SPC /* SpellCap */ - , HLF_SPR /* SpellRare */ - , HLF_SPL /* SpellLocal */ - , HLF_PNI /* popup menu normal item */ - , HLF_PSI /* popup menu selected item */ - , HLF_PSB /* popup menu scrollbar */ - , HLF_PST /* popup menu scrollbar thumb */ - , HLF_TP /* tabpage line */ - , HLF_TPS /* tabpage line selected */ - , HLF_TPF /* tabpage line filler */ - , HLF_CUC /* 'cursorcolumn' */ - , HLF_CUL /* 'cursorline' */ - , HLF_MC /* 'colorcolumn' */ - , HLF_QFL /* quickfix window line currently selected */ - , HLF_ST /* status lines of terminal windows */ - , HLF_STNC /* status lines of not-current terminal windows */ - , HLF_COUNT /* MUST be the last one */ + HLF_8 = 0 // Meta & special keys listed with ":map", text that is + // displayed different from what it is + , HLF_EOB // after the last line in the buffer + , HLF_AT // @ characters at end of screen, characters that + // don't really exist in the text + , HLF_D // directories in CTRL-D listing + , HLF_E // error messages + , HLF_H // obsolete, ignored + , HLF_I // incremental search + , HLF_L // last search string + , HLF_M // "--More--" message + , HLF_CM // Mode (e.g., "-- INSERT --") + , HLF_N // line number for ":number" and ":#" commands + , HLF_CLN // current line number + , HLF_R // return to continue message and yes/no questions + , HLF_S // status lines + , HLF_SNC // status lines of not-current windows + , HLF_C // column to separate vertically split windows + , HLF_T // Titles for output from ":set all", ":autocmd" etc. + , HLF_V // Visual mode + , HLF_VNC // Visual mode, autoselecting and not clipboard owner + , HLF_W // warning messages + , HLF_WM // Wildmenu highlight + , HLF_FL // Folded line + , HLF_FC // Fold column + , HLF_ADD // Added diff line + , HLF_CHD // Changed diff line + , HLF_DED // Deleted diff line + , HLF_TXD // Text Changed in diff line + , HLF_CONCEAL // Concealed text + , HLF_SC // Sign column + , HLF_SPB // SpellBad + , HLF_SPC // SpellCap + , HLF_SPR // SpellRare + , HLF_SPL // SpellLocal + , HLF_PNI // popup menu normal item + , HLF_PSI // popup menu selected item + , HLF_PSB // popup menu scrollbar + , HLF_PST // popup menu scrollbar thumb + , HLF_TP // tabpage line + , HLF_TPS // tabpage line selected + , HLF_TPF // tabpage line filler + , HLF_CUC // 'cursorcolumn' + , HLF_CUL // 'cursorline' + , HLF_MC // 'colorcolumn' + , HLF_QFL // quickfix window line currently selected + , HLF_ST // status lines of terminal windows + , HLF_STNC // status lines of not-current terminal windows + , HLF_COUNT // MUST be the last one } hlf_T; -/* The HL_FLAGS must be in the same order as the HLF_ enums! - * When changing this also adjust the default for 'highlight'. */ +// The HL_FLAGS must be in the same order as the HLF_ enums! +// When changing this also adjust the default for 'highlight'. #define HL_FLAGS {'8', '~', '@', 'd', 'e', 'h', 'i', 'l', 'm', 'M', \ 'n', 'N', 'r', 's', 'S', 'c', 't', 'v', 'V', 'w', 'W', \ 'f', 'F', 'A', 'C', 'D', 'T', '-', '>', \ @@ -1425,11 +1421,11 @@ typedef enum * Boolean constants */ #ifndef TRUE -# define FALSE 0 /* note: this is an int, not a long! */ +# define FALSE 0 // note: this is an int, not a long! # define TRUE 1 #endif -#define MAYBE 2 /* sometimes used for a variant on TRUE */ +#define MAYBE 2 // sometimes used for a variant on TRUE #ifndef UINT32_T typedef UINT32_TYPEDEF UINT32_T; @@ -1438,87 +1434,87 @@ typedef UINT32_TYPEDEF UINT32_T; /* * Operator IDs; The order must correspond to opchars[] in ops.c! */ -#define OP_NOP 0 /* no pending operation */ -#define OP_DELETE 1 /* "d" delete operator */ -#define OP_YANK 2 /* "y" yank operator */ -#define OP_CHANGE 3 /* "c" change operator */ -#define OP_LSHIFT 4 /* "<" left shift operator */ -#define OP_RSHIFT 5 /* ">" right shift operator */ -#define OP_FILTER 6 /* "!" filter operator */ -#define OP_TILDE 7 /* "g~" switch case operator */ -#define OP_INDENT 8 /* "=" indent operator */ -#define OP_FORMAT 9 /* "gq" format operator */ -#define OP_COLON 10 /* ":" colon operator */ -#define OP_UPPER 11 /* "gU" make upper case operator */ -#define OP_LOWER 12 /* "gu" make lower case operator */ -#define OP_JOIN 13 /* "J" join operator, only for Visual mode */ -#define OP_JOIN_NS 14 /* "gJ" join operator, only for Visual mode */ -#define OP_ROT13 15 /* "g?" rot-13 encoding */ -#define OP_REPLACE 16 /* "r" replace chars, only for Visual mode */ -#define OP_INSERT 17 /* "I" Insert column, only for Visual mode */ -#define OP_APPEND 18 /* "A" Append column, only for Visual mode */ -#define OP_FOLD 19 /* "zf" define a fold */ -#define OP_FOLDOPEN 20 /* "zo" open folds */ -#define OP_FOLDOPENREC 21 /* "zO" open folds recursively */ -#define OP_FOLDCLOSE 22 /* "zc" close folds */ -#define OP_FOLDCLOSEREC 23 /* "zC" close folds recursively */ -#define OP_FOLDDEL 24 /* "zd" delete folds */ -#define OP_FOLDDELREC 25 /* "zD" delete folds recursively */ -#define OP_FORMAT2 26 /* "gw" format operator, keeps cursor pos */ -#define OP_FUNCTION 27 /* "g@" call 'operatorfunc' */ -#define OP_NR_ADD 28 /* "<C-A>" Add to the number or alphabetic - character (OP_ADD conflicts with Perl) */ -#define OP_NR_SUB 29 /* "<C-X>" Subtract from the number or - alphabetic character */ +#define OP_NOP 0 // no pending operation +#define OP_DELETE 1 // "d" delete operator +#define OP_YANK 2 // "y" yank operator +#define OP_CHANGE 3 // "c" change operator +#define OP_LSHIFT 4 // "<" left shift operator +#define OP_RSHIFT 5 // ">" right shift operator +#define OP_FILTER 6 // "!" filter operator +#define OP_TILDE 7 // "g~" switch case operator +#define OP_INDENT 8 // "=" indent operator +#define OP_FORMAT 9 // "gq" format operator +#define OP_COLON 10 // ":" colon operator +#define OP_UPPER 11 // "gU" make upper case operator +#define OP_LOWER 12 // "gu" make lower case operator +#define OP_JOIN 13 // "J" join operator, only for Visual mode +#define OP_JOIN_NS 14 // "gJ" join operator, only for Visual mode +#define OP_ROT13 15 // "g?" rot-13 encoding +#define OP_REPLACE 16 // "r" replace chars, only for Visual mode +#define OP_INSERT 17 // "I" Insert column, only for Visual mode +#define OP_APPEND 18 // "A" Append column, only for Visual mode +#define OP_FOLD 19 // "zf" define a fold +#define OP_FOLDOPEN 20 // "zo" open folds +#define OP_FOLDOPENREC 21 // "zO" open folds recursively +#define OP_FOLDCLOSE 22 // "zc" close folds +#define OP_FOLDCLOSEREC 23 // "zC" close folds recursively +#define OP_FOLDDEL 24 // "zd" delete folds +#define OP_FOLDDELREC 25 // "zD" delete folds recursively +#define OP_FORMAT2 26 // "gw" format operator, keeps cursor pos +#define OP_FUNCTION 27 // "g@" call 'operatorfunc' +#define OP_NR_ADD 28 // "<C-A>" Add to the number or alphabetic + // character (OP_ADD conflicts with Perl) +#define OP_NR_SUB 29 // "<C-X>" Subtract from the number or + // alphabetic character /* * Motion types, used for operators and for yank/delete registers. */ -#define MCHAR 0 /* character-wise movement/register */ -#define MLINE 1 /* line-wise movement/register */ -#define MBLOCK 2 /* block-wise register */ +#define MCHAR 0 // character-wise movement/register +#define MLINE 1 // line-wise movement/register +#define MBLOCK 2 // block-wise register -#define MAUTO 0xff /* Decide between MLINE/MCHAR */ +#define MAUTO 0xff // Decide between MLINE/MCHAR /* * Minimum screen size */ -#define MIN_COLUMNS 12 /* minimal columns for screen */ -#define MIN_LINES 2 /* minimal lines for screen */ -#define STATUS_HEIGHT 1 /* height of a status line under a window */ -#ifdef FEAT_MENU /* height of a status line under a window */ +#define MIN_COLUMNS 12 // minimal columns for screen +#define MIN_LINES 2 // minimal lines for screen +#define STATUS_HEIGHT 1 // height of a status line under a window +#ifdef FEAT_MENU // height of a status line under a window # define WINBAR_HEIGHT(wp) (wp)->w_winbar_height # define VISIBLE_HEIGHT(wp) ((wp)->w_height + (wp)->w_winbar_height) #else # define WINBAR_HEIGHT(wp) 0 # define VISIBLE_HEIGHT(wp) (wp)->w_height #endif -#define QF_WINHEIGHT 10 /* default height for quickfix window */ +#define QF_WINHEIGHT 10 // default height for quickfix window /* * Buffer sizes */ #ifndef CMDBUFFSIZE -# define CMDBUFFSIZE 256 /* size of the command processing buffer */ +# define CMDBUFFSIZE 256 // size of the command processing buffer #endif -#define LSIZE 512 /* max. size of a line in the tags file */ +#define LSIZE 512 // max. size of a line in the tags file -#define IOSIZE (1024+1) /* file i/o and sprintf buffer size */ +#define IOSIZE (1024+1) // file i/o and sprintf buffer size -#define DIALOG_MSG_SIZE 1000 /* buffer size for dialog_msg() */ +#define DIALOG_MSG_SIZE 1000 // buffer size for dialog_msg() -#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) */ +#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) -#define FOLD_TEXT_LEN 51 /* buffer size for get_foldtext() */ +#define FOLD_TEXT_LEN 51 // buffer size for get_foldtext() -/* Size of the buffer used for tgetent(). Unfortunately this is largely - * undocumented, some systems use 1024. Using a buffer that is too small - * causes a buffer overrun and a crash. Use the maximum known value to stay - * on the safe side. */ -#define TBUFSZ 2048 /* buffer size for termcap entry */ +// Size of the buffer used for tgetent(). Unfortunately this is largely +// undocumented, some systems use 1024. Using a buffer that is too small +// causes a buffer overrun and a crash. Use the maximum known value to stay +// on the safe side. +#define TBUFSZ 2048 // buffer size for termcap entry /* * Maximum length of key sequence to be mapped. @@ -1526,7 +1522,7 @@ typedef UINT32_TYPEDEF UINT32_T; */ #define MAXMAPLEN 50 -/* Size in bytes of the hash used in the undo file. */ +// Size in bytes of the hash used in the undo file. #define UNDO_HASH_SIZE 32 #ifdef HAVE_FCNTL_H @@ -1534,7 +1530,7 @@ typedef UINT32_TYPEDEF UINT32_T; #endif #ifdef BINARY_FILE_IO -# define WRITEBIN "wb" /* no CR-LF translation */ +# define WRITEBIN "wb" // no CR-LF translation # define READBIN "rb" # define APPENDBIN "ab" #else @@ -1558,10 +1554,10 @@ typedef UINT32_TYPEDEF UINT32_T; #endif #ifndef W_OK -# define W_OK 2 /* for systems that don't have W_OK in unistd.h */ +# define W_OK 2 // for systems that don't have W_OK in unistd.h #endif #ifndef R_OK -# define R_OK 4 /* for systems that don't have R_OK in unistd.h */ +# define R_OK 4 // for systems that don't have R_OK in unistd.h #endif // Allocate memory for one type and cast the returned pointer to have the @@ -1593,7 +1589,7 @@ typedef UINT32_TYPEDEF UINT32_T; # endif #endif -/* Like strcpy() but allows overlapped source and destination. */ +// Like strcpy() but allows overlapped source and destination. #define STRMOVE(d, s) mch_memmove((d), (s), STRLEN(s) + 1) #ifdef HAVE_STRNCASECMP @@ -1606,11 +1602,11 @@ typedef UINT32_TYPEDEF UINT32_T; # endif #endif -/* We need to call mb_stricmp() even when we aren't dealing with a multi-byte - * encoding because mb_stricmp() takes care of all ascii and non-ascii - * encodings, including characters with umlauts in latin1, etc., while - * STRICMP() only handles the system locale version, which often does not - * handle non-ascii properly. */ +// We need to call mb_stricmp() even when we aren't dealing with a multi-byte +// encoding because mb_stricmp() takes care of all ascii and non-ascii +// encodings, including characters with umlauts in latin1, etc., while +// STRICMP() only handles the system locale version, which often does not +// handle non-ascii properly. # define MB_STRICMP(d, s) mb_strnicmp((char_u *)(d), (char_u *)(s), (int)MAXCOL) # define MB_STRNICMP(d, s, n) mb_strnicmp((char_u *)(d), (char_u *)(s), (int)(n)) @@ -1660,17 +1656,17 @@ typedef UINT32_TYPEDEF UINT32_T; # define GUI_GET_COLOR GUI_FUNCTION(get_color) #endif -/* Prefer using emsgf(), because perror() may send the output to the wrong - * destination and mess up the screen. */ +// Prefer using emsgf(), because perror() may send the output to the wrong +// destination and mess up the screen. #ifdef HAVE_STRERROR # define PERROR(msg) (void)semsg("%s: %s", (char *)msg, strerror(errno)) #else # define PERROR(msg) do_perror(msg) #endif -typedef long linenr_T; /* line number type */ -typedef int colnr_T; /* column number type */ -typedef unsigned short disptick_T; /* display tick type */ +typedef long linenr_T; // line number type +typedef int colnr_T; // column number type +typedef unsigned short disptick_T; // display tick type /* * Well, you won't believe it, but some S/390 machines ("host", now also known @@ -1724,8 +1720,8 @@ void *vim_memset(void *, int, size_t); #endif #ifdef MSWIN -/* On MS-Windows the third argument isn't size_t. This matters for Win64, - * where sizeof(size_t)==8, not 4 */ +// On MS-Windows the third argument isn't size_t. This matters for Win64, +// where sizeof(size_t)==8, not 4 # define vim_read(fd, buf, count) read((fd), (char *)(buf), (unsigned int)(count)) # define vim_write(fd, buf, count) write((fd), (char *)(buf), (unsigned int)(count)) #else @@ -1754,11 +1750,11 @@ void *vim_memset(void *, int, size_t); # endif #endif -#define MAX_MCO 6 /* maximum value for 'maxcombine' */ +#define MAX_MCO 6 // maximum value for 'maxcombine' -/* Maximum number of bytes in a multi-byte character. It can be one 32-bit - * character of up to 6 bytes, or one 16-bit character of up to three bytes - * plus six following composing characters of three bytes each. */ +// Maximum number of bytes in a multi-byte character. It can be one 32-bit +// character of up to 6 bytes, or one 16-bit character of up to three bytes +// plus six following composing characters of three bytes each. #define MB_MAXBYTES 21 #if (defined(FEAT_PROFILE) || defined(FEAT_RELTIME)) && !defined(PROTO) @@ -1768,7 +1764,7 @@ typedef LARGE_INTEGER proftime_T; typedef struct timeval proftime_T; # endif #else -typedef int proftime_T; /* dummy for function prototypes */ +typedef int proftime_T; // dummy for function prototypes #endif /* @@ -1792,55 +1788,55 @@ typedef __int64 sock_T; typedef int sock_T; #endif -/* Include option.h before structs.h, because the number of window-local and - * buffer-local options is used there. */ -#include "option.h" /* options and default values */ +// Include option.h before structs.h, because the number of window-local and +// buffer-local options is used there. +#include "option.h" // options and default values -#include "beval.h" /* BalloonEval */ +#include "beval.h" // BalloonEval -/* Note that gui.h is included by structs.h */ +// Note that gui.h is included by structs.h -#include "structs.h" /* defines many structures */ +#include "structs.h" // defines many structures #include "alloc.h" -/* Values for "do_profiling". */ -#define PROF_NONE 0 /* profiling not started */ -#define PROF_YES 1 /* profiling busy */ -#define PROF_PAUSED 2 /* profiling paused */ +// Values for "do_profiling". +#define PROF_NONE 0 // profiling not started +#define PROF_YES 1 // profiling busy +#define PROF_PAUSED 2 // profiling paused #ifdef FEAT_MOUSE -/* Codes for mouse button events in lower three bits: */ +// Codes for mouse button events in lower three bits: # define MOUSE_LEFT 0x00 # define MOUSE_MIDDLE 0x01 # define MOUSE_RIGHT 0x02 # define MOUSE_RELEASE 0x03 -/* bit masks for modifiers: */ +// bit masks for modifiers: # define MOUSE_SHIFT 0x04 # define MOUSE_ALT 0x08 # define MOUSE_CTRL 0x10 -/* mouse buttons that are handled like a key press (GUI only) */ -/* Note that the scroll wheel keys are inverted: MOUSE_5 scrolls lines up but - * the result of this is that the window moves down, similarly MOUSE_6 scrolls - * columns left but the window moves right. */ -# define MOUSE_4 0x100 /* scroll wheel down */ -# define MOUSE_5 0x200 /* scroll wheel up */ +// mouse buttons that are handled like a key press (GUI only) +// Note that the scroll wheel keys are inverted: MOUSE_5 scrolls lines up but +// the result of this is that the window moves down, similarly MOUSE_6 scrolls +// columns left but the window moves right. +# define MOUSE_4 0x100 // scroll wheel down +# define MOUSE_5 0x200 // scroll wheel up -# define MOUSE_X1 0x300 /* Mouse-button X1 (6th) */ -# define MOUSE_X2 0x400 /* Mouse-button X2 */ +# define MOUSE_X1 0x300 // Mouse-button X1 (6th) +# define MOUSE_X2 0x400 // Mouse-button X2 -# define MOUSE_6 0x500 /* scroll wheel left */ -# define MOUSE_7 0x600 /* scroll wheel right */ +# define MOUSE_6 0x500 // scroll wheel left +# define MOUSE_7 0x600 // scroll wheel right -/* 0x20 is reserved by xterm */ +// 0x20 is reserved by xterm # define MOUSE_DRAG_XTERM 0x40 # define MOUSE_DRAG (0x40 | MOUSE_RELEASE) -/* Lowest button code for using the mouse wheel (xterm only) */ +// Lowest button code for using the mouse wheel (xterm only) # define MOUSEWHEEL_LOW 0x60 # define MOUSE_CLICK_MASK 0x03 @@ -1851,9 +1847,9 @@ typedef int sock_T; # define SET_NUM_MOUSE_CLICKS(code, num) \ (code) = ((code) & 0x3f) | ((((num) - 1) & 3) << 6) -/* Added to mouse column for GUI when 'mousefocus' wants to give focus to a - * window by simulating a click on its status line. We could use up to 128 * - * 128 = 16384 columns, now it's reduced to 10000. */ +// Added to mouse column for GUI when 'mousefocus' wants to give focus to a +// window by simulating a click on its status line. We could use up to 128 * +// 128 = 16384 columns, now it's reduced to 10000. # define MOUSE_COLOFF 10000 /* @@ -1862,33 +1858,33 @@ typedef int sock_T; */ # define IN_UNKNOWN 0 # define IN_BUFFER 1 -# define IN_STATUS_LINE 2 /* on status or command line */ -# define IN_SEP_LINE 4 /* on vertical separator line */ -# define IN_OTHER_WIN 8 /* in other window but can't go there */ +# define IN_STATUS_LINE 2 // on status or command line +# define IN_SEP_LINE 4 // on vertical separator line +# define IN_OTHER_WIN 8 // in other window but can't go there # define CURSOR_MOVED 0x100 -# define MOUSE_FOLD_CLOSE 0x200 /* clicked on '-' in fold column */ -# define MOUSE_FOLD_OPEN 0x400 /* clicked on '+' in fold column */ -# define MOUSE_WINBAR 0x800 /* in window toolbar */ - -/* flags for jump_to_mouse() */ -# define MOUSE_FOCUS 0x01 /* need to stay in this window */ -# define MOUSE_MAY_VIS 0x02 /* may start Visual mode */ -# define MOUSE_DID_MOVE 0x04 /* only act when mouse has moved */ -# define MOUSE_SETPOS 0x08 /* only set current mouse position */ -# define MOUSE_MAY_STOP_VIS 0x10 /* may stop Visual mode */ -# define MOUSE_RELEASED 0x20 /* button was released */ +# define MOUSE_FOLD_CLOSE 0x200 // clicked on '-' in fold column +# define MOUSE_FOLD_OPEN 0x400 // clicked on '+' in fold column +# define MOUSE_WINBAR 0x800 // in window toolbar + +// flags for jump_to_mouse() +# define MOUSE_FOCUS 0x01 // need to stay in this window +# define MOUSE_MAY_VIS 0x02 // may start Visual mode +# define MOUSE_DID_MOVE 0x04 // only act when mouse has moved +# define MOUSE_SETPOS 0x08 // only set current mouse position +# define MOUSE_MAY_STOP_VIS 0x10 // may stop Visual mode +# define MOUSE_RELEASED 0x20 // button was released # if defined(UNIX) && defined(HAVE_GETTIMEOFDAY) && defined(HAVE_SYS_TIME_H) -# define CHECK_DOUBLE_CLICK 1 /* Checking for double clicks ourselves. */ +# define CHECK_DOUBLE_CLICK 1 // Checking for double clicks ourselves. # endif -#endif /* FEAT_MOUSE */ +#endif // FEAT_MOUSE -/* defines for eval_vars() */ +// defines for eval_vars() #define VALID_PATH 1 #define VALID_HEAD 2 -/* Defines for Vim variables. These must match vimvars[] in eval.c! */ +// Defines for Vim variables. These must match vimvars[] in eval.c! #define VV_COUNT 0 #define VV_COUNT1 1 #define VV_PREVCOUNT 2 @@ -2003,17 +1999,17 @@ typedef int sock_T; #define VAR_TYPE_CHANNEL 9 #define VAR_TYPE_BLOB 10 -#define DICT_MAXNEST 100 /* maximum nesting of lists and dicts */ +#define DICT_MAXNEST 100 // maximum nesting of lists and dicts #ifdef FEAT_CLIPBOARD -/* VIM_ATOM_NAME is the older Vim-specific selection type for X11. Still - * supported for when a mix of Vim versions is used. VIMENC_ATOM_NAME includes - * the encoding to support Vims using different 'encoding' values. */ +// VIM_ATOM_NAME is the older Vim-specific selection type for X11. Still +// supported for when a mix of Vim versions is used. VIMENC_ATOM_NAME includes +// the encoding to support Vims using different 'encoding' values. # define VIM_ATOM_NAME "_VIM_TEXT" # define VIMENC_ATOM_NAME "_VIMENC_TEXT" -/* Selection states for modeless selection */ +// Selection states for modeless selection # define SELECT_CLEARED 0 # define SELECT_IN_PROGRESS 1 # define SELECT_DONE 2 @@ -2028,7 +2024,7 @@ typedef int sock_T; # endif # endif -/* Info about selected text */ +// Info about selected text typedef struct { int available; // Is clipboard available? @@ -2072,7 +2068,7 @@ typedef struct typedef int Clipboard_T; // This is required for the prototypes. #endif -/* Use 64-bit stat structure if available. */ +// Use 64-bit stat structure if available. #if (defined(_MSC_VER) && (_MSC_VER >= 1300)) || defined(__MINGW32__) # define HAVE_STAT64 typedef struct _stat64 stat_T; @@ -2093,12 +2089,12 @@ typedef enum ASSERT_OTHER } assert_type_T; -/* Mode for bracketed_paste(). */ +// Mode for bracketed_paste(). typedef enum { - PASTE_INSERT, /* insert mode */ - PASTE_CMDLINE, /* command line */ - PASTE_EX, /* ex mode line */ - PASTE_ONE_CHAR /* return first character */ + PASTE_INSERT, // insert mode + PASTE_CMDLINE, // command line + PASTE_EX, // ex mode line + PASTE_ONE_CHAR // return first character } paste_mode_T; // Argument for flush_buffers(). @@ -2108,15 +2104,15 @@ typedef enum { FLUSH_INPUT // flush typebuf and inchar() input } flush_buffers_T; -#include "ex_cmds.h" /* Ex command defines */ -#include "spell.h" /* spell checking stuff */ +#include "ex_cmds.h" // Ex command defines +#include "spell.h" // spell checking stuff -#include "proto.h" /* function prototypes */ +#include "proto.h" // function prototypes -/* This has to go after the include of proto.h, as proto/gui.pro declares - * functions of these names. The declarations would break if the defines had - * been seen at that stage. But it must be before globals.h, where error_ga - * is declared. */ +// This has to go after the include of proto.h, as proto/gui.pro declares +// functions of these names. The declarations would break if the defines had +// been seen at that stage. But it must be before globals.h, where error_ga +// is declared. #if !defined(MSWIN) && !defined(FEAT_GUI_X11) \ && !defined(FEAT_GUI_GTK) && !defined(FEAT_GUI_MAC) && !defined(PROTO) # define mch_errmsg(str) fprintf(stderr, "%s", (str)) @@ -2130,10 +2126,10 @@ typedef enum { && (!defined(FEAT_GUI_MSWIN) \ || !(defined(FEAT_MBYTE_IME) || defined(GLOBAL_IME))) \ && !(defined(FEAT_GUI_MAC) && defined(MACOS_CONVERT)) -/* Whether IME is supported by im_get_status() defined in mbyte.c. - * For Win32 GUI it's in gui_w32.c when FEAT_MBYTE_IME or GLOBAL_IME is defined. - * for Mac it is in gui_mac.c for the GUI or in os_mac_conv.c when - * MACOS_CONVERT is defined. */ +// Whether IME is supported by im_get_status() defined in mbyte.c. +// For Win32 GUI it's in gui_w32.c when FEAT_MBYTE_IME or GLOBAL_IME is defined. +// for Mac it is in gui_mac.c for the GUI or in os_mac_conv.c when +// MACOS_CONVERT is defined. # define IME_WITHOUT_XIM #endif @@ -2142,23 +2138,23 @@ typedef enum { || (defined(FEAT_GUI_MSWIN) \ && (defined(FEAT_MBYTE_IME) || defined(GLOBAL_IME))) \ || defined(FEAT_GUI_MAC) -/* im_set_active() is available */ +// im_set_active() is available # define HAVE_INPUT_METHOD #endif #ifndef FEAT_LINEBREAK -/* Without the 'numberwidth' option line numbers are always 7 chars. */ +// Without the 'numberwidth' option line numbers are always 7 chars. # define number_width(x) 7 #endif -/* This must come after including proto.h. - * For VMS this is defined in macros.h. */ +// This must come after including proto.h. +// For VMS this is defined in macros.h. #if !defined(MSWIN) && !defined(VMS) # define mch_open(n, m, p) open((n), (m), (p)) # define mch_fopen(n, p) fopen((n), (p)) #endif -#include "globals.h" /* global variables and messages */ +#include "globals.h" // global variables and messages /* * If console dialog not supported, but GUI dialog is, use the GUI one. @@ -2188,30 +2184,30 @@ typedef enum { # define BROWSE_FILTER_DEFAULT \ (char_u *)N_("All Files (*)\t*\nC source (*.c, *.h)\t*.c;*.h\nC++ source (*.cpp, *.hpp)\t*.cpp;*.hpp\nVim files (*.vim, _vimrc, _gvimrc)\t*.vim;_vimrc;_gvimrc\n") # endif -# define BROWSE_SAVE 1 /* flag for do_browse() */ -# define BROWSE_DIR 2 /* flag for do_browse() */ +# define BROWSE_SAVE 1 // flag for do_browse() +# define BROWSE_DIR 2 // flag for do_browse() #endif #ifdef _MSC_VER -/* Avoid useless warning "conversion from X to Y of greater size". */ +// Avoid useless warning "conversion from X to Y of greater size". #pragma warning(disable : 4312) -/* Avoid warning for old style function declarators */ +// Avoid warning for old style function declarators #pragma warning(disable : 4131) -/* Avoid warning for conversion to type with smaller range */ +// Avoid warning for conversion to type with smaller range #pragma warning(disable : 4244) -/* Avoid warning for conversion to larger size */ +// Avoid warning for conversion to larger size #pragma warning(disable : 4306) -/* Avoid warning for unreferenced formal parameter */ +// Avoid warning for unreferenced formal parameter #pragma warning(disable : 4100) -/* Avoid warning for differs in indirection to slightly different base type */ +// Avoid warning for differs in indirection to slightly different base type #pragma warning(disable : 4057) -/* Avoid warning for constant conditional expression */ +// Avoid warning for constant conditional expression #pragma warning(disable : 4127) -/* Avoid warning for assignment within conditional */ +// Avoid warning for assignment within conditional #pragma warning(disable : 4706) #endif -/* Note: a NULL argument for vim_realloc() is not portable, don't use it. */ +// Note: a NULL argument for vim_realloc() is not portable, don't use it. #if defined(MEM_PROFILE) # define vim_realloc(ptr, size) mem_realloc((ptr), (size)) #else @@ -2227,28 +2223,28 @@ typedef enum { #define MB_BYTE2LEN(b) mb_bytelen_tab[b] #define MB_BYTE2LEN_CHECK(b) (((b) < 0 || (b) > 255) ? 1 : mb_bytelen_tab[b]) -/* 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! :-) #ifdef USE_ICONV # ifndef EILSEQ # define EILSEQ 123 # endif # ifdef DYNAMIC_ICONV -/* On Win32 iconv.dll is dynamically loaded. */ +// On Win32 iconv.dll is dynamically loaded. # define ICONV_ERRNO (*iconv_errno()) # define ICONV_E2BIG 7 # define ICONV_EINVAL 22 @@ -2261,18 +2257,18 @@ typedef enum { # endif #endif -#define SIGN_BYTE 1 /* byte value used where sign is displayed; - attribute value is sign type */ +#define SIGN_BYTE 1 // byte value used where sign is displayed; + // attribute value is sign type #ifdef FEAT_NETBEANS_INTG -# define MULTISIGN_BYTE 2 /* byte value used where sign is displayed if - multiple signs exist on the line */ +# define MULTISIGN_BYTE 2 // byte value used where sign is displayed if + // multiple signs exist on the line #endif #if defined(FEAT_GUI) && defined(FEAT_XCLIPBOARD) # ifdef FEAT_GUI_GTK - /* Avoid using a global variable for the X display. It's ugly - * and is likely to cause trouble in multihead environments. */ + // Avoid using a global variable for the X display. It's ugly + // and is likely to cause trouble in multihead environments. # define X_DISPLAY ((gui.in_use) ? gui_mch_get_display() : xterm_dpy) # else # define X_DISPLAY (gui.in_use ? gui.dpy : xterm_dpy) @@ -2353,7 +2349,7 @@ typedef enum { #ifndef FEAT_NETBEANS_INTG # undef NBDEBUG #endif -#ifdef NBDEBUG /* Netbeans debugging. */ +#ifdef NBDEBUG // Netbeans debugging. # include "nbdebug.h" #else # define nbdebug(a) @@ -2368,14 +2364,14 @@ typedef enum { # undef FF # undef OP_DELETE # undef OP_JOIN - /* remove MAX and MIN, included by glib.h, redefined by sys/param.h */ + // remove MAX and MIN, included by glib.h, redefined by sys/param.h # ifdef MAX # undef MAX # endif # ifdef MIN # undef MIN # endif - /* We use _() for gettext(), Perl uses it for function prototypes... */ + // We use _() for gettext(), Perl uses it for function prototypes... # ifdef _ # undef _ # endif @@ -2388,8 +2384,8 @@ typedef enum { # ifdef instr # undef instr # endif - /* bool may cause trouble on some old versions of Mac OS X but is required - * on a few other systems and for Perl */ + // bool may cause trouble on some old versions of Mac OS X but is required + // on a few other systems and for Perl # if (defined(MACOS_X) && !defined(MAC_OS_X_VERSION_10_6)) \ && defined(bool) && !defined(FEAT_PERL) # undef bool @@ -2397,74 +2393,74 @@ typedef enum { #endif -/* values for vim_handle_signal() that are not a signal */ +// values for vim_handle_signal() that are not a signal #define SIGNAL_BLOCK -1 #define SIGNAL_UNBLOCK -2 #if !defined(UNIX) && !defined(VMS) # define vim_handle_signal(x) 0 #endif -/* flags for skip_vimgrep_pat() */ +// flags for skip_vimgrep_pat() #define VGR_GLOBAL 1 #define VGR_NOJUMP 2 -/* 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 -/* last argument for do_source() */ +// last argument for do_source() #define DOSO_NONE 0 -#define DOSO_VIMRC 1 /* loading vimrc file */ -#define DOSO_GVIMRC 2 /* loading gvimrc file */ - -/* flags for read_viminfo() and children */ -#define VIF_WANT_INFO 1 /* load non-mark info */ -#define VIF_WANT_MARKS 2 /* load file marks */ -#define VIF_FORCEIT 4 /* overwrite info already read */ -#define VIF_GET_OLDFILES 8 /* load v:oldfiles */ - -/* flags for buf_freeall() */ -#define BFA_DEL 1 /* buffer is going to be deleted */ -#define BFA_WIPE 2 /* buffer is going to be wiped out */ -#define BFA_KEEP_UNDO 4 /* do not free undo information */ - -/* direction for nv_mousescroll() and ins_mousescroll() */ -#define MSCR_DOWN 0 /* DOWN must be FALSE */ +#define DOSO_VIMRC 1 // loading vimrc file +#define DOSO_GVIMRC 2 // loading gvimrc file + +// flags for read_viminfo() and children +#define VIF_WANT_INFO 1 // load non-mark info +#define VIF_WANT_MARKS 2 // load file marks +#define VIF_FORCEIT 4 // overwrite info already read +#define VIF_GET_OLDFILES 8 // load v:oldfiles + +// flags for buf_freeall() +#define BFA_DEL 1 // buffer is going to be deleted +#define BFA_WIPE 2 // buffer is going to be wiped out +#define BFA_KEEP_UNDO 4 // do not free undo information + +// direction for nv_mousescroll() and ins_mousescroll() +#define MSCR_DOWN 0 // DOWN must be FALSE #define MSCR_UP 1 #define MSCR_LEFT -1 #define MSCR_RIGHT -2 -#define KEYLEN_PART_KEY -1 /* keylen value for incomplete key-code */ -#define KEYLEN_PART_MAP -2 /* keylen value for incomplete mapping */ -#define KEYLEN_REMOVED 9999 /* keylen value for removed sequence */ +#define KEYLEN_PART_KEY -1 // keylen value for incomplete key-code +#define KEYLEN_PART_MAP -2 // keylen value for incomplete mapping +#define KEYLEN_REMOVED 9999 // keylen value for removed sequence -/* Return values from win32_fileinfo(). */ +// Return values from win32_fileinfo(). #define FILEINFO_OK 0 -#define FILEINFO_ENC_FAIL 1 /* enc_to_utf16() failed */ -#define FILEINFO_READ_FAIL 2 /* CreateFile() failed */ -#define FILEINFO_INFO_FAIL 3 /* GetFileInformationByHandle() failed */ - -/* Return value from get_option_value_strict */ -#define SOPT_BOOL 0x01 /* Boolean option */ -#define SOPT_NUM 0x02 /* Number option */ -#define SOPT_STRING 0x04 /* String option */ -#define SOPT_GLOBAL 0x08 /* Option has global value */ -#define SOPT_WIN 0x10 /* Option has window-local value */ -#define SOPT_BUF 0x20 /* Option has buffer-local value */ -#define SOPT_UNSET 0x40 /* Option does not have local value set */ - -/* Option types for various functions in option.c */ -#define SREQ_GLOBAL 0 /* Request global option */ -#define SREQ_WIN 1 /* Request window-local option */ -#define SREQ_BUF 2 /* Request buffer-local option */ - -/* Flags for get_reg_contents */ -#define GREG_NO_EXPR 1 /* Do not allow expression register */ -#define GREG_EXPR_SRC 2 /* Return expression itself for "=" register */ -#define GREG_LIST 4 /* Return list */ - -/* Character used as separated in autoload function/variable names. */ +#define FILEINFO_ENC_FAIL 1 // enc_to_utf16() failed +#define FILEINFO_READ_FAIL 2 // CreateFile() failed +#define FILEINFO_INFO_FAIL 3 // GetFileInformationByHandle() failed + +// Return value from get_option_value_strict +#define SOPT_BOOL 0x01 // Boolean option +#define SOPT_NUM 0x02 // Number option +#define SOPT_STRING 0x04 // String option +#define SOPT_GLOBAL 0x08 // Option has global value +#define SOPT_WIN 0x10 // Option has window-local value +#define SOPT_BUF 0x20 // Option has buffer-local value +#define SOPT_UNSET 0x40 // Option does not have local value set + +// Option types for various functions in option.c +#define SREQ_GLOBAL 0 // Request global option +#define SREQ_WIN 1 // Request window-local option +#define SREQ_BUF 2 // Request buffer-local option + +// Flags for get_reg_contents +#define GREG_NO_EXPR 1 // Do not allow expression register +#define GREG_EXPR_SRC 2 // Return expression itself for "=" register +#define GREG_LIST 4 // Return list + +// Character used as separated in autoload function/variable names. #define AUTOLOAD_CHAR '#' #ifdef FEAT_JOB_CHANNEL @@ -2477,44 +2473,44 @@ typedef enum { # define MAX_NAMED_PIPE_SIZE 65535 #endif -/* Options for json_encode() and json_decode. */ -#define JSON_JS 1 /* use JS instead of JSON */ -#define JSON_NO_NONE 2 /* v:none item not allowed */ -#define JSON_NL 4 /* append a NL */ +// Options for json_encode() and json_decode. +#define JSON_JS 1 // use JS instead of JSON +#define JSON_NO_NONE 2 // v:none item not allowed +#define JSON_NL 4 // append a NL -/* Used for flags of do_in_path() */ -#define DIP_ALL 0x01 /* all matches, not just the first one */ -#define DIP_DIR 0x02 /* find directories instead of files. */ -#define DIP_ERR 0x04 /* give an error message when none found. */ -#define DIP_START 0x08 /* also use "start" directory in 'packpath' */ -#define DIP_OPT 0x10 /* also use "opt" directory in 'packpath' */ -#define DIP_NORTP 0x20 /* do not use 'runtimepath' */ -#define DIP_NOAFTER 0x40 /* skip "after" directories */ -#define DIP_AFTER 0x80 /* only use "after" directories */ +// Used for flags of do_in_path() +#define DIP_ALL 0x01 // all matches, not just the first one +#define DIP_DIR 0x02 // find directories instead of files. +#define DIP_ERR 0x04 // give an error message when none found. +#define DIP_START 0x08 // also use "start" directory in 'packpath' +#define DIP_OPT 0x10 // also use "opt" directory in 'packpath' +#define DIP_NORTP 0x20 // do not use 'runtimepath' +#define DIP_NOAFTER 0x40 // skip "after" directories +#define DIP_AFTER 0x80 // only use "after" directories -/* Lowest number used for window ID. Cannot have this many windows. */ +// Lowest number used for window ID. Cannot have this many windows. #define LOWEST_WIN_ID 1000 -/* Used by the garbage collector. */ +// Used by the garbage collector. #define COPYID_INC 2 #define COPYID_MASK (~0x1) -/* Values for trans_function_name() argument: */ -#define TFN_INT 1 /* internal function name OK */ -#define TFN_QUIET 2 /* no error messages */ -#define TFN_NO_AUTOLOAD 4 /* do not use script autoloading */ -#define TFN_NO_DEREF 8 /* do not dereference a Funcref */ -#define TFN_READ_ONLY 16 /* will not change the var */ +// Values for trans_function_name() argument: +#define TFN_INT 1 // internal function name OK +#define TFN_QUIET 2 // no error messages +#define TFN_NO_AUTOLOAD 4 // do not use script autoloading +#define TFN_NO_DEREF 8 // do not dereference a Funcref +#define TFN_READ_ONLY 16 // will not change the var -/* Values for get_lval() flags argument: */ -#define GLV_QUIET TFN_QUIET /* no error messages */ -#define GLV_NO_AUTOLOAD TFN_NO_AUTOLOAD /* do not use script autoloading */ -#define GLV_READ_ONLY TFN_READ_ONLY /* will not change the var */ +// Values for get_lval() flags argument: +#define GLV_QUIET TFN_QUIET // no error messages +#define GLV_NO_AUTOLOAD TFN_NO_AUTOLOAD // do not use script autoloading +#define GLV_READ_ONLY TFN_READ_ONLY // will not change the var -#define DO_NOT_FREE_CNT 99999 /* refcount for dict or list that should not - be freed. */ +#define DO_NOT_FREE_CNT 99999 // refcount for dict or list that should not + // be freed. -/* errors for when calling a function */ +// errors for when calling a function #define ERROR_UNKNOWN 0 #define ERROR_TOOMANY 1 #define ERROR_TOOFEW 2 @@ -2525,17 +2521,17 @@ typedef enum { #define ERROR_DELETED 7 #define ERROR_NOTMETHOD 8 // function cannot be used as a method -/* flags for find_name_end() */ -#define FNE_INCL_BR 1 /* include [] in name */ -#define FNE_CHECK_START 2 /* check name starts with valid character */ +// flags for find_name_end() +#define FNE_INCL_BR 1 // include [] in name +#define FNE_CHECK_START 2 // check name starts with valid character -/* BSD is supposed to cover FreeBSD and similar systems. */ +// BSD is supposed to cover FreeBSD and similar systems. #if (defined(SUN_SYSTEM) || defined(BSD) || defined(__FreeBSD_kernel__)) \ && (defined(S_ISCHR) || defined(S_IFCHR)) # define OPEN_CHR_FILES #endif -/* stat macros */ +// stat macros #ifndef S_ISDIR # ifdef S_IFDIR # define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) @@ -2605,11 +2601,11 @@ long elapsed(DWORD start_tick); # endif #endif -/* Replacement for nchar used by nv_replace(). */ +// Replacement for nchar used by nv_replace(). #define REPLACE_CR_NCHAR -1 #define REPLACE_NL_NCHAR -2 -/* flags for term_start() */ +// flags for term_start() #define TERM_START_NOJOB 1 #define TERM_START_FORCEIT 2 #define TERM_START_SYSTEM 4 @@ -2625,4 +2621,4 @@ long elapsed(DWORD start_tick); #define CLIP_ZINDEX 32000 -#endif /* VIM__H */ +#endif // VIM__H |