/* vi:set ts=8 sts=4 sw=4: * * 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 < 658typedef long linenr_T;typedef unsigned colnr_T;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# define INIT_POS_T {0, 0, 0}#else# define INIT_POS_T {0, 0}#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 */ int ga_maxlen; /* maximum number of items possible */ int ga_itemsize; /* sizeof(item) */ 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} /* * This is here because regexp.h needs pos_T and below regprog_T is used. */#include "regexp.h" typedef struct window_S win_T;typedef struct wininfo_S wininfo_T;typedef struct frame_S frame_T;typedef int scid_T; /* script ID */ /* * 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# define guicolor_T int /* avoid error in prototypes */#endif /* * 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 */} 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#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' */ int wo_fen;# define w_p_fen w_onebuf_opt.wo_fen /* 'foldenable' */ 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' */ char_u *wo_fdm;# define w_p_fdm w_onebuf_opt.wo_fdm /* 'foldmethod' */ long wo_fml;# define w_p_fml w_onebuf_opt.wo_fml /* 'foldminlines' */ long wo_fdn;# define w_p_fdn w_onebuf_opt.wo_fdn /* 'foldnestmax' */# 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' */#ifdef FEAT_LINEBREAK long wo_nuw;# define w_p_nuw w_onebuf_opt.wo_nuw /* 'numberwidth' */#endif#if defined(FEAT_WINDOWS) int wo_wfh;# define w_p_wfh w_onebuf_opt.wo_wfh /* 'winfixheight' */ int wo_wfw;# define w_p_wfw w_onebuf_opt.wo_wfw /* 'winfixwidth' */#endif#if defined(FEAT_WINDOWS) && defined(FEAT_QUICKFIX) 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' */#ifdef FEAT_SPELL int wo_spell;# 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' */#endif#ifdef FEAT_STL_OPT char_u *wo_stl;#define w_p_stl w_onebuf_opt.wo_stl /* 'statusline' */#endif#ifdef FEAT_SCROLLBIND int wo_scb;# define w_p_scb w_onebuf_opt.wo_scb /* 'scrollbind' */#endif int wo_wrap;#define w_p_wrap w_onebuf_opt.wo_wrap /* 'wrap' */ #ifdef FEAT_EVAL int wo_scriptID[WV_COUNT]; /* SIDs for window-local options */# define w_p_scriptID w_onebuf_opt.wo_scriptID#endif} 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. */struct wininfo_S{ wininfo_T *wi_next; /* next entry or NULL for last entry */ wininfo_T *wi_prev; /* previous entry or NULL for first entry */ win_T *wi_win; /* pointer to window that did set wi_lnum */ 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; /* 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; /* * structures used for undo */ 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 */}; struct u_header{ u_header_T *uh_next; /* pointer to next undo header in list */ u_header_T *uh_prev; /* pointer to previous header in list */ u_header_T *uh_alt_next; /* pointer to next header for alt. redo */ u_header_T *uh_alt_prev; /* pointer to previous header for alt. redo */ long uh_seq; /* sequence number, higher == newer undo */ int uh_walk; /* used by undo_time() */ u_entry_T *uh_entry; /* pointer to first entry */ u_entry_T *uh_getbot_entry; /* pointer to where ue_bot must be set */ pos_T uh_cursor; /* cursor position before saving */#ifdef FEAT_VIRTUALEDIT long uh_cursor_vcol;#endif int uh_flags; /* see below */ pos_T uh_namedm[NMARKS]; /* marks before undo/after redo */#ifdef FEAT_VISUAL visualinfo_T uh_visual; /* Visual areas before undo/after redo */#endif time_t uh_time; /* timestamp when the change was made */}; /* values for uh_flags */#define UH_CHANGED 0x01 /* b_changed flag before undo/after redo */#define UH_EMPTYBUF 0x02 /* buffer was empty */ /* * structures used in undo.c */#if SIZEOF_INT > 2# 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; /* * stucture used to link chunks in one of the free chunk lists. */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 */}; /* * structure used to link blocks in the list of allocated blocks. */typedef struct m_block mblock_T;struct m_block{ mblock_T *mb_next; /* pointer to next allocated block */ size_t mb_size; /* total size of all chunks in this block */ size_t mb_maxsize; /* size of largest fee chunk */ minfo_T mb_info; /* head of free chunk list for this block */}; /* * things used in memfile.c */ typedef struct block_hdr bhdr_T;typedef struct memfile memfile_T;typedef long blocknr_T; /* * 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{ bhdr_T *bh_next; /* next block_hdr in free or used list */ bhdr_T *bh_prev; /* previous block_hdr in used list */ bhdr_T *bh_hash_next; /* next block_hdr in hash list */ bhdr_T *bh_hash_prev; /* previous block_hdr in hash list */ blocknr_T bh_bnum; /* block number */ 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{ NR_TRANS *nt_next; /* next nr_trans in hash list */ NR_TRANS *nt_prev; /* previous nr_trans in hash list */ blocknr_T nt_old_bnum; /* old, negative, number */ blocknr_T nt_new_bnum; /* new, positive, number */}; /* * structure used to store one block of the stuff/redo/recording buffers */struct buffblock{ struct buffblock *b_next; /* pointer to next buffblock */ char_u b_str[1]; /* contents (actually longer) */}; /* * header used for the stuff buffer and the redo buffer */struct buffheader{ struct buffblock bh_first; /* first (dummy) block of list */ struct buffblock *bh_curr; /* buffblock for appending */ int bh_index; /* index for reading */ int bh_space; /* space in bh_curr for appending */}; /* * 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 */#if defined(FEAT_USR_CMDS) && defined(FEAT_EVAL) && defined(FEAT_CMDL_COMPL) char_u *xp_arg; /* completion function */ int xp_scriptID; /* SID for completion function */#endif int xp_backslash; /* one of the XP_BS_ values */#ifndef BACKSLASH_IN_FILENAME int xp_shell; /* for a shell command more characters need to be escaped */#endif int xp_numfiles; /* number of files found by file name completion */ char_u **xp_files; /* list of files */} 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 */# ifdef FEAT_BROWSE int browse; /* TRUE to invoke file dialog */# endif# ifdef FEAT_WINDOWS int split; /* flags for win_split() */ int tab; /* > 0 when ":tab" was used */# endif# if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG) int confirm; /* TRUE to invoke yes/no dialog */# endif int keepalt; /* TRUE when ":keepalt" was used */ int keepmarks; /* TRUE when ":keepmarks" was used */ int keepjumps; /* TRUE when ":keepjumps" was used */ int lockmarks; /* TRUE when ":lockmarks" was used */# ifdef FEAT_AUTOCMD char_u *save_ei; /* saved value of 'eventignore' */# endif} cmdmod_T; /* * Simplistic hashing scheme to quickly locate the blocks in the used list. * 64 blocks are found directly (64 * 4K = 256K, most files are smaller). */#define MEMHASHSIZE 64#define MEMHASH(nr) ((nr) & (MEMHASHSIZE - 1)) 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 */ bhdr_T *mf_hash[MEMHASHSIZE]; /* array of hash lists */ NR_TRANS *mf_trans[MEMHASHSIZE]; /* array of trans lists */ 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 */};Lines 1–500 of 2315. Load more
/* vi:set ts=8 sts=4 sw=4: * * 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; typedef unsigned colnr_T; 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 # define INIT_POS_T {0, 0, 0} #else # define INIT_POS_T {0, 0} #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 */ int ga_maxlen; /* maximum number of items possible */ int ga_itemsize; /* sizeof(item) */ 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} /* * This is here because regexp.h needs pos_T and below regprog_T is used. */ #include "regexp.h" typedef struct window_S win_T; typedef struct wininfo_S wininfo_T; typedef struct frame_S frame_T; typedef int scid_T; /* script ID */ /* * 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 # define guicolor_T int /* avoid error in prototypes */ #endif /* * 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 */ } 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 #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' */ int wo_fen; # define w_p_fen w_onebuf_opt.wo_fen /* 'foldenable' */ 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' */ char_u *wo_fdm; # define w_p_fdm w_onebuf_opt.wo_fdm /* 'foldmethod' */ long wo_fml; # define w_p_fml w_onebuf_opt.wo_fml /* 'foldminlines' */ long wo_fdn; # define w_p_fdn w_onebuf_opt.wo_fdn /* 'foldnestmax' */ # 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' */ #ifdef FEAT_LINEBREAK long wo_nuw; # define w_p_nuw w_onebuf_opt.wo_nuw /* 'numberwidth' */ #endif #if defined(FEAT_WINDOWS) int wo_wfh; # define w_p_wfh w_onebuf_opt.wo_wfh /* 'winfixheight' */ int wo_wfw; # define w_p_wfw w_onebuf_opt.wo_wfw /* 'winfixwidth' */ #endif #if defined(FEAT_WINDOWS) && defined(FEAT_QUICKFIX) 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' */ #ifdef FEAT_SPELL int wo_spell; # 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' */ #endif #ifdef FEAT_STL_OPT char_u *wo_stl; #define w_p_stl w_onebuf_opt.wo_stl /* 'statusline' */ #endif #ifdef FEAT_SCROLLBIND int wo_scb; # define w_p_scb w_onebuf_opt.wo_scb /* 'scrollbind' */ #endif int wo_wrap; #define w_p_wrap w_onebuf_opt.wo_wrap /* 'wrap' */ #ifdef FEAT_EVAL int wo_scriptID[WV_COUNT]; /* SIDs for window-local options */ # define w_p_scriptID w_onebuf_opt.wo_scriptID #endif } 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. */ struct wininfo_S { wininfo_T *wi_next; /* next entry or NULL for last entry */ wininfo_T *wi_prev; /* previous entry or NULL for first entry */ win_T *wi_win; /* pointer to window that did set wi_lnum */ 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; /* 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; /* * structures used for undo */ 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 */ }; struct u_header { u_header_T *uh_next; /* pointer to next undo header in list */ u_header_T *uh_prev; /* pointer to previous header in list */ u_header_T *uh_alt_next; /* pointer to next header for alt. redo */ u_header_T *uh_alt_prev; /* pointer to previous header for alt. redo */ long uh_seq; /* sequence number, higher == newer undo */ int uh_walk; /* used by undo_time() */ u_entry_T *uh_entry; /* pointer to first entry */ u_entry_T *uh_getbot_entry; /* pointer to where ue_bot must be set */ pos_T uh_cursor; /* cursor position before saving */ #ifdef FEAT_VIRTUALEDIT long uh_cursor_vcol; #endif int uh_flags; /* see below */ pos_T uh_namedm[NMARKS]; /* marks before undo/after redo */ #ifdef FEAT_VISUAL visualinfo_T uh_visual; /* Visual areas before undo/after redo */ #endif time_t uh_time; /* timestamp when the change was made */ }; /* values for uh_flags */ #define UH_CHANGED 0x01 /* b_changed flag before undo/after redo */ #define UH_EMPTYBUF 0x02 /* buffer was empty */ /* * structures used in undo.c */ #if SIZEOF_INT > 2 # 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; /* * stucture used to link chunks in one of the free chunk lists. */ 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 */ }; /* * structure used to link blocks in the list of allocated blocks. */ typedef struct m_block mblock_T; struct m_block { mblock_T *mb_next; /* pointer to next allocated block */ size_t mb_size; /* total size of all chunks in this block */ size_t mb_maxsize; /* size of largest fee chunk */ minfo_T mb_info; /* head of free chunk list for this block */ }; /* * things used in memfile.c */ typedef struct block_hdr bhdr_T; typedef struct memfile memfile_T; typedef long blocknr_T; /* * 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 { bhdr_T *bh_next; /* next block_hdr in free or used list */ bhdr_T *bh_prev; /* previous block_hdr in used list */ bhdr_T *bh_hash_next; /* next block_hdr in hash list */ bhdr_T *bh_hash_prev; /* previous block_hdr in hash list */ blocknr_T bh_bnum; /* block number */ 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 { NR_TRANS *nt_next; /* next nr_trans in hash list */ NR_TRANS *nt_prev; /* previous nr_trans in hash list */ blocknr_T nt_old_bnum; /* old, negative, number */ blocknr_T nt_new_bnum; /* new, positive, number */ }; /* * structure used to store one block of the stuff/redo/recording buffers */ struct buffblock { struct buffblock *b_next; /* pointer to next buffblock */ char_u b_str[1]; /* contents (actually longer) */ }; /* * header used for the stuff buffer and the redo buffer */ struct buffheader { struct buffblock bh_first; /* first (dummy) block of list */ struct buffblock *bh_curr; /* buffblock for appending */ int bh_index; /* index for reading */ int bh_space; /* space in bh_curr for appending */ }; /* * 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 */ #if defined(FEAT_USR_CMDS) && defined(FEAT_EVAL) && defined(FEAT_CMDL_COMPL) char_u *xp_arg; /* completion function */ int xp_scriptID; /* SID for completion function */ #endif int xp_backslash; /* one of the XP_BS_ values */ #ifndef BACKSLASH_IN_FILENAME int xp_shell; /* for a shell command more characters need to be escaped */ #endif int xp_numfiles; /* number of files found by file name completion */ char_u **xp_files; /* list of files */ } 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 */ # ifdef FEAT_BROWSE int browse; /* TRUE to invoke file dialog */ # endif # ifdef FEAT_WINDOWS int split; /* flags for win_split() */ int tab; /* > 0 when ":tab" was used */ # endif # if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG) int confirm; /* TRUE to invoke yes/no dialog */ # endif int keepalt; /* TRUE when ":keepalt" was used */ int keepmarks; /* TRUE when ":keepmarks" was used */ int keepjumps; /* TRUE when ":keepjumps" was used */ int lockmarks; /* TRUE when ":lockmarks" was used */ # ifdef FEAT_AUTOCMD char_u *save_ei; /* saved value of 'eventignore' */ # endif } cmdmod_T; /* * Simplistic hashing scheme to quickly locate the blocks in the used list. * 64 blocks are found directly (64 * 4K = 256K, most files are smaller). */ #define MEMHASHSIZE 64 #define MEMHASH(nr) ((nr) & (MEMHASHSIZE - 1)) 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 */ bhdr_T *mf_hash[MEMHASHSIZE]; /* array of hash lists */ NR_TRANS *mf_trans[MEMHASHSIZE]; /* array of trans lists */ 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 */ };