memline_defs.h
Go to the documentation of this file.
1 #ifndef NVIM_MEMLINE_DEFS_H
2 #define NVIM_MEMLINE_DEFS_H
3 
4 #include "nvim/memfile_defs.h"
5 
6 /*
7  * When searching for a specific line, we remember what blocks in the tree
8  * are the branches leading to that block. This is stored in ml_stack. Each
9  * entry is a pointer to info in a block (may be data block or pointer block)
10  */
11 typedef struct info_pointer {
12  blocknr_T ip_bnum; /* block number */
13  linenr_T ip_low; /* lowest lnum in this block */
14  linenr_T ip_high; /* highest lnum in this block */
15  int ip_index; /* index for block with current lnum */
16 } infoptr_T; /* block/index pair */
17 
18 typedef struct ml_chunksize {
21 } chunksize_T;
22 
23 /* Flags when calling ml_updatechunk() */
24 
25 #define ML_CHNK_ADDLINE 1
26 #define ML_CHNK_DELLINE 2
27 #define ML_CHNK_UPDLINE 3
28 
29 /*
30  * the memline structure holds all the information about a memline
31  */
32 typedef struct memline {
33  linenr_T ml_line_count; /* number of lines in the buffer */
34 
35  memfile_T *ml_mfp; /* pointer to associated memfile */
36 
37 #define ML_EMPTY 1 /* empty buffer */
38 #define ML_LINE_DIRTY 2 /* cached line was changed and allocated */
39 #define ML_LOCKED_DIRTY 4 /* ml_locked was changed */
40 #define ML_LOCKED_POS 8 /* ml_locked needs positive block number */
41  int ml_flags;
42 
43  infoptr_T *ml_stack; /* stack of pointer blocks (array of IPTRs) */
44  int ml_stack_top; /* current top of ml_stack */
45  int ml_stack_size; /* total number of entries in ml_stack */
46 
47  linenr_T ml_line_lnum; /* line number of cached line, 0 if not valid */
48  char_u *ml_line_ptr; /* pointer to cached line */
49 
50  bhdr_T *ml_locked; /* block used by last ml_get */
51  linenr_T ml_locked_low; /* first line in ml_locked */
52  linenr_T ml_locked_high; /* last line in ml_locked */
53  int ml_locked_lineadd; /* number of lines inserted in ml_locked */
57 } memline_T;
58 
59 #endif // NVIM_MEMLINE_DEFS_H
linenr_T ml_line_lnum
Definition: memline_defs.h:47
linenr_T ml_line_count
Definition: memline_defs.h:33
blocknr_T ip_bnum
Definition: memline_defs.h:12
int ip_index
Definition: memline_defs.h:15
int ml_stack_top
Definition: memline_defs.h:44
linenr_T ml_locked_low
Definition: memline_defs.h:51
struct info_pointer infoptr_T
linenr_T ip_high
Definition: memline_defs.h:14
char_u * ml_line_ptr
Definition: memline_defs.h:48
A memory file.
Definition: memfile_defs.h:90
chunksize_T * ml_chunksize
Definition: memline_defs.h:54
infoptr_T * ml_stack
Definition: memline_defs.h:43
Definition: memline_defs.h:11
struct ml_chunksize chunksize_T
Definition: memline_defs.h:18
linenr_T ip_low
Definition: memline_defs.h:13
long mlcs_totalsize
Definition: memline_defs.h:20
Definition: memline_defs.h:32
int ml_flags
Definition: memline_defs.h:41
Definition: memfile_defs.h:63
int ml_locked_lineadd
Definition: memline_defs.h:53
int ml_numchunks
Definition: memline_defs.h:55
bhdr_T * ml_locked
Definition: memline_defs.h:50
linenr_T ml_locked_high
Definition: memline_defs.h:52
int ml_stack_size
Definition: memline_defs.h:45
int mlcs_numlines
Definition: memline_defs.h:19
long linenr_T
Definition: pos.h:4
int64_t blocknr_T
Definition: memfile_defs.h:16
unsigned char char_u
Definition: types.h:11
struct memline memline_T
int ml_usedchunks
Definition: memline_defs.h:56
memfile_T * ml_mfp
Definition: memline_defs.h:35