-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstructs.h
3416 lines (3085 loc) · 108 KB
/
structs.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/* vi:set ts=8 sts=4 sw=4 noet:
*
* 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 int 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(l, c, ca) {l, c, ca}
#else
# define INIT_POS_T(l, c, ca) {l, c}
#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}
typedef struct window_S win_T;
typedef struct wininfo_S wininfo_T;
typedef struct frame_S frame_T;
typedef int scid_T; /* script ID */
typedef struct file_buffer buf_T; /* forward declaration */
typedef struct terminal_S term_T;
/*
* Reference to a buffer that stores the value of buf_free_count.
* bufref_valid() only needs to check "buf" when the count differs.
*/
typedef struct {
buf_T *br_buf;
int br_fnum;
int br_buf_free_count;
} bufref_T;
/*
* This is here because regexp.h needs pos_T and below regprog_T is used.
*/
#include "regexp.h"
/*
* 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 long
# define INVALCOLOR ((guicolor_T)0x1ffffff)
#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 */
#ifdef FEAT_VIMINFO
time_T time_set;
#endif
} 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_LINEBREAK
int wo_bri;
# define w_p_bri w_onebuf_opt.wo_bri /* 'breakindent' */
char_u *wo_briopt;
# define w_p_briopt w_onebuf_opt.wo_briopt /* 'breakindentopt' */
#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_fdc_save;
# define w_p_fdc_save w_onebuf_opt.wo_fdc_save /* 'foldenable' saved for diff mode */
int wo_fen;
# define w_p_fen w_onebuf_opt.wo_fen /* 'foldenable' */
int wo_fen_save;
# define w_p_fen_save w_onebuf_opt.wo_fen_save /* 'foldenable' saved for diff mode */
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' */
int wo_fdl_save;
# define w_p_fdl_save w_onebuf_opt.wo_fdl_save /* 'foldlevel' state saved for diff mode */
char_u *wo_fdm;
# define w_p_fdm w_onebuf_opt.wo_fdm /* 'foldmethod' */
char_u *wo_fdm_save;
# define w_p_fdm_save w_onebuf_opt.wo_fdm_save /* 'fdm' saved for diff mode */
long wo_fml;
# define w_p_fml w_onebuf_opt.wo_fml /* 'foldminlines' */
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' */
int wo_rnu;
#define w_p_rnu w_onebuf_opt.wo_rnu /* 'relativenumber' */
#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' */
char_u *wo_cc;
# define w_p_cc w_onebuf_opt.wo_cc /* 'colorcolumn' */
#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' */
int wo_diff_saved; /* options were saved for starting diff mode */
# define w_p_diff_saved w_onebuf_opt.wo_diff_saved
int wo_scb_save; /* 'scrollbind' saved for diff mode*/
# define w_p_scb_save w_onebuf_opt.wo_scb_save
#endif
int wo_wrap;
#define w_p_wrap w_onebuf_opt.wo_wrap /* 'wrap' */
#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
#ifdef FEAT_CONCEAL
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
#endif
#ifdef FEAT_CURSORBIND
int wo_crb;
# define w_p_crb w_onebuf_opt.wo_crb /* 'cursorbind' */
int wo_crb_save; /* 'cursorbind' state saved for diff mode*/
# define w_p_crb_save w_onebuf_opt.wo_crb_save
#endif
#ifdef FEAT_SIGNS
char_u *wo_scl;
# define w_p_scl w_onebuf_opt.wo_scl /* 'signcolumn' */
#endif
#ifdef FEAT_TERMINAL
char_u *wo_tk;
#define w_p_tk w_onebuf_opt.wo_tk /* 'termkey' */
char_u *wo_tms;
#define w_p_tms w_onebuf_opt.wo_tms /* 'termsize' */
#endif
#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_fpos */
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 */
#ifdef U_DEBUG
int ue_magic; /* magic number to check allocation */
#endif
};
struct u_header
{
/* The following have a pointer and a number. The number is used when
* reading the undo file in u_read_undo() */
union {
u_header_T *ptr; /* pointer to next undo header in list */
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;
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 */
visualinfo_T uh_visual; /* Visual areas before undo/after redo */
time_T uh_time; /* timestamp when the change was made */
long uh_save_nr; /* set when the file was saved after the
changes in this block */
#ifdef U_DEBUG
int uh_magic; /* magic number to check allocation */
#endif
};
/* 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 VIM_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;
/*
* structure 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 */
};
/*
* things used in memfile.c
*/
typedef struct block_hdr bhdr_T;
typedef struct memfile memfile_T;
typedef long blocknr_T;
/*
* 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;
/*
* 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
{
mf_hashitem_T bh_hashitem; /* header for hash table and key */
#define bh_bnum bh_hashitem.mhi_key /* block number, part of bh_hashitem */
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
{
mf_hashitem_T nt_hashitem; /* header for hash table and key */
#define nt_old_bnum nt_hashitem.mhi_key /* old, negative, number */
blocknr_T nt_new_bnum; /* new, positive, number */
};
typedef struct buffblock buffblock_T;
typedef struct buffheader buffheader_T;
/*
* structure used to store one block of the stuff/redo/recording buffers
*/
struct buffblock
{
buffblock_T *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
{
buffblock_T bh_first; /* first (dummy) block of list */
buffblock_T *bh_curr; /* buffblock for appending */
int bh_index; /* index for reading */
int bh_space; /* space in bh_curr for appending */
};
typedef struct
{
buffheader_T sr_redobuff;
buffheader_T sr_old_redobuff;
} save_redo_T;
/*
* 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 */
int xp_pattern_len; /* bytes in xp_pattern before cursor */
#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; /* TRUE 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 */
char_u *xp_line; /* text being completed */
int xp_col; /* cursor position in line */
} 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_CMD
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 */
int keeppatterns; /* TRUE when ":keeppatterns" was used */
int noswapfile; /* TRUE when ":noswapfile" was used */
# ifdef FEAT_AUTOCMD
char_u *save_ei; /* saved value of 'eventignore' */
# endif
regmatch_T filter_regmatch; /* set by :filter /pat/ */
int filter_force; /* set for :filter! */
} cmdmod_T;
#define MF_SEED_LEN 8
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 */
mf_hashtab_T mf_hash; /* hash lists */
mf_hashtab_T mf_trans; /* 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 */
#ifdef FEAT_CRYPT
buf_T *mf_buffer; /* buffer this memfile is for */
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
};
/*
* 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) */
int ml_stack_top; /* current top of ml_stack */
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 */
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;
#if defined(FEAT_SIGNS) || defined(PROTO)
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 */
signlist_T *next; /* next signlist entry */
# ifdef FEAT_NETBEANS_INTG
signlist_T *prev; /* previous entry -- for easy reordering */
# endif
};
/* 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 */
int id; /* id of this arglist */
} 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;
#ifdef FEAT_WINDOWS
# define ALIST(win) (win)->w_alist
#else
# define ALIST(win) (&global_alist)
#endif
#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
{
short cs_flags[CSTACK_LEN]; /* CSF_ flags */
char cs_pending[CSTACK_LEN]; /* CSTP_: what's pending in ":finally"*/
union {
void *csp_rv[CSTACK_LEN]; /* return typeval for pending return */
void *csp_ex[CSTACK_LEN]; /* exception for pending throw */
} cs_pend;
void *cs_forinfo[CSTACK_LEN]; /* info used by ":for" */
int cs_line[CSTACK_LEN]; /* line nr of ":while"/":for" line */
int cs_idx; /* current entry, or -1 if none */
int cs_looplevel; /* nr of nested ":while"s and ":for"s */
int cs_trylevel; /* nr of nested ":try"s */
eslist_T *cs_emsg_silent_list; /* saved values of "emsg_silent" */
char cs_lflags; /* loop flags: CSL_ flags */
};
# define cs_rettv cs_pend.csp_rv
# define cs_exception cs_pend.csp_ex
/* There is no CSF_IF, the lack of CSF_WHILE, CSF_FOR and CSF_TRY means ":if"
* was used. */
# define CSF_TRUE 0x0001 /* condition was TRUE */
# define CSF_ACTIVE 0x0002 /* current state is active */
# define CSF_ELSE 0x0004 /* ":else" has been passed */
# define CSF_WHILE 0x0008 /* is a ":while" */
# define CSF_FOR 0x0010 /* is a ":for" */
# define CSF_TRY 0x0100 /* is a ":try" */
# define CSF_FINALLY 0x0200 /* ":finally" has been passed */
# define CSF_THROWN 0x0400 /* exception thrown to this try conditional */
# define CSF_CAUGHT 0x0800 /* exception caught by this try conditional */
# define CSF_SILENT 0x1000 /* "emsg_silent" reset by ":try" */
/* Note that CSF_ELSE is only used when CSF_TRY and CSF_WHILE are unset
* (an ":if"), and CSF_SILENT is only used when CSF_TRY is set. */
/*
* 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 */
/*
* 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" */
/*
* 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 */
};
/*
* The exception types.
*/
typedef enum
{
ET_USER, /* exception caused by ":throw" command */
ET_ERROR, /* error exception */
ET_INTERRUPT /* interrupt exception triggered by Ctrl-C */
} except_type_T;
/*
* 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
{
except_type_T type; /* exception type */
char_u *value; /* exception value */
struct msglist *messages; /* message(s) causing error exception */
char_u *throw_name; /* name of the throw point */
linenr_T throw_lnum; /* line number of the throw point */
except_T *caught; /* next exception on the caught stack */
};
/*
* 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 */
};
#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
{
keyentry_T *ke_next; /* next entry with identical "keyword[]" */
struct sp_syn k_syn; /* struct passed to in_id_list() */
short *next_list; /* ID list for next match (if non-zero) */
int flags;
int k_char; /* conceal substitute character */
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 */
int bs_flags; /* flags for pattern */
#ifdef FEAT_CONCEAL
int bs_seqnr; /* stores si_seqnr */
int bs_cchar; /* stores si_cchar */
#endif
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 */
int sst_stacksize; /* number of states on the stack */
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
{
/* These colors need to be > 8 bits to hold 256. */
short_u fg_color; /* foreground color number */
short_u bg_color; /* background color number */
# ifdef FEAT_TERMGUICOLORS
guicolor_T fg_rgb; /* foreground color RGB */
guicolor_T bg_rgb; /* background color RGB */
# endif
} cterm;
# ifdef FEAT_GUI
struct
{
guicolor_T fg_color; /* foreground color handle */
guicolor_T bg_color; /* background color handle */
guicolor_T sp_color; /* special color handle */
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>
# define EILSEQ ENOENT /* MacOS X does not have EILSEQ */
typedef struct _iconv_t *iconv_t;
# else
# if defined(MACOS_CLASSIC)
typedef struct _iconv_t *iconv_t;
# define EINVAL 22
# define E2BIG 7
# define ENOENT 2
# define EFAULT 14
# define EILSEQ 123
# else
# include <errno.h>
# endif
# 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[] */