2016-08-29 22:49:24 +02:00
|
|
|
/* vi:set ts=8 sts=4 sw=4 noet:
|
2004-06-13 20:20:40 +00:00
|
|
|
*
|
|
|
|
* VIM - Vi IMproved by Bram Moolenaar
|
|
|
|
*
|
|
|
|
* Do ":help uganda" in Vim to read copying and usage conditions.
|
|
|
|
* Do ":help credits" in Vim to see a list of people who contributed.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* This file contains various definitions of structures that are used by Vim
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* There is something wrong in the SAS compiler that makes typedefs not
|
|
|
|
* valid in include files. Has been fixed in version 6.58.
|
|
|
|
*/
|
|
|
|
#if defined(SASC) && SASC < 658
|
|
|
|
typedef long linenr_T;
|
2009-05-13 16:56:33 +00:00
|
|
|
typedef int colnr_T;
|
2004-06-13 20:20:40 +00:00
|
|
|
typedef unsigned short short_u;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/*
|
|
|
|
* position in file or buffer
|
|
|
|
*/
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
linenr_T lnum; /* line number */
|
|
|
|
colnr_T col; /* column number */
|
|
|
|
#ifdef FEAT_VIRTUALEDIT
|
|
|
|
colnr_T coladd;
|
|
|
|
#endif
|
|
|
|
} pos_T;
|
|
|
|
|
|
|
|
#ifdef FEAT_VIRTUALEDIT
|
2009-05-13 10:51:08 +00:00
|
|
|
# define INIT_POS_T(l, c, ca) {l, c, ca}
|
2004-06-13 20:20:40 +00:00
|
|
|
#else
|
2009-05-13 10:51:08 +00:00
|
|
|
# define INIT_POS_T(l, c, ca) {l, c}
|
2004-06-13 20:20:40 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Same, but without coladd.
|
|
|
|
*/
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
linenr_T lnum; /* line number */
|
|
|
|
colnr_T col; /* column number */
|
|
|
|
} lpos_T;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Structure used for growing arrays.
|
|
|
|
* This is used to store information that only grows, is deleted all at
|
|
|
|
* once, and needs to be accessed by index. See ga_clear() and ga_grow().
|
|
|
|
*/
|
|
|
|
typedef struct growarray
|
|
|
|
{
|
|
|
|
int ga_len; /* current number of items used */
|
2004-12-27 21:59:20 +00:00
|
|
|
int ga_maxlen; /* maximum number of items possible */
|
2004-06-16 11:19:22 +00:00
|
|
|
int ga_itemsize; /* sizeof(item) */
|
2004-06-13 20:20:40 +00:00
|
|
|
int ga_growsize; /* number of items to grow each time */
|
|
|
|
void *ga_data; /* pointer to the first item */
|
|
|
|
} garray_T;
|
|
|
|
|
|
|
|
#define GA_EMPTY {0, 0, 0, 0, NULL}
|
|
|
|
|
2006-02-14 22:29:30 +00:00
|
|
|
typedef struct window_S win_T;
|
|
|
|
typedef struct wininfo_S wininfo_T;
|
|
|
|
typedef struct frame_S frame_T;
|
|
|
|
typedef int scid_T; /* script ID */
|
2013-05-19 19:40:29 +02:00
|
|
|
typedef struct file_buffer buf_T; /* forward declaration */
|
2017-07-07 11:54:15 +02:00
|
|
|
typedef struct terminal_S term_T;
|
2013-05-19 19:40:29 +02:00
|
|
|
|
2017-09-17 23:03:31 +02:00
|
|
|
#ifdef FEAT_MENU
|
|
|
|
typedef struct VimMenu vimmenu_T;
|
|
|
|
#endif
|
|
|
|
|
2018-09-10 21:05:02 +02:00
|
|
|
/*
|
|
|
|
* SCript ConteXt (SCTX): identifies a script script line.
|
|
|
|
* When sourcing a script "sc_lnum" is zero, "sourcing_lnum" is the current
|
|
|
|
* line number. When executing a user function "sc_lnum" is the line where the
|
|
|
|
* function was defined, "sourcing_lnum" is the line number inside the
|
|
|
|
* function. When stored with a function, mapping, option, etc. "sc_lnum" is
|
|
|
|
* the line number in the script "sc_sid".
|
|
|
|
*/
|
|
|
|
typedef struct {
|
|
|
|
scid_T sc_sid; // script ID
|
2018-11-10 17:33:29 +01:00
|
|
|
int sc_seq; // sourcing sequence number
|
2018-09-10 21:05:02 +02:00
|
|
|
linenr_T sc_lnum; // line number
|
|
|
|
} sctx_T;
|
|
|
|
|
2017-06-04 14:58:02 +02:00
|
|
|
/*
|
|
|
|
* Reference to a buffer that stores the value of buf_free_count.
|
2016-07-10 18:21:50 +02:00
|
|
|
* bufref_valid() only needs to check "buf" when the count differs.
|
|
|
|
*/
|
|
|
|
typedef struct {
|
|
|
|
buf_T *br_buf;
|
2017-06-04 14:58:02 +02:00
|
|
|
int br_fnum;
|
2016-07-10 18:21:50 +02:00
|
|
|
int br_buf_free_count;
|
|
|
|
} bufref_T;
|
|
|
|
|
2013-05-19 19:40:29 +02:00
|
|
|
/*
|
|
|
|
* This is here because regexp.h needs pos_T and below regprog_T is used.
|
|
|
|
*/
|
|
|
|
#include "regexp.h"
|
2004-06-13 20:20:40 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* This is here because gui.h needs the pos_T and win_T, and win_T needs gui.h
|
|
|
|
* for scrollbar_T.
|
|
|
|
*/
|
|
|
|
#ifdef FEAT_GUI
|
|
|
|
# include "gui.h"
|
|
|
|
#else
|
|
|
|
# ifdef FEAT_XCLIPBOARD
|
|
|
|
# include <X11/Intrinsic.h>
|
|
|
|
# endif
|
2016-08-22 23:04:33 +02:00
|
|
|
# define guicolor_T long
|
2016-04-21 21:10:14 +02:00
|
|
|
# define INVALCOLOR ((guicolor_T)0x1ffffff)
|
2018-02-27 14:39:03 +01:00
|
|
|
/* only used for cterm.bg_rgb and cterm.fg_rgb: use cterm color */
|
|
|
|
# define CTERMCOLOR ((guicolor_T)0x1fffffe)
|
2004-06-13 20:20:40 +00:00
|
|
|
#endif
|
2018-02-27 14:39:03 +01:00
|
|
|
#define COLOR_INVALID(x) ((x) == INVALCOLOR || (x) == CTERMCOLOR)
|
2004-06-13 20:20:40 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* marks: positions in a file
|
|
|
|
* (a normal mark is a lnum/col pair, the same as a file position)
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* (Note: for EBCDIC there are more than 26, because there are gaps in the
|
|
|
|
* alphabet coding. To minimize changes to the code, I decided to just
|
|
|
|
* increase the number of possible marks. */
|
|
|
|
#define NMARKS ('z' - 'a' + 1) /* max. # of named marks */
|
|
|
|
#define JUMPLISTSIZE 100 /* max. # of marks in jump list */
|
|
|
|
#define TAGSTACKSIZE 20 /* max. # of tags in tag stack */
|
|
|
|
|
|
|
|
typedef struct filemark
|
|
|
|
{
|
|
|
|
pos_T mark; /* cursor position */
|
|
|
|
int fnum; /* file number */
|
|
|
|
} fmark_T;
|
|
|
|
|
|
|
|
/* Xtended file mark: also has a file name */
|
|
|
|
typedef struct xfilemark
|
|
|
|
{
|
|
|
|
fmark_T fmark;
|
|
|
|
char_u *fname; /* file name, used when fnum == 0 */
|
2016-06-12 21:20:54 +02:00
|
|
|
#ifdef FEAT_VIMINFO
|
2016-06-26 16:44:24 +02:00
|
|
|
time_T time_set;
|
2016-06-12 21:20:54 +02:00
|
|
|
#endif
|
2004-06-13 20:20:40 +00:00
|
|
|
} xfmark_T;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* The taggy struct is used to store the information about a :tag command.
|
|
|
|
*/
|
|
|
|
typedef struct taggy
|
|
|
|
{
|
|
|
|
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 */
|
|
|
|
} taggy_T;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Structure that contains all options that are local to a window.
|
|
|
|
* Used twice in a window: for the current buffer and for all buffers.
|
|
|
|
* Also used in wininfo_T.
|
|
|
|
*/
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
#ifdef FEAT_ARABIC
|
|
|
|
int wo_arab;
|
|
|
|
# define w_p_arab w_onebuf_opt.wo_arab /* 'arabic' */
|
|
|
|
#endif
|
2014-06-25 14:39:50 +02:00
|
|
|
#ifdef FEAT_LINEBREAK
|
|
|
|
int wo_bri;
|
|
|
|
# define w_p_bri w_onebuf_opt.wo_bri /* 'breakindent' */
|
2014-09-23 15:45:08 +02:00
|
|
|
char_u *wo_briopt;
|
2014-06-25 14:39:50 +02:00
|
|
|
# define w_p_briopt w_onebuf_opt.wo_briopt /* 'breakindentopt' */
|
|
|
|
#endif
|
2004-06-13 20:20:40 +00:00
|
|
|
#ifdef FEAT_DIFF
|
|
|
|
int wo_diff;
|
|
|
|
# define w_p_diff w_onebuf_opt.wo_diff /* 'diff' */
|
|
|
|
#endif
|
|
|
|
#ifdef FEAT_FOLDING
|
|
|
|
long wo_fdc;
|
|
|
|
# define w_p_fdc w_onebuf_opt.wo_fdc /* 'foldcolumn' */
|
2013-07-03 15:47:03 +02:00
|
|
|
int wo_fdc_save;
|
|
|
|
# define w_p_fdc_save w_onebuf_opt.wo_fdc_save /* 'foldenable' saved for diff mode */
|
2004-06-13 20:20:40 +00:00
|
|
|
int wo_fen;
|
|
|
|
# define w_p_fen w_onebuf_opt.wo_fen /* 'foldenable' */
|
2013-07-03 15:47:03 +02:00
|
|
|
int wo_fen_save;
|
|
|
|
# define w_p_fen_save w_onebuf_opt.wo_fen_save /* 'foldenable' saved for diff mode */
|
2004-06-13 20:20:40 +00:00
|
|
|
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' */
|
2013-07-03 15:47:03 +02:00
|
|
|
int wo_fdl_save;
|
|
|
|
# define w_p_fdl_save w_onebuf_opt.wo_fdl_save /* 'foldlevel' state saved for diff mode */
|
2004-06-13 20:20:40 +00:00
|
|
|
char_u *wo_fdm;
|
|
|
|
# define w_p_fdm w_onebuf_opt.wo_fdm /* 'foldmethod' */
|
2013-07-03 15:47:03 +02:00
|
|
|
char_u *wo_fdm_save;
|
|
|
|
# define w_p_fdm_save w_onebuf_opt.wo_fdm_save /* 'fdm' saved for diff mode */
|
2004-06-13 20:20:40 +00:00
|
|
|
long wo_fml;
|
|
|
|
# define w_p_fml w_onebuf_opt.wo_fml /* 'foldminlines' */
|
|
|
|
long wo_fdn;
|
2006-03-03 22:56:30 +00:00
|
|
|
# define w_p_fdn w_onebuf_opt.wo_fdn /* 'foldnestmax' */
|
2004-06-13 20:20:40 +00:00
|
|
|
# ifdef FEAT_EVAL
|
|
|
|
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' */
|
|
|
|
# endif
|
|
|
|
char_u *wo_fmr;
|
|
|
|
# define w_p_fmr w_onebuf_opt.wo_fmr /* 'foldmarker' */
|
|
|
|
#endif
|
|
|
|
#ifdef FEAT_LINEBREAK
|
|
|
|
int wo_lbr;
|
|
|
|
# define w_p_lbr w_onebuf_opt.wo_lbr /* 'linebreak' */
|
|
|
|
#endif
|
|
|
|
int wo_list;
|
|
|
|
#define w_p_list w_onebuf_opt.wo_list /* 'list' */
|
|
|
|
int wo_nu;
|
|
|
|
#define w_p_nu w_onebuf_opt.wo_nu /* 'number' */
|
2010-05-16 15:46:46 +02:00
|
|
|
int wo_rnu;
|
|
|
|
#define w_p_rnu w_onebuf_opt.wo_rnu /* 'relativenumber' */
|
2004-07-03 16:05:59 +00:00
|
|
|
#ifdef FEAT_LINEBREAK
|
|
|
|
long wo_nuw;
|
|
|
|
# define w_p_nuw w_onebuf_opt.wo_nuw /* 'numberwidth' */
|
|
|
|
#endif
|
2004-06-13 20:20:40 +00:00
|
|
|
int wo_wfh;
|
|
|
|
# define w_p_wfh w_onebuf_opt.wo_wfh /* 'winfixheight' */
|
2006-03-18 21:40:56 +00:00
|
|
|
int wo_wfw;
|
|
|
|
# define w_p_wfw w_onebuf_opt.wo_wfw /* 'winfixwidth' */
|
2017-09-16 20:54:51 +02:00
|
|
|
#if defined(FEAT_QUICKFIX)
|
2004-06-13 20:20:40 +00:00
|
|
|
int wo_pvw;
|
|
|
|
# define w_p_pvw w_onebuf_opt.wo_pvw /* 'previewwindow' */
|
|
|
|
#endif
|
|
|
|
#ifdef FEAT_RIGHTLEFT
|
|
|
|
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' */
|
|
|
|
#endif
|
|
|
|
long wo_scr;
|
|
|
|
#define w_p_scr w_onebuf_opt.wo_scr /* 'scroll' */
|
2006-03-12 22:08:12 +00:00
|
|
|
#ifdef FEAT_SPELL
|
2005-03-20 22:37:15 +00:00
|
|
|
int wo_spell;
|
2006-03-12 22:08:12 +00:00
|
|
|
# define w_p_spell w_onebuf_opt.wo_spell /* 'spell' */
|
|
|
|
#endif
|
|
|
|
#ifdef FEAT_SYN_HL
|
|
|
|
int wo_cuc;
|
|
|
|
# define w_p_cuc w_onebuf_opt.wo_cuc /* 'cursorcolumn' */
|
|
|
|
int wo_cul;
|
|
|
|
# define w_p_cul w_onebuf_opt.wo_cul /* 'cursorline' */
|
2010-07-14 19:53:30 +02:00
|
|
|
char_u *wo_cc;
|
|
|
|
# define w_p_cc w_onebuf_opt.wo_cc /* 'colorcolumn' */
|
2005-03-20 22:37:15 +00:00
|
|
|
#endif
|
2004-12-24 14:35:23 +00:00
|
|
|
#ifdef FEAT_STL_OPT
|
|
|
|
char_u *wo_stl;
|
|
|
|
#define w_p_stl w_onebuf_opt.wo_stl /* 'statusline' */
|
|
|
|
#endif
|
2004-06-13 20:20:40 +00:00
|
|
|
int wo_scb;
|
2018-03-04 20:14:14 +01:00
|
|
|
#define w_p_scb w_onebuf_opt.wo_scb /* 'scrollbind' */
|
2013-07-03 15:47:03 +02:00
|
|
|
int wo_diff_saved; /* options were saved for starting diff mode */
|
2018-03-04 20:14:14 +01:00
|
|
|
#define w_p_diff_saved w_onebuf_opt.wo_diff_saved
|
2013-07-03 15:47:03 +02:00
|
|
|
int wo_scb_save; /* 'scrollbind' saved for diff mode*/
|
2018-03-04 20:14:14 +01:00
|
|
|
#define w_p_scb_save w_onebuf_opt.wo_scb_save
|
2004-06-13 20:20:40 +00:00
|
|
|
int wo_wrap;
|
|
|
|
#define w_p_wrap w_onebuf_opt.wo_wrap /* 'wrap' */
|
2013-07-03 15:47:03 +02:00
|
|
|
#ifdef FEAT_DIFF
|
|
|
|
int wo_wrap_save; /* 'wrap' state saved for diff mode*/
|
|
|
|
# define w_p_wrap_save w_onebuf_opt.wo_wrap_save
|
|
|
|
#endif
|
2010-06-05 23:22:07 +02:00
|
|
|
#ifdef FEAT_CONCEAL
|
2010-07-23 22:10:27 +02:00
|
|
|
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
|
2010-06-05 23:22:07 +02:00
|
|
|
#endif
|
|
|
|
int wo_crb;
|
2018-03-04 20:14:14 +01:00
|
|
|
#define w_p_crb w_onebuf_opt.wo_crb /* 'cursorbind' */
|
2013-07-03 15:47:03 +02:00
|
|
|
int wo_crb_save; /* 'cursorbind' state saved for diff mode*/
|
2018-03-04 20:14:14 +01:00
|
|
|
#define w_p_crb_save w_onebuf_opt.wo_crb_save
|
2016-08-12 18:29:59 +02:00
|
|
|
#ifdef FEAT_SIGNS
|
|
|
|
char_u *wo_scl;
|
|
|
|
# define w_p_scl w_onebuf_opt.wo_scl /* 'signcolumn' */
|
|
|
|
#endif
|
2017-07-07 11:54:15 +02:00
|
|
|
#ifdef FEAT_TERMINAL
|
2018-04-21 19:49:08 +02:00
|
|
|
char_u *wo_twk;
|
|
|
|
# define w_p_twk w_onebuf_opt.wo_twk /* 'termwinkey' */
|
|
|
|
char_u *wo_tws;
|
|
|
|
# define w_p_tws w_onebuf_opt.wo_tws /* 'termwinsize' */
|
2017-07-07 11:54:15 +02:00
|
|
|
#endif
|
2006-02-27 23:58:35 +00:00
|
|
|
|
|
|
|
#ifdef FEAT_EVAL
|
2018-09-10 21:05:02 +02:00
|
|
|
sctx_T wo_script_ctx[WV_COUNT]; /* SCTXs for window-local options */
|
|
|
|
# define w_p_script_ctx w_onebuf_opt.wo_script_ctx
|
2006-02-27 23:58:35 +00:00
|
|
|
#endif
|
2004-06-13 20:20:40 +00:00
|
|
|
} winopt_T;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Window info stored with a buffer.
|
|
|
|
*
|
|
|
|
* Two types of info are kept for a buffer which are associated with a
|
|
|
|
* specific window:
|
|
|
|
* 1. Each window can have a different line number associated with a buffer.
|
|
|
|
* 2. The window-local options for a buffer work in a similar way.
|
|
|
|
* The window-info is kept in a list at b_wininfo. It is kept in
|
|
|
|
* most-recently-used order.
|
|
|
|
*/
|
2006-02-14 22:29:30 +00:00
|
|
|
struct wininfo_S
|
2004-06-13 20:20:40 +00:00
|
|
|
{
|
|
|
|
wininfo_T *wi_next; /* next entry or NULL for last entry */
|
|
|
|
wininfo_T *wi_prev; /* previous entry or NULL for first entry */
|
2010-05-14 22:24:40 +02:00
|
|
|
win_T *wi_win; /* pointer to window that did set wi_fpos */
|
2004-06-13 20:20:40 +00:00
|
|
|
pos_T wi_fpos; /* last cursor position in the file */
|
|
|
|
int wi_optset; /* TRUE when wi_opt has useful values */
|
|
|
|
winopt_T wi_opt; /* local window options */
|
|
|
|
#ifdef FEAT_FOLDING
|
|
|
|
int wi_fold_manual; /* copy of w_fold_manual */
|
|
|
|
garray_T wi_folds; /* clone of w_folds */
|
|
|
|
#endif
|
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Info used to pass info about a fold from the fold-detection code to the
|
|
|
|
* code that displays the foldcolumn.
|
|
|
|
*/
|
|
|
|
typedef struct foldinfo
|
|
|
|
{
|
|
|
|
int fi_level; /* level of the fold; when this is zero the
|
|
|
|
other fields are invalid */
|
|
|
|
int fi_lnum; /* line number where fold starts */
|
|
|
|
int fi_low_level; /* lowest fold level that starts in the same
|
|
|
|
line */
|
|
|
|
} foldinfo_T;
|
|
|
|
|
2006-02-27 00:08:02 +00:00
|
|
|
/* 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 */
|
|
|
|
} visualinfo_T;
|
|
|
|
|
2004-06-13 20:20:40 +00:00
|
|
|
/*
|
2007-05-10 18:32:52 +00:00
|
|
|
* structures used for undo
|
2004-06-13 20:20:40 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
typedef struct u_entry u_entry_T;
|
|
|
|
typedef struct u_header u_header_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 */
|
2007-10-01 20:54:15 +00:00
|
|
|
#ifdef U_DEBUG
|
|
|
|
int ue_magic; /* magic number to check allocation */
|
|
|
|
#endif
|
2004-06-13 20:20:40 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct u_header
|
|
|
|
{
|
2010-06-01 19:58:08 +02:00
|
|
|
/* 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 */
|
|
|
|
long seq;
|
|
|
|
} uh_next;
|
|
|
|
union {
|
|
|
|
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 */
|
|
|
|
long seq;
|
|
|
|
} uh_alt_next;
|
|
|
|
union {
|
|
|
|
u_header_T *ptr; /* pointer to previous header for alt. redo */
|
|
|
|
long seq;
|
|
|
|
} uh_alt_prev;
|
2006-03-13 22:15:53 +00:00
|
|
|
long uh_seq; /* sequence number, higher == newer undo */
|
|
|
|
int uh_walk; /* used by undo_time() */
|
2004-06-13 20:20:40 +00:00
|
|
|
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 */
|
|
|
|
#ifdef FEAT_VIRTUALEDIT
|
|
|
|
long uh_cursor_vcol;
|
|
|
|
#endif
|
|
|
|
int uh_flags; /* see below */
|
|
|
|
pos_T uh_namedm[NMARKS]; /* marks before undo/after redo */
|
2006-02-27 00:08:02 +00:00
|
|
|
visualinfo_T uh_visual; /* Visual areas before undo/after redo */
|
2016-06-26 16:44:24 +02:00
|
|
|
time_T uh_time; /* timestamp when the change was made */
|
2010-06-27 05:18:54 +02:00
|
|
|
long uh_save_nr; /* set when the file was saved after the
|
|
|
|
changes in this block */
|
2007-10-01 20:54:15 +00:00
|
|
|
#ifdef U_DEBUG
|
|
|
|
int uh_magic; /* magic number to check allocation */
|
|
|
|
#endif
|
2004-06-13 20:20:40 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/* values for uh_flags */
|
|
|
|
#define UH_CHANGED 0x01 /* b_changed flag before undo/after redo */
|
|
|
|
#define UH_EMPTYBUF 0x02 /* buffer was empty */
|
|
|
|
|
|
|
|
/*
|
2007-05-10 18:32:52 +00:00
|
|
|
* structures used in undo.c
|
2004-06-13 20:20:40 +00:00
|
|
|
*/
|
2014-02-23 22:52:40 +01:00
|
|
|
#if VIM_SIZEOF_INT > 2
|
2004-06-13 20:20:40 +00:00
|
|
|
# define ALIGN_LONG /* longword alignment and use filler byte */
|
|
|
|
# define ALIGN_SIZE (sizeof(long))
|
|
|
|
#else
|
|
|
|
# define ALIGN_SIZE (sizeof(short))
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#define ALIGN_MASK (ALIGN_SIZE - 1)
|
|
|
|
|
|
|
|
typedef struct m_info minfo_T;
|
|
|
|
|
|
|
|
/*
|
2010-05-16 13:56:06 +02:00
|
|
|
* structure used to link chunks in one of the free chunk lists.
|
2004-06-13 20:20:40 +00:00
|
|
|
*/
|
|
|
|
struct m_info
|
|
|
|
{
|
|
|
|
#ifdef ALIGN_LONG
|
|
|
|
long_u m_size; /* size of the chunk (including m_info) */
|
|
|
|
#else
|
|
|
|
short_u m_size; /* size of the chunk (including m_info) */
|
|
|
|
#endif
|
|
|
|
minfo_T *m_next; /* pointer to next free chunk in the list */
|
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* things used in memfile.c
|
|
|
|
*/
|
|
|
|
|
|
|
|
typedef struct block_hdr bhdr_T;
|
|
|
|
typedef struct memfile memfile_T;
|
|
|
|
typedef long blocknr_T;
|
|
|
|
|
2011-03-22 18:10:45 +01:00
|
|
|
/*
|
|
|
|
* mf_hashtab_T is a chained hashtable with blocknr_T key and arbitrary
|
|
|
|
* structures as items. This is an intrusive data structure: we require
|
|
|
|
* that items begin with mf_hashitem_T which contains the key and linked
|
|
|
|
* list pointers. List of items in each bucket is doubly-linked.
|
|
|
|
*/
|
|
|
|
|
|
|
|
typedef struct mf_hashitem_S mf_hashitem_T;
|
|
|
|
|
|
|
|
struct mf_hashitem_S
|
|
|
|
{
|
|
|
|
mf_hashitem_T *mhi_next;
|
|
|
|
mf_hashitem_T *mhi_prev;
|
|
|
|
blocknr_T mhi_key;
|
|
|
|
};
|
|
|
|
|
|
|
|
#define MHT_INIT_SIZE 64
|
|
|
|
|
|
|
|
typedef struct mf_hashtab_S
|
|
|
|
{
|
|
|
|
long_u mht_mask; /* mask used for hash value (nr of items
|
|
|
|
* in array is "mht_mask" + 1) */
|
|
|
|
long_u mht_count; /* nr of items inserted into hashtable */
|
|
|
|
mf_hashitem_T **mht_buckets; /* points to mht_small_buckets or
|
|
|
|
*dynamically allocated array */
|
|
|
|
mf_hashitem_T *mht_small_buckets[MHT_INIT_SIZE]; /* initial buckets */
|
|
|
|
char mht_fixed; /* non-zero value forbids growth */
|
|
|
|
} mf_hashtab_T;
|
|
|
|
|
2004-06-13 20:20:40 +00:00
|
|
|
/*
|
|
|
|
* for each (previously) used block in the memfile there is one block header.
|
|
|
|
*
|
|
|
|
* The block may be linked in the used list OR in the free list.
|
|
|
|
* The used blocks are also kept in hash lists.
|
|
|
|
*
|
|
|
|
* The used list is a doubly linked list, most recently used block first.
|
|
|
|
* The blocks in the used list have a block of memory allocated.
|
|
|
|
* mf_used_count is the number of pages in the used list.
|
|
|
|
* The hash lists are used to quickly find a block in the used list.
|
|
|
|
* The free list is a single linked list, not sorted.
|
|
|
|
* The blocks in the free list have no block of memory allocated and
|
|
|
|
* the contents of the block in the file (if any) is irrelevant.
|
|
|
|
*/
|
|
|
|
|
|
|
|
struct block_hdr
|
|
|
|
{
|
2011-03-22 18:10:45 +01:00
|
|
|
mf_hashitem_T bh_hashitem; /* header for hash table and key */
|
|
|
|
#define bh_bnum bh_hashitem.mhi_key /* block number, part of bh_hashitem */
|
|
|
|
|
2004-06-13 20:20:40 +00:00
|
|
|
bhdr_T *bh_next; /* next block_hdr in free or used list */
|
|
|
|
bhdr_T *bh_prev; /* previous block_hdr in used list */
|
|
|
|
char_u *bh_data; /* pointer to memory (for used block) */
|
|
|
|
int bh_page_count; /* number of pages in this block */
|
|
|
|
|
|
|
|
#define BH_DIRTY 1
|
|
|
|
#define BH_LOCKED 2
|
|
|
|
char bh_flags; /* BH_DIRTY or BH_LOCKED */
|
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* when a block with a negative number is flushed to the file, it gets
|
|
|
|
* a positive number. Because the reference to the block is still the negative
|
|
|
|
* number, we remember the translation to the new positive number in the
|
|
|
|
* double linked trans lists. The structure is the same as the hash lists.
|
|
|
|
*/
|
|
|
|
typedef struct nr_trans NR_TRANS;
|
|
|
|
|
|
|
|
struct nr_trans
|
|
|
|
{
|
2011-03-22 18:10:45 +01:00
|
|
|
mf_hashitem_T nt_hashitem; /* header for hash table and key */
|
|
|
|
#define nt_old_bnum nt_hashitem.mhi_key /* old, negative, number */
|
|
|
|
|
2004-06-13 20:20:40 +00:00
|
|
|
blocknr_T nt_new_bnum; /* new, positive, number */
|
|
|
|
};
|
|
|
|
|
2014-02-11 15:10:43 +01:00
|
|
|
|
|
|
|
typedef struct buffblock buffblock_T;
|
|
|
|
typedef struct buffheader buffheader_T;
|
|
|
|
|
2004-06-13 20:20:40 +00:00
|
|
|
/*
|
|
|
|
* structure used to store one block of the stuff/redo/recording buffers
|
|
|
|
*/
|
|
|
|
struct buffblock
|
|
|
|
{
|
2014-02-11 15:10:43 +01:00
|
|
|
buffblock_T *b_next; /* pointer to next buffblock */
|
2018-04-18 23:01:13 +02:00
|
|
|
char_u b_str[1]; /* contents (actually longer) */
|
2004-06-13 20:20:40 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* header used for the stuff buffer and the redo buffer
|
|
|
|
*/
|
|
|
|
struct buffheader
|
|
|
|
{
|
2018-04-18 23:01:13 +02:00
|
|
|
buffblock_T bh_first; /* first (dummy) block of list */
|
2014-02-11 15:10:43 +01:00
|
|
|
buffblock_T *bh_curr; /* buffblock for appending */
|
|
|
|
int bh_index; /* index for reading */
|
|
|
|
int bh_space; /* space in bh_curr for appending */
|
2004-06-13 20:20:40 +00:00
|
|
|
};
|
|
|
|
|
2017-04-07 19:50:12 +02:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
buffheader_T sr_redobuff;
|
|
|
|
buffheader_T sr_old_redobuff;
|
|
|
|
} save_redo_T;
|
|
|
|
|
2004-06-13 20:20:40 +00:00
|
|
|
/*
|
|
|
|
* used for completion on the command line
|
|
|
|
*/
|
|
|
|
typedef struct expand
|
|
|
|
{
|
|
|
|
int xp_context; /* type of expansion */
|
|
|
|
char_u *xp_pattern; /* start of item to expand */
|
2009-09-18 15:25:52 +00:00
|
|
|
int xp_pattern_len; /* bytes in xp_pattern before cursor */
|
2004-06-13 20:20:40 +00:00
|
|
|
#if defined(FEAT_USR_CMDS) && defined(FEAT_EVAL) && defined(FEAT_CMDL_COMPL)
|
|
|
|
char_u *xp_arg; /* completion function */
|
2018-09-10 21:05:02 +02:00
|
|
|
sctx_T xp_script_ctx; /* SCTX for completion function */
|
2004-06-13 20:20:40 +00:00
|
|
|
#endif
|
|
|
|
int xp_backslash; /* one of the XP_BS_ values */
|
2006-01-19 22:16:24 +00:00
|
|
|
#ifndef BACKSLASH_IN_FILENAME
|
2010-08-07 17:07:21 +02:00
|
|
|
int xp_shell; /* TRUE for a shell command, more
|
|
|
|
characters need to be escaped */
|
2006-01-19 22:16:24 +00:00
|
|
|
#endif
|
2004-06-13 20:20:40 +00:00
|
|
|
int xp_numfiles; /* number of files found by
|
|
|
|
file name completion */
|
|
|
|
char_u **xp_files; /* list of files */
|
2013-06-29 12:58:33 +02:00
|
|
|
char_u *xp_line; /* text being completed */
|
|
|
|
int xp_col; /* cursor position in line */
|
2004-06-13 20:20:40 +00:00
|
|
|
} expand_T;
|
|
|
|
|
|
|
|
/* values for xp_backslash */
|
|
|
|
#define XP_BS_NONE 0 /* nothing special for backslashes */
|
|
|
|
#define XP_BS_ONE 1 /* uses one backslash before a space */
|
|
|
|
#define XP_BS_THREE 2 /* uses three backslashes before a space */
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Command modifiers ":vertical", ":browse", ":confirm" and ":hide" set a flag.
|
|
|
|
* This needs to be saved for recursive commands, put them in a structure for
|
|
|
|
* easy manipulation.
|
|
|
|
*/
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
int hide; /* TRUE when ":hide" was used */
|
2008-11-09 12:46:09 +00:00
|
|
|
# ifdef FEAT_BROWSE_CMD
|
2004-06-13 20:20:40 +00:00
|
|
|
int browse; /* TRUE to invoke file dialog */
|
|
|
|
# endif
|
|
|
|
int split; /* flags for win_split() */
|
2006-02-23 21:32:16 +00:00
|
|
|
int tab; /* > 0 when ":tab" was used */
|
2004-06-13 20:20:40 +00:00
|
|
|
# if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG)
|
|
|
|
int confirm; /* TRUE to invoke yes/no dialog */
|
|
|
|
# endif
|
2004-09-02 19:12:26 +00:00
|
|
|
int keepalt; /* TRUE when ":keepalt" was used */
|
2004-06-13 20:20:40 +00:00
|
|
|
int keepmarks; /* TRUE when ":keepmarks" was used */
|
|
|
|
int keepjumps; /* TRUE when ":keepjumps" was used */
|
|
|
|
int lockmarks; /* TRUE when ":lockmarks" was used */
|
2013-11-09 05:30:26 +01:00
|
|
|
int keeppatterns; /* TRUE when ":keeppatterns" was used */
|
2014-03-23 16:04:02 +01:00
|
|
|
int noswapfile; /* TRUE when ":noswapfile" was used */
|
2005-12-11 21:33:32 +00:00
|
|
|
char_u *save_ei; /* saved value of 'eventignore' */
|
2016-08-23 23:51:21 +02:00
|
|
|
regmatch_T filter_regmatch; /* set by :filter /pat/ */
|
2016-08-26 22:29:11 +02:00
|
|
|
int filter_force; /* set for :filter! */
|
2004-06-13 20:20:40 +00:00
|
|
|
} cmdmod_T;
|
|
|
|
|
2010-06-21 06:15:46 +02:00
|
|
|
#define MF_SEED_LEN 8
|
2004-06-13 20:20:40 +00:00
|
|
|
|
|
|
|
struct memfile
|
|
|
|
{
|
|
|
|
char_u *mf_fname; /* name of the file */
|
|
|
|
char_u *mf_ffname; /* idem, full path */
|
|
|
|
int mf_fd; /* file descriptor */
|
|
|
|
bhdr_T *mf_free_first; /* first block_hdr in free list */
|
|
|
|
bhdr_T *mf_used_first; /* mru block_hdr in used list */
|
|
|
|
bhdr_T *mf_used_last; /* lru block_hdr in used list */
|
|
|
|
unsigned mf_used_count; /* number of pages in used list */
|
|
|
|
unsigned mf_used_count_max; /* maximum number of pages in memory */
|
2011-03-22 18:10:45 +01:00
|
|
|
mf_hashtab_T mf_hash; /* hash lists */
|
|
|
|
mf_hashtab_T mf_trans; /* trans lists */
|
2004-06-13 20:20:40 +00:00
|
|
|
blocknr_T mf_blocknr_max; /* highest positive block number + 1*/
|
|
|
|
blocknr_T mf_blocknr_min; /* lowest negative block number - 1 */
|
|
|
|
blocknr_T mf_neg_count; /* number of negative blocks numbers */
|
|
|
|
blocknr_T mf_infile_count; /* number of pages in the file */
|
|
|
|
unsigned mf_page_size; /* number of bytes in a page */
|
|
|
|
int mf_dirty; /* TRUE if there are dirty blocks */
|
2010-06-21 06:15:46 +02:00
|
|
|
#ifdef FEAT_CRYPT
|
2014-05-13 20:19:58 +02:00
|
|
|
buf_T *mf_buffer; /* buffer this memfile is for */
|
2010-06-21 06:15:46 +02:00
|
|
|
char_u mf_seed[MF_SEED_LEN]; /* seed for encryption */
|
|
|
|
|
|
|
|
/* Values for key, method and seed used for reading data blocks when
|
|
|
|
* updating for a newly set key or method. Only when mf_old_key != NULL. */
|
|
|
|
char_u *mf_old_key;
|
|
|
|
int mf_old_cm;
|
|
|
|
char_u mf_old_seed[MF_SEED_LEN];
|
|
|
|
#endif
|
2004-06-13 20:20:40 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* things used in memline.c
|
|
|
|
*/
|
|
|
|
/*
|
|
|
|
* When searching for a specific line, we remember what blocks in the tree
|
|
|
|
* are the branches leading to that block. This is stored in ml_stack. Each
|
|
|
|
* entry is a pointer to info in a block (may be data block or pointer block)
|
|
|
|
*/
|
|
|
|
typedef struct info_pointer
|
|
|
|
{
|
|
|
|
blocknr_T ip_bnum; /* block number */
|
|
|
|
linenr_T ip_low; /* lowest lnum in this block */
|
|
|
|
linenr_T ip_high; /* highest lnum in this block */
|
|
|
|
int ip_index; /* index for block with current lnum */
|
|
|
|
} infoptr_T; /* block/index pair */
|
|
|
|
|
|
|
|
#ifdef FEAT_BYTEOFF
|
|
|
|
typedef struct ml_chunksize
|
|
|
|
{
|
|
|
|
int mlcs_numlines;
|
|
|
|
long mlcs_totalsize;
|
|
|
|
} chunksize_T;
|
|
|
|
|
|
|
|
/* Flags when calling ml_updatechunk() */
|
|
|
|
|
|
|
|
#define ML_CHNK_ADDLINE 1
|
|
|
|
#define ML_CHNK_DELLINE 2
|
|
|
|
#define ML_CHNK_UPDLINE 3
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/*
|
|
|
|
* the memline structure holds all the information about a memline
|
|
|
|
*/
|
|
|
|
typedef struct memline
|
|
|
|
{
|
|
|
|
linenr_T ml_line_count; /* number of lines in the buffer */
|
|
|
|
|
|
|
|
memfile_T *ml_mfp; /* pointer to associated memfile */
|
|
|
|
|
|
|
|
#define ML_EMPTY 1 /* empty buffer */
|
|
|
|
#define ML_LINE_DIRTY 2 /* cached line was changed and allocated */
|
|
|
|
#define ML_LOCKED_DIRTY 4 /* ml_locked was changed */
|
|
|
|
#define ML_LOCKED_POS 8 /* ml_locked needs positive block number */
|
|
|
|
int ml_flags;
|
|
|
|
|
|
|
|
infoptr_T *ml_stack; /* stack of pointer blocks (array of IPTRs) */
|
2015-07-17 14:18:08 +02:00
|
|
|
int ml_stack_top; /* current top of ml_stack */
|
2004-06-13 20:20:40 +00:00
|
|
|
int ml_stack_size; /* total number of entries in ml_stack */
|
|
|
|
|
|
|
|
linenr_T ml_line_lnum; /* line number of cached line, 0 if not valid */
|
|
|
|
char_u *ml_line_ptr; /* pointer to cached line */
|
2018-12-13 22:20:09 +01:00
|
|
|
colnr_T ml_line_len; /* length of the cached line, including NUL */
|
2004-06-13 20:20:40 +00:00
|
|
|
|
|
|
|
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 */
|
|
|
|
#ifdef FEAT_BYTEOFF
|
|
|
|
chunksize_T *ml_chunksize;
|
|
|
|
int ml_numchunks;
|
|
|
|
int ml_usedchunks;
|
|
|
|
#endif
|
|
|
|
} memline_T;
|
|
|
|
|
2018-12-13 22:20:09 +01:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Structure defining text properties. These stick with the text.
|
|
|
|
* When stored in memline they are after the text, ml_line_len is larger than
|
|
|
|
* STRLEN(ml_line_ptr) + 1.
|
|
|
|
*/
|
|
|
|
typedef struct textprop_S
|
|
|
|
{
|
|
|
|
colnr_T tp_col; // start column
|
|
|
|
colnr_T tp_len; // length in bytes
|
|
|
|
int tp_id; // identifier
|
|
|
|
int tp_type; // property type
|
|
|
|
int tp_flags; // TP_FLAG_ values
|
|
|
|
} textprop_T;
|
|
|
|
|
|
|
|
#define TP_FLAG_CONT_NEXT 1 // property continues in next line
|
|
|
|
#define TP_FLAG_CONT_PREV 2 // property was continued from prev line
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Structure defining a property type.
|
|
|
|
*/
|
|
|
|
typedef struct proptype_S
|
|
|
|
{
|
|
|
|
int pt_id; // value used for tp_id
|
|
|
|
int pt_type; // number used for tp_type
|
|
|
|
int pt_hl_id; // highlighting
|
|
|
|
int pt_priority; // priority
|
|
|
|
int pt_flags; // PT_FLAG_ values
|
|
|
|
char_u pt_name[1]; // property type name, actually longer
|
|
|
|
} proptype_T;
|
|
|
|
|
|
|
|
#define PT_FLAG_INS_START_INCL 1 // insert at start included in property
|
|
|
|
#define PT_FLAG_INS_END_INCL 2 // insert at end included in property
|
|
|
|
|
|
|
|
|
2004-06-13 20:20:40 +00:00
|
|
|
#if defined(FEAT_SIGNS) || defined(PROTO)
|
2018-12-24 20:23:49 +01:00
|
|
|
// Sign group
|
|
|
|
typedef struct signgroup_S
|
|
|
|
{
|
|
|
|
short_u refcount; // number of signs in this group
|
|
|
|
char_u sg_name[1]; // sign group name
|
|
|
|
} signgroup_T;
|
|
|
|
|
|
|
|
// Macros to get the sign group structure from the group name
|
|
|
|
#define SGN_KEY_OFF offsetof(signgroup_T, sg_name)
|
|
|
|
#define HI2SG(hi) ((signgroup_T *)((hi)->hi_key - SGN_KEY_OFF))
|
|
|
|
|
2004-06-13 20:20:40 +00:00
|
|
|
typedef struct signlist signlist_T;
|
|
|
|
|
|
|
|
struct signlist
|
|
|
|
{
|
|
|
|
int id; /* unique identifier for each placed sign */
|
|
|
|
linenr_T lnum; /* line number which has this sign */
|
|
|
|
int typenr; /* typenr of sign */
|
2018-12-24 20:23:49 +01:00
|
|
|
signgroup_T *group; /* sign group */
|
2018-12-21 15:17:36 +01:00
|
|
|
int priority; /* priority for highlighting */
|
2004-06-13 20:20:40 +00:00
|
|
|
signlist_T *next; /* next signlist entry */
|
|
|
|
signlist_T *prev; /* previous entry -- for easy reordering */
|
|
|
|
};
|
|
|
|
|
2018-12-21 15:17:36 +01:00
|
|
|
// Default sign priority for highlighting
|
|
|
|
#define SIGN_DEF_PRIO 10
|
|
|
|
|
2004-06-13 20:20:40 +00:00
|
|
|
/* type argument for buf_getsigntype() */
|
|
|
|
#define SIGN_ANY 0
|
|
|
|
#define SIGN_LINEHL 1
|
|
|
|
#define SIGN_ICON 2
|
|
|
|
#define SIGN_TEXT 3
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Argument list: Array of file names.
|
|
|
|
* Used for the global argument list and the argument lists local to a window.
|
|
|
|
*/
|
|
|
|
typedef struct arglist
|
|
|
|
{
|
|
|
|
garray_T al_ga; /* growarray with the array of file names */
|
|
|
|
int al_refcount; /* number of windows using this arglist */
|
2014-05-28 18:22:57 +02:00
|
|
|
int id; /* id of this arglist */
|
2004-06-13 20:20:40 +00:00
|
|
|
} alist_T;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* For each argument remember the file name as it was given, and the buffer
|
|
|
|
* number that contains the expanded file name (required for when ":cd" is
|
|
|
|
* used.
|
|
|
|
*/
|
|
|
|
typedef struct argentry
|
|
|
|
{
|
|
|
|
char_u *ae_fname; /* file name as specified */
|
|
|
|
int ae_fnum; /* buffer number with expanded file name */
|
|
|
|
} aentry_T;
|
|
|
|
|
2017-09-16 20:54:51 +02:00
|
|
|
#define ALIST(win) (win)->w_alist
|
2004-06-13 20:20:40 +00:00
|
|
|
#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)
|
|
|
|
#define AARGLIST(al) ((aentry_T *)((al)->al_ga.ga_data))
|
|
|
|
#define GARGCOUNT (global_alist.al_ga.ga_len)
|
|
|
|
#define ARGCOUNT (ALIST(curwin)->al_ga.ga_len)
|
|
|
|
#define WARGCOUNT(wp) (ALIST(wp)->al_ga.ga_len)
|
|
|
|
|
|
|
|
/*
|
|
|
|
* A list used for saving values of "emsg_silent". Used by ex_try() to save the
|
|
|
|
* value of "emsg_silent" if it was non-zero. When this is done, the CSF_SILENT
|
|
|
|
* flag below is set.
|
|
|
|
*/
|
|
|
|
|
|
|
|
typedef struct eslist_elem eslist_T;
|
|
|
|
struct eslist_elem
|
|
|
|
{
|
|
|
|
int saved_emsg_silent; /* saved value of "emsg_silent" */
|
|
|
|
eslist_T *next; /* next element on the list */
|
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* For conditional commands a stack is kept of nested conditionals.
|
|
|
|
* When cs_idx < 0, there is no conditional command.
|
|
|
|
*/
|
|
|
|
#define CSTACK_LEN 50
|
|
|
|
|
|
|
|
struct condstack
|
|
|
|
{
|
2005-01-05 22:16:17 +00:00
|
|
|
short cs_flags[CSTACK_LEN]; /* CSF_ flags */
|
2004-06-13 20:20:40 +00:00
|
|
|
char cs_pending[CSTACK_LEN]; /* CSTP_: what's pending in ":finally"*/
|
|
|
|
union {
|
2005-01-05 22:16:17 +00:00
|
|
|
void *csp_rv[CSTACK_LEN]; /* return typeval for pending return */
|
|
|
|
void *csp_ex[CSTACK_LEN]; /* exception for pending throw */
|
2004-06-13 20:20:40 +00:00
|
|
|
} cs_pend;
|
2005-01-06 23:24:37 +00:00
|
|
|
void *cs_forinfo[CSTACK_LEN]; /* info used by ":for" */
|
2005-01-05 22:16:17 +00:00
|
|
|
int cs_line[CSTACK_LEN]; /* line nr of ":while"/":for" line */
|
2004-06-13 20:20:40 +00:00
|
|
|
int cs_idx; /* current entry, or -1 if none */
|
2005-01-05 22:16:17 +00:00
|
|
|
int cs_looplevel; /* nr of nested ":while"s and ":for"s */
|
|
|
|
int cs_trylevel; /* nr of nested ":try"s */
|
2004-06-13 20:20:40 +00:00
|
|
|
eslist_T *cs_emsg_silent_list; /* saved values of "emsg_silent" */
|
2005-01-05 22:16:17 +00:00
|
|
|
char cs_lflags; /* loop flags: CSL_ flags */
|
2004-06-13 20:20:40 +00:00
|
|
|
};
|
2005-01-05 22:16:17 +00:00
|
|
|
# define cs_rettv cs_pend.csp_rv
|
|
|
|
# define cs_exception cs_pend.csp_ex
|
|
|
|
|
2005-01-06 23:24:37 +00:00
|
|
|
/* There is no CSF_IF, the lack of CSF_WHILE, CSF_FOR and CSF_TRY means ":if"
|
|
|
|
* was used. */
|
2005-01-05 22:16:17 +00:00
|
|
|
# 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" */
|
2004-06-13 20:20:40 +00:00
|
|
|
/* 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. */
|
|
|
|
|
|
|
|
/*
|
|
|
|
* 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 */
|
|
|
|
|
2005-01-05 22:16:17 +00:00
|
|
|
/*
|
|
|
|
* Flags for the cs_lflags item in struct condstack.
|
|
|
|
*/
|
|
|
|
# define CSL_HAD_LOOP 1 /* just found ":while" or ":for" */
|
|
|
|
# define CSL_HAD_ENDLOOP 2 /* just found ":endwhile" or ":endfor" */
|
|
|
|
# define CSL_HAD_CONT 4 /* just found ":continue" */
|
|
|
|
# define CSL_HAD_FINA 8 /* just found ":finally" */
|
|
|
|
|
2004-06-13 20:20:40 +00:00
|
|
|
/*
|
|
|
|
* A list of error messages that can be converted to an exception. "throw_msg"
|
|
|
|
* is only set in the first element of the list. Usually, it points to the
|
|
|
|
* original message stored in that element, but sometimes it points to a later
|
|
|
|
* 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 */
|
|
|
|
};
|
|
|
|
|
2016-11-10 20:20:05 +01:00
|
|
|
/*
|
|
|
|
* The exception types.
|
|
|
|
*/
|
|
|
|
typedef enum
|
|
|
|
{
|
2018-04-17 20:14:39 +02:00
|
|
|
ET_USER, // exception caused by ":throw" command
|
|
|
|
ET_ERROR, // error exception
|
|
|
|
ET_INTERRUPT, // interrupt exception triggered by Ctrl-C
|
2016-11-10 20:20:05 +01:00
|
|
|
} except_type_T;
|
|
|
|
|
2004-06-13 20:20:40 +00:00
|
|
|
/*
|
|
|
|
* Structure describing an exception.
|
|
|
|
* (don't use "struct exception", it's used by the math library).
|
|
|
|
*/
|
|
|
|
typedef struct vim_exception except_T;
|
|
|
|
struct vim_exception
|
|
|
|
{
|
2016-11-10 20:20:05 +01:00
|
|
|
except_type_T type; /* exception type */
|
2004-06-13 20:20:40 +00:00
|
|
|
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 */
|
|
|
|
};
|
|
|
|
|
2004-09-13 20:26:32 +00:00
|
|
|
/*
|
|
|
|
* Structure to save the error/interrupt/exception state between calls to
|
|
|
|
* enter_cleanup() and leave_cleanup(). Must be allocated as an automatic
|
|
|
|
* variable by the (common) caller of these functions.
|
|
|
|
*/
|
|
|
|
typedef struct cleanup_stuff cleanup_T;
|
|
|
|
struct cleanup_stuff
|
|
|
|
{
|
|
|
|
int pending; /* error/interrupt/exception state */
|
|
|
|
except_T *exception; /* exception value */
|
|
|
|
};
|
2004-06-13 20:20:40 +00:00
|
|
|
|
|
|
|
#ifdef FEAT_SYN_HL
|
|
|
|
/* struct passed to in_id_list() */
|
|
|
|
struct sp_syn
|
|
|
|
{
|
|
|
|
int inc_tag; /* ":syn include" unique tag */
|
|
|
|
short id; /* highlight group ID of item */
|
|
|
|
short *cont_in_list; /* cont.in group IDs, if non-zero */
|
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Each keyword has one keyentry, which is linked in a hash list.
|
|
|
|
*/
|
|
|
|
typedef struct keyentry keyentry_T;
|
|
|
|
|
|
|
|
struct keyentry
|
|
|
|
{
|
2005-01-25 22:12:55 +00:00
|
|
|
keyentry_T *ke_next; /* next entry with identical "keyword[]" */
|
2004-06-13 20:20:40 +00:00
|
|
|
struct sp_syn k_syn; /* struct passed to in_id_list() */
|
|
|
|
short *next_list; /* ID list for next match (if non-zero) */
|
2010-06-05 23:22:07 +02:00
|
|
|
int flags;
|
|
|
|
int k_char; /* conceal substitute character */
|
2004-06-13 20:20:40 +00:00
|
|
|
char_u keyword[1]; /* actually longer */
|
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Struct used to store one state of the state stack.
|
|
|
|
*/
|
|
|
|
typedef struct buf_state
|
|
|
|
{
|
|
|
|
int bs_idx; /* index of pattern */
|
2010-06-05 23:22:07 +02:00
|
|
|
int bs_flags; /* flags for pattern */
|
2010-07-28 18:14:45 +02:00
|
|
|
#ifdef FEAT_CONCEAL
|
|
|
|
int bs_seqnr; /* stores si_seqnr */
|
|
|
|
int bs_cchar; /* stores si_cchar */
|
|
|
|
#endif
|
2004-06-13 20:20:40 +00:00
|
|
|
reg_extmatch_T *bs_extmatch; /* external matches from start pattern */
|
|
|
|
} bufstate_T;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* syn_state contains the syntax state stack for the start of one line.
|
|
|
|
* Used by b_sst_array[].
|
|
|
|
*/
|
|
|
|
typedef struct syn_state synstate_T;
|
|
|
|
|
|
|
|
struct syn_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 */
|
|
|
|
} sst_union;
|
|
|
|
int sst_next_flags; /* flags for sst_next_list */
|
2010-05-16 13:56:06 +02:00
|
|
|
int sst_stacksize; /* number of states on the stack */
|
2004-06-13 20:20:40 +00:00
|
|
|
short *sst_next_list; /* "nextgroup" list in this state
|
|
|
|
* (this is a copy, don't free it! */
|
|
|
|
disptick_T sst_tick; /* tick when last displayed */
|
|
|
|
linenr_T sst_change_lnum;/* when non-zero, change in this line
|
|
|
|
* may have made the state invalid */
|
|
|
|
};
|
|
|
|
#endif /* FEAT_SYN_HL */
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Structure shared between syntax.c, screen.c and gui_x11.c.
|
|
|
|
*/
|
|
|
|
typedef struct attr_entry
|
|
|
|
{
|
|
|
|
short ae_attr; /* HL_BOLD, etc. */
|
|
|
|
union
|
|
|
|
{
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
char_u *start; /* start escape sequence */
|
|
|
|
char_u *stop; /* stop escape sequence */
|
|
|
|
} term;
|
|
|
|
struct
|
|
|
|
{
|
2006-02-24 23:53:04 +00:00
|
|
|
/* These colors need to be > 8 bits to hold 256. */
|
|
|
|
short_u fg_color; /* foreground color number */
|
|
|
|
short_u bg_color; /* background color number */
|
2016-04-29 22:59:22 +02:00
|
|
|
# ifdef FEAT_TERMGUICOLORS
|
2016-08-22 23:04:33 +02:00
|
|
|
guicolor_T fg_rgb; /* foreground color RGB */
|
|
|
|
guicolor_T bg_rgb; /* background color RGB */
|
2016-04-21 21:10:14 +02:00
|
|
|
# endif
|
2004-06-13 20:20:40 +00:00
|
|
|
} cterm;
|
|
|
|
# ifdef FEAT_GUI
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
guicolor_T fg_color; /* foreground color handle */
|
|
|
|
guicolor_T bg_color; /* background color handle */
|
2005-03-15 22:43:58 +00:00
|
|
|
guicolor_T sp_color; /* special color handle */
|
2004-06-13 20:20:40 +00:00
|
|
|
GuiFont font; /* font handle */
|
|
|
|
# ifdef FEAT_XFONTSET
|
|
|
|
GuiFontset fontset; /* fontset handle */
|
|
|
|
# endif
|
|
|
|
} gui;
|
|
|
|
# endif
|
|
|
|
} ae_u;
|
|
|
|
} attrentry_T;
|
|
|
|
|
|
|
|
#ifdef USE_ICONV
|
|
|
|
# ifdef HAVE_ICONV_H
|
|
|
|
# include <iconv.h>
|
|
|
|
# else
|
|
|
|
# if defined(MACOS_X)
|
|
|
|
# include <sys/errno.h>
|
2017-10-28 21:11:06 +02:00
|
|
|
# ifndef EILSEQ
|
|
|
|
# define EILSEQ ENOENT /* Early MacOS X does not have EILSEQ */
|
|
|
|
# endif
|
2004-06-13 20:20:40 +00:00
|
|
|
typedef struct _iconv_t *iconv_t;
|
|
|
|
# else
|
2017-10-28 21:11:06 +02:00
|
|
|
# include <errno.h>
|
2004-06-13 20:20:40 +00:00
|
|
|
# endif
|
|
|
|
typedef void *iconv_t;
|
|
|
|
# endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/*
|
|
|
|
* 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[] */
|
|
|
|
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[] */
|
|
|
|
int tb_maplen; /* nr of mapped bytes in tb_buf[] */
|
|
|
|
int tb_silent; /* nr of silently mapped bytes in tb_buf[] */
|
|
|
|
int tb_no_abbr_cnt; /* nr of bytes without abbrev. in tb_buf[] */
|
|
|
|
int tb_change_cnt; /* nr of time tb_buf was changed; never zero */
|
|
|
|
} typebuf_T;
|
|
|
|
|
|
|
|
/* Struct to hold the saved typeahead for save_typeahead(). */
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
typebuf_T save_typebuf;
|
|
|
|
int typebuf_valid; /* TRUE when save_typebuf valid */
|
2009-07-09 16:24:19 +00:00
|
|
|
int old_char;
|
|
|
|
int old_mod_mask;
|
2014-02-11 15:10:43 +01:00
|
|
|
buffheader_T save_readbuf1;
|
|
|
|
buffheader_T save_readbuf2;
|
2004-06-13 20:20:40 +00:00
|
|
|
#ifdef USE_INPUT_BUF
|
|
|
|
char_u *save_inputbuf;
|
|
|
|
#endif
|
|
|
|
} tasave_T;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Used for conversion of terminal I/O and script files.
|
|
|
|
*/
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
int vc_type; /* zero or one of the CONV_ values */
|
|
|
|
int vc_factor; /* max. expansion factor */
|
|
|
|
# ifdef WIN3264
|
|
|
|
int vc_cpfrom; /* codepage to convert from (CONV_CODEPAGE) */
|
|
|
|
int vc_cpto; /* codepage to convert to (CONV_CODEPAGE) */
|
|
|
|
# endif
|
|
|
|
# ifdef USE_ICONV
|
|
|
|
iconv_t vc_fd; /* for CONV_ICONV */
|
|
|
|
# endif
|
|
|
|
int vc_fail; /* fail for invalid char, don't use '?' */
|
|
|
|
} vimconv_T;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Structure used for reading from the viminfo file.
|
|
|
|
*/
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
char_u *vir_line; /* text of the current line */
|
|
|
|
FILE *vir_fd; /* file descriptor */
|
|
|
|
#ifdef FEAT_MBYTE
|
|
|
|
vimconv_T vir_conv; /* encoding conversion */
|
|
|
|
#endif
|
2016-06-06 21:07:52 +02:00
|
|
|
int vir_version; /* viminfo version detected or -1 */
|
2016-01-18 23:29:01 +01:00
|
|
|
garray_T vir_barlines; /* lines starting with | */
|
2004-06-13 20:20:40 +00:00
|
|
|
} vir_T;
|
|
|
|
|
|
|
|
#define CONV_NONE 0
|
|
|
|
#define CONV_TO_UTF8 1
|
2004-10-07 21:02:47 +00:00
|
|
|
#define CONV_9_TO_UTF8 2
|
|
|
|
#define CONV_TO_LATIN1 3
|
|
|
|
#define CONV_TO_LATIN9 4
|
|
|
|
#define CONV_ICONV 5
|
2004-06-13 20:20:40 +00:00
|
|
|
#ifdef WIN3264
|
2004-10-07 21:02:47 +00:00
|
|
|
# define CONV_CODEPAGE 10 /* codepage -> codepage */
|
2004-06-13 20:20:40 +00:00
|
|
|
#endif
|
|
|
|
#ifdef MACOS_X
|
2004-10-07 21:02:47 +00:00
|
|
|
# define CONV_MAC_LATIN1 20
|
|
|
|
# define CONV_LATIN1_MAC 21
|
|
|
|
# define CONV_MAC_UTF8 22
|
|
|
|
# define CONV_UTF8_MAC 23
|
2004-06-13 20:20:40 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Structure used for mappings and abbreviations.
|
|
|
|
*/
|
|
|
|
typedef struct mapblock mapblock_T;
|
|
|
|
struct mapblock
|
|
|
|
{
|
|
|
|
mapblock_T *m_next; /* next mapblock in list */
|
2010-10-20 21:23:33 +02:00
|
|
|
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 */
|
2013-06-29 14:47:22 +02:00
|
|
|
int m_keylen; /* strlen(m_keys) */
|
2004-06-13 20:20:40 +00:00
|
|
|
int m_mode; /* valid mode */
|
|
|
|
int m_noremap; /* if non-zero no re-mapping for m_str */
|
|
|
|
char m_silent; /* <silent> used, don't echo commands */
|
2013-06-29 14:47:22 +02:00
|
|
|
char m_nowait; /* <nowait> used */
|
2005-08-15 21:41:48 +00:00
|
|
|
#ifdef FEAT_EVAL
|
2006-03-10 21:42:59 +00:00
|
|
|
char m_expr; /* <expr> used, m_str is an expression */
|
2018-09-10 21:05:02 +02:00
|
|
|
sctx_T m_script_ctx; /* SCTX where map was defined */
|
2004-06-13 20:20:40 +00:00
|
|
|
#endif
|
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Used for highlighting in the status line.
|
|
|
|
*/
|
|
|
|
struct stl_hlrec
|
|
|
|
{
|
|
|
|
char_u *start;
|
2006-02-21 22:12:05 +00:00
|
|
|
int userhl; /* 0: no HL, 1-9: User HL, < 0 for syn ID */
|
2004-06-13 20:20:40 +00:00
|
|
|
};
|
|
|
|
|
2010-06-05 23:22:07 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Syntax items - usually buffer-specific.
|
|
|
|
*/
|
|
|
|
|
2005-01-21 11:55:25 +00:00
|
|
|
/* Item for a hashtable. "hi_key" can be one of three values:
|
|
|
|
* NULL: Never been used
|
|
|
|
* HI_KEY_REMOVED: Entry was removed
|
|
|
|
* Otherwise: Used item, pointer to the actual key; this usually is
|
|
|
|
* inside the item, subtract an offset to locate the item.
|
|
|
|
* This reduces the size of hashitem by 1/3.
|
|
|
|
*/
|
|
|
|
typedef struct hashitem_S
|
|
|
|
{
|
|
|
|
long_u hi_hash; /* cached hash number of hi_key */
|
|
|
|
char_u *hi_key;
|
2005-01-25 22:12:55 +00:00
|
|
|
} hashitem_T;
|
2005-01-21 11:55:25 +00:00
|
|
|
|
|
|
|
/* The address of "hash_removed" is used as a magic number for hi_key to
|
|
|
|
* indicate a removed item. */
|
|
|
|
#define HI_KEY_REMOVED &hash_removed
|
|
|
|
#define HASHITEM_EMPTY(hi) ((hi)->hi_key == NULL || (hi)->hi_key == &hash_removed)
|
|
|
|
|
|
|
|
/* Initial size for a hashtable. Our items are relatively small and growing
|
|
|
|
* is expensive, thus use 16 as a start. Must be a power of 2. */
|
|
|
|
#define HT_INIT_SIZE 16
|
|
|
|
|
|
|
|
typedef struct hashtable_S
|
|
|
|
{
|
|
|
|
long_u ht_mask; /* mask used for hash value (nr of items in
|
|
|
|
* array is "ht_mask" + 1) */
|
2005-01-27 14:41:15 +00:00
|
|
|
long_u ht_used; /* number of items used */
|
|
|
|
long_u ht_filled; /* number of items used + removed */
|
2005-01-21 11:55:25 +00:00
|
|
|
int ht_locked; /* counter for hash_lock() */
|
|
|
|
int ht_error; /* when set growing failed, can't add more
|
|
|
|
items before growing works */
|
2005-01-25 22:12:55 +00:00
|
|
|
hashitem_T *ht_array; /* points to the array, allocated when it's
|
2005-01-21 11:55:25 +00:00
|
|
|
not "ht_smallarray" */
|
2005-01-25 22:12:55 +00:00
|
|
|
hashitem_T ht_smallarray[HT_INIT_SIZE]; /* initial array */
|
|
|
|
} hashtab_T;
|
|
|
|
|
|
|
|
typedef long_u hash_T; /* Type for hi_hash */
|
|
|
|
|
|
|
|
|
2016-07-01 18:17:26 +02:00
|
|
|
#ifdef FEAT_NUM64
|
|
|
|
/* Use 64-bit Number. */
|
|
|
|
# ifdef WIN3264
|
2016-08-28 18:10:45 +02:00
|
|
|
# ifdef PROTO
|
|
|
|
typedef long varnumber_T;
|
|
|
|
typedef unsigned long uvarnumber_T;
|
2017-01-22 18:34:57 +01:00
|
|
|
#define VARNUM_MIN LONG_MIN
|
|
|
|
#define VARNUM_MAX LONG_MAX
|
|
|
|
#define UVARNUM_MAX ULONG_MAX
|
2016-08-28 18:10:45 +02:00
|
|
|
# else
|
2016-07-01 18:17:26 +02:00
|
|
|
typedef __int64 varnumber_T;
|
|
|
|
typedef unsigned __int64 uvarnumber_T;
|
2017-01-22 18:34:57 +01:00
|
|
|
#define VARNUM_MIN _I64_MIN
|
|
|
|
#define VARNUM_MAX _I64_MAX
|
|
|
|
#define UVARNUM_MAX _UI64_MAX
|
2016-08-28 18:10:45 +02:00
|
|
|
# endif
|
2016-07-01 18:17:26 +02:00
|
|
|
# elif defined(HAVE_STDINT_H)
|
|
|
|
typedef int64_t varnumber_T;
|
|
|
|
typedef uint64_t uvarnumber_T;
|
2017-01-22 18:34:57 +01:00
|
|
|
#define VARNUM_MIN INT64_MIN
|
|
|
|
#define VARNUM_MAX INT64_MAX
|
|
|
|
#define UVARNUM_MAX UINT64_MAX
|
2016-07-01 18:17:26 +02:00
|
|
|
# else
|
|
|
|
typedef long varnumber_T;
|
|
|
|
typedef unsigned long uvarnumber_T;
|
2017-01-22 18:34:57 +01:00
|
|
|
#define VARNUM_MIN LONG_MIN
|
|
|
|
#define VARNUM_MAX LONG_MAX
|
|
|
|
#define UVARNUM_MAX ULONG_MAX
|
2016-07-01 18:17:26 +02:00
|
|
|
# endif
|
2005-01-25 22:12:55 +00:00
|
|
|
#else
|
2016-07-01 18:17:26 +02:00
|
|
|
/* Use 32-bit Number. */
|
|
|
|
# if VIM_SIZEOF_INT <= 3 /* use long if int is smaller than 32 bits */
|
|
|
|
typedef long varnumber_T;
|
|
|
|
typedef unsigned long uvarnumber_T;
|
2017-01-22 18:34:57 +01:00
|
|
|
#define VARNUM_MIN LONG_MIN
|
|
|
|
#define VARNUM_MAX LONG_MAX
|
|
|
|
#define UVARNUM_MAX ULONG_MAX
|
2016-07-01 18:17:26 +02:00
|
|
|
# else
|
|
|
|
typedef int varnumber_T;
|
|
|
|
typedef unsigned int uvarnumber_T;
|
2017-01-22 18:34:57 +01:00
|
|
|
#define VARNUM_MIN INT_MIN
|
|
|
|
#define VARNUM_MAX INT_MAX
|
|
|
|
#define UVARNUM_MAX UINT_MAX
|
2016-07-01 18:17:26 +02:00
|
|
|
# endif
|
2005-01-25 22:12:55 +00:00
|
|
|
#endif
|
2016-07-01 18:17:26 +02:00
|
|
|
|
2008-06-24 22:09:24 +00:00
|
|
|
typedef double float_T;
|
2005-01-25 22:12:55 +00:00
|
|
|
|
|
|
|
typedef struct listvar_S list_T;
|
|
|
|
typedef struct dictvar_S dict_T;
|
2016-03-14 23:05:14 +01:00
|
|
|
typedef struct partial_S partial_T;
|
2016-02-13 17:04:46 +01:00
|
|
|
|
2016-02-07 14:27:38 +01:00
|
|
|
typedef struct jobvar_S job_T;
|
2016-02-13 17:04:46 +01:00
|
|
|
typedef struct readq_S readq_T;
|
2017-08-18 20:50:30 +02:00
|
|
|
typedef struct writeq_S writeq_T;
|
2016-02-13 17:04:46 +01:00
|
|
|
typedef struct jsonq_S jsonq_T;
|
|
|
|
typedef struct cbq_S cbq_T;
|
|
|
|
typedef struct channel_S channel_T;
|
2005-01-25 22:12:55 +00:00
|
|
|
|
2016-02-06 18:09:59 +01:00
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
VAR_UNKNOWN = 0,
|
2018-04-17 20:14:39 +02:00
|
|
|
VAR_NUMBER, // "v_number" is used
|
|
|
|
VAR_STRING, // "v_string" is used
|
|
|
|
VAR_FUNC, // "v_string" is function name
|
|
|
|
VAR_PARTIAL, // "v_partial" is used
|
|
|
|
VAR_LIST, // "v_list" is used
|
|
|
|
VAR_DICT, // "v_dict" is used
|
|
|
|
VAR_FLOAT, // "v_float" is used
|
|
|
|
VAR_SPECIAL, // "v_number" is used
|
|
|
|
VAR_JOB, // "v_job" is used
|
|
|
|
VAR_CHANNEL, // "v_channel" is used
|
2016-02-06 18:09:59 +01:00
|
|
|
} vartype_T;
|
|
|
|
|
2005-01-25 22:12:55 +00:00
|
|
|
/*
|
|
|
|
* Structure to hold an internal variable without a name.
|
|
|
|
*/
|
|
|
|
typedef struct
|
|
|
|
{
|
2016-02-06 18:09:59 +01:00
|
|
|
vartype_T v_type;
|
2005-01-31 19:19:04 +00:00
|
|
|
char v_lock; /* see below: VAR_LOCKED, VAR_FIXED */
|
2005-01-25 22:12:55 +00:00
|
|
|
union
|
|
|
|
{
|
|
|
|
varnumber_T v_number; /* number value */
|
2008-06-24 22:09:24 +00:00
|
|
|
#ifdef FEAT_FLOAT
|
|
|
|
float_T v_float; /* floating number value */
|
|
|
|
#endif
|
2005-01-25 22:12:55 +00:00
|
|
|
char_u *v_string; /* string value (can be NULL!) */
|
|
|
|
list_T *v_list; /* list value (can be NULL!) */
|
|
|
|
dict_T *v_dict; /* dict value (can be NULL!) */
|
2016-03-14 23:05:14 +01:00
|
|
|
partial_T *v_partial; /* closure: function with args */
|
2016-03-11 22:52:15 +01:00
|
|
|
#ifdef FEAT_JOB_CHANNEL
|
2016-02-07 14:27:38 +01:00
|
|
|
job_T *v_job; /* job value (can be NULL!) */
|
2016-02-13 23:23:53 +01:00
|
|
|
channel_T *v_channel; /* channel value (can be NULL!) */
|
2016-02-07 14:27:38 +01:00
|
|
|
#endif
|
2005-01-25 22:12:55 +00:00
|
|
|
} vval;
|
|
|
|
} typval_T;
|
|
|
|
|
2012-07-16 17:31:53 +02:00
|
|
|
/* Values for "dv_scope". */
|
|
|
|
#define VAR_SCOPE 1 /* a:, v:, s:, etc. scope dictionaries */
|
|
|
|
#define VAR_DEF_SCOPE 2 /* l:, g: scope dictionaries: here funcrefs are not
|
|
|
|
allowed to mask existing functions */
|
|
|
|
|
2005-01-31 19:19:04 +00:00
|
|
|
/* Values for "v_lock". */
|
|
|
|
#define VAR_LOCKED 1 /* locked with lock(), can use unlock() */
|
|
|
|
#define VAR_FIXED 2 /* locked forever */
|
|
|
|
|
2005-01-25 22:12:55 +00:00
|
|
|
/*
|
|
|
|
* Structure to hold an item of a list: an internal variable without a name.
|
|
|
|
*/
|
|
|
|
typedef struct listitem_S listitem_T;
|
|
|
|
|
|
|
|
struct listitem_S
|
|
|
|
{
|
|
|
|
listitem_T *li_next; /* next item in list */
|
|
|
|
listitem_T *li_prev; /* previous item in list */
|
|
|
|
typval_T li_tv; /* type and value of the variable */
|
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Struct used by those that are using an item in a list.
|
|
|
|
*/
|
|
|
|
typedef struct listwatch_S listwatch_T;
|
|
|
|
|
|
|
|
struct listwatch_S
|
|
|
|
{
|
|
|
|
listitem_T *lw_item; /* item being watched */
|
|
|
|
listwatch_T *lw_next; /* next watcher */
|
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Structure to hold info about a list.
|
2018-03-08 21:46:43 +01:00
|
|
|
* Order of members is optimized to reduce padding.
|
2005-01-25 22:12:55 +00:00
|
|
|
*/
|
|
|
|
struct listvar_S
|
|
|
|
{
|
|
|
|
listitem_T *lv_first; /* first item, NULL if none */
|
|
|
|
listitem_T *lv_last; /* last item, NULL if none */
|
|
|
|
listwatch_T *lv_watch; /* first watcher, NULL if none */
|
2005-02-02 23:04:36 +00:00
|
|
|
listitem_T *lv_idx_item; /* when not NULL item at index "lv_idx" */
|
2005-02-12 14:29:27 +00:00
|
|
|
list_T *lv_copylist; /* copied list used by deepcopy() */
|
2005-09-07 21:18:43 +00:00
|
|
|
list_T *lv_used_next; /* next list in used lists list */
|
2005-06-27 22:42:44 +00:00
|
|
|
list_T *lv_used_prev; /* previous list in used lists list */
|
2018-03-08 21:46:43 +01:00
|
|
|
int lv_refcount; /* reference count */
|
|
|
|
int lv_len; /* number of items */
|
|
|
|
int lv_idx; /* cached index of an item */
|
|
|
|
int lv_copyID; /* ID used by deepcopy() */
|
|
|
|
char lv_lock; /* zero, VAR_LOCKED, VAR_FIXED */
|
2005-01-25 22:12:55 +00:00
|
|
|
};
|
|
|
|
|
2016-07-22 21:50:18 +02:00
|
|
|
/*
|
|
|
|
* Static list with 10 items. Use init_static_list() to initialize.
|
|
|
|
*/
|
|
|
|
typedef struct {
|
|
|
|
list_T sl_list; /* must be first */
|
|
|
|
listitem_T sl_items[10];
|
|
|
|
} staticList10_T;
|
|
|
|
|
2005-01-25 22:12:55 +00:00
|
|
|
/*
|
|
|
|
* Structure to hold an item of a Dictionary.
|
|
|
|
* Also used for a variable.
|
|
|
|
* The key is copied into "di_key" to avoid an extra alloc/free for it.
|
|
|
|
*/
|
|
|
|
struct dictitem_S
|
|
|
|
{
|
|
|
|
typval_T di_tv; /* type and value of the variable */
|
|
|
|
char_u di_flags; /* flags (only used for variable) */
|
|
|
|
char_u di_key[1]; /* key (actually longer!) */
|
|
|
|
};
|
|
|
|
typedef struct dictitem_S dictitem_T;
|
|
|
|
|
2016-03-25 15:40:50 +01:00
|
|
|
/* A dictitem with a 16 character key (plus NUL). */
|
|
|
|
struct dictitem16_S
|
|
|
|
{
|
|
|
|
typval_T di_tv; /* type and value of the variable */
|
|
|
|
char_u di_flags; /* flags (only used for variable) */
|
|
|
|
char_u di_key[17]; /* key */
|
|
|
|
};
|
|
|
|
typedef struct dictitem16_S dictitem16_T;
|
|
|
|
|
2015-04-13 16:16:38 +02:00
|
|
|
#define DI_FLAGS_RO 1 /* "di_flags" value: read-only variable */
|
|
|
|
#define DI_FLAGS_RO_SBX 2 /* "di_flags" value: read-only in the sandbox */
|
|
|
|
#define DI_FLAGS_FIX 4 /* "di_flags" value: fixed: no :unlet or remove() */
|
|
|
|
#define DI_FLAGS_LOCK 8 /* "di_flags" value: locked variable */
|
|
|
|
#define DI_FLAGS_ALLOC 16 /* "di_flags" value: separately allocated */
|
2005-01-25 22:12:55 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Structure to hold info about a Dictionary.
|
|
|
|
*/
|
|
|
|
struct dictvar_S
|
|
|
|
{
|
2013-06-12 19:52:15 +02:00
|
|
|
char dv_lock; /* zero, VAR_LOCKED, VAR_FIXED */
|
|
|
|
char dv_scope; /* zero, VAR_SCOPE, VAR_DEF_SCOPE */
|
2005-01-25 22:12:55 +00:00
|
|
|
int dv_refcount; /* reference count */
|
2005-02-12 14:29:27 +00:00
|
|
|
int dv_copyID; /* ID used by deepcopy() */
|
2013-06-12 19:52:15 +02:00
|
|
|
hashtab_T dv_hashtab; /* hashtab that refers to the items */
|
2005-02-12 14:29:27 +00:00
|
|
|
dict_T *dv_copydict; /* copied dict used by deepcopy() */
|
2005-06-27 22:42:44 +00:00
|
|
|
dict_T *dv_used_next; /* next dict in used dicts list */
|
|
|
|
dict_T *dv_used_prev; /* previous dict in used dicts list */
|
2005-01-25 22:12:55 +00:00
|
|
|
};
|
|
|
|
|
2016-08-01 15:40:54 +02:00
|
|
|
#if defined(FEAT_EVAL) || defined(PROTO)
|
|
|
|
typedef struct funccall_S funccall_T;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Structure to hold info for a user function.
|
|
|
|
*/
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
int uf_varargs; /* variable nr of arguments */
|
|
|
|
int uf_flags;
|
|
|
|
int uf_calls; /* nr of active calls */
|
2017-02-02 22:59:27 +01:00
|
|
|
int uf_cleared; /* func_clear() was already called */
|
2016-08-01 15:40:54 +02:00
|
|
|
garray_T uf_args; /* arguments */
|
|
|
|
garray_T uf_lines; /* function lines */
|
2018-10-14 21:41:01 +02:00
|
|
|
# ifdef FEAT_PROFILE
|
2016-08-01 15:40:54 +02:00
|
|
|
int uf_profiling; /* TRUE when func is being profiled */
|
2018-06-30 18:28:03 +02:00
|
|
|
int uf_prof_initialized;
|
2016-08-01 15:40:54 +02:00
|
|
|
/* profiling the function as a whole */
|
|
|
|
int uf_tm_count; /* nr of calls */
|
|
|
|
proftime_T uf_tm_total; /* time spent in function + children */
|
|
|
|
proftime_T uf_tm_self; /* time spent in function itself */
|
|
|
|
proftime_T uf_tm_children; /* time spent in children this call */
|
|
|
|
/* profiling the function per line */
|
|
|
|
int *uf_tml_count; /* nr of times line was executed */
|
|
|
|
proftime_T *uf_tml_total; /* time spent in a line + children */
|
|
|
|
proftime_T *uf_tml_self; /* time spent in a line itself */
|
|
|
|
proftime_T uf_tml_start; /* start time for current line */
|
|
|
|
proftime_T uf_tml_children; /* time spent in children for this line */
|
|
|
|
proftime_T uf_tml_wait; /* start wait time for current line */
|
|
|
|
int uf_tml_idx; /* index of line being timed; -1 if none */
|
|
|
|
int uf_tml_execed; /* line being timed was executed */
|
2018-10-14 21:41:01 +02:00
|
|
|
# endif
|
2018-09-10 21:05:02 +02:00
|
|
|
sctx_T uf_script_ctx; /* SCTX where function was defined,
|
2016-08-01 15:40:54 +02:00
|
|
|
used for s: variables */
|
2016-08-01 20:46:25 +02:00
|
|
|
int uf_refcount; /* reference count, see func_name_refcount() */
|
2016-08-01 15:40:54 +02:00
|
|
|
funccall_T *uf_scoped; /* l: local variables for closure */
|
|
|
|
char_u uf_name[1]; /* name of function (actually longer); can
|
|
|
|
start with <SNR>123_ (<SNR> is K_SPECIAL
|
|
|
|
KS_EXTRA KE_SNR) */
|
|
|
|
} ufunc_T;
|
|
|
|
|
|
|
|
#define MAX_FUNC_ARGS 20 /* maximum number of function arguments */
|
|
|
|
#define VAR_SHORT_LEN 20 /* short variable name length */
|
|
|
|
#define FIXVAR_CNT 12 /* number of fixed variables */
|
|
|
|
|
|
|
|
/* structure to hold info for a function that is currently being executed. */
|
|
|
|
struct funccall_S
|
|
|
|
{
|
|
|
|
ufunc_T *func; /* function being called */
|
|
|
|
int linenr; /* next line to be executed */
|
|
|
|
int returned; /* ":return" used */
|
|
|
|
struct /* fixed variables for arguments */
|
|
|
|
{
|
|
|
|
dictitem_T var; /* variable (without room for name) */
|
|
|
|
char_u room[VAR_SHORT_LEN]; /* room for the name */
|
|
|
|
} fixvar[FIXVAR_CNT];
|
|
|
|
dict_T l_vars; /* l: local function variables */
|
|
|
|
dictitem_T l_vars_var; /* variable for l: scope */
|
|
|
|
dict_T l_avars; /* a: argument variables */
|
|
|
|
dictitem_T l_avars_var; /* variable for a: scope */
|
|
|
|
list_T l_varlist; /* list for a:000 */
|
|
|
|
listitem_T l_listitems[MAX_FUNC_ARGS]; /* listitems for a:000 */
|
|
|
|
typval_T *rettv; /* return value */
|
|
|
|
linenr_T breakpoint; /* next line with breakpoint or zero */
|
|
|
|
int dbg_tick; /* debug_tick when breakpoint was set */
|
|
|
|
int level; /* top nesting level of executed function */
|
|
|
|
#ifdef FEAT_PROFILE
|
|
|
|
proftime_T prof_child; /* time spent in a child */
|
|
|
|
#endif
|
|
|
|
funccall_T *caller; /* calling function or NULL */
|
|
|
|
|
|
|
|
/* for closure */
|
2016-08-01 20:46:25 +02:00
|
|
|
int fc_refcount; /* number of user functions that reference this
|
|
|
|
* funccal */
|
2016-08-01 15:40:54 +02:00
|
|
|
int fc_copyID; /* for garbage collection */
|
2016-08-01 20:46:25 +02:00
|
|
|
garray_T fc_funcs; /* list of ufunc_T* which keep a reference to
|
|
|
|
* "func" */
|
2016-08-01 15:40:54 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Struct used by trans_function_name()
|
|
|
|
*/
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
dict_T *fd_dict; /* Dictionary used */
|
|
|
|
char_u *fd_newkey; /* new key in "dict" in allocated memory */
|
|
|
|
dictitem_T *fd_di; /* Dictionary item used */
|
|
|
|
} funcdict_T;
|
|
|
|
|
2018-10-14 21:41:01 +02:00
|
|
|
typedef struct funccal_entry funccal_entry_T;
|
|
|
|
struct funccal_entry {
|
|
|
|
void *top_funccal;
|
|
|
|
funccal_entry_T *next;
|
|
|
|
};
|
|
|
|
|
2016-08-01 16:35:59 +02:00
|
|
|
#else
|
|
|
|
/* dummy typedefs for function prototypes */
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
int dummy;
|
|
|
|
} ufunc_T;
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
int dummy;
|
|
|
|
} funcdict_T;
|
2018-10-14 22:38:09 +02:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
int dummy;
|
|
|
|
} funccal_entry_T;
|
2016-08-01 15:40:54 +02:00
|
|
|
#endif
|
|
|
|
|
2016-03-14 23:05:14 +01:00
|
|
|
struct partial_S
|
|
|
|
{
|
|
|
|
int pt_refcount; /* reference count */
|
2016-08-01 15:40:54 +02:00
|
|
|
char_u *pt_name; /* function name; when NULL use
|
|
|
|
* pt_func->uf_name */
|
|
|
|
ufunc_T *pt_func; /* function pointer; when NULL lookup function
|
|
|
|
* with pt_name */
|
2016-05-24 15:44:17 +02:00
|
|
|
int pt_auto; /* when TRUE the partial was created for using
|
|
|
|
dict.member in handle_subscript() */
|
2016-03-14 23:05:14 +01:00
|
|
|
int pt_argc; /* number of arguments */
|
|
|
|
typval_T *pt_argv; /* arguments in allocated array */
|
|
|
|
dict_T *pt_dict; /* dict for "self" */
|
|
|
|
};
|
|
|
|
|
2017-08-13 20:28:53 +02:00
|
|
|
/* Information returned by get_tty_info(). */
|
|
|
|
typedef struct {
|
|
|
|
int backspace; /* what the Backspace key produces */
|
|
|
|
int enter; /* what the Enter key produces */
|
|
|
|
int interrupt; /* interrupt character */
|
|
|
|
int nl_does_cr; /* TRUE when a NL is expanded to CR-NL on output */
|
|
|
|
} ttyinfo_T;
|
|
|
|
|
2016-11-17 17:25:32 +01:00
|
|
|
/* Status of a job. Order matters! */
|
2016-02-07 14:27:38 +01:00
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
JOB_FAILED,
|
|
|
|
JOB_STARTED,
|
2018-04-17 20:14:39 +02:00
|
|
|
JOB_ENDED, // detected job done
|
|
|
|
JOB_FINISHED, // job done and cleanup done
|
2016-02-07 14:27:38 +01:00
|
|
|
} jobstatus_T;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Structure to hold info about a Job.
|
|
|
|
*/
|
|
|
|
struct jobvar_S
|
|
|
|
{
|
2016-02-21 16:40:11 +01:00
|
|
|
job_T *jv_next;
|
|
|
|
job_T *jv_prev;
|
2016-02-07 14:27:38 +01:00
|
|
|
#ifdef UNIX
|
|
|
|
pid_t jv_pid;
|
|
|
|
#endif
|
|
|
|
#ifdef WIN32
|
2016-02-12 19:30:26 +01:00
|
|
|
PROCESS_INFORMATION jv_proc_info;
|
2016-10-27 21:13:10 +02:00
|
|
|
HANDLE jv_job_object;
|
2016-02-07 14:27:38 +01:00
|
|
|
#endif
|
2017-09-08 14:39:30 +02:00
|
|
|
char_u *jv_tty_in; /* controlling tty input, allocated */
|
|
|
|
char_u *jv_tty_out; /* controlling tty output, allocated */
|
2016-02-07 14:27:38 +01:00
|
|
|
jobstatus_T jv_status;
|
2016-02-21 16:40:11 +01:00
|
|
|
char_u *jv_stoponexit; /* allocated */
|
2016-02-21 19:32:02 +01:00
|
|
|
int jv_exitval;
|
2016-02-21 19:14:41 +01:00
|
|
|
char_u *jv_exit_cb; /* allocated */
|
2016-03-14 23:05:14 +01:00
|
|
|
partial_T *jv_exit_partial;
|
2016-02-07 14:27:38 +01:00
|
|
|
|
2016-03-03 22:51:40 +01:00
|
|
|
buf_T *jv_in_buf; /* buffer from "in-name" */
|
|
|
|
|
2016-02-07 14:27:38 +01:00
|
|
|
int jv_refcount; /* reference count */
|
2016-04-08 17:07:19 +02:00
|
|
|
int jv_copyID;
|
|
|
|
|
2016-02-13 23:23:53 +01:00
|
|
|
channel_T *jv_channel; /* channel for I/O, reference counted */
|
2018-05-13 14:05:18 +02:00
|
|
|
char **jv_argv; /* command line used to start the job */
|
2016-02-13 17:04:46 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Structures to hold info about a Channel.
|
|
|
|
*/
|
|
|
|
struct readq_S
|
|
|
|
{
|
2016-02-13 23:23:53 +01:00
|
|
|
char_u *rq_buffer;
|
2016-06-04 17:17:11 +02:00
|
|
|
long_u rq_buflen;
|
2016-02-13 23:23:53 +01:00
|
|
|
readq_T *rq_next;
|
|
|
|
readq_T *rq_prev;
|
2016-02-13 17:04:46 +01:00
|
|
|
};
|
|
|
|
|
2017-08-18 20:50:30 +02:00
|
|
|
struct writeq_S
|
|
|
|
{
|
|
|
|
garray_T wq_ga;
|
|
|
|
writeq_T *wq_next;
|
|
|
|
writeq_T *wq_prev;
|
|
|
|
};
|
|
|
|
|
2016-02-13 17:04:46 +01:00
|
|
|
struct jsonq_S
|
|
|
|
{
|
2016-02-13 23:23:53 +01:00
|
|
|
typval_T *jq_value;
|
|
|
|
jsonq_T *jq_next;
|
|
|
|
jsonq_T *jq_prev;
|
2016-12-01 15:34:12 +01:00
|
|
|
int jq_no_callback; /* TRUE when no callback was found */
|
2016-02-13 17:04:46 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
struct cbq_S
|
|
|
|
{
|
2016-02-13 23:23:53 +01:00
|
|
|
char_u *cq_callback;
|
2016-03-14 23:05:14 +01:00
|
|
|
partial_T *cq_partial;
|
2016-02-13 23:23:53 +01:00
|
|
|
int cq_seq_nr;
|
|
|
|
cbq_T *cq_next;
|
|
|
|
cbq_T *cq_prev;
|
2016-02-13 17:04:46 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
/* mode for a channel */
|
|
|
|
typedef enum
|
|
|
|
{
|
2016-02-13 23:23:53 +01:00
|
|
|
MODE_NL = 0,
|
|
|
|
MODE_RAW,
|
2016-02-13 17:04:46 +01:00
|
|
|
MODE_JSON,
|
2018-04-17 20:14:39 +02:00
|
|
|
MODE_JS,
|
2016-02-13 17:04:46 +01:00
|
|
|
} ch_mode_T;
|
|
|
|
|
2016-03-20 21:17:13 +01:00
|
|
|
typedef enum {
|
2018-04-17 20:14:39 +02:00
|
|
|
JIO_PIPE, // default
|
2016-03-20 21:17:13 +01:00
|
|
|
JIO_NULL,
|
|
|
|
JIO_FILE,
|
|
|
|
JIO_BUFFER,
|
|
|
|
JIO_OUT
|
|
|
|
} job_io_T;
|
|
|
|
|
2017-08-03 13:51:25 +02:00
|
|
|
#define CH_PART_FD(part) ch_part[part].ch_fd
|
|
|
|
|
2016-02-14 23:02:34 +01:00
|
|
|
/* Ordering matters, it is used in for loops: IN is last, only SOCK/OUT/ERR
|
|
|
|
* are polled. */
|
2016-10-09 17:28:01 +02:00
|
|
|
typedef enum {
|
|
|
|
PART_SOCK = 0,
|
2017-08-03 13:51:25 +02:00
|
|
|
#define CH_SOCK_FD CH_PART_FD(PART_SOCK)
|
2016-03-11 22:52:15 +01:00
|
|
|
#ifdef FEAT_JOB_CHANNEL
|
2016-10-09 17:28:01 +02:00
|
|
|
PART_OUT,
|
2017-08-03 13:51:25 +02:00
|
|
|
# define CH_OUT_FD CH_PART_FD(PART_OUT)
|
2016-10-09 17:28:01 +02:00
|
|
|
PART_ERR,
|
2017-08-03 13:51:25 +02:00
|
|
|
# define CH_ERR_FD CH_PART_FD(PART_ERR)
|
2016-10-09 17:28:01 +02:00
|
|
|
PART_IN,
|
2017-08-03 13:51:25 +02:00
|
|
|
# define CH_IN_FD CH_PART_FD(PART_IN)
|
2016-02-13 17:04:46 +01:00
|
|
|
#endif
|
2018-04-17 20:14:39 +02:00
|
|
|
PART_COUNT,
|
2016-10-09 17:28:01 +02:00
|
|
|
} ch_part_T;
|
|
|
|
|
|
|
|
#define INVALID_FD (-1)
|
2016-02-13 17:04:46 +01:00
|
|
|
|
2016-02-14 19:13:43 +01:00
|
|
|
/* The per-fd info for a channel. */
|
|
|
|
typedef struct {
|
|
|
|
sock_T ch_fd; /* socket/stdin/stdout/stderr, -1 if not used */
|
|
|
|
|
|
|
|
# if defined(UNIX) && !defined(HAVE_SELECT)
|
|
|
|
int ch_poll_idx; /* used by channel_poll_setup() */
|
|
|
|
# endif
|
2016-02-13 17:04:46 +01:00
|
|
|
|
|
|
|
#ifdef FEAT_GUI_X11
|
|
|
|
XtInputId ch_inputHandler; /* Cookie for input */
|
|
|
|
#endif
|
|
|
|
#ifdef FEAT_GUI_GTK
|
|
|
|
gint ch_inputHandler; /* Cookie for input */
|
|
|
|
#endif
|
2016-02-20 18:18:59 +01:00
|
|
|
|
|
|
|
ch_mode_T ch_mode;
|
2016-03-20 21:17:13 +01:00
|
|
|
job_io_T ch_io;
|
2016-02-20 18:18:59 +01:00
|
|
|
int ch_timeout; /* request timeout in msec */
|
|
|
|
|
|
|
|
readq_T ch_head; /* header for circular raw read queue */
|
|
|
|
jsonq_T ch_json_head; /* header for circular json read queue */
|
|
|
|
int ch_block_id; /* ID that channel_read_json_block() is
|
|
|
|
waiting for */
|
2017-02-06 21:56:09 +01:00
|
|
|
/* When ch_wait_len is non-zero use ch_deadline to wait for incomplete
|
|
|
|
* message to be complete. The value is the length of the incomplete
|
|
|
|
* message when the deadline was set. If it gets longer (something was
|
|
|
|
* received) the deadline is reset. */
|
|
|
|
size_t ch_wait_len;
|
2016-03-20 16:40:37 +01:00
|
|
|
#ifdef WIN32
|
|
|
|
DWORD ch_deadline;
|
|
|
|
#else
|
|
|
|
struct timeval ch_deadline;
|
|
|
|
#endif
|
2016-03-28 19:16:20 +02:00
|
|
|
int ch_block_write; /* for testing: 0 when not used, -1 when write
|
|
|
|
* does not block, 1 simulate blocking */
|
2017-08-18 20:50:30 +02:00
|
|
|
int ch_nonblocking; /* write() is non-blocking */
|
|
|
|
writeq_T ch_writeque; /* header for write queue */
|
2016-02-20 18:18:59 +01:00
|
|
|
|
|
|
|
cbq_T ch_cb_head; /* dummy node for per-request callbacks */
|
|
|
|
char_u *ch_callback; /* call when a msg is not handled */
|
2016-03-14 23:05:14 +01:00
|
|
|
partial_T *ch_partial;
|
2016-03-03 22:51:40 +01:00
|
|
|
|
2016-07-10 22:11:16 +02:00
|
|
|
bufref_T ch_bufref; /* buffer to read from or write to */
|
2016-05-29 16:17:08 +02:00
|
|
|
int ch_nomodifiable; /* TRUE when buffer can be 'nomodifiable' */
|
|
|
|
int ch_nomod_error; /* TRUE when e_modifiable was given */
|
2016-03-28 19:16:20 +02:00
|
|
|
int ch_buf_append; /* write appended lines instead top-bot */
|
2016-03-03 22:51:40 +01:00
|
|
|
linenr_T ch_buf_top; /* next line to send */
|
|
|
|
linenr_T ch_buf_bot; /* last line to send */
|
2016-02-20 18:18:59 +01:00
|
|
|
} chanpart_T;
|
2016-02-14 19:13:43 +01:00
|
|
|
|
|
|
|
struct channel_S {
|
|
|
|
channel_T *ch_next;
|
|
|
|
channel_T *ch_prev;
|
|
|
|
|
|
|
|
int ch_id; /* ID of the channel */
|
2016-03-20 19:31:33 +01:00
|
|
|
int ch_last_msg_id; /* ID of the last message */
|
2016-02-14 19:13:43 +01:00
|
|
|
|
2016-10-09 17:28:01 +02:00
|
|
|
chanpart_T ch_part[PART_COUNT]; /* info for socket, out, err and in */
|
2017-09-02 16:28:36 +02:00
|
|
|
int ch_write_text_mode; /* write buffer lines with CR, not NL */
|
2016-02-14 19:13:43 +01:00
|
|
|
|
2016-03-20 21:17:13 +01:00
|
|
|
char *ch_hostname; /* only for socket, allocated */
|
|
|
|
int ch_port; /* only for socket */
|
|
|
|
|
2016-10-09 17:28:01 +02:00
|
|
|
int ch_to_be_closed; /* bitset of readable fds to be closed.
|
|
|
|
* When all readable fds have been closed,
|
|
|
|
* set to (1 << PART_COUNT). */
|
2016-05-09 17:58:04 +02:00
|
|
|
int ch_to_be_freed; /* When TRUE channel must be freed when it's
|
|
|
|
* safe to invoke callbacks. */
|
2016-02-14 19:13:43 +01:00
|
|
|
int ch_error; /* When TRUE an error was reported. Avoids
|
|
|
|
* giving pages full of error messages when
|
|
|
|
* the other side has exited, only mention the
|
|
|
|
* first error until the connection works
|
|
|
|
* again. */
|
2016-02-14 23:02:34 +01:00
|
|
|
|
2016-02-23 13:20:22 +01:00
|
|
|
void (*ch_nb_close_cb)(void);
|
|
|
|
/* callback for Netbeans when channel is
|
|
|
|
* closed */
|
2016-02-13 17:04:46 +01:00
|
|
|
|
2017-09-08 14:39:30 +02:00
|
|
|
#ifdef WIN32
|
|
|
|
int ch_named_pipe; /* using named pipe instead of pty */
|
|
|
|
#endif
|
2016-02-20 18:18:59 +01:00
|
|
|
char_u *ch_callback; /* call when any msg is not handled */
|
2016-03-14 23:05:14 +01:00
|
|
|
partial_T *ch_partial;
|
2016-02-23 13:20:22 +01:00
|
|
|
char_u *ch_close_cb; /* call when channel is closed */
|
2016-03-14 23:05:14 +01:00
|
|
|
partial_T *ch_close_partial;
|
2016-12-01 15:34:12 +01:00
|
|
|
int ch_drop_never;
|
2017-08-26 22:02:51 +02:00
|
|
|
int ch_keep_open; /* do not close on read error */
|
2018-09-06 16:27:24 +02:00
|
|
|
int ch_nonblock;
|
2016-02-13 17:04:46 +01:00
|
|
|
|
2016-02-13 23:23:53 +01:00
|
|
|
job_T *ch_job; /* Job that uses this channel; this does not
|
|
|
|
* count as a reference to avoid a circular
|
2016-04-08 17:07:19 +02:00
|
|
|
* reference, the job refers to the channel. */
|
2016-02-26 11:17:46 +01:00
|
|
|
int ch_job_killed; /* TRUE when there was a job and it was killed
|
|
|
|
* or we know it died. */
|
2016-02-13 23:23:53 +01:00
|
|
|
|
|
|
|
int ch_refcount; /* reference count */
|
2016-04-08 17:07:19 +02:00
|
|
|
int ch_copyID;
|
2016-02-07 14:27:38 +01:00
|
|
|
};
|
|
|
|
|
2016-02-23 13:20:22 +01:00
|
|
|
#define JO_MODE 0x0001 /* channel mode */
|
|
|
|
#define JO_IN_MODE 0x0002 /* stdin mode */
|
|
|
|
#define JO_OUT_MODE 0x0004 /* stdout mode */
|
|
|
|
#define JO_ERR_MODE 0x0008 /* stderr mode */
|
|
|
|
#define JO_CALLBACK 0x0010 /* channel callback */
|
|
|
|
#define JO_OUT_CALLBACK 0x0020 /* stdout callback */
|
|
|
|
#define JO_ERR_CALLBACK 0x0040 /* stderr callback */
|
2017-08-05 14:50:12 +02:00
|
|
|
#define JO_CLOSE_CALLBACK 0x0080 /* "close_cb" */
|
2016-02-23 13:20:22 +01:00
|
|
|
#define JO_WAITTIME 0x0100 /* only for ch_open() */
|
|
|
|
#define JO_TIMEOUT 0x0200 /* all timeouts */
|
|
|
|
#define JO_OUT_TIMEOUT 0x0400 /* stdout timeouts */
|
|
|
|
#define JO_ERR_TIMEOUT 0x0800 /* stderr timeouts */
|
|
|
|
#define JO_PART 0x1000 /* "part" */
|
|
|
|
#define JO_ID 0x2000 /* "id" */
|
|
|
|
#define JO_STOPONEXIT 0x4000 /* "stoponexit" */
|
2016-03-14 23:22:59 +01:00
|
|
|
#define JO_EXIT_CB 0x8000 /* "exit_cb" */
|
|
|
|
#define JO_OUT_IO 0x10000 /* "out_io" */
|
|
|
|
#define JO_ERR_IO 0x20000 /* "err_io" (JO_OUT_IO << 1) */
|
|
|
|
#define JO_IN_IO 0x40000 /* "in_io" (JO_OUT_IO << 2) */
|
|
|
|
#define JO_OUT_NAME 0x80000 /* "out_name" */
|
|
|
|
#define JO_ERR_NAME 0x100000 /* "err_name" (JO_OUT_NAME << 1) */
|
|
|
|
#define JO_IN_NAME 0x200000 /* "in_name" (JO_OUT_NAME << 2) */
|
|
|
|
#define JO_IN_TOP 0x400000 /* "in_top" */
|
|
|
|
#define JO_IN_BOT 0x800000 /* "in_bot" */
|
|
|
|
#define JO_OUT_BUF 0x1000000 /* "out_buf" */
|
|
|
|
#define JO_ERR_BUF 0x2000000 /* "err_buf" (JO_OUT_BUF << 1) */
|
|
|
|
#define JO_IN_BUF 0x4000000 /* "in_buf" (JO_OUT_BUF << 2) */
|
2016-03-11 22:19:44 +01:00
|
|
|
#define JO_CHANNEL 0x8000000 /* "channel" */
|
2016-03-28 19:16:20 +02:00
|
|
|
#define JO_BLOCK_WRITE 0x10000000 /* "block_write" */
|
2016-05-29 16:17:08 +02:00
|
|
|
#define JO_OUT_MODIFIABLE 0x20000000 /* "out_modifiable" */
|
|
|
|
#define JO_ERR_MODIFIABLE 0x40000000 /* "err_modifiable" (JO_OUT_ << 1) */
|
2016-03-28 19:16:20 +02:00
|
|
|
#define JO_ALL 0x7fffffff
|
2016-02-19 22:33:35 +01:00
|
|
|
|
2016-09-07 23:32:23 +02:00
|
|
|
#define JO2_OUT_MSG 0x0001 /* "out_msg" */
|
|
|
|
#define JO2_ERR_MSG 0x0002 /* "err_msg" (JO_OUT_ << 1) */
|
2017-08-05 14:50:12 +02:00
|
|
|
#define JO2_TERM_NAME 0x0004 /* "term_name" */
|
2017-08-10 23:15:19 +02:00
|
|
|
#define JO2_TERM_FINISH 0x0008 /* "term_finish" */
|
2017-08-11 19:12:11 +02:00
|
|
|
#define JO2_ENV 0x0010 /* "env" */
|
|
|
|
#define JO2_CWD 0x0020 /* "cwd" */
|
2017-08-11 21:51:23 +02:00
|
|
|
#define JO2_TERM_ROWS 0x0040 /* "term_rows" */
|
|
|
|
#define JO2_TERM_COLS 0x0080 /* "term_cols" */
|
|
|
|
#define JO2_VERTICAL 0x0100 /* "vertical" */
|
2017-08-11 22:27:50 +02:00
|
|
|
#define JO2_CURWIN 0x0200 /* "curwin" */
|
2017-08-12 14:32:32 +02:00
|
|
|
#define JO2_HIDDEN 0x0400 /* "hidden" */
|
2017-08-12 16:01:04 +02:00
|
|
|
#define JO2_TERM_OPENCMD 0x0800 /* "term_opencmd" */
|
2017-09-02 14:54:21 +02:00
|
|
|
#define JO2_EOF_CHARS 0x1000 /* "eof_chars" */
|
2018-03-09 21:33:34 +01:00
|
|
|
#define JO2_NORESTORE 0x2000 /* "norestore" */
|
2018-03-10 20:28:12 +01:00
|
|
|
#define JO2_TERM_KILL 0x4000 /* "term_kill" */
|
2018-04-10 15:59:11 +02:00
|
|
|
#define JO2_ANSI_COLORS 0x8000 /* "ansi_colors" */
|
2016-09-07 23:32:23 +02:00
|
|
|
|
2016-02-20 23:30:07 +01:00
|
|
|
#define JO_MODE_ALL (JO_MODE + JO_IN_MODE + JO_OUT_MODE + JO_ERR_MODE)
|
2016-02-23 13:20:22 +01:00
|
|
|
#define JO_CB_ALL \
|
|
|
|
(JO_CALLBACK + JO_OUT_CALLBACK + JO_ERR_CALLBACK + JO_CLOSE_CALLBACK)
|
2016-02-20 23:30:07 +01:00
|
|
|
#define JO_TIMEOUT_ALL (JO_TIMEOUT + JO_OUT_TIMEOUT + JO_ERR_TIMEOUT)
|
|
|
|
|
2016-02-16 19:25:12 +01:00
|
|
|
/*
|
2016-02-16 21:03:07 +01:00
|
|
|
* Options for job and channel commands.
|
2016-02-16 19:25:12 +01:00
|
|
|
*/
|
|
|
|
typedef struct
|
|
|
|
{
|
2016-02-19 22:33:35 +01:00
|
|
|
int jo_set; /* JO_ bits for values that were set */
|
2016-09-07 23:32:23 +02:00
|
|
|
int jo_set2; /* JO2_ bits for values that were set */
|
2016-02-19 22:33:35 +01:00
|
|
|
|
|
|
|
ch_mode_T jo_mode;
|
2016-02-20 23:30:07 +01:00
|
|
|
ch_mode_T jo_in_mode;
|
|
|
|
ch_mode_T jo_out_mode;
|
|
|
|
ch_mode_T jo_err_mode;
|
2018-09-06 16:27:24 +02:00
|
|
|
int jo_noblock;
|
2016-02-27 14:44:26 +01:00
|
|
|
|
|
|
|
job_io_T jo_io[4]; /* PART_OUT, PART_ERR, PART_IN */
|
|
|
|
char_u jo_io_name_buf[4][NUMBUFLEN];
|
|
|
|
char_u *jo_io_name[4]; /* not allocated! */
|
2016-03-09 23:14:07 +01:00
|
|
|
int jo_io_buf[4];
|
2017-07-22 18:04:08 +02:00
|
|
|
int jo_pty;
|
2016-05-29 16:17:08 +02:00
|
|
|
int jo_modifiable[4];
|
2016-09-07 23:32:23 +02:00
|
|
|
int jo_message[4];
|
2016-03-11 22:19:44 +01:00
|
|
|
channel_T *jo_channel;
|
2016-02-27 14:44:26 +01:00
|
|
|
|
2016-03-03 22:51:40 +01:00
|
|
|
linenr_T jo_in_top;
|
|
|
|
linenr_T jo_in_bot;
|
|
|
|
|
2016-02-19 22:33:35 +01:00
|
|
|
char_u *jo_callback; /* not allocated! */
|
2016-03-14 23:05:14 +01:00
|
|
|
partial_T *jo_partial; /* not referenced! */
|
2016-02-20 23:30:07 +01:00
|
|
|
char_u *jo_out_cb; /* not allocated! */
|
2016-03-14 23:05:14 +01:00
|
|
|
partial_T *jo_out_partial; /* not referenced! */
|
2016-02-20 23:30:07 +01:00
|
|
|
char_u *jo_err_cb; /* not allocated! */
|
2016-03-14 23:05:14 +01:00
|
|
|
partial_T *jo_err_partial; /* not referenced! */
|
2016-02-23 13:20:22 +01:00
|
|
|
char_u *jo_close_cb; /* not allocated! */
|
2016-03-14 23:05:14 +01:00
|
|
|
partial_T *jo_close_partial; /* not referenced! */
|
|
|
|
char_u *jo_exit_cb; /* not allocated! */
|
|
|
|
partial_T *jo_exit_partial; /* not referenced! */
|
2016-12-01 15:34:12 +01:00
|
|
|
int jo_drop_never;
|
2016-02-19 22:33:35 +01:00
|
|
|
int jo_waittime;
|
|
|
|
int jo_timeout;
|
2016-02-20 23:30:07 +01:00
|
|
|
int jo_out_timeout;
|
|
|
|
int jo_err_timeout;
|
2016-03-28 19:16:20 +02:00
|
|
|
int jo_block_write; /* for testing only */
|
2016-02-20 19:56:13 +01:00
|
|
|
int jo_part;
|
|
|
|
int jo_id;
|
2016-02-21 16:40:11 +01:00
|
|
|
char_u jo_soe_buf[NUMBUFLEN];
|
|
|
|
char_u *jo_stoponexit;
|
2017-08-11 19:12:11 +02:00
|
|
|
dict_T *jo_env; /* environment variables */
|
|
|
|
char_u jo_cwd_buf[NUMBUFLEN];
|
|
|
|
char_u *jo_cwd;
|
2017-07-20 23:04:46 +02:00
|
|
|
|
|
|
|
#ifdef FEAT_TERMINAL
|
|
|
|
/* when non-zero run the job in a terminal window of this size */
|
|
|
|
int jo_term_rows;
|
|
|
|
int jo_term_cols;
|
2017-08-11 21:51:23 +02:00
|
|
|
int jo_vertical;
|
2017-08-11 22:27:50 +02:00
|
|
|
int jo_curwin;
|
2017-08-12 14:32:32 +02:00
|
|
|
int jo_hidden;
|
2018-03-09 21:33:34 +01:00
|
|
|
int jo_term_norestore;
|
2017-08-05 14:50:12 +02:00
|
|
|
char_u *jo_term_name;
|
2017-08-12 16:01:04 +02:00
|
|
|
char_u *jo_term_opencmd;
|
2017-08-10 23:15:19 +02:00
|
|
|
int jo_term_finish;
|
2017-09-02 14:54:21 +02:00
|
|
|
char_u *jo_eof_chars;
|
2018-03-10 20:28:12 +01:00
|
|
|
char_u *jo_term_kill;
|
2018-04-10 15:59:11 +02:00
|
|
|
# if defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS)
|
|
|
|
long_u jo_ansi_colors[16];
|
|
|
|
# endif
|
2017-07-20 23:04:46 +02:00
|
|
|
#endif
|
2016-02-16 19:25:12 +01:00
|
|
|
} jobopt_T;
|
|
|
|
|
2016-02-13 17:04:46 +01:00
|
|
|
|
2015-02-03 12:55:18 +01:00
|
|
|
/* structure used for explicit stack while garbage collecting hash tables */
|
|
|
|
typedef struct ht_stack_S
|
|
|
|
{
|
|
|
|
hashtab_T *ht;
|
|
|
|
struct ht_stack_S *prev;
|
|
|
|
} ht_stack_T;
|
|
|
|
|
|
|
|
/* structure used for explicit stack while garbage collecting lists */
|
|
|
|
typedef struct list_stack_S
|
|
|
|
{
|
|
|
|
list_T *list;
|
|
|
|
struct list_stack_S *prev;
|
|
|
|
} list_stack_T;
|
|
|
|
|
2005-07-18 21:58:11 +00:00
|
|
|
/* values for b_syn_spell: what to do with toplevel text */
|
|
|
|
#define SYNSPL_DEFAULT 0 /* spell check if @Spell not defined */
|
|
|
|
#define SYNSPL_TOP 1 /* spell check toplevel text */
|
|
|
|
#define SYNSPL_NOTOP 2 /* don't spell check toplevel text */
|
|
|
|
|
2006-01-12 23:22:24 +00:00
|
|
|
/* avoid #ifdefs for when b_spell is not available */
|
2006-03-12 22:08:12 +00:00
|
|
|
#ifdef FEAT_SPELL
|
2006-01-12 23:22:24 +00:00
|
|
|
# define B_SPELL(buf) ((buf)->b_spell)
|
|
|
|
#else
|
|
|
|
# define B_SPELL(buf) (0)
|
|
|
|
#endif
|
|
|
|
|
2006-03-24 22:46:53 +00:00
|
|
|
#ifdef FEAT_QUICKFIX
|
2006-01-25 22:10:52 +00:00
|
|
|
typedef struct qf_info_S qf_info_T;
|
2006-03-24 22:46:53 +00:00
|
|
|
#endif
|
2005-01-21 11:55:25 +00:00
|
|
|
|
2013-06-06 14:55:19 +02:00
|
|
|
#ifdef FEAT_PROFILE
|
2013-06-06 14:01:46 +02:00
|
|
|
/*
|
|
|
|
* Used for :syntime: timing of executing a syntax pattern.
|
|
|
|
*/
|
|
|
|
typedef struct {
|
|
|
|
proftime_T total; /* total time used */
|
|
|
|
proftime_T slowest; /* time of slowest call */
|
|
|
|
long count; /* nr of times used */
|
|
|
|
long match; /* nr of times matched */
|
|
|
|
} syn_time_T;
|
|
|
|
#endif
|
|
|
|
|
2014-08-10 13:38:34 +02:00
|
|
|
#ifdef FEAT_CRYPT
|
|
|
|
/*
|
|
|
|
* Structure to hold the type of encryption and the state of encryption or
|
|
|
|
* decryption.
|
|
|
|
*/
|
|
|
|
typedef struct {
|
|
|
|
int method_nr;
|
|
|
|
void *method_state; /* method-specific state information */
|
|
|
|
} cryptstate_T;
|
|
|
|
|
|
|
|
/* values for method_nr */
|
|
|
|
# define CRYPT_M_ZIP 0
|
|
|
|
# define CRYPT_M_BF 1
|
|
|
|
# define CRYPT_M_BF2 2
|
|
|
|
# define CRYPT_M_COUNT 3 /* number of crypt methods */
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2012-06-06 19:02:45 +02:00
|
|
|
/*
|
|
|
|
* These are items normally related to a buffer. But when using ":ownsyntax"
|
|
|
|
* a window may have its own instance.
|
|
|
|
*/
|
2010-06-05 23:22:07 +02:00
|
|
|
typedef struct {
|
|
|
|
#ifdef FEAT_SYN_HL
|
|
|
|
hashtab_T b_keywtab; /* syntax keywords hash table */
|
|
|
|
hashtab_T b_keywtab_ic; /* idem, ignore case */
|
2013-05-06 04:24:17 +02:00
|
|
|
int b_syn_error; /* TRUE when error occurred in HL */
|
2017-06-18 22:41:03 +02:00
|
|
|
# ifdef FEAT_RELTIME
|
|
|
|
int b_syn_slow; /* TRUE when 'redrawtime' reached */
|
|
|
|
# endif
|
2010-06-05 23:22:07 +02:00
|
|
|
int b_syn_ic; /* ignore case for :syn cmds */
|
|
|
|
int b_syn_spell; /* SYNSPL_ values */
|
|
|
|
garray_T b_syn_patterns; /* table for syntax patterns */
|
|
|
|
garray_T b_syn_clusters; /* table for syntax clusters */
|
|
|
|
int b_spell_cluster_id; /* @Spell cluster ID or 0 */
|
|
|
|
int b_nospell_cluster_id; /* @NoSpell cluster ID or 0 */
|
|
|
|
int b_syn_containedin; /* TRUE when there is an item with a
|
|
|
|
"containedin" argument */
|
|
|
|
int b_syn_sync_flags; /* flags about how to sync */
|
|
|
|
short b_syn_sync_id; /* group to sync on */
|
|
|
|
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 */
|
2013-06-06 14:55:19 +02:00
|
|
|
#ifdef FEAT_PROFILE
|
2013-06-06 14:01:46 +02:00
|
|
|
syn_time_T b_syn_linecont_time;
|
|
|
|
#endif
|
2010-06-05 23:22:07 +02:00
|
|
|
int b_syn_linecont_ic; /* ignore-case flag for above */
|
|
|
|
int b_syn_topgrp; /* for ":syntax include" */
|
|
|
|
# ifdef FEAT_CONCEAL
|
|
|
|
int b_syn_conceal; /* auto-conceal for :syn cmds */
|
|
|
|
# endif
|
|
|
|
# ifdef FEAT_FOLDING
|
|
|
|
int b_syn_folditems; /* number of patterns with the HL_FOLD
|
|
|
|
flag set */
|
|
|
|
# endif
|
2010-07-27 22:41:43 +02:00
|
|
|
/*
|
|
|
|
* b_sst_array[] contains the state stack for a number of lines, for the
|
|
|
|
* start of that line (col == 0). This avoids having to recompute the
|
|
|
|
* syntax state too often.
|
|
|
|
* b_sst_array[] is allocated to hold the state for all displayed lines,
|
|
|
|
* and states for 1 out of about 20 other lines.
|
|
|
|
* b_sst_array pointer to an array of synstate_T
|
|
|
|
* b_sst_len number of entries in b_sst_array[]
|
|
|
|
* b_sst_first pointer to first used entry in b_sst_array[] or NULL
|
|
|
|
* b_sst_firstfree pointer to first free entry in b_sst_array[] or NULL
|
|
|
|
* 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)
|
|
|
|
*/
|
2010-06-05 23:22:07 +02:00
|
|
|
synstate_T *b_sst_array;
|
|
|
|
int b_sst_len;
|
|
|
|
synstate_T *b_sst_first;
|
|
|
|
synstate_T *b_sst_firstfree;
|
|
|
|
int b_sst_freecount;
|
|
|
|
linenr_T b_sst_check_lnum;
|
|
|
|
short_u b_sst_lasttick; /* last display tick */
|
|
|
|
#endif /* FEAT_SYN_HL */
|
|
|
|
|
|
|
|
#ifdef FEAT_SPELL
|
|
|
|
/* for spell checking */
|
|
|
|
garray_T b_langp; /* list of pointers to slang_T, see spell.c */
|
|
|
|
char_u b_spell_ismw[256];/* flags: is midword char */
|
|
|
|
# ifdef FEAT_MBYTE
|
|
|
|
char_u *b_spell_ismw_mb; /* multi-byte midword chars */
|
|
|
|
# endif
|
|
|
|
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' */
|
2013-11-12 04:44:01 +01:00
|
|
|
# ifdef FEAT_MBYTE
|
|
|
|
int b_cjk; /* all CJK letters as OK */
|
|
|
|
# endif
|
2010-06-05 23:22:07 +02:00
|
|
|
#endif
|
2010-07-27 22:41:43 +02:00
|
|
|
#if !defined(FEAT_SYN_HL) && !defined(FEAT_SPELL)
|
|
|
|
int dummy;
|
|
|
|
#endif
|
2016-01-19 22:29:28 +01:00
|
|
|
char_u b_syn_chartab[32]; /* syntax iskeyword option */
|
|
|
|
char_u *b_syn_isk; /* iskeyword option */
|
2010-06-05 23:22:07 +02:00
|
|
|
} synblock_T;
|
|
|
|
|
|
|
|
|
2004-06-13 20:20:40 +00:00
|
|
|
/*
|
|
|
|
* buffer: structure that holds information about one file
|
|
|
|
*
|
|
|
|
* Several windows can share a single Buffer
|
|
|
|
* A buffer is unallocated if there is no memfile for it.
|
|
|
|
* A buffer is new if the associated file has never been loaded yet.
|
|
|
|
*/
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
int b_nwindows; /* nr of windows open on this buffer */
|
|
|
|
|
|
|
|
int b_flags; /* various BF_ flags */
|
2016-09-04 19:50:54 +02:00
|
|
|
int b_locked; /* Buffer is being closed or referenced, don't
|
|
|
|
let autocommands wipe it out. */
|
2004-06-13 20:20:40 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* b_ffname has the full path of the file (NULL for no name).
|
|
|
|
* b_sfname is the name as the user typed it (or NULL).
|
|
|
|
* 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).
|
|
|
|
*/
|
2018-10-11 19:27:47 +02:00
|
|
|
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
|
2004-06-13 20:20:40 +00:00
|
|
|
|
|
|
|
#ifdef UNIX
|
2009-05-13 18:48:16 +00:00
|
|
|
int b_dev_valid; /* TRUE when b_dev has a valid number */
|
|
|
|
dev_t b_dev; /* device number */
|
2004-06-13 20:20:40 +00:00
|
|
|
ino_t b_ino; /* inode number */
|
|
|
|
#endif
|
|
|
|
#ifdef FEAT_CW_EDITOR
|
|
|
|
FSSpec b_FSSpec; /* MacOS File Identification */
|
|
|
|
#endif
|
|
|
|
#ifdef VMS
|
2004-09-02 19:12:26 +00:00
|
|
|
char b_fab_rfm; /* Record format */
|
|
|
|
char b_fab_rat; /* Record attribute */
|
|
|
|
unsigned int b_fab_mrs; /* Max record size */
|
2004-06-13 20:20:40 +00:00
|
|
|
#endif
|
|
|
|
int b_fnum; /* buffer number for this file. */
|
2016-07-14 22:09:39 +02:00
|
|
|
char_u b_key[VIM_SIZEOF_INT * 2 + 1];
|
|
|
|
/* key used for buf_hashtab, holds b_fnum as
|
|
|
|
hex string */
|
2004-06-13 20:20:40 +00:00
|
|
|
|
|
|
|
int b_changed; /* 'modified': Set to TRUE if something in the
|
|
|
|
file has been changed and not written out. */
|
2017-02-25 14:59:34 +01:00
|
|
|
dictitem16_T b_ct_di; /* holds the b:changedtick value in
|
|
|
|
b_ct_di.di_tv.vval.v_number;
|
2017-02-17 16:31:35 +01:00
|
|
|
incremented for each change, also for undo */
|
2017-02-25 14:59:34 +01:00
|
|
|
#define CHANGEDTICK(buf) ((buf)->b_ct_di.di_tv.vval.v_number)
|
2004-06-13 20:20:40 +00:00
|
|
|
|
2018-02-10 18:15:19 +01:00
|
|
|
varnumber_T b_last_changedtick; /* b:changedtick when TextChanged or
|
|
|
|
TextChangedI was last triggered. */
|
2018-03-04 18:08:14 +01:00
|
|
|
#ifdef FEAT_INS_EXPAND
|
2018-02-10 18:15:19 +01:00
|
|
|
varnumber_T b_last_changedtick_pum; /* b:changedtick when TextChangedP was
|
|
|
|
last triggered. */
|
|
|
|
#endif
|
|
|
|
|
2004-06-13 20:20:40 +00:00
|
|
|
int b_saving; /* Set to TRUE if we are in the middle of
|
|
|
|
saving the buffer. */
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Changes to a buffer require updating of the display. To minimize the
|
|
|
|
* work, remember changes made and update everything at once.
|
|
|
|
*/
|
|
|
|
int b_mod_set; /* TRUE when there are changes since the last
|
|
|
|
time the display was updated */
|
|
|
|
linenr_T b_mod_top; /* topmost lnum that was changed */
|
|
|
|
linenr_T b_mod_bot; /* lnum below last changed line, AFTER the
|
|
|
|
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 */
|
|
|
|
|
|
|
|
long b_mtime; /* last change time of original file */
|
|
|
|
long b_mtime_read; /* last change time when reading */
|
2016-07-01 17:17:39 +02:00
|
|
|
off_T b_orig_size; /* size of original file in bytes */
|
2004-06-13 20:20:40 +00:00
|
|
|
int b_orig_mode; /* mode of original file */
|
2016-07-03 17:47:26 +02:00
|
|
|
#ifdef FEAT_VIMINFO
|
|
|
|
time_T b_last_used; /* time when the buffer was last used; used
|
|
|
|
* for viminfo */
|
|
|
|
#endif
|
2004-06-13 20:20:40 +00:00
|
|
|
|
|
|
|
pos_T b_namedm[NMARKS]; /* current named marks (mark.c) */
|
|
|
|
|
|
|
|
/* These variables are set when VIsual_active becomes FALSE */
|
2006-02-27 00:08:02 +00:00
|
|
|
visualinfo_T b_visual;
|
2014-03-23 15:13:05 +01:00
|
|
|
#ifdef FEAT_EVAL
|
2006-02-27 00:08:02 +00:00
|
|
|
int b_visual_mode_eval; /* b_visual.vi_mode for visualmode() */
|
2004-06-13 20:20:40 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
pos_T b_last_cursor; /* cursor position when last unloading this
|
|
|
|
buffer */
|
|
|
|
pos_T b_last_insert; /* where Insert mode was left */
|
|
|
|
pos_T b_last_change; /* position of last change: '. mark */
|
|
|
|
|
|
|
|
#ifdef FEAT_JUMPLIST
|
|
|
|
/*
|
|
|
|
* the changelist contains old change positions
|
|
|
|
*/
|
|
|
|
pos_T b_changelist[JUMPLISTSIZE];
|
|
|
|
int b_changelistlen; /* number of active entries */
|
|
|
|
int b_new_change; /* set by u_savecommon() */
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Character table, only used in charset.c for 'iskeyword'
|
|
|
|
* 32 bytes of 8 bits: 1 bit per character 0-255.
|
|
|
|
*/
|
|
|
|
char_u b_chartab[32];
|
|
|
|
|
|
|
|
#ifdef FEAT_LOCALMAP
|
|
|
|
/* Table used for mappings local to a buffer. */
|
|
|
|
mapblock_T *(b_maphash[256]);
|
|
|
|
|
|
|
|
/* First abbreviation local to a buffer. */
|
|
|
|
mapblock_T *b_first_abbr;
|
|
|
|
#endif
|
|
|
|
#ifdef FEAT_USR_CMDS
|
|
|
|
/* User commands local to the buffer. */
|
|
|
|
garray_T b_ucmds;
|
|
|
|
#endif
|
|
|
|
/*
|
|
|
|
* start and end of an operator, also used for '[ and ']
|
|
|
|
*/
|
|
|
|
pos_T b_op_start;
|
2014-02-22 23:03:55 +01:00
|
|
|
pos_T b_op_start_orig; /* used for Insstart_orig */
|
2004-06-13 20:20:40 +00:00
|
|
|
pos_T b_op_end;
|
|
|
|
|
|
|
|
#ifdef FEAT_VIMINFO
|
|
|
|
int b_marks_read; /* Have we read viminfo marks yet? */
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/*
|
|
|
|
* The following only used in undo.c.
|
|
|
|
*/
|
|
|
|
u_header_T *b_u_oldhead; /* pointer to oldest header */
|
2006-03-14 23:04:27 +00:00
|
|
|
u_header_T *b_u_newhead; /* pointer to newest header; may not be valid
|
|
|
|
if b_u_curhead is not NULL */
|
2004-06-13 20:20:40 +00:00
|
|
|
u_header_T *b_u_curhead; /* pointer to current header */
|
|
|
|
int b_u_numhead; /* current number of headers */
|
|
|
|
int b_u_synced; /* entry lists are synced */
|
2006-03-17 23:19:38 +00:00
|
|
|
long b_u_seq_last; /* last used undo sequence number */
|
2010-06-27 05:18:54 +02:00
|
|
|
long b_u_save_nr_last; /* counter for last file write */
|
2006-03-17 23:19:38 +00:00
|
|
|
long b_u_seq_cur; /* hu_seq of header below which we are now */
|
2016-06-26 16:44:24 +02:00
|
|
|
time_T b_u_time_cur; /* uh_time of header below which we are now */
|
2010-06-27 05:18:54 +02:00
|
|
|
long b_u_save_nr_cur; /* file write nr after which we are now */
|
2004-06-13 20:20:40 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* variables for "U" command in undo.c
|
|
|
|
*/
|
|
|
|
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 */
|
|
|
|
|
|
|
|
#ifdef FEAT_INS_EXPAND
|
|
|
|
int b_scanned; /* ^N/^P have scanned this buffer */
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* flags for use of ":lmap" and IM control */
|
|
|
|
long b_p_iminsert; /* input mode for insert */
|
|
|
|
long b_p_imsearch; /* input mode for search */
|
|
|
|
#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 */
|
2017-11-25 15:20:02 +01:00
|
|
|
#define B_IMODE_IM 2 /* Input via input method */
|
|
|
|
#define B_IMODE_LAST 2
|
2004-06-13 20:20:40 +00:00
|
|
|
|
|
|
|
#ifdef FEAT_KEYMAP
|
|
|
|
short 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 */
|
|
|
|
garray_T b_kmap_ga; /* the keymap table */
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Options local to a buffer.
|
|
|
|
* They are here because their value depends on the type of file
|
|
|
|
* or contents of the file being edited.
|
|
|
|
*/
|
|
|
|
int b_p_initialized; /* set when options initialized */
|
|
|
|
|
2006-02-27 23:58:35 +00:00
|
|
|
#ifdef FEAT_EVAL
|
2018-09-10 21:05:02 +02:00
|
|
|
sctx_T b_p_script_ctx[BV_COUNT]; /* SCTXs for buffer-local options */
|
2006-02-27 23:58:35 +00:00
|
|
|
#endif
|
|
|
|
|
2004-06-13 20:20:40 +00:00
|
|
|
int b_p_ai; /* 'autoindent' */
|
|
|
|
int b_p_ai_nopaste; /* b_p_ai saved for paste mode */
|
2014-09-23 15:45:08 +02:00
|
|
|
char_u *b_p_bkc; /* 'backupcopy' */
|
|
|
|
unsigned b_bkc_flags; /* flags for 'backupcopy' */
|
2004-06-13 20:20:40 +00:00
|
|
|
int b_p_ci; /* 'copyindent' */
|
|
|
|
int b_p_bin; /* 'binary' */
|
|
|
|
#ifdef FEAT_MBYTE
|
|
|
|
int b_p_bomb; /* 'bomb' */
|
|
|
|
#endif
|
|
|
|
char_u *b_p_bh; /* 'bufhidden' */
|
|
|
|
char_u *b_p_bt; /* 'buftype' */
|
2017-07-23 19:51:01 +02:00
|
|
|
#ifdef FEAT_QUICKFIX
|
2016-07-20 21:44:37 +02:00
|
|
|
#define BUF_HAS_QF_ENTRY 1
|
|
|
|
#define BUF_HAS_LL_ENTRY 2
|
2016-06-03 19:05:49 +02:00
|
|
|
int b_has_qf_entry;
|
2004-06-13 20:20:40 +00:00
|
|
|
#endif
|
|
|
|
int b_p_bl; /* 'buflisted' */
|
|
|
|
#ifdef FEAT_CINDENT
|
|
|
|
int b_p_cin; /* 'cindent' */
|
|
|
|
char_u *b_p_cino; /* 'cinoptions' */
|
|
|
|
char_u *b_p_cink; /* 'cinkeys' */
|
|
|
|
#endif
|
|
|
|
#if defined(FEAT_CINDENT) || defined(FEAT_SMARTINDENT)
|
|
|
|
char_u *b_p_cinw; /* 'cinwords' */
|
|
|
|
#endif
|
|
|
|
#ifdef FEAT_COMMENTS
|
|
|
|
char_u *b_p_com; /* 'comments' */
|
|
|
|
#endif
|
|
|
|
#ifdef FEAT_FOLDING
|
|
|
|
char_u *b_p_cms; /* 'commentstring' */
|
|
|
|
#endif
|
|
|
|
#ifdef FEAT_INS_EXPAND
|
|
|
|
char_u *b_p_cpt; /* 'complete' */
|
2004-07-02 15:38:35 +00:00
|
|
|
#endif
|
|
|
|
#ifdef FEAT_COMPL_FUNC
|
|
|
|
char_u *b_p_cfu; /* 'completefunc' */
|
2005-09-13 21:20:47 +00:00
|
|
|
char_u *b_p_ofu; /* 'omnifunc' */
|
2004-06-13 20:20:40 +00:00
|
|
|
#endif
|
|
|
|
int b_p_eol; /* 'endofline' */
|
2015-07-17 14:18:08 +02:00
|
|
|
int b_p_fixeol; /* 'fixendofline' */
|
2004-06-13 20:20:40 +00:00
|
|
|
int b_p_et; /* 'expandtab' */
|
|
|
|
int b_p_et_nobin; /* b_p_et saved for binary mode */
|
2015-09-15 17:30:40 +02:00
|
|
|
int b_p_et_nopaste; /* b_p_et saved for paste mode */
|
2004-06-13 20:20:40 +00:00
|
|
|
#ifdef FEAT_MBYTE
|
|
|
|
char_u *b_p_fenc; /* 'fileencoding' */
|
|
|
|
#endif
|
|
|
|
char_u *b_p_ff; /* 'fileformat' */
|
|
|
|
char_u *b_p_ft; /* 'filetype' */
|
|
|
|
char_u *b_p_fo; /* 'formatoptions' */
|
2004-12-27 21:59:20 +00:00
|
|
|
char_u *b_p_flp; /* 'formatlistpat' */
|
2004-06-13 20:20:40 +00:00
|
|
|
int b_p_inf; /* 'infercase' */
|
|
|
|
char_u *b_p_isk; /* 'iskeyword' */
|
|
|
|
#ifdef FEAT_FIND_ID
|
|
|
|
char_u *b_p_def; /* 'define' local value */
|
|
|
|
char_u *b_p_inc; /* 'include' */
|
|
|
|
# ifdef FEAT_EVAL
|
|
|
|
char_u *b_p_inex; /* 'includeexpr' */
|
2006-02-22 21:25:37 +00:00
|
|
|
long_u b_p_inex_flags; /* flags for 'includeexpr' */
|
2004-06-13 20:20:40 +00:00
|
|
|
# endif
|
|
|
|
#endif
|
|
|
|
#if defined(FEAT_CINDENT) && defined(FEAT_EVAL)
|
|
|
|
char_u *b_p_inde; /* 'indentexpr' */
|
2006-02-22 21:25:37 +00:00
|
|
|
long_u b_p_inde_flags; /* flags for 'indentexpr' */
|
2004-06-13 20:20:40 +00:00
|
|
|
char_u *b_p_indk; /* 'indentkeys' */
|
|
|
|
#endif
|
2017-01-14 14:28:30 +01:00
|
|
|
char_u *b_p_fp; /* 'formatprg' */
|
2006-02-14 22:29:30 +00:00
|
|
|
#if defined(FEAT_EVAL)
|
|
|
|
char_u *b_p_fex; /* 'formatexpr' */
|
2006-02-22 21:25:37 +00:00
|
|
|
long_u b_p_fex_flags; /* flags for 'formatexpr' */
|
2006-02-14 22:29:30 +00:00
|
|
|
#endif
|
2004-06-13 20:20:40 +00:00
|
|
|
#ifdef FEAT_CRYPT
|
|
|
|
char_u *b_p_key; /* 'key' */
|
|
|
|
#endif
|
|
|
|
char_u *b_p_kp; /* 'keywordprg' */
|
|
|
|
#ifdef FEAT_LISP
|
|
|
|
int b_p_lisp; /* 'lisp' */
|
2017-03-05 17:43:31 +01:00
|
|
|
#endif
|
|
|
|
#ifdef FEAT_MBYTE
|
|
|
|
char_u *b_p_menc; /* 'makeencoding' */
|
2004-06-13 20:20:40 +00:00
|
|
|
#endif
|
|
|
|
char_u *b_p_mps; /* 'matchpairs' */
|
|
|
|
int b_p_ml; /* 'modeline' */
|
|
|
|
int b_p_ml_nobin; /* b_p_ml saved for binary mode */
|
|
|
|
int b_p_ma; /* 'modifiable' */
|
|
|
|
char_u *b_p_nf; /* 'nrformats' */
|
|
|
|
int b_p_pi; /* 'preserveindent' */
|
2004-07-02 15:38:35 +00:00
|
|
|
#ifdef FEAT_TEXTOBJ
|
|
|
|
char_u *b_p_qe; /* 'quoteescape' */
|
|
|
|
#endif
|
2004-06-13 20:20:40 +00:00
|
|
|
int b_p_ro; /* 'readonly' */
|
|
|
|
long b_p_sw; /* 'shiftwidth' */
|
|
|
|
int b_p_sn; /* 'shortname' */
|
|
|
|
#ifdef FEAT_SMARTINDENT
|
|
|
|
int b_p_si; /* 'smartindent' */
|
|
|
|
#endif
|
|
|
|
long b_p_sts; /* 'softtabstop' */
|
|
|
|
long b_p_sts_nopaste; /* b_p_sts saved for paste mode */
|
|
|
|
#ifdef FEAT_SEARCHPATH
|
|
|
|
char_u *b_p_sua; /* 'suffixesadd' */
|
|
|
|
#endif
|
|
|
|
int b_p_swf; /* 'swapfile' */
|
|
|
|
#ifdef FEAT_SYN_HL
|
2005-07-11 22:40:32 +00:00
|
|
|
long b_p_smc; /* 'synmaxcol' */
|
2004-06-13 20:20:40 +00:00
|
|
|
char_u *b_p_syn; /* 'syntax' */
|
|
|
|
#endif
|
|
|
|
long b_p_ts; /* 'tabstop' */
|
|
|
|
int b_p_tx; /* 'textmode' */
|
|
|
|
long b_p_tw; /* 'textwidth' */
|
|
|
|
long b_p_tw_nobin; /* b_p_tw saved for binary mode */
|
|
|
|
long b_p_tw_nopaste; /* b_p_tw saved for paste mode */
|
|
|
|
long b_p_wm; /* 'wrapmargin' */
|
|
|
|
long b_p_wm_nobin; /* b_p_wm saved for binary mode */
|
|
|
|
long b_p_wm_nopaste; /* b_p_wm saved for paste mode */
|
2018-06-23 19:23:02 +02:00
|
|
|
#ifdef FEAT_VARTABS
|
|
|
|
char_u *b_p_vsts; /* 'varsofttabstop' */
|
|
|
|
int *b_p_vsts_array; /* 'varsofttabstop' in internal format */
|
|
|
|
char_u *b_p_vsts_nopaste; /* b_p_vsts saved for paste mode */
|
|
|
|
char_u *b_p_vts; /* 'vartabstop' */
|
|
|
|
int *b_p_vts_array; /* 'vartabstop' in internal format */
|
|
|
|
#endif
|
2004-06-13 20:20:40 +00:00
|
|
|
#ifdef FEAT_KEYMAP
|
|
|
|
char_u *b_p_keymap; /* 'keymap' */
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* local values for options which are normally global */
|
|
|
|
#ifdef FEAT_QUICKFIX
|
|
|
|
char_u *b_p_gp; /* 'grepprg' local value */
|
|
|
|
char_u *b_p_mp; /* 'makeprg' local value */
|
|
|
|
char_u *b_p_efm; /* 'errorformat' local value */
|
|
|
|
#endif
|
|
|
|
char_u *b_p_ep; /* 'equalprg' local value */
|
|
|
|
char_u *b_p_path; /* 'path' local value */
|
|
|
|
int b_p_ar; /* 'autoread' local value */
|
|
|
|
char_u *b_p_tags; /* 'tags' local value */
|
2015-11-24 18:48:14 +01:00
|
|
|
char_u *b_p_tc; /* 'tagcase' local value */
|
|
|
|
unsigned b_tc_flags; /* flags for 'tagcase' */
|
2004-06-13 20:20:40 +00:00
|
|
|
#ifdef FEAT_INS_EXPAND
|
|
|
|
char_u *b_p_dict; /* 'dictionary' local value */
|
|
|
|
char_u *b_p_tsr; /* 'thesaurus' local value */
|
|
|
|
#endif
|
2013-11-06 05:26:15 +01:00
|
|
|
long b_p_ul; /* 'undolevels' local value */
|
2010-05-23 23:34:36 +02:00
|
|
|
#ifdef FEAT_PERSISTENT_UNDO
|
|
|
|
int b_p_udf; /* 'undofile' */
|
|
|
|
#endif
|
2014-03-12 18:55:58 +01:00
|
|
|
#ifdef FEAT_LISP
|
|
|
|
char_u *b_p_lw; /* 'lispwords' local value */
|
|
|
|
#endif
|
2018-04-21 19:49:08 +02:00
|
|
|
#ifdef FEAT_TERMINAL
|
|
|
|
long b_p_twsl; /* 'termwinscroll' */
|
|
|
|
#endif
|
2004-06-13 20:20:40 +00:00
|
|
|
|
|
|
|
/* end of buffer options */
|
|
|
|
|
2013-11-05 07:13:41 +01:00
|
|
|
#ifdef FEAT_CINDENT
|
|
|
|
/* values set from b_p_cino */
|
|
|
|
int b_ind_level;
|
|
|
|
int b_ind_open_imag;
|
|
|
|
int b_ind_no_brace;
|
|
|
|
int b_ind_first_open;
|
|
|
|
int b_ind_open_extra;
|
|
|
|
int b_ind_close_extra;
|
|
|
|
int b_ind_open_left_imag;
|
|
|
|
int b_ind_jump_label;
|
|
|
|
int b_ind_case;
|
|
|
|
int b_ind_case_code;
|
|
|
|
int b_ind_case_break;
|
|
|
|
int b_ind_param;
|
|
|
|
int b_ind_func_type;
|
|
|
|
int b_ind_comment;
|
|
|
|
int b_ind_in_comment;
|
|
|
|
int b_ind_in_comment2;
|
|
|
|
int b_ind_cpp_baseclass;
|
|
|
|
int b_ind_continuation;
|
|
|
|
int b_ind_unclosed;
|
|
|
|
int b_ind_unclosed2;
|
|
|
|
int b_ind_unclosed_noignore;
|
|
|
|
int b_ind_unclosed_wrapped;
|
|
|
|
int b_ind_unclosed_whiteok;
|
|
|
|
int b_ind_matching_paren;
|
|
|
|
int b_ind_paren_prev;
|
|
|
|
int b_ind_maxparen;
|
|
|
|
int b_ind_maxcomment;
|
|
|
|
int b_ind_scopedecl;
|
|
|
|
int b_ind_scopedecl_code;
|
|
|
|
int b_ind_java;
|
|
|
|
int b_ind_js;
|
|
|
|
int b_ind_keep_case_label;
|
|
|
|
int b_ind_hash_comment;
|
|
|
|
int b_ind_cpp_namespace;
|
|
|
|
int b_ind_if_for_while;
|
2017-03-08 22:19:26 +01:00
|
|
|
int b_ind_cpp_extern_c;
|
2013-11-05 07:13:41 +01:00
|
|
|
#endif
|
|
|
|
|
2011-02-15 17:39:22 +01:00
|
|
|
linenr_T b_no_eol_lnum; /* non-zero lnum when last line of next binary
|
|
|
|
* write should not have an end-of-line */
|
|
|
|
|
2004-06-13 20:20:40 +00:00
|
|
|
int b_start_eol; /* last line had eol when it was read */
|
|
|
|
int b_start_ffc; /* first char of 'ff' when edit started */
|
|
|
|
#ifdef FEAT_MBYTE
|
|
|
|
char_u *b_start_fenc; /* 'fileencoding' when edit started or NULL */
|
2005-12-19 22:14:58 +00:00
|
|
|
int b_bad_char; /* "++bad=" argument when edit started or 0 */
|
2007-08-12 13:51:26 +00:00
|
|
|
int b_start_bomb; /* 'bomb' when it was read */
|
2004-06-13 20:20:40 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef FEAT_EVAL
|
2005-01-25 22:12:55 +00:00
|
|
|
dictitem_T b_bufvar; /* variable for "b:" Dictionary */
|
2013-04-15 12:27:36 +02:00
|
|
|
dict_T *b_vars; /* internal variables, local to buffer */
|
2004-06-13 20:20:40 +00:00
|
|
|
#endif
|
2018-12-13 22:20:09 +01:00
|
|
|
#ifdef FEAT_TEXT_PROP
|
|
|
|
hashtab_T *b_proptypes; /* text property types local to buffer */
|
|
|
|
#endif
|
2004-06-13 20:20:40 +00:00
|
|
|
|
2006-03-20 21:55:45 +00:00
|
|
|
#if defined(FEAT_BEVAL) && defined(FEAT_EVAL)
|
|
|
|
char_u *b_p_bexpr; /* 'balloonexpr' local value */
|
|
|
|
long_u b_p_bexpr_flags;/* flags for 'balloonexpr' */
|
|
|
|
#endif
|
2010-07-20 17:32:38 +02:00
|
|
|
#ifdef FEAT_CRYPT
|
|
|
|
char_u *b_p_cm; /* 'cryptmethod' */
|
|
|
|
#endif
|
2006-03-20 21:55:45 +00:00
|
|
|
|
2004-06-13 20:20:40 +00:00
|
|
|
/* When a buffer is created, it starts without a swap file. b_may_swap is
|
|
|
|
* then set to indicate that a swap file may be opened later. It is reset
|
|
|
|
* if a swap file could not be opened.
|
|
|
|
*/
|
|
|
|
int b_may_swap;
|
|
|
|
int b_did_warn; /* Set to 1 if user has been warned on first
|
|
|
|
change of a read-only file */
|
2006-01-12 23:22:24 +00:00
|
|
|
|
|
|
|
/* Two special kinds of buffers:
|
|
|
|
* help buffer - used for help files, won't use a swap file.
|
|
|
|
* spell buffer - used for spell info, never displayed and doesn't have a
|
|
|
|
* file name.
|
|
|
|
*/
|
|
|
|
int b_help; /* TRUE for help file buffer (when set b_p_bt
|
|
|
|
is "help") */
|
2006-03-12 22:08:12 +00:00
|
|
|
#ifdef FEAT_SPELL
|
2006-01-12 23:22:24 +00:00
|
|
|
int b_spell; /* TRUE for a spell file buffer, most fields
|
|
|
|
are not used! Use the B_SPELL macro to
|
|
|
|
access b_spell without #ifdef. */
|
|
|
|
#endif
|
2004-06-13 20:20:40 +00:00
|
|
|
|
|
|
|
int b_shortname; /* this file has an 8.3 file name */
|
|
|
|
|
2018-06-03 14:47:35 +02:00
|
|
|
#ifdef FEAT_JOB_CHANNEL
|
|
|
|
char_u *b_prompt_text; // set by prompt_setprompt()
|
|
|
|
char_u *b_prompt_callback; // set by prompt_setcallback()
|
|
|
|
partial_T *b_prompt_partial; // set by prompt_setcallback()
|
2018-06-17 20:10:39 +02:00
|
|
|
char_u *b_prompt_interrupt; // set by prompt_setinterrupt()
|
|
|
|
partial_T *b_prompt_int_partial; // set by prompt_setinterrupt()
|
2018-06-06 09:11:12 +02:00
|
|
|
int b_prompt_insert; // value for restart_edit when entering
|
|
|
|
// a prompt buffer window.
|
2018-06-03 14:47:35 +02:00
|
|
|
#endif
|
2004-07-05 15:58:32 +00:00
|
|
|
#ifdef FEAT_MZSCHEME
|
2005-09-01 20:46:49 +00:00
|
|
|
void *b_mzscheme_ref; /* The MzScheme reference to this buffer */
|
2004-07-05 15:58:32 +00:00
|
|
|
#endif
|
|
|
|
|
2004-06-13 20:20:40 +00:00
|
|
|
#ifdef FEAT_PERL
|
2005-09-01 20:46:49 +00:00
|
|
|
void *b_perl_private;
|
2004-06-13 20:20:40 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef FEAT_PYTHON
|
2005-09-01 20:46:49 +00:00
|
|
|
void *b_python_ref; /* The Python reference to this buffer */
|
2004-06-13 20:20:40 +00:00
|
|
|
#endif
|
|
|
|
|
2010-07-17 21:19:38 +02:00
|
|
|
#ifdef FEAT_PYTHON3
|
|
|
|
void *b_python3_ref; /* The Python3 reference to this buffer */
|
|
|
|
#endif
|
|
|
|
|
2004-06-13 20:20:40 +00:00
|
|
|
#ifdef FEAT_TCL
|
2005-09-01 20:46:49 +00:00
|
|
|
void *b_tcl_ref;
|
2004-06-13 20:20:40 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef FEAT_RUBY
|
2005-09-01 20:46:49 +00:00
|
|
|
void *b_ruby_ref;
|
2004-06-13 20:20:40 +00:00
|
|
|
#endif
|
|
|
|
|
2010-06-05 23:22:07 +02:00
|
|
|
#if defined(FEAT_SYN_HL) || defined(FEAT_SPELL)
|
|
|
|
synblock_T b_s; /* Info related to syntax highlighting. w_s
|
|
|
|
* normally points to this, but some windows
|
|
|
|
* may use a different synblock_T. */
|
2006-03-12 22:08:12 +00:00
|
|
|
#endif
|
2004-06-13 20:20:40 +00:00
|
|
|
|
|
|
|
#ifdef FEAT_SIGNS
|
|
|
|
signlist_T *b_signlist; /* list of signs to draw */
|
2015-03-20 18:11:48 +01:00
|
|
|
# ifdef FEAT_NETBEANS_INTG
|
|
|
|
int b_has_sign_column; /* Flag that is set when a first sign is
|
|
|
|
* added and remains set until the end of
|
|
|
|
* the netbeans session. */
|
|
|
|
# endif
|
2004-06-13 20:20:40 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef FEAT_NETBEANS_INTG
|
|
|
|
int b_netbeans_file; /* TRUE when buffer is owned by NetBeans */
|
|
|
|
int b_was_netbeans_file;/* TRUE if b_netbeans_file was once set */
|
|
|
|
#endif
|
2016-03-11 22:52:15 +01:00
|
|
|
#ifdef FEAT_JOB_CHANNEL
|
2016-03-06 20:22:25 +01:00
|
|
|
int b_write_to_channel; /* TRUE when appended lines are written to
|
|
|
|
* a channel. */
|
|
|
|
#endif
|
2004-06-13 20:20:40 +00:00
|
|
|
|
2014-08-10 13:38:34 +02:00
|
|
|
#ifdef FEAT_CRYPT
|
|
|
|
cryptstate_T *b_cryptstate; /* Encryption state while reading or writing
|
|
|
|
* the file. NULL when not using encryption. */
|
|
|
|
#endif
|
2015-01-14 12:44:41 +01:00
|
|
|
int b_mapped_ctrl_c; /* modes where CTRL-C is mapped */
|
2014-08-10 13:38:34 +02:00
|
|
|
|
2017-07-07 11:54:15 +02:00
|
|
|
#ifdef FEAT_TERMINAL
|
|
|
|
term_T *b_term; /* When not NULL this buffer is for a terminal
|
|
|
|
* window. */
|
|
|
|
#endif
|
2018-09-10 17:51:58 +02:00
|
|
|
#ifdef FEAT_DIFF
|
|
|
|
int b_diff_failed; // internal diff failed for this buffer
|
|
|
|
#endif
|
2014-08-10 13:38:34 +02:00
|
|
|
}; /* file_buffer */
|
2004-06-13 20:20:40 +00:00
|
|
|
|
2006-02-17 21:53:23 +00:00
|
|
|
|
|
|
|
#ifdef FEAT_DIFF
|
|
|
|
/*
|
|
|
|
* Stuff for diff mode.
|
|
|
|
*/
|
2016-08-24 22:34:33 +02:00
|
|
|
# define DB_COUNT 8 /* up to eight buffers can be diff'ed */
|
2006-02-17 21:53:23 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Each diffblock defines where a block of lines starts in each of the buffers
|
|
|
|
* and how many lines it occupies in that buffer. When the lines are missing
|
|
|
|
* in the buffer the df_count[] is zero. This is all counted in
|
|
|
|
* buffer lines.
|
|
|
|
* There is always at least one unchanged line in between the diffs.
|
|
|
|
* Otherwise it would have been included in the diff above or below it.
|
|
|
|
* df_lnum[] + df_count[] is the lnum below the change. When in one buffer
|
|
|
|
* lines have been inserted, in the other buffer df_lnum[] is the line below
|
|
|
|
* the insertion and df_count[] is zero. When appending lines at the end of
|
|
|
|
* the buffer, df_lnum[] is one beyond the end!
|
|
|
|
* This is using a linked list, because the number of differences is expected
|
|
|
|
* to be reasonable small. The list is sorted on lnum.
|
|
|
|
*/
|
|
|
|
typedef struct diffblock_S diff_T;
|
|
|
|
struct diffblock_S
|
|
|
|
{
|
|
|
|
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 */
|
|
|
|
};
|
|
|
|
#endif
|
|
|
|
|
2009-06-16 14:01:43 +00:00
|
|
|
#define SNAP_HELP_IDX 0
|
2018-03-04 18:08:14 +01:00
|
|
|
#define SNAP_AUCMD_IDX 1
|
|
|
|
#define SNAP_COUNT 2
|
2009-06-16 14:01:43 +00:00
|
|
|
|
2006-02-17 21:53:23 +00:00
|
|
|
/*
|
|
|
|
* Tab pages point to the top frame of each tab page.
|
|
|
|
* Note: Most values are NOT valid for the current tab page! Use "curwin",
|
|
|
|
* "firstwin", etc. for that. "tp_topframe" is always valid and can be
|
|
|
|
* compared against "topframe" to find the current tab page.
|
|
|
|
*/
|
|
|
|
typedef struct tabpage_S tabpage_T;
|
|
|
|
struct tabpage_S
|
|
|
|
{
|
|
|
|
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 */
|
2006-04-09 21:54:49 +00:00
|
|
|
long tp_ch_used; /* value of 'cmdheight' when frame size
|
|
|
|
was set */
|
2006-03-20 21:55:45 +00:00
|
|
|
#ifdef FEAT_GUI
|
|
|
|
int tp_prev_which_scrollbars[3];
|
|
|
|
/* previous value of which_scrollbars */
|
|
|
|
#endif
|
2006-02-17 21:53:23 +00:00
|
|
|
#ifdef FEAT_DIFF
|
|
|
|
diff_T *tp_first_diff;
|
|
|
|
buf_T *(tp_diffbuf[DB_COUNT]);
|
2018-09-16 14:10:31 +02:00
|
|
|
int tp_diff_invalid; // list of diffs is outdated
|
|
|
|
int tp_diff_update; // update diffs before redrawing
|
2006-02-17 21:53:23 +00:00
|
|
|
#endif
|
2009-06-16 14:01:43 +00:00
|
|
|
frame_T *(tp_snapshot[SNAP_COUNT]); /* window layout snapshots */
|
2006-04-05 20:41:53 +00:00
|
|
|
#ifdef FEAT_EVAL
|
|
|
|
dictitem_T tp_winvar; /* variable for "t:" Dictionary */
|
2013-04-15 12:27:36 +02:00
|
|
|
dict_T *tp_vars; /* internal variables, local to tab page */
|
2006-04-05 20:41:53 +00:00
|
|
|
#endif
|
2013-05-15 15:12:29 +02:00
|
|
|
|
|
|
|
#ifdef FEAT_PYTHON
|
|
|
|
void *tp_python_ref; /* The Python value for this tab page */
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef FEAT_PYTHON3
|
|
|
|
void *tp_python3_ref; /* The Python value for this tab page */
|
|
|
|
#endif
|
2006-02-17 21:53:23 +00:00
|
|
|
};
|
|
|
|
|
2004-06-13 20:20:40 +00:00
|
|
|
/*
|
|
|
|
* Structure to cache info for displayed lines in w_lines[].
|
|
|
|
* Each logical line has one entry.
|
|
|
|
* The entry tells how the logical line is currently displayed in the window.
|
|
|
|
* This is updated when displaying the window.
|
|
|
|
* When the display is changed (e.g., when clearing the screen) w_lines_valid
|
|
|
|
* is changed to exclude invalid entries.
|
|
|
|
* When making changes to the buffer, wl_valid is reset to indicate wl_size
|
|
|
|
* may not reflect what is actually in the buffer. When wl_valid is FALSE,
|
|
|
|
* the entries can only be used to count the number of displayed lines used.
|
|
|
|
* wl_lnum and wl_lastlnum are invalid too.
|
|
|
|
*/
|
|
|
|
typedef struct w_line
|
|
|
|
{
|
|
|
|
linenr_T wl_lnum; /* buffer line number for logical line */
|
|
|
|
short_u wl_size; /* height in screen lines */
|
|
|
|
char wl_valid; /* TRUE values are valid for text in buffer */
|
|
|
|
#ifdef FEAT_FOLDING
|
|
|
|
char wl_folded; /* TRUE when this is a range of folded lines */
|
|
|
|
linenr_T wl_lastlnum; /* last buffer line number for logical line */
|
|
|
|
#endif
|
|
|
|
} wline_T;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Windows are kept in a tree of frames. Each frame has a column (FR_COL)
|
|
|
|
* or row (FR_ROW) layout or is a leaf, which has a window.
|
|
|
|
*/
|
2006-02-14 22:29:30 +00:00
|
|
|
struct frame_S
|
2004-06-13 20:20:40 +00:00
|
|
|
{
|
|
|
|
char fr_layout; /* FR_LEAF, FR_COL or FR_ROW */
|
|
|
|
int fr_width;
|
2006-03-18 21:40:56 +00:00
|
|
|
int fr_newwidth; /* new width used in win_equal_rec() */
|
2004-06-13 20:20:40 +00:00
|
|
|
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 first */
|
|
|
|
frame_T *fr_prev; /* frame left or above in same parent, NULL
|
|
|
|
for last */
|
|
|
|
/* fr_child and fr_win are mutually exclusive */
|
|
|
|
frame_T *fr_child; /* first contained frame */
|
|
|
|
win_T *fr_win; /* window that fills this frame */
|
|
|
|
};
|
|
|
|
|
|
|
|
#define FR_LEAF 0 /* frame is a leaf */
|
|
|
|
#define FR_ROW 1 /* frame with a row of windows */
|
|
|
|
#define FR_COL 2 /* frame with a column of windows */
|
|
|
|
|
2007-07-26 20:58:42 +00:00
|
|
|
/*
|
|
|
|
* Struct used for highlighting 'hlsearch' matches, matches defined by
|
|
|
|
* ":match" and matches defined by match functions.
|
|
|
|
* For 'hlsearch' there is one pattern for all windows. For ":match" and the
|
|
|
|
* match functions there is a different pattern for each window.
|
|
|
|
*/
|
|
|
|
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 */
|
|
|
|
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() */
|
|
|
|
linenr_T first_lnum; /* first lnum to search for multi-line pat */
|
|
|
|
colnr_T startcol; /* in win_line() points to char where HL starts */
|
|
|
|
colnr_T endcol; /* in win_line() points to char where HL ends */
|
2016-08-16 16:08:18 +02:00
|
|
|
int is_addpos; /* position specified directly by
|
|
|
|
matchaddpos(). TRUE/FALSE */
|
2008-01-19 14:59:58 +00:00
|
|
|
#ifdef FEAT_RELTIME
|
|
|
|
proftime_T tm; /* for a time limit */
|
|
|
|
#endif
|
2007-07-26 20:58:42 +00:00
|
|
|
} match_T;
|
|
|
|
|
2014-06-17 17:48:32 +02:00
|
|
|
/* number of positions supported by matchaddpos() */
|
|
|
|
#define MAXPOSMATCH 8
|
|
|
|
|
|
|
|
/*
|
|
|
|
* 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 */
|
|
|
|
} llpos_T;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* posmatch_T provides an array for storing match items for matchaddpos()
|
|
|
|
* function.
|
|
|
|
*/
|
|
|
|
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 */
|
|
|
|
};
|
|
|
|
|
2007-07-26 20:58:42 +00:00
|
|
|
/*
|
|
|
|
* matchitem_T provides a linked list for storing match items for ":match" and
|
|
|
|
* the match functions.
|
|
|
|
*/
|
|
|
|
typedef struct matchitem matchitem_T;
|
|
|
|
struct matchitem
|
|
|
|
{
|
|
|
|
matchitem_T *next;
|
|
|
|
int id; /* match ID */
|
|
|
|
int priority; /* match priority */
|
|
|
|
char_u *pattern; /* pattern to highlight */
|
|
|
|
int hlg_id; /* highlight group ID */
|
|
|
|
regmmatch_T match; /* regexp program for pattern */
|
2014-06-17 17:48:32 +02:00
|
|
|
posmatch_T pos; /* position matches */
|
2007-07-26 20:58:42 +00:00
|
|
|
match_T hl; /* struct for doing the actual highlighting */
|
2015-07-21 15:48:27 +02:00
|
|
|
#ifdef FEAT_CONCEAL
|
|
|
|
int conceal_char; /* cchar for Conceal highlighting */
|
|
|
|
#endif
|
2007-07-26 20:58:42 +00:00
|
|
|
};
|
|
|
|
|
2017-09-17 23:03:31 +02:00
|
|
|
#ifdef FEAT_MENU
|
|
|
|
typedef struct {
|
|
|
|
int wb_startcol;
|
|
|
|
int wb_endcol;
|
|
|
|
vimmenu_T *wb_menu;
|
|
|
|
} winbar_item_T;
|
|
|
|
#endif
|
|
|
|
|
2004-06-13 20:20:40 +00:00
|
|
|
/*
|
|
|
|
* Structure which contains all information that belongs to a window
|
|
|
|
*
|
|
|
|
* All row numbers are relative to the start of the window, except w_winrow.
|
|
|
|
*/
|
2006-02-14 22:29:30 +00:00
|
|
|
struct window_S
|
2004-06-13 20:20:40 +00:00
|
|
|
{
|
2016-03-13 18:07:30 +01:00
|
|
|
int w_id; /* unique window ID */
|
|
|
|
|
2004-06-13 20:20:40 +00:00
|
|
|
buf_T *w_buffer; /* buffer we are a window into (used
|
|
|
|
often, keep it the first item!) */
|
|
|
|
|
2010-06-05 23:22:07 +02:00
|
|
|
#if defined(FEAT_SYN_HL) || defined(FEAT_SPELL)
|
2012-02-04 21:59:01 +01:00
|
|
|
synblock_T *w_s; /* for :ownsyntax */
|
2010-06-05 23:22:07 +02:00
|
|
|
#endif
|
|
|
|
|
2004-06-13 20:20:40 +00:00
|
|
|
win_T *w_prev; /* link to previous window */
|
|
|
|
win_T *w_next; /* link to next window */
|
2012-06-06 19:02:45 +02:00
|
|
|
int w_closing; /* window is being closed, don't let
|
|
|
|
autocommands close it too. */
|
2004-06-13 20:20:40 +00:00
|
|
|
|
|
|
|
frame_T *w_frame; /* frame containing this window */
|
|
|
|
|
|
|
|
pos_T w_cursor; /* cursor position in buffer */
|
|
|
|
|
|
|
|
colnr_T w_curswant; /* The column we'd like to be at. This is
|
|
|
|
used to try to stay in the same column
|
|
|
|
for up/down cursor motions. */
|
|
|
|
|
|
|
|
int w_set_curswant; /* If set, then update w_curswant the next
|
|
|
|
time through cursupdate() to the
|
|
|
|
current virtual column */
|
|
|
|
|
2018-10-02 18:26:10 +02:00
|
|
|
#ifdef FEAT_SYN_HL
|
|
|
|
linenr_T w_last_cursorline; // where last time 'cursorline' was drawn
|
|
|
|
#endif
|
|
|
|
|
2004-06-13 20:20:40 +00:00
|
|
|
/*
|
2015-11-24 18:48:14 +01:00
|
|
|
* the next seven are used to update the visual part
|
2004-06-13 20:20:40 +00:00
|
|
|
*/
|
|
|
|
char w_old_visual_mode; /* last known VIsual_mode */
|
|
|
|
linenr_T w_old_cursor_lnum; /* last known end of visual part */
|
|
|
|
colnr_T w_old_cursor_fcol; /* first column for block visual part */
|
|
|
|
colnr_T w_old_cursor_lcol; /* last column for block visual part */
|
|
|
|
linenr_T w_old_visual_lnum; /* last known start of visual part */
|
2005-07-19 22:17:30 +00:00
|
|
|
colnr_T w_old_visual_col; /* last known start of visual part */
|
2004-06-13 20:20:40 +00:00
|
|
|
colnr_T w_old_curswant; /* last known value of Curswant */
|
|
|
|
|
|
|
|
/*
|
2008-11-15 15:06:17 +00:00
|
|
|
* "w_topline", "w_leftcol" and "w_skipcol" specify the offsets for
|
|
|
|
* displaying the buffer.
|
2004-06-13 20:20:40 +00:00
|
|
|
*/
|
|
|
|
linenr_T w_topline; /* buffer line number of the line at the
|
|
|
|
top of the window */
|
2008-11-15 15:06:17 +00:00
|
|
|
char w_topline_was_set; /* flag set to TRUE when topline is set,
|
|
|
|
e.g. by winrestview() */
|
2004-06-13 20:20:40 +00:00
|
|
|
#ifdef FEAT_DIFF
|
|
|
|
int w_topfill; /* number of filler lines above w_topline */
|
|
|
|
int w_old_topfill; /* w_topfill at last redraw */
|
|
|
|
int w_botfill; /* TRUE when filler lines are actually
|
|
|
|
below w_topline (at end of file) */
|
|
|
|
int w_old_botfill; /* w_botfill at last redraw */
|
|
|
|
#endif
|
|
|
|
colnr_T w_leftcol; /* window column number of the left most
|
|
|
|
character in the window; used when
|
|
|
|
'wrap' is off */
|
|
|
|
colnr_T w_skipcol; /* starting column when a single line
|
|
|
|
doesn't fit in the window */
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Layout of the window in the screen.
|
|
|
|
* May need to add "msg_scrolled" to "w_winrow" in rare situations.
|
|
|
|
*/
|
|
|
|
int w_winrow; /* first row of window in screen */
|
|
|
|
int w_height; /* number of rows in window, excluding
|
2017-09-17 23:03:31 +02:00
|
|
|
status/command/winbar line(s) */
|
2004-06-13 20:20:40 +00:00
|
|
|
int w_status_height; /* number of status lines (0 or 1) */
|
2017-09-22 14:35:51 +02:00
|
|
|
int w_wincol; /* Leftmost column of window in screen. */
|
2017-09-22 15:20:32 +02:00
|
|
|
int w_width; /* Width of window, excluding separation. */
|
2017-09-24 16:24:34 +02:00
|
|
|
int w_vsep_width; /* Number of separator columns (0 or 1). */
|
|
|
|
|
2004-06-13 20:20:40 +00:00
|
|
|
/*
|
|
|
|
* === start of cached values ====
|
|
|
|
*/
|
|
|
|
/*
|
|
|
|
* Recomputing is minimized by storing the result of computations.
|
|
|
|
* Use functions in screen.c to check if they are valid and to update.
|
|
|
|
* w_valid is a bitfield of flags, which indicate if specific values are
|
|
|
|
* valid or need to be recomputed. See screen.c for values.
|
|
|
|
*/
|
|
|
|
int w_valid;
|
|
|
|
pos_T w_valid_cursor; /* last known position of w_cursor, used
|
|
|
|
to adjust w_valid */
|
|
|
|
colnr_T w_valid_leftcol; /* last known w_leftcol */
|
|
|
|
|
|
|
|
/*
|
|
|
|
* w_cline_height is the number of physical lines taken by the buffer line
|
|
|
|
* that the cursor is on. We use this to avoid extra calls to plines().
|
|
|
|
*/
|
|
|
|
int w_cline_height; /* current size of cursor line */
|
|
|
|
#ifdef FEAT_FOLDING
|
|
|
|
int w_cline_folded; /* cursor line is folded */
|
|
|
|
#endif
|
|
|
|
|
|
|
|
int w_cline_row; /* starting row of the cursor line */
|
|
|
|
|
|
|
|
colnr_T w_virtcol; /* column number of the cursor in the
|
|
|
|
buffer line, as opposed to the column
|
|
|
|
number we're at on the screen. This
|
|
|
|
makes a difference on lines which span
|
|
|
|
more than one screen line or when
|
|
|
|
w_leftcol is non-zero */
|
|
|
|
|
|
|
|
/*
|
|
|
|
* w_wrow and w_wcol specify the cursor position in the window.
|
|
|
|
* This is related to positions in the window, not in the display or
|
|
|
|
* buffer, thus w_wrow is relative to w_winrow.
|
|
|
|
*/
|
|
|
|
int w_wrow, w_wcol; /* cursor position in window */
|
|
|
|
|
|
|
|
linenr_T w_botline; /* number of the line below the bottom of
|
2016-06-03 19:05:49 +02:00
|
|
|
the window */
|
2004-06-13 20:20:40 +00:00
|
|
|
int w_empty_rows; /* number of ~ rows in window */
|
|
|
|
#ifdef FEAT_DIFF
|
|
|
|
int w_filler_rows; /* number of filler rows at the end of the
|
|
|
|
window */
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Info about the lines currently in the window is remembered to avoid
|
|
|
|
* recomputing it every time. The allocated size of w_lines[] is Rows.
|
|
|
|
* Only the w_lines_valid entries are actually valid.
|
|
|
|
* When the display is up-to-date w_lines[0].wl_lnum is equal to w_topline
|
|
|
|
* and w_lines[w_lines_valid - 1].wl_lnum is equal to w_botline.
|
|
|
|
* Between changing text and updating the display w_lines[] represents
|
|
|
|
* what is currently displayed. wl_valid is reset to indicated this.
|
|
|
|
* This is used for efficient redrawing.
|
|
|
|
*/
|
|
|
|
int w_lines_valid; /* number of valid entries */
|
|
|
|
wline_T *w_lines;
|
|
|
|
|
|
|
|
#ifdef FEAT_FOLDING
|
|
|
|
garray_T w_folds; /* array of nested folds */
|
|
|
|
char w_fold_manual; /* when TRUE: some folds are opened/closed
|
|
|
|
manually */
|
|
|
|
char w_foldinvalid; /* when TRUE: folding needs to be
|
|
|
|
recomputed */
|
|
|
|
#endif
|
2004-07-03 16:05:59 +00:00
|
|
|
#ifdef FEAT_LINEBREAK
|
2010-05-16 15:46:46 +02:00
|
|
|
int w_nrwidth; /* width of 'number' and 'relativenumber'
|
|
|
|
column being used */
|
2004-07-03 16:05:59 +00:00
|
|
|
#endif
|
2004-06-13 20:20:40 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* === end of cached values ===
|
|
|
|
*/
|
|
|
|
|
|
|
|
int w_redr_type; /* type of redraw to be performed on win */
|
|
|
|
int w_upd_rows; /* number of window lines to update when
|
|
|
|
w_redr_type is REDRAW_TOP */
|
|
|
|
linenr_T w_redraw_top; /* when != 0: first line needing redraw */
|
|
|
|
linenr_T w_redraw_bot; /* when != 0: last line needing redraw */
|
|
|
|
int w_redr_status; /* if TRUE status line must be redrawn */
|
|
|
|
|
|
|
|
#ifdef FEAT_CMDL_INFO
|
|
|
|
/* remember what is shown in the ruler for this window (if 'ruler' set) */
|
|
|
|
pos_T w_ru_cursor; /* cursor position shown in ruler */
|
|
|
|
colnr_T w_ru_virtcol; /* virtcol shown in ruler */
|
|
|
|
linenr_T w_ru_topline; /* topline shown in ruler */
|
|
|
|
linenr_T w_ru_line_count; /* line count used for ruler */
|
|
|
|
# ifdef FEAT_DIFF
|
|
|
|
int w_ru_topfill; /* topfill shown in ruler */
|
|
|
|
# endif
|
|
|
|
char w_ru_empty; /* TRUE if ruler shows 0-1 (empty line) */
|
|
|
|
#endif
|
|
|
|
|
|
|
|
int w_alt_fnum; /* alternate file (for # and CTRL-^) */
|
|
|
|
|
|
|
|
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 */
|
2017-09-17 23:03:31 +02:00
|
|
|
#ifdef FEAT_MENU
|
|
|
|
vimmenu_T *w_winbar; /* The root of the WinBar menu hierarchy. */
|
|
|
|
winbar_item_T *w_winbar_items; /* list of items in the WinBar */
|
|
|
|
int w_winbar_height; /* 1 if there is a window toolbar */
|
|
|
|
#endif
|
|
|
|
|
2004-06-13 20:20:40 +00:00
|
|
|
/*
|
|
|
|
* Options local to a window.
|
|
|
|
* They are local because they influence the layout of the window or
|
|
|
|
* depend on the window layout.
|
|
|
|
* There are two values: w_onebuf_opt is local to the buffer currently in
|
|
|
|
* this window, w_allbuf_opt is for all buffers in this window.
|
|
|
|
*/
|
|
|
|
winopt_T w_onebuf_opt;
|
|
|
|
winopt_T w_allbuf_opt;
|
|
|
|
|
2006-02-22 21:25:37 +00:00
|
|
|
/* A few options have local flags for P_INSECURE. */
|
|
|
|
#ifdef FEAT_STL_OPT
|
|
|
|
long_u w_p_stl_flags; /* flags for 'statusline' */
|
|
|
|
#endif
|
|
|
|
#ifdef FEAT_EVAL
|
|
|
|
long_u w_p_fde_flags; /* flags for 'foldexpr' */
|
|
|
|
long_u w_p_fdt_flags; /* flags for 'foldtext' */
|
2010-07-14 19:53:30 +02:00
|
|
|
#endif
|
|
|
|
#ifdef FEAT_SYN_HL
|
|
|
|
int *w_p_cc_cols; /* array of columns to highlight or NULL */
|
2006-02-22 21:25:37 +00:00
|
|
|
#endif
|
2014-06-25 14:39:50 +02:00
|
|
|
#ifdef FEAT_LINEBREAK
|
|
|
|
int w_p_brimin; /* minimum width for breakindent */
|
|
|
|
int w_p_brishift; /* additional shift for breakindent */
|
|
|
|
int w_p_brisbr; /* sbr in 'briopt' */
|
|
|
|
#endif
|
2006-02-22 21:25:37 +00:00
|
|
|
|
2004-06-13 20:20:40 +00:00
|
|
|
/* transform a pointer to a "onebuf" option into a "allbuf" option */
|
|
|
|
#define GLOBAL_WO(p) ((char *)p + sizeof(winopt_T))
|
|
|
|
|
|
|
|
long w_scbind_pos;
|
|
|
|
|
|
|
|
#ifdef FEAT_EVAL
|
2005-01-25 22:12:55 +00:00
|
|
|
dictitem_T w_winvar; /* variable for "w:" Dictionary */
|
2013-04-15 12:27:36 +02:00
|
|
|
dict_T *w_vars; /* internal variables, local to window */
|
2004-06-13 20:20:40 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(FEAT_RIGHTLEFT) && defined(FEAT_FKMAP)
|
|
|
|
int w_farsi; /* for the window dependent Farsi functions */
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/*
|
|
|
|
* The w_prev_pcmark field is used to check whether we really did jump to
|
|
|
|
* a new line after setting the w_pcmark. If not, then we revert to
|
|
|
|
* using the previous w_pcmark.
|
|
|
|
*/
|
|
|
|
pos_T w_pcmark; /* previous context mark */
|
|
|
|
pos_T w_prev_pcmark; /* previous w_pcmark */
|
|
|
|
|
|
|
|
#ifdef FEAT_JUMPLIST
|
|
|
|
/*
|
|
|
|
* the jumplist contains old cursor positions
|
|
|
|
*/
|
|
|
|
xfmark_T w_jumplist[JUMPLISTSIZE];
|
|
|
|
int w_jumplistlen; /* number of active entries */
|
|
|
|
int w_jumplistidx; /* current position */
|
|
|
|
|
|
|
|
int w_changelistidx; /* current position in b_changelist */
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef FEAT_SEARCH_EXTRA
|
2007-07-26 20:58:42 +00:00
|
|
|
matchitem_T *w_match_head; /* head of match list */
|
|
|
|
int w_next_match_id; /* next match ID */
|
2004-06-13 20:20:40 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/*
|
|
|
|
* the tagstack grows from 0 upwards:
|
|
|
|
* entry 0: older
|
|
|
|
* entry 1: newer
|
|
|
|
* entry 2: newest
|
|
|
|
*/
|
|
|
|
taggy_T w_tagstack[TAGSTACKSIZE]; /* the tag stack */
|
2007-05-10 18:32:52 +00:00
|
|
|
int w_tagstackidx; /* idx just below active entry */
|
2004-06-13 20:20:40 +00:00
|
|
|
int w_tagstacklen; /* number of tags on stack */
|
|
|
|
|
|
|
|
/*
|
|
|
|
* w_fraction is the fractional row of the cursor within the window, from
|
|
|
|
* 0 at the top row to FRACTION_MULT at the last row.
|
|
|
|
* w_prev_fraction_row was the actual cursor row when w_fraction was last
|
|
|
|
* calculated.
|
|
|
|
*/
|
|
|
|
int w_fraction;
|
|
|
|
int w_prev_fraction_row;
|
|
|
|
|
|
|
|
#ifdef FEAT_GUI
|
|
|
|
scrollbar_T w_scrollbars[2]; /* vert. Scrollbars for this window */
|
|
|
|
#endif
|
2004-07-03 16:05:59 +00:00
|
|
|
#ifdef FEAT_LINEBREAK
|
|
|
|
linenr_T w_nrwidth_line_count; /* line count when ml_nrwidth_width
|
|
|
|
* was computed. */
|
2015-03-20 15:42:10 +01:00
|
|
|
long w_nuw_cached; /* 'numberwidth' option cached */
|
2004-07-03 16:05:59 +00:00
|
|
|
int w_nrwidth_width; /* nr of chars to print line count. */
|
|
|
|
#endif
|
2004-06-13 20:20:40 +00:00
|
|
|
|
2006-01-25 22:10:52 +00:00
|
|
|
#ifdef FEAT_QUICKFIX
|
|
|
|
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;
|
|
|
|
#endif
|
|
|
|
|
2004-07-05 15:58:32 +00:00
|
|
|
|
|
|
|
#ifdef FEAT_MZSCHEME
|
2005-09-01 20:46:49 +00:00
|
|
|
void *w_mzscheme_ref; /* The MzScheme value for this window */
|
2004-07-05 15:58:32 +00:00
|
|
|
#endif
|
|
|
|
|
2004-06-13 20:20:40 +00:00
|
|
|
#ifdef FEAT_PERL
|
2005-09-01 20:46:49 +00:00
|
|
|
void *w_perl_private;
|
2004-06-13 20:20:40 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef FEAT_PYTHON
|
2005-09-01 20:46:49 +00:00
|
|
|
void *w_python_ref; /* The Python value for this window */
|
2004-06-13 20:20:40 +00:00
|
|
|
#endif
|
|
|
|
|
2010-07-17 21:19:38 +02:00
|
|
|
#ifdef FEAT_PYTHON3
|
|
|
|
void *w_python3_ref; /* The Python value for this window */
|
|
|
|
#endif
|
|
|
|
|
2004-06-13 20:20:40 +00:00
|
|
|
#ifdef FEAT_TCL
|
2005-09-01 20:46:49 +00:00
|
|
|
void *w_tcl_ref;
|
2004-06-13 20:20:40 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef FEAT_RUBY
|
2005-09-01 20:46:49 +00:00
|
|
|
void *w_ruby_ref;
|
2004-06-13 20:20:40 +00:00
|
|
|
#endif
|
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Arguments for operators.
|
|
|
|
*/
|
2005-09-01 20:46:49 +00:00
|
|
|
typedef struct oparg_S
|
2004-06-13 20:20:40 +00:00
|
|
|
{
|
|
|
|
int op_type; /* current pending operator type */
|
|
|
|
int regname; /* register to use for the operator */
|
|
|
|
int motion_type; /* type of the current cursor motion */
|
|
|
|
int motion_force; /* force motion type: 'v', 'V' or CTRL-V */
|
|
|
|
int use_reg_one; /* TRUE if delete uses reg 1 even when not
|
|
|
|
linewise */
|
|
|
|
int inclusive; /* TRUE if char motion is inclusive (only
|
|
|
|
valid when motion_type is MCHAR */
|
|
|
|
int end_adjusted; /* backuped b_op_end one char (only used by
|
|
|
|
do_format()) */
|
|
|
|
pos_T start; /* start of the operator */
|
|
|
|
pos_T end; /* end of the operator */
|
|
|
|
pos_T cursor_start; /* cursor position before motion for "gw" */
|
|
|
|
|
|
|
|
long line_count; /* number of lines from op_start to op_end
|
|
|
|
(inclusive) */
|
|
|
|
int empty; /* op_start and op_end the same (only used by
|
|
|
|
do_change()) */
|
|
|
|
int is_VIsual; /* operator on Visual area */
|
|
|
|
int block_mode; /* current operator is Visual block mode */
|
|
|
|
colnr_T start_vcol; /* start col for block mode operator */
|
|
|
|
colnr_T end_vcol; /* end col for block mode operator */
|
2008-07-31 20:04:27 +00:00
|
|
|
long prev_opcount; /* ca.opcount saved for K_CURSORHOLD */
|
|
|
|
long prev_count0; /* ca.count0 saved for K_CURSORHOLD */
|
2004-06-13 20:20:40 +00:00
|
|
|
} oparg_T;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Arguments for Normal mode commands.
|
|
|
|
*/
|
2005-09-01 20:46:49 +00:00
|
|
|
typedef struct cmdarg_S
|
2004-06-13 20:20:40 +00:00
|
|
|
{
|
|
|
|
oparg_T *oap; /* Operator arguments */
|
|
|
|
int prechar; /* prefix character (optional, always 'g') */
|
|
|
|
int cmdchar; /* command character */
|
|
|
|
int nchar; /* next command character (optional) */
|
|
|
|
#ifdef FEAT_MBYTE
|
|
|
|
int ncharC1; /* first composing character (optional) */
|
|
|
|
int ncharC2; /* second composing character (optional) */
|
|
|
|
#endif
|
|
|
|
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 */
|
|
|
|
|
|
|
|
#ifdef CURSOR_SHAPE
|
|
|
|
/*
|
|
|
|
* struct to store values from 'guicursor' and 'mouseshape'
|
|
|
|
*/
|
|
|
|
/* Indexes in shape_table[] */
|
|
|
|
#define SHAPE_IDX_N 0 /* Normal mode */
|
|
|
|
#define SHAPE_IDX_V 1 /* Visual mode */
|
|
|
|
#define SHAPE_IDX_I 2 /* Insert mode */
|
|
|
|
#define SHAPE_IDX_R 3 /* Replace mode */
|
|
|
|
#define SHAPE_IDX_C 4 /* Command line Normal mode */
|
|
|
|
#define SHAPE_IDX_CI 5 /* Command line Insert mode */
|
|
|
|
#define SHAPE_IDX_CR 6 /* Command line Replace mode */
|
|
|
|
#define SHAPE_IDX_O 7 /* Operator-pending mode */
|
2010-05-16 13:56:06 +02:00
|
|
|
#define SHAPE_IDX_VE 8 /* Visual mode with 'selection' exclusive */
|
2004-06-13 20:20:40 +00:00
|
|
|
#define SHAPE_IDX_CLINE 9 /* On command line */
|
|
|
|
#define SHAPE_IDX_STATUS 10 /* A status line */
|
|
|
|
#define SHAPE_IDX_SDRAG 11 /* dragging a status line */
|
|
|
|
#define SHAPE_IDX_VSEP 12 /* A vertical separator line */
|
|
|
|
#define SHAPE_IDX_VDRAG 13 /* dragging a vertical separator line */
|
|
|
|
#define SHAPE_IDX_MORE 14 /* Hit-return or More */
|
|
|
|
#define SHAPE_IDX_MOREL 15 /* Hit-return or More in last line */
|
|
|
|
#define SHAPE_IDX_SM 16 /* showing matching paren */
|
|
|
|
#define SHAPE_IDX_COUNT 17
|
|
|
|
|
|
|
|
#define SHAPE_BLOCK 0 /* block cursor */
|
|
|
|
#define SHAPE_HOR 1 /* horizontal bar cursor */
|
|
|
|
#define SHAPE_VER 2 /* vertical bar cursor */
|
|
|
|
|
|
|
|
#define MSHAPE_NUMBERED 1000 /* offset for shapes identified by number */
|
|
|
|
#define MSHAPE_HIDE 1 /* hide mouse pointer */
|
|
|
|
|
|
|
|
#define SHAPE_MOUSE 1 /* used for mouse pointer shape */
|
|
|
|
#define SHAPE_CURSOR 2 /* used for text cursor shape */
|
|
|
|
|
|
|
|
typedef struct cursor_entry
|
|
|
|
{
|
|
|
|
int shape; /* one of the SHAPE_ defines */
|
|
|
|
int mshape; /* one of the MSHAPE defines */
|
|
|
|
int percentage; /* percentage of cell for bar */
|
|
|
|
long blinkwait; /* blinking, wait time before blinking starts */
|
|
|
|
long blinkon; /* blinking, on time */
|
|
|
|
long blinkoff; /* blinking, off time */
|
|
|
|
int id; /* highlight group ID */
|
|
|
|
int id_lm; /* highlight group ID for :lmap mode */
|
|
|
|
char *name; /* mode name (fixed) */
|
|
|
|
char used_for; /* SHAPE_MOUSE and/or SHAPE_CURSOR */
|
|
|
|
} cursorentry_T;
|
|
|
|
#endif /* CURSOR_SHAPE */
|
|
|
|
|
|
|
|
#ifdef FEAT_MENU
|
|
|
|
|
|
|
|
/* Indices into vimmenu_T->strings[] and vimmenu_T->noremap[] for each mode */
|
|
|
|
#define MENU_INDEX_INVALID -1
|
|
|
|
#define MENU_INDEX_NORMAL 0
|
|
|
|
#define MENU_INDEX_VISUAL 1
|
2006-03-20 21:55:45 +00:00
|
|
|
#define MENU_INDEX_SELECT 2
|
|
|
|
#define MENU_INDEX_OP_PENDING 3
|
|
|
|
#define MENU_INDEX_INSERT 4
|
|
|
|
#define MENU_INDEX_CMDLINE 5
|
2018-10-19 22:36:53 +02:00
|
|
|
#define MENU_INDEX_TERMINAL 6
|
|
|
|
#define MENU_INDEX_TIP 7
|
|
|
|
#define MENU_MODES 8
|
2004-06-13 20:20:40 +00:00
|
|
|
|
|
|
|
/* Menu modes */
|
|
|
|
#define MENU_NORMAL_MODE (1 << MENU_INDEX_NORMAL)
|
|
|
|
#define MENU_VISUAL_MODE (1 << MENU_INDEX_VISUAL)
|
2006-03-20 21:55:45 +00:00
|
|
|
#define MENU_SELECT_MODE (1 << MENU_INDEX_SELECT)
|
2004-06-13 20:20:40 +00:00
|
|
|
#define MENU_OP_PENDING_MODE (1 << MENU_INDEX_OP_PENDING)
|
|
|
|
#define MENU_INSERT_MODE (1 << MENU_INDEX_INSERT)
|
|
|
|
#define MENU_CMDLINE_MODE (1 << MENU_INDEX_CMDLINE)
|
2018-10-19 22:36:53 +02:00
|
|
|
#define MENU_TERMINAL_MODE (1 << MENU_INDEX_TERMINAL)
|
2004-06-13 20:20:40 +00:00
|
|
|
#define MENU_TIP_MODE (1 << MENU_INDEX_TIP)
|
|
|
|
#define MENU_ALL_MODES ((1 << MENU_INDEX_TIP) - 1)
|
|
|
|
/*note MENU_INDEX_TIP is not a 'real' mode*/
|
|
|
|
|
|
|
|
/* Start a menu name with this to not include it on the main menu bar */
|
|
|
|
#define MNU_HIDDEN_CHAR ']'
|
|
|
|
|
|
|
|
struct VimMenu
|
|
|
|
{
|
|
|
|
int modes; /* Which modes is this menu visible for? */
|
|
|
|
int enabled; /* for which modes the menu is enabled */
|
2010-05-14 22:24:40 +02:00
|
|
|
char_u *name; /* Name of menu, possibly translated */
|
|
|
|
char_u *dname; /* Displayed Name ("name" without '&') */
|
|
|
|
#ifdef FEAT_MULTI_LANG
|
|
|
|
char_u *en_name; /* "name" untranslated, NULL when "name"
|
|
|
|
* was not translated */
|
|
|
|
char_u *en_dname; /* "dname" untranslated, NULL when "dname"
|
|
|
|
* was not translated */
|
|
|
|
#endif
|
2004-06-13 20:20:40 +00:00
|
|
|
int mnemonic; /* mnemonic key (after '&') */
|
|
|
|
char_u *actext; /* accelerator text (after TAB) */
|
|
|
|
int priority; /* Menu order priority */
|
|
|
|
#ifdef FEAT_GUI
|
2016-01-29 23:20:40 +01:00
|
|
|
void (*cb)(vimmenu_T *); /* Call-back routine */
|
2004-06-13 20:20:40 +00:00
|
|
|
#endif
|
|
|
|
#ifdef FEAT_TOOLBAR
|
|
|
|
char_u *iconfile; /* name of file for icon or NULL */
|
|
|
|
int iconidx; /* icon index (-1 if not set) */
|
|
|
|
int icon_builtin; /* icon names is BuiltIn{nr} */
|
|
|
|
#endif
|
|
|
|
char_u *strings[MENU_MODES]; /* Mapped string for each mode */
|
|
|
|
int noremap[MENU_MODES]; /* A REMAP_ flag for each mode */
|
|
|
|
char 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 */
|
|
|
|
#ifdef FEAT_GUI_X11
|
|
|
|
Widget id; /* Manage this to enable item */
|
|
|
|
Widget submenu_id; /* If this is submenu, add children here */
|
|
|
|
#endif
|
|
|
|
#ifdef FEAT_GUI_GTK
|
|
|
|
GtkWidget *id; /* Manage this to enable item */
|
|
|
|
GtkWidget *submenu_id; /* If this is submenu, add children here */
|
2016-02-23 17:14:37 +01:00
|
|
|
# if defined(GTK_CHECK_VERSION) && !GTK_CHECK_VERSION(3,4,0)
|
2004-06-13 20:20:40 +00:00
|
|
|
GtkWidget *tearoff_handle;
|
2016-02-23 17:14:37 +01:00
|
|
|
# endif
|
2004-06-13 20:20:40 +00:00
|
|
|
GtkWidget *label; /* Used by "set wak=" code. */
|
|
|
|
#endif
|
|
|
|
#ifdef FEAT_GUI_MOTIF
|
|
|
|
int sensitive; /* turn button on/off */
|
2005-01-02 11:36:03 +00:00
|
|
|
char **xpm; /* pixmap data */
|
2005-02-07 22:01:03 +00:00
|
|
|
char *xpm_fname; /* file with pixmap data */
|
2004-06-13 20:20:40 +00:00
|
|
|
#endif
|
2005-01-02 11:36:03 +00:00
|
|
|
#ifdef FEAT_GUI_ATHENA
|
2004-06-13 20:20:40 +00:00
|
|
|
Pixmap image; /* Toolbar image */
|
|
|
|
#endif
|
|
|
|
#ifdef FEAT_BEVAL_TIP
|
|
|
|
BalloonEval *tip; /* tooltip for this menu item */
|
|
|
|
#endif
|
|
|
|
#ifdef FEAT_GUI_W32
|
|
|
|
UINT id; /* Id of menu item */
|
|
|
|
HMENU submenu_id; /* If this is submenu, add children here */
|
|
|
|
HWND tearoff_handle; /* hWnd of tearoff if created */
|
|
|
|
#endif
|
|
|
|
#ifdef FEAT_GUI_MAC
|
|
|
|
/* MenuHandle id; */
|
|
|
|
/* short index; */ /* the item index within the father menu */
|
|
|
|
short menu_id; /* the menu id to which this item belong */
|
|
|
|
short submenu_id; /* the menu id of the children (could be
|
2010-05-16 13:56:06 +02:00
|
|
|
get through some tricks) */
|
2004-06-13 20:20:40 +00:00
|
|
|
MenuHandle menu_handle;
|
|
|
|
MenuHandle submenu_handle;
|
|
|
|
#endif
|
|
|
|
#ifdef FEAT_GUI_PHOTON
|
|
|
|
PtWidget_t *id;
|
|
|
|
PtWidget_t *submenu_id;
|
|
|
|
#endif
|
|
|
|
};
|
|
|
|
#else
|
|
|
|
/* For generating prototypes when FEAT_MENU isn't defined. */
|
|
|
|
typedef int vimmenu_T;
|
|
|
|
|
|
|
|
#endif /* FEAT_MENU */
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Struct to save values in before executing autocommands for a buffer that is
|
2018-03-04 18:08:14 +01:00
|
|
|
* not the current buffer.
|
2004-06-13 20:20:40 +00:00
|
|
|
*/
|
|
|
|
typedef struct
|
|
|
|
{
|
2009-06-16 14:01:43 +00:00
|
|
|
buf_T *save_curbuf; /* saved curbuf */
|
2009-07-29 10:10:29 +00:00
|
|
|
int use_aucmd_win; /* using aucmd_win */
|
2009-06-16 14:01:43 +00:00
|
|
|
win_T *save_curwin; /* saved curwin */
|
|
|
|
win_T *new_curwin; /* new curwin */
|
2018-12-24 00:22:39 +01:00
|
|
|
win_T *save_prevwin; /* saved prevwin */
|
2016-07-10 22:11:16 +02:00
|
|
|
bufref_T new_curbuf; /* new curbuf */
|
2009-07-29 10:10:29 +00:00
|
|
|
char_u *globaldir; /* saved value of globaldir */
|
2004-06-13 20:20:40 +00:00
|
|
|
} aco_save_T;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Generic option table item, only used for printer at the moment.
|
|
|
|
*/
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
const char *name;
|
|
|
|
int hasnum;
|
|
|
|
long number;
|
|
|
|
char_u *string; /* points into option string */
|
|
|
|
int strlen;
|
|
|
|
int present;
|
|
|
|
} option_table_T;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Structure to hold printing color and font attributes.
|
|
|
|
*/
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
long_u fg_color;
|
|
|
|
long_u bg_color;
|
|
|
|
int bold;
|
|
|
|
int italic;
|
|
|
|
int underline;
|
2005-03-15 22:43:58 +00:00
|
|
|
int undercurl;
|
2004-06-13 20:20:40 +00:00
|
|
|
} prt_text_attr_T;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Structure passed back to the generic printer code.
|
|
|
|
*/
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
int n_collated_copies;
|
|
|
|
int n_uncollated_copies;
|
|
|
|
int duplex;
|
|
|
|
int chars_per_line;
|
|
|
|
int lines_per_page;
|
|
|
|
int has_color;
|
|
|
|
prt_text_attr_T number;
|
|
|
|
#ifdef FEAT_SYN_HL
|
|
|
|
int modec;
|
|
|
|
int do_syntax;
|
|
|
|
#endif
|
|
|
|
int user_abort;
|
|
|
|
char_u *jobname;
|
|
|
|
#ifdef FEAT_POSTSCRIPT
|
|
|
|
char_u *outfile;
|
|
|
|
char_u *arguments;
|
|
|
|
#endif
|
|
|
|
} prt_settings_T;
|
|
|
|
|
|
|
|
#define PRINT_NUMBER_WIDTH 8
|
2006-02-08 09:20:24 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Used for popup menu items.
|
|
|
|
*/
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
char_u *pum_text; /* main menu text */
|
2006-03-11 21:29:41 +00:00
|
|
|
char_u *pum_kind; /* extra kind text (may be truncated) */
|
2006-02-08 09:20:24 +00:00
|
|
|
char_u *pum_extra; /* extra menu text (may be truncated) */
|
|
|
|
char_u *pum_info; /* extra info */
|
|
|
|
} pumitem_T;
|
2006-02-27 00:08:02 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* 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 */
|
|
|
|
int tn_did_filefind_init;
|
|
|
|
int tn_hf_idx;
|
|
|
|
void *tn_search_ctx;
|
|
|
|
} tagname_T;
|
|
|
|
|
2006-03-19 22:15:26 +00:00
|
|
|
/*
|
|
|
|
* Array indexes used for cptext argument of ins_compl_add().
|
|
|
|
*/
|
2018-02-10 16:19:32 +01:00
|
|
|
#define CPT_ABBR 0 /* "abbr" */
|
|
|
|
#define CPT_MENU 1 /* "menu" */
|
|
|
|
#define CPT_KIND 2 /* "kind" */
|
|
|
|
#define CPT_INFO 3 /* "info" */
|
|
|
|
#define CPT_USER_DATA 4 /* "user data" */
|
|
|
|
#define CPT_COUNT 5 /* Number of entries */
|
2010-05-23 23:34:36 +02:00
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
UINT32_T total[2];
|
|
|
|
UINT32_T state[8];
|
|
|
|
char_u buffer[64];
|
|
|
|
} context_sha256_T;
|
2016-01-23 19:46:28 +01:00
|
|
|
|
2018-02-11 19:06:26 +01:00
|
|
|
/*
|
|
|
|
* types for expressions.
|
|
|
|
*/
|
|
|
|
typedef enum
|
|
|
|
{
|
2018-04-17 20:14:39 +02:00
|
|
|
TYPE_UNKNOWN = 0,
|
|
|
|
TYPE_EQUAL, // ==
|
|
|
|
TYPE_NEQUAL, // !=
|
|
|
|
TYPE_GREATER, // >
|
|
|
|
TYPE_GEQUAL, // >=
|
|
|
|
TYPE_SMALLER, // <
|
|
|
|
TYPE_SEQUAL, // <=
|
|
|
|
TYPE_MATCH, // =~
|
|
|
|
TYPE_NOMATCH, // !~
|
2018-02-11 19:06:26 +01:00
|
|
|
} exptype_T;
|
|
|
|
|
2016-01-23 19:46:28 +01:00
|
|
|
/*
|
|
|
|
* Structure used for reading in json_decode().
|
|
|
|
*/
|
2016-02-02 18:20:08 +01:00
|
|
|
struct js_reader
|
2016-01-23 19:46:28 +01:00
|
|
|
{
|
|
|
|
char_u *js_buf; /* text to be decoded */
|
2016-02-02 18:20:08 +01:00
|
|
|
char_u *js_end; /* NUL in js_buf */
|
2016-01-23 19:46:28 +01:00
|
|
|
int js_used; /* bytes used from js_buf */
|
2016-02-02 18:20:08 +01:00
|
|
|
int (*js_fill)(struct js_reader *);
|
|
|
|
/* function to fill the buffer or NULL;
|
|
|
|
* return TRUE when the buffer was filled */
|
|
|
|
void *js_cookie; /* can be used by js_fill */
|
2016-03-28 14:11:42 +02:00
|
|
|
int js_cookie_arg; /* can be used by js_fill */
|
2016-02-02 18:20:08 +01:00
|
|
|
};
|
|
|
|
typedef struct js_reader js_read_T;
|
2016-03-15 23:10:59 +01:00
|
|
|
|
|
|
|
typedef struct timer_S timer_T;
|
|
|
|
struct timer_S
|
|
|
|
{
|
2016-09-05 22:45:28 +02:00
|
|
|
long tr_id;
|
2016-03-15 23:10:59 +01:00
|
|
|
#ifdef FEAT_TIMERS
|
|
|
|
timer_T *tr_next;
|
|
|
|
timer_T *tr_prev;
|
|
|
|
proftime_T tr_due; /* when the callback is to be invoked */
|
2016-09-05 22:45:28 +02:00
|
|
|
char tr_firing; /* when TRUE callback is being called */
|
|
|
|
char tr_paused; /* when TRUE callback is not invoked */
|
2016-03-15 23:10:59 +01:00
|
|
|
int tr_repeat; /* number of times to repeat, -1 forever */
|
2016-08-07 15:19:26 +02:00
|
|
|
long tr_interval; /* msec */
|
2016-03-15 23:10:59 +01:00
|
|
|
char_u *tr_callback; /* allocated */
|
|
|
|
partial_T *tr_partial;
|
2017-07-08 22:37:34 +02:00
|
|
|
int tr_emsg_count;
|
2016-03-15 23:10:59 +01:00
|
|
|
#endif
|
|
|
|
};
|
2016-07-16 19:50:13 +02:00
|
|
|
|
|
|
|
/* Maximum number of commands from + or -c arguments. */
|
|
|
|
#define MAX_ARG_CMDS 10
|
|
|
|
|
|
|
|
/* values for "window_layout" */
|
|
|
|
#define WIN_HOR 1 /* "-o" horizontally split windows */
|
|
|
|
#define WIN_VER 2 /* "-O" vertically split windows */
|
|
|
|
#define WIN_TABS 3 /* "-p" windows on tab pages */
|
|
|
|
|
|
|
|
/* Struct for various parameters passed between main() and other functions. */
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
int argc;
|
|
|
|
char **argv;
|
|
|
|
|
2016-08-07 15:19:26 +02:00
|
|
|
char_u *fname; /* first file to edit */
|
|
|
|
|
2016-07-16 19:50:13 +02:00
|
|
|
int evim_mode; /* started as "evim" */
|
|
|
|
char_u *use_vimrc; /* vimrc from -u argument */
|
2018-03-01 21:57:32 +01:00
|
|
|
int clean; /* --clean argument */
|
2016-07-16 19:50:13 +02:00
|
|
|
|
|
|
|
int n_commands; /* no. of commands from + or -c */
|
|
|
|
char_u *commands[MAX_ARG_CMDS]; /* commands from + or -c arg. */
|
|
|
|
char_u cmds_tofree[MAX_ARG_CMDS]; /* commands that need free() */
|
|
|
|
int n_pre_commands; /* no. of commands from --cmd */
|
|
|
|
char_u *pre_commands[MAX_ARG_CMDS]; /* commands from --cmd argument */
|
|
|
|
|
|
|
|
int edit_type; /* type of editing to do */
|
|
|
|
char_u *tagname; /* tag from -t argument */
|
|
|
|
#ifdef FEAT_QUICKFIX
|
|
|
|
char_u *use_ef; /* 'errorfile' from -q argument */
|
|
|
|
#endif
|
|
|
|
|
|
|
|
int want_full_screen;
|
|
|
|
int not_a_term; /* no warning for missing term? */
|
2016-11-24 15:09:07 +01:00
|
|
|
int tty_fail; /* exit if not a tty */
|
2016-07-16 19:50:13 +02:00
|
|
|
char_u *term; /* specified terminal name */
|
|
|
|
#ifdef FEAT_CRYPT
|
|
|
|
int ask_for_key; /* -x argument */
|
|
|
|
#endif
|
|
|
|
int no_swap_file; /* "-n" argument used */
|
|
|
|
#ifdef FEAT_EVAL
|
|
|
|
int use_debug_break_level;
|
|
|
|
#endif
|
|
|
|
int window_count; /* number of windows to use */
|
|
|
|
int window_layout; /* 0, WIN_HOR, WIN_VER or WIN_TABS */
|
|
|
|
|
|
|
|
#ifdef FEAT_CLIENTSERVER
|
|
|
|
int serverArg; /* TRUE when argument for a server */
|
|
|
|
char_u *serverName_arg; /* cmdline arg for server name */
|
|
|
|
char_u *serverStr; /* remote server command */
|
|
|
|
char_u *serverStrEnc; /* encoding of serverStr */
|
|
|
|
char_u *servername; /* allocated name for our server */
|
|
|
|
#endif
|
|
|
|
#if !defined(UNIX)
|
|
|
|
# define EXPAND_FILENAMES
|
|
|
|
int literal; /* don't expand file names */
|
|
|
|
#endif
|
|
|
|
#ifdef MSWIN
|
|
|
|
int full_path; /* file name argument was full path */
|
|
|
|
#endif
|
|
|
|
#ifdef FEAT_DIFF
|
|
|
|
int diff_mode; /* start with 'diff' set */
|
|
|
|
#endif
|
|
|
|
} mparm_T;
|
2016-07-17 18:29:19 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
* 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
|
|
|
|
* For a magic braces name:
|
|
|
|
* "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.
|
|
|
|
* 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
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
typedef struct lval_S
|
|
|
|
{
|
|
|
|
char_u *ll_name; /* start of variable name (can be NULL) */
|
|
|
|
char_u *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. */
|
|
|
|
int ll_range; /* TRUE when a [i:j] range was used */
|
|
|
|
long ll_n1; /* First index for list */
|
|
|
|
long ll_n2; /* Second index for list range */
|
|
|
|
int ll_empty2; /* Second index is empty: [i:] */
|
|
|
|
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 alloc. mem or NULL. */
|
|
|
|
} lval_T;
|
2017-09-23 16:33:50 +02:00
|
|
|
|
|
|
|
/* Structure used to save the current state. Used when executing Normal mode
|
|
|
|
* commands while in any other mode. */
|
|
|
|
typedef struct {
|
|
|
|
int save_msg_scroll;
|
|
|
|
int save_restart_edit;
|
|
|
|
int save_msg_didout;
|
|
|
|
int save_State;
|
|
|
|
int save_insertmode;
|
|
|
|
int save_finish_op;
|
|
|
|
int save_opcount;
|
|
|
|
tasave_T tabuf;
|
|
|
|
} save_state_T;
|
2018-05-12 15:38:26 +02:00
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
varnumber_T vv_prevcount;
|
|
|
|
varnumber_T vv_count;
|
|
|
|
varnumber_T vv_count1;
|
|
|
|
} vimvars_save_T;
|