comparison src/structs.h @ 17255:765aa1380e93 v8.1.1627

patch 8.1.1627: header file contains mixed comment style commit https://github.com/vim/vim/commit/6cb39f924a10912a615573230e906e8089975198 Author: Bram Moolenaar <Bram@vim.org> Date: Thu Jul 4 16:05:14 2019 +0200 patch 8.1.1627: header file contains mixed comment style Problem: Header file contains mixed comment style. Solution: Use // style comments.
author Bram Moolenaar <Bram@vim.org>
date Thu, 04 Jul 2019 16:15:04 +0200
parents 2a97167854fc
children 82b5d981fe59
comparison
equal deleted inserted replaced
17254:45f7b54c884a 17255:765aa1380e93
45 * This is used to store information that only grows, is deleted all at 45 * This is used to store information that only grows, is deleted all at
46 * once, and needs to be accessed by index. See ga_clear() and ga_grow(). 46 * once, and needs to be accessed by index. See ga_clear() and ga_grow().
47 */ 47 */
48 typedef struct growarray 48 typedef struct growarray
49 { 49 {
50 int ga_len; /* current number of items used */ 50 int ga_len; // current number of items used
51 int ga_maxlen; /* maximum number of items possible */ 51 int ga_maxlen; // maximum number of items possible
52 int ga_itemsize; /* sizeof(item) */ 52 int ga_itemsize; // sizeof(item)
53 int ga_growsize; /* number of items to grow each time */ 53 int ga_growsize; // number of items to grow each time
54 void *ga_data; /* pointer to the first item */ 54 void *ga_data; // pointer to the first item
55 } garray_T; 55 } garray_T;
56 56
57 #define GA_EMPTY {0, 0, 0, 0, NULL} 57 #define GA_EMPTY {0, 0, 0, 0, NULL}
58 58
59 typedef struct window_S win_T; 59 typedef struct window_S win_T;
60 typedef struct wininfo_S wininfo_T; 60 typedef struct wininfo_S wininfo_T;
61 typedef struct frame_S frame_T; 61 typedef struct frame_S frame_T;
62 typedef int scid_T; /* script ID */ 62 typedef int scid_T; // script ID
63 typedef struct file_buffer buf_T; /* forward declaration */ 63 typedef struct file_buffer buf_T; // forward declaration
64 typedef struct terminal_S term_T; 64 typedef struct terminal_S term_T;
65 65
66 #ifdef FEAT_MENU 66 #ifdef FEAT_MENU
67 typedef struct VimMenu vimmenu_T; 67 typedef struct VimMenu vimmenu_T;
68 #endif 68 #endif
107 # ifdef FEAT_XCLIPBOARD 107 # ifdef FEAT_XCLIPBOARD
108 # include <X11/Intrinsic.h> 108 # include <X11/Intrinsic.h>
109 # endif 109 # endif
110 # define guicolor_T long 110 # define guicolor_T long
111 # define INVALCOLOR ((guicolor_T)0x1ffffff) 111 # define INVALCOLOR ((guicolor_T)0x1ffffff)
112 /* only used for cterm.bg_rgb and cterm.fg_rgb: use cterm color */ 112 // only used for cterm.bg_rgb and cterm.fg_rgb: use cterm color
113 # define CTERMCOLOR ((guicolor_T)0x1fffffe) 113 # define CTERMCOLOR ((guicolor_T)0x1fffffe)
114 #endif 114 #endif
115 #define COLOR_INVALID(x) ((x) == INVALCOLOR || (x) == CTERMCOLOR) 115 #define COLOR_INVALID(x) ((x) == INVALCOLOR || (x) == CTERMCOLOR)
116 116
117 /* 117 /*
118 * marks: positions in a file 118 * marks: positions in a file
119 * (a normal mark is a lnum/col pair, the same as a file position) 119 * (a normal mark is a lnum/col pair, the same as a file position)
120 */ 120 */
121 121
122 /* (Note: for EBCDIC there are more than 26, because there are gaps in the 122 // (Note: for EBCDIC there are more than 26, because there are gaps in the
123 * alphabet coding. To minimize changes to the code, I decided to just 123 // alphabet coding. To minimize changes to the code, I decided to just
124 * increase the number of possible marks. */ 124 // increase the number of possible marks.
125 #define NMARKS ('z' - 'a' + 1) /* max. # of named marks */ 125 #define NMARKS ('z' - 'a' + 1) // max. # of named marks
126 #define JUMPLISTSIZE 100 /* max. # of marks in jump list */ 126 #define JUMPLISTSIZE 100 // max. # of marks in jump list
127 #define TAGSTACKSIZE 20 /* max. # of tags in tag stack */ 127 #define TAGSTACKSIZE 20 // max. # of tags in tag stack
128 128
129 typedef struct filemark 129 typedef struct filemark
130 { 130 {
131 pos_T mark; /* cursor position */ 131 pos_T mark; // cursor position
132 int fnum; /* file number */ 132 int fnum; // file number
133 } fmark_T; 133 } fmark_T;
134 134
135 /* Xtended file mark: also has a file name */ 135 // Xtended file mark: also has a file name
136 typedef struct xfilemark 136 typedef struct xfilemark
137 { 137 {
138 fmark_T fmark; 138 fmark_T fmark;
139 char_u *fname; /* file name, used when fnum == 0 */ 139 char_u *fname; // file name, used when fnum == 0
140 #ifdef FEAT_VIMINFO 140 #ifdef FEAT_VIMINFO
141 time_T time_set; 141 time_T time_set;
142 #endif 142 #endif
143 } xfmark_T; 143 } xfmark_T;
144 144
177 int wo_diff; 177 int wo_diff;
178 # define w_p_diff w_onebuf_opt.wo_diff // 'diff' 178 # define w_p_diff w_onebuf_opt.wo_diff // 'diff'
179 #endif 179 #endif
180 #ifdef FEAT_FOLDING 180 #ifdef FEAT_FOLDING
181 long wo_fdc; 181 long wo_fdc;
182 # define w_p_fdc w_onebuf_opt.wo_fdc /* 'foldcolumn' */ 182 # define w_p_fdc w_onebuf_opt.wo_fdc // 'foldcolumn'
183 int wo_fdc_save; 183 int wo_fdc_save;
184 # define w_p_fdc_save w_onebuf_opt.wo_fdc_save /* 'foldenable' saved for diff mode */ 184 # define w_p_fdc_save w_onebuf_opt.wo_fdc_save // 'foldenable' saved for diff mode
185 int wo_fen; 185 int wo_fen;
186 # define w_p_fen w_onebuf_opt.wo_fen /* 'foldenable' */ 186 # define w_p_fen w_onebuf_opt.wo_fen // 'foldenable'
187 int wo_fen_save; 187 int wo_fen_save;
188 # define w_p_fen_save w_onebuf_opt.wo_fen_save /* 'foldenable' saved for diff mode */ 188 # define w_p_fen_save w_onebuf_opt.wo_fen_save // 'foldenable' saved for diff mode
189 char_u *wo_fdi; 189 char_u *wo_fdi;
190 # define w_p_fdi w_onebuf_opt.wo_fdi /* 'foldignore' */ 190 # define w_p_fdi w_onebuf_opt.wo_fdi // 'foldignore'
191 long wo_fdl; 191 long wo_fdl;
192 # define w_p_fdl w_onebuf_opt.wo_fdl /* 'foldlevel' */ 192 # define w_p_fdl w_onebuf_opt.wo_fdl // 'foldlevel'
193 int wo_fdl_save; 193 int wo_fdl_save;
194 # define w_p_fdl_save w_onebuf_opt.wo_fdl_save /* 'foldlevel' state saved for diff mode */ 194 # define w_p_fdl_save w_onebuf_opt.wo_fdl_save // 'foldlevel' state saved for diff mode
195 char_u *wo_fdm; 195 char_u *wo_fdm;
196 # define w_p_fdm w_onebuf_opt.wo_fdm /* 'foldmethod' */ 196 # define w_p_fdm w_onebuf_opt.wo_fdm // 'foldmethod'
197 char_u *wo_fdm_save; 197 char_u *wo_fdm_save;
198 # define w_p_fdm_save w_onebuf_opt.wo_fdm_save /* 'fdm' saved for diff mode */ 198 # define w_p_fdm_save w_onebuf_opt.wo_fdm_save // 'fdm' saved for diff mode
199 long wo_fml; 199 long wo_fml;
200 # define w_p_fml w_onebuf_opt.wo_fml /* 'foldminlines' */ 200 # define w_p_fml w_onebuf_opt.wo_fml // 'foldminlines'
201 long wo_fdn; 201 long wo_fdn;
202 # define w_p_fdn w_onebuf_opt.wo_fdn /* 'foldnestmax' */ 202 # define w_p_fdn w_onebuf_opt.wo_fdn // 'foldnestmax'
203 # ifdef FEAT_EVAL 203 # ifdef FEAT_EVAL
204 char_u *wo_fde; 204 char_u *wo_fde;
205 # define w_p_fde w_onebuf_opt.wo_fde /* 'foldexpr' */ 205 # define w_p_fde w_onebuf_opt.wo_fde // 'foldexpr'
206 char_u *wo_fdt; 206 char_u *wo_fdt;
207 # define w_p_fdt w_onebuf_opt.wo_fdt /* 'foldtext' */ 207 # define w_p_fdt w_onebuf_opt.wo_fdt // 'foldtext'
208 # endif 208 # endif
209 char_u *wo_fmr; 209 char_u *wo_fmr;
210 # define w_p_fmr w_onebuf_opt.wo_fmr /* 'foldmarker' */ 210 # define w_p_fmr w_onebuf_opt.wo_fmr // 'foldmarker'
211 #endif 211 #endif
212 #ifdef FEAT_LINEBREAK 212 #ifdef FEAT_LINEBREAK
213 int wo_lbr; 213 int wo_lbr;
214 # define w_p_lbr w_onebuf_opt.wo_lbr /* 'linebreak' */ 214 # define w_p_lbr w_onebuf_opt.wo_lbr // 'linebreak'
215 #endif 215 #endif
216 int wo_list; 216 int wo_list;
217 #define w_p_list w_onebuf_opt.wo_list /* 'list' */ 217 #define w_p_list w_onebuf_opt.wo_list // 'list'
218 int wo_nu; 218 int wo_nu;
219 #define w_p_nu w_onebuf_opt.wo_nu /* 'number' */ 219 #define w_p_nu w_onebuf_opt.wo_nu // 'number'
220 int wo_rnu; 220 int wo_rnu;
221 #define w_p_rnu w_onebuf_opt.wo_rnu /* 'relativenumber' */ 221 #define w_p_rnu w_onebuf_opt.wo_rnu // 'relativenumber'
222 #ifdef FEAT_LINEBREAK 222 #ifdef FEAT_LINEBREAK
223 long wo_nuw; 223 long wo_nuw;
224 # define w_p_nuw w_onebuf_opt.wo_nuw /* 'numberwidth' */ 224 # define w_p_nuw w_onebuf_opt.wo_nuw // 'numberwidth'
225 #endif 225 #endif
226 int wo_wfh; 226 int wo_wfh;
227 # define w_p_wfh w_onebuf_opt.wo_wfh /* 'winfixheight' */ 227 # define w_p_wfh w_onebuf_opt.wo_wfh // 'winfixheight'
228 int wo_wfw; 228 int wo_wfw;
229 # define w_p_wfw w_onebuf_opt.wo_wfw /* 'winfixwidth' */ 229 # define w_p_wfw w_onebuf_opt.wo_wfw // 'winfixwidth'
230 #if defined(FEAT_QUICKFIX) 230 #if defined(FEAT_QUICKFIX)
231 int wo_pvw; 231 int wo_pvw;
232 # define w_p_pvw w_onebuf_opt.wo_pvw /* 'previewwindow' */ 232 # define w_p_pvw w_onebuf_opt.wo_pvw // 'previewwindow'
233 #endif 233 #endif
234 #ifdef FEAT_RIGHTLEFT 234 #ifdef FEAT_RIGHTLEFT
235 int wo_rl; 235 int wo_rl;
236 # define w_p_rl w_onebuf_opt.wo_rl /* 'rightleft' */ 236 # define w_p_rl w_onebuf_opt.wo_rl // 'rightleft'
237 char_u *wo_rlc; 237 char_u *wo_rlc;
238 # define w_p_rlc w_onebuf_opt.wo_rlc /* 'rightleftcmd' */ 238 # define w_p_rlc w_onebuf_opt.wo_rlc // 'rightleftcmd'
239 #endif 239 #endif
240 long wo_scr; 240 long wo_scr;
241 #define w_p_scr w_onebuf_opt.wo_scr /* 'scroll' */ 241 #define w_p_scr w_onebuf_opt.wo_scr // 'scroll'
242 #ifdef FEAT_SPELL 242 #ifdef FEAT_SPELL
243 int wo_spell; 243 int wo_spell;
244 # define w_p_spell w_onebuf_opt.wo_spell /* 'spell' */ 244 # define w_p_spell w_onebuf_opt.wo_spell // 'spell'
245 #endif 245 #endif
246 #ifdef FEAT_SYN_HL 246 #ifdef FEAT_SYN_HL
247 int wo_cuc; 247 int wo_cuc;
248 # define w_p_cuc w_onebuf_opt.wo_cuc /* 'cursorcolumn' */ 248 # define w_p_cuc w_onebuf_opt.wo_cuc // 'cursorcolumn'
249 int wo_cul; 249 int wo_cul;
250 # define w_p_cul w_onebuf_opt.wo_cul /* 'cursorline' */ 250 # define w_p_cul w_onebuf_opt.wo_cul // 'cursorline'
251 char_u *wo_cc; 251 char_u *wo_cc;
252 # define w_p_cc w_onebuf_opt.wo_cc /* 'colorcolumn' */ 252 # define w_p_cc w_onebuf_opt.wo_cc // 'colorcolumn'
253 #endif 253 #endif
254 #ifdef FEAT_STL_OPT 254 #ifdef FEAT_STL_OPT
255 char_u *wo_stl; 255 char_u *wo_stl;
256 #define w_p_stl w_onebuf_opt.wo_stl /* 'statusline' */ 256 #define w_p_stl w_onebuf_opt.wo_stl // 'statusline'
257 #endif 257 #endif
258 int wo_scb; 258 int wo_scb;
259 #define w_p_scb w_onebuf_opt.wo_scb /* 'scrollbind' */ 259 #define w_p_scb w_onebuf_opt.wo_scb // 'scrollbind'
260 int wo_diff_saved; /* options were saved for starting diff mode */ 260 int wo_diff_saved; // options were saved for starting diff mode
261 #define w_p_diff_saved w_onebuf_opt.wo_diff_saved 261 #define w_p_diff_saved w_onebuf_opt.wo_diff_saved
262 int wo_scb_save; /* 'scrollbind' saved for diff mode*/ 262 int wo_scb_save; // 'scrollbind' saved for diff mode
263 #define w_p_scb_save w_onebuf_opt.wo_scb_save 263 #define w_p_scb_save w_onebuf_opt.wo_scb_save
264 int wo_wrap; 264 int wo_wrap;
265 #define w_p_wrap w_onebuf_opt.wo_wrap /* 'wrap' */ 265 #define w_p_wrap w_onebuf_opt.wo_wrap // 'wrap'
266 #ifdef FEAT_DIFF 266 #ifdef FEAT_DIFF
267 int wo_wrap_save; /* 'wrap' state saved for diff mode*/ 267 int wo_wrap_save; // 'wrap' state saved for diff mode
268 # define w_p_wrap_save w_onebuf_opt.wo_wrap_save 268 # define w_p_wrap_save w_onebuf_opt.wo_wrap_save
269 #endif 269 #endif
270 #ifdef FEAT_CONCEAL 270 #ifdef FEAT_CONCEAL
271 char_u *wo_cocu; /* 'concealcursor' */ 271 char_u *wo_cocu; // 'concealcursor'
272 # define w_p_cocu w_onebuf_opt.wo_cocu 272 # define w_p_cocu w_onebuf_opt.wo_cocu
273 long wo_cole; /* 'conceallevel' */ 273 long wo_cole; // 'conceallevel'
274 # define w_p_cole w_onebuf_opt.wo_cole 274 # define w_p_cole w_onebuf_opt.wo_cole
275 #endif 275 #endif
276 int wo_crb; 276 int wo_crb;
277 #define w_p_crb w_onebuf_opt.wo_crb /* 'cursorbind' */ 277 #define w_p_crb w_onebuf_opt.wo_crb // 'cursorbind'
278 int wo_crb_save; /* 'cursorbind' state saved for diff mode*/ 278 int wo_crb_save; // 'cursorbind' state saved for diff mode
279 #define w_p_crb_save w_onebuf_opt.wo_crb_save 279 #define w_p_crb_save w_onebuf_opt.wo_crb_save
280 #ifdef FEAT_SIGNS 280 #ifdef FEAT_SIGNS
281 char_u *wo_scl; 281 char_u *wo_scl;
282 # define w_p_scl w_onebuf_opt.wo_scl /* 'signcolumn' */ 282 # define w_p_scl w_onebuf_opt.wo_scl // 'signcolumn'
283 #endif 283 #endif
284 #ifdef FEAT_TERMINAL 284 #ifdef FEAT_TERMINAL
285 char_u *wo_twk; 285 char_u *wo_twk;
286 # define w_p_twk w_onebuf_opt.wo_twk /* 'termwinkey' */ 286 # define w_p_twk w_onebuf_opt.wo_twk // 'termwinkey'
287 char_u *wo_tws; 287 char_u *wo_tws;
288 # define w_p_tws w_onebuf_opt.wo_tws /* 'termwinsize' */ 288 # define w_p_tws w_onebuf_opt.wo_tws // 'termwinsize'
289 #endif 289 #endif
290 290
291 #ifdef FEAT_EVAL 291 #ifdef FEAT_EVAL
292 sctx_T wo_script_ctx[WV_COUNT]; /* SCTXs for window-local options */ 292 sctx_T wo_script_ctx[WV_COUNT]; // SCTXs for window-local options
293 # define w_p_script_ctx w_onebuf_opt.wo_script_ctx 293 # define w_p_script_ctx w_onebuf_opt.wo_script_ctx
294 #endif 294 #endif
295 } winopt_T; 295 } winopt_T;
296 296
297 /* 297 /*
304 * The window-info is kept in a list at b_wininfo. It is kept in 304 * The window-info is kept in a list at b_wininfo. It is kept in
305 * most-recently-used order. 305 * most-recently-used order.
306 */ 306 */
307 struct wininfo_S 307 struct wininfo_S
308 { 308 {
309 wininfo_T *wi_next; /* next entry or NULL for last entry */ 309 wininfo_T *wi_next; // next entry or NULL for last entry
310 wininfo_T *wi_prev; /* previous entry or NULL for first entry */ 310 wininfo_T *wi_prev; // previous entry or NULL for first entry
311 win_T *wi_win; /* pointer to window that did set wi_fpos */ 311 win_T *wi_win; // pointer to window that did set wi_fpos
312 pos_T wi_fpos; /* last cursor position in the file */ 312 pos_T wi_fpos; // last cursor position in the file
313 int wi_optset; /* TRUE when wi_opt has useful values */ 313 int wi_optset; // TRUE when wi_opt has useful values
314 winopt_T wi_opt; /* local window options */ 314 winopt_T wi_opt; // local window options
315 #ifdef FEAT_FOLDING 315 #ifdef FEAT_FOLDING
316 int wi_fold_manual; /* copy of w_fold_manual */ 316 int wi_fold_manual; // copy of w_fold_manual
317 garray_T wi_folds; /* clone of w_folds */ 317 garray_T wi_folds; // clone of w_folds
318 #endif 318 #endif
319 }; 319 };
320 320
321 /* 321 /*
322 * Info used to pass info about a fold from the fold-detection code to the 322 * Info used to pass info about a fold from the fold-detection code to the
323 * code that displays the foldcolumn. 323 * code that displays the foldcolumn.
324 */ 324 */
325 typedef struct foldinfo 325 typedef struct foldinfo
326 { 326 {
327 int fi_level; /* level of the fold; when this is zero the 327 int fi_level; // level of the fold; when this is zero the
328 other fields are invalid */ 328 // other fields are invalid
329 int fi_lnum; /* line number where fold starts */ 329 int fi_lnum; // line number where fold starts
330 int fi_low_level; /* lowest fold level that starts in the same 330 int fi_low_level; // lowest fold level that starts in the same
331 line */ 331 // line
332 } foldinfo_T; 332 } foldinfo_T;
333 333
334 /* Structure to store info about the Visual area. */ 334 /*
335 * Structure to store info about the Visual area.
336 */
335 typedef struct 337 typedef struct
336 { 338 {
337 pos_T vi_start; /* start pos of last VIsual */ 339 pos_T vi_start; // start pos of last VIsual
338 pos_T vi_end; /* end position of last VIsual */ 340 pos_T vi_end; // end position of last VIsual
339 int vi_mode; /* VIsual_mode of last VIsual */ 341 int vi_mode; // VIsual_mode of last VIsual
340 colnr_T vi_curswant; /* MAXCOL from w_curswant */ 342 colnr_T vi_curswant; // MAXCOL from w_curswant
341 } visualinfo_T; 343 } visualinfo_T;
342 344
343 /* 345 /*
344 * structures used for undo 346 * structures used for undo
345 */ 347 */
354 356
355 typedef struct u_entry u_entry_T; 357 typedef struct u_entry u_entry_T;
356 typedef struct u_header u_header_T; 358 typedef struct u_header u_header_T;
357 struct u_entry 359 struct u_entry
358 { 360 {
359 u_entry_T *ue_next; /* pointer to next entry in list */ 361 u_entry_T *ue_next; // pointer to next entry in list
360 linenr_T ue_top; /* number of line above undo block */ 362 linenr_T ue_top; // number of line above undo block
361 linenr_T ue_bot; /* number of line below undo block */ 363 linenr_T ue_bot; // number of line below undo block
362 linenr_T ue_lcount; /* linecount when u_save called */ 364 linenr_T ue_lcount; // linecount when u_save called
363 undoline_T *ue_array; /* array of lines in undo block */ 365 undoline_T *ue_array; // array of lines in undo block
364 long ue_size; /* number of lines in ue_array */ 366 long ue_size; // number of lines in ue_array
365 #ifdef U_DEBUG 367 #ifdef U_DEBUG
366 int ue_magic; /* magic number to check allocation */ 368 int ue_magic; // magic number to check allocation
367 #endif 369 #endif
368 }; 370 };
369 371
370 struct u_header 372 struct u_header
371 { 373 {
372 /* The following have a pointer and a number. The number is used when 374 // The following have a pointer and a number. The number is used when
373 * reading the undo file in u_read_undo() */ 375 // reading the undo file in u_read_undo()
374 union { 376 union {
375 u_header_T *ptr; /* pointer to next undo header in list */ 377 u_header_T *ptr; // pointer to next undo header in list
376 long seq; 378 long seq;
377 } uh_next; 379 } uh_next;
378 union { 380 union {
379 u_header_T *ptr; /* pointer to previous header in list */ 381 u_header_T *ptr; // pointer to previous header in list
380 long seq; 382 long seq;
381 } uh_prev; 383 } uh_prev;
382 union { 384 union {
383 u_header_T *ptr; /* pointer to next header for alt. redo */ 385 u_header_T *ptr; // pointer to next header for alt. redo
384 long seq; 386 long seq;
385 } uh_alt_next; 387 } uh_alt_next;
386 union { 388 union {
387 u_header_T *ptr; /* pointer to previous header for alt. redo */ 389 u_header_T *ptr; // pointer to previous header for alt. redo
388 long seq; 390 long seq;
389 } uh_alt_prev; 391 } uh_alt_prev;
390 long uh_seq; /* sequence number, higher == newer undo */ 392 long uh_seq; // sequence number, higher == newer undo
391 int uh_walk; /* used by undo_time() */ 393 int uh_walk; // used by undo_time()
392 u_entry_T *uh_entry; /* pointer to first entry */ 394 u_entry_T *uh_entry; // pointer to first entry
393 u_entry_T *uh_getbot_entry; /* pointer to where ue_bot must be set */ 395 u_entry_T *uh_getbot_entry; // pointer to where ue_bot must be set
394 pos_T uh_cursor; /* cursor position before saving */ 396 pos_T uh_cursor; // cursor position before saving
395 long uh_cursor_vcol; 397 long uh_cursor_vcol;
396 int uh_flags; /* see below */ 398 int uh_flags; // see below
397 pos_T uh_namedm[NMARKS]; /* marks before undo/after redo */ 399 pos_T uh_namedm[NMARKS]; // marks before undo/after redo
398 visualinfo_T uh_visual; /* Visual areas before undo/after redo */ 400 visualinfo_T uh_visual; // Visual areas before undo/after redo
399 time_T uh_time; /* timestamp when the change was made */ 401 time_T uh_time; // timestamp when the change was made
400 long uh_save_nr; /* set when the file was saved after the 402 long uh_save_nr; // set when the file was saved after the
401 changes in this block */ 403 // changes in this block
402 #ifdef U_DEBUG 404 #ifdef U_DEBUG
403 int uh_magic; /* magic number to check allocation */ 405 int uh_magic; // magic number to check allocation
404 #endif 406 #endif
405 }; 407 };
406 408
407 /* values for uh_flags */ 409 // values for uh_flags
408 #define UH_CHANGED 0x01 /* b_changed flag before undo/after redo */ 410 #define UH_CHANGED 0x01 // b_changed flag before undo/after redo
409 #define UH_EMPTYBUF 0x02 /* buffer was empty */ 411 #define UH_EMPTYBUF 0x02 // buffer was empty
410 412
411 /* 413 /*
412 * structures used in undo.c 414 * structures used in undo.c
413 */ 415 */
414 #define ALIGN_LONG /* longword alignment and use filler byte */ 416 #define ALIGN_LONG // longword alignment and use filler byte
415 #define ALIGN_SIZE (sizeof(long)) 417 #define ALIGN_SIZE (sizeof(long))
416 418
417 #define ALIGN_MASK (ALIGN_SIZE - 1) 419 #define ALIGN_MASK (ALIGN_SIZE - 1)
418 420
419 typedef struct m_info minfo_T; 421 typedef struct m_info minfo_T;
422 * structure used to link chunks in one of the free chunk lists. 424 * structure used to link chunks in one of the free chunk lists.
423 */ 425 */
424 struct m_info 426 struct m_info
425 { 427 {
426 #ifdef ALIGN_LONG 428 #ifdef ALIGN_LONG
427 long_u m_size; /* size of the chunk (including m_info) */ 429 long_u m_size; // size of the chunk (including m_info)
428 #else 430 #else
429 short_u m_size; /* size of the chunk (including m_info) */ 431 short_u m_size; // size of the chunk (including m_info)
430 #endif 432 #endif
431 minfo_T *m_next; /* pointer to next free chunk in the list */ 433 minfo_T *m_next; // pointer to next free chunk in the list
432 }; 434 };
433 435
434 /* 436 /*
435 * things used in memfile.c 437 * things used in memfile.c
436 */ 438 */
457 459
458 #define MHT_INIT_SIZE 64 460 #define MHT_INIT_SIZE 64
459 461
460 typedef struct mf_hashtab_S 462 typedef struct mf_hashtab_S
461 { 463 {
462 long_u mht_mask; /* mask used for hash value (nr of items 464 long_u mht_mask; // mask used for hash value (nr of items
463 * in array is "mht_mask" + 1) */ 465 // in array is "mht_mask" + 1)
464 long_u mht_count; /* nr of items inserted into hashtable */ 466 long_u mht_count; // nr of items inserted into hashtable
465 mf_hashitem_T **mht_buckets; /* points to mht_small_buckets or 467 mf_hashitem_T **mht_buckets; // points to mht_small_buckets or
466 *dynamically allocated array */ 468 //dynamically allocated array
467 mf_hashitem_T *mht_small_buckets[MHT_INIT_SIZE]; /* initial buckets */ 469 mf_hashitem_T *mht_small_buckets[MHT_INIT_SIZE]; // initial buckets
468 char mht_fixed; /* non-zero value forbids growth */ 470 char mht_fixed; // non-zero value forbids growth
469 } mf_hashtab_T; 471 } mf_hashtab_T;
470 472
471 /* 473 /*
472 * for each (previously) used block in the memfile there is one block header. 474 * for each (previously) used block in the memfile there is one block header.
473 * 475 *
483 * the contents of the block in the file (if any) is irrelevant. 485 * the contents of the block in the file (if any) is irrelevant.
484 */ 486 */
485 487
486 struct block_hdr 488 struct block_hdr
487 { 489 {
488 mf_hashitem_T bh_hashitem; /* header for hash table and key */ 490 mf_hashitem_T bh_hashitem; // header for hash table and key
489 #define bh_bnum bh_hashitem.mhi_key /* block number, part of bh_hashitem */ 491 #define bh_bnum bh_hashitem.mhi_key // block number, part of bh_hashitem
490 492
491 bhdr_T *bh_next; /* next block_hdr in free or used list */ 493 bhdr_T *bh_next; // next block_hdr in free or used list
492 bhdr_T *bh_prev; /* previous block_hdr in used list */ 494 bhdr_T *bh_prev; // previous block_hdr in used list
493 char_u *bh_data; /* pointer to memory (for used block) */ 495 char_u *bh_data; // pointer to memory (for used block)
494 int bh_page_count; /* number of pages in this block */ 496 int bh_page_count; // number of pages in this block
495 497
496 #define BH_DIRTY 1 498 #define BH_DIRTY 1
497 #define BH_LOCKED 2 499 #define BH_LOCKED 2
498 char bh_flags; /* BH_DIRTY or BH_LOCKED */ 500 char bh_flags; // BH_DIRTY or BH_LOCKED
499 }; 501 };
500 502
501 /* 503 /*
502 * when a block with a negative number is flushed to the file, it gets 504 * when a block with a negative number is flushed to the file, it gets
503 * a positive number. Because the reference to the block is still the negative 505 * a positive number. Because the reference to the block is still the negative
506 */ 508 */
507 typedef struct nr_trans NR_TRANS; 509 typedef struct nr_trans NR_TRANS;
508 510
509 struct nr_trans 511 struct nr_trans
510 { 512 {
511 mf_hashitem_T nt_hashitem; /* header for hash table and key */ 513 mf_hashitem_T nt_hashitem; // header for hash table and key
512 #define nt_old_bnum nt_hashitem.mhi_key /* old, negative, number */ 514 #define nt_old_bnum nt_hashitem.mhi_key // old, negative, number
513 515
514 blocknr_T nt_new_bnum; /* new, positive, number */ 516 blocknr_T nt_new_bnum; // new, positive, number
515 }; 517 };
516 518
517 519
518 typedef struct buffblock buffblock_T; 520 typedef struct buffblock buffblock_T;
519 typedef struct buffheader buffheader_T; 521 typedef struct buffheader buffheader_T;
521 /* 523 /*
522 * structure used to store one block of the stuff/redo/recording buffers 524 * structure used to store one block of the stuff/redo/recording buffers
523 */ 525 */
524 struct buffblock 526 struct buffblock
525 { 527 {
526 buffblock_T *b_next; /* pointer to next buffblock */ 528 buffblock_T *b_next; // pointer to next buffblock
527 char_u b_str[1]; /* contents (actually longer) */ 529 char_u b_str[1]; // contents (actually longer)
528 }; 530 };
529 531
530 /* 532 /*
531 * header used for the stuff buffer and the redo buffer 533 * header used for the stuff buffer and the redo buffer
532 */ 534 */
533 struct buffheader 535 struct buffheader
534 { 536 {
535 buffblock_T bh_first; /* first (dummy) block of list */ 537 buffblock_T bh_first; // first (dummy) block of list
536 buffblock_T *bh_curr; /* buffblock for appending */ 538 buffblock_T *bh_curr; // buffblock for appending
537 int bh_index; /* index for reading */ 539 int bh_index; // index for reading
538 int bh_space; /* space in bh_curr for appending */ 540 int bh_space; // space in bh_curr for appending
539 }; 541 };
540 542
541 typedef struct 543 typedef struct
542 { 544 {
543 buffheader_T sr_redobuff; 545 buffheader_T sr_redobuff;
547 /* 549 /*
548 * used for completion on the command line 550 * used for completion on the command line
549 */ 551 */
550 typedef struct expand 552 typedef struct expand
551 { 553 {
552 int xp_context; /* type of expansion */ 554 int xp_context; // type of expansion
553 char_u *xp_pattern; /* start of item to expand */ 555 char_u *xp_pattern; // start of item to expand
554 int xp_pattern_len; /* bytes in xp_pattern before cursor */ 556 int xp_pattern_len; // bytes in xp_pattern before cursor
555 #if defined(FEAT_EVAL) && defined(FEAT_CMDL_COMPL) 557 #if defined(FEAT_EVAL) && defined(FEAT_CMDL_COMPL)
556 char_u *xp_arg; /* completion function */ 558 char_u *xp_arg; // completion function
557 sctx_T xp_script_ctx; /* SCTX for completion function */ 559 sctx_T xp_script_ctx; // SCTX for completion function
558 #endif 560 #endif
559 int xp_backslash; /* one of the XP_BS_ values */ 561 int xp_backslash; // one of the XP_BS_ values
560 #ifndef BACKSLASH_IN_FILENAME 562 #ifndef BACKSLASH_IN_FILENAME
561 int xp_shell; /* TRUE for a shell command, more 563 int xp_shell; // TRUE for a shell command, more
562 characters need to be escaped */ 564 // characters need to be escaped
563 #endif 565 #endif
564 int xp_numfiles; /* number of files found by 566 int xp_numfiles; // number of files found by
565 file name completion */ 567 // file name completion
566 char_u **xp_files; /* list of files */ 568 char_u **xp_files; // list of files
567 char_u *xp_line; /* text being completed */ 569 char_u *xp_line; // text being completed
568 int xp_col; /* cursor position in line */ 570 int xp_col; // cursor position in line
569 } expand_T; 571 } expand_T;
570 572
571 /* values for xp_backslash */ 573 /*
572 #define XP_BS_NONE 0 /* nothing special for backslashes */ 574 * values for xp_backslash
573 #define XP_BS_ONE 1 /* uses one backslash before a space */ 575 */
574 #define XP_BS_THREE 2 /* uses three backslashes before a space */ 576 #define XP_BS_NONE 0 // nothing special for backslashes
577 #define XP_BS_ONE 1 // uses one backslash before a space
578 #define XP_BS_THREE 2 // uses three backslashes before a space
575 579
576 /* 580 /*
577 * Command modifiers ":vertical", ":browse", ":confirm" and ":hide" set a flag. 581 * Command modifiers ":vertical", ":browse", ":confirm" and ":hide" set a flag.
578 * This needs to be saved for recursive commands, put them in a structure for 582 * This needs to be saved for recursive commands, put them in a structure for
579 * easy manipulation. 583 * easy manipulation.
580 */ 584 */
581 typedef struct 585 typedef struct
582 { 586 {
583 int hide; /* TRUE when ":hide" was used */ 587 int hide; // TRUE when ":hide" was used
584 # ifdef FEAT_BROWSE_CMD 588 # ifdef FEAT_BROWSE_CMD
585 int browse; /* TRUE to invoke file dialog */ 589 int browse; // TRUE to invoke file dialog
586 # endif 590 # endif
587 int split; /* flags for win_split() */ 591 int split; // flags for win_split()
588 int tab; /* > 0 when ":tab" was used */ 592 int tab; // > 0 when ":tab" was used
589 # if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG) 593 # if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG)
590 int confirm; /* TRUE to invoke yes/no dialog */ 594 int confirm; // TRUE to invoke yes/no dialog
591 # endif 595 # endif
592 int keepalt; /* TRUE when ":keepalt" was used */ 596 int keepalt; // TRUE when ":keepalt" was used
593 int keepmarks; /* TRUE when ":keepmarks" was used */ 597 int keepmarks; // TRUE when ":keepmarks" was used
594 int keepjumps; /* TRUE when ":keepjumps" was used */ 598 int keepjumps; // TRUE when ":keepjumps" was used
595 int lockmarks; /* TRUE when ":lockmarks" was used */ 599 int lockmarks; // TRUE when ":lockmarks" was used
596 int keeppatterns; /* TRUE when ":keeppatterns" was used */ 600 int keeppatterns; // TRUE when ":keeppatterns" was used
597 int noswapfile; /* TRUE when ":noswapfile" was used */ 601 int noswapfile; // TRUE when ":noswapfile" was used
598 char_u *save_ei; /* saved value of 'eventignore' */ 602 char_u *save_ei; // saved value of 'eventignore'
599 regmatch_T filter_regmatch; /* set by :filter /pat/ */ 603 regmatch_T filter_regmatch; // set by :filter /pat/
600 int filter_force; /* set for :filter! */ 604 int filter_force; // set for :filter!
601 } cmdmod_T; 605 } cmdmod_T;
602 606
603 #define MF_SEED_LEN 8 607 #define MF_SEED_LEN 8
604 608
605 struct memfile 609 struct memfile
642 * are the branches leading to that block. This is stored in ml_stack. Each 646 * are the branches leading to that block. This is stored in ml_stack. Each
643 * entry is a pointer to info in a block (may be data block or pointer block) 647 * entry is a pointer to info in a block (may be data block or pointer block)
644 */ 648 */
645 typedef struct info_pointer 649 typedef struct info_pointer
646 { 650 {
647 blocknr_T ip_bnum; /* block number */ 651 blocknr_T ip_bnum; // block number
648 linenr_T ip_low; /* lowest lnum in this block */ 652 linenr_T ip_low; // lowest lnum in this block
649 linenr_T ip_high; /* highest lnum in this block */ 653 linenr_T ip_high; // highest lnum in this block
650 int ip_index; /* index for block with current lnum */ 654 int ip_index; // index for block with current lnum
651 } infoptr_T; /* block/index pair */ 655 } infoptr_T; // block/index pair
652 656
653 #ifdef FEAT_BYTEOFF 657 #ifdef FEAT_BYTEOFF
654 typedef struct ml_chunksize 658 typedef struct ml_chunksize
655 { 659 {
656 int mlcs_numlines; 660 int mlcs_numlines;
657 long mlcs_totalsize; 661 long mlcs_totalsize;
658 } chunksize_T; 662 } chunksize_T;
659 663
660 /* Flags when calling ml_updatechunk() */ 664 /*
661 665 * Flags when calling ml_updatechunk()
662 #define ML_CHNK_ADDLINE 1 666 */
663 #define ML_CHNK_DELLINE 2 667 # define ML_CHNK_ADDLINE 1
664 #define ML_CHNK_UPDLINE 3 668 # define ML_CHNK_DELLINE 2
669 # define ML_CHNK_UPDLINE 3
665 #endif 670 #endif
666 671
667 /* 672 /*
668 * the memline structure holds all the information about a memline 673 * the memline structure holds all the information about a memline
669 */ 674 */
670 typedef struct memline 675 typedef struct memline
671 { 676 {
672 linenr_T ml_line_count; /* number of lines in the buffer */ 677 linenr_T ml_line_count; // number of lines in the buffer
673 678
674 memfile_T *ml_mfp; /* pointer to associated memfile */ 679 memfile_T *ml_mfp; // pointer to associated memfile
675 680
676 #define ML_EMPTY 1 /* empty buffer */ 681 #define ML_EMPTY 1 // empty buffer
677 #define ML_LINE_DIRTY 2 /* cached line was changed and allocated */ 682 #define ML_LINE_DIRTY 2 // cached line was changed and allocated
678 #define ML_LOCKED_DIRTY 4 /* ml_locked was changed */ 683 #define ML_LOCKED_DIRTY 4 // ml_locked was changed
679 #define ML_LOCKED_POS 8 /* ml_locked needs positive block number */ 684 #define ML_LOCKED_POS 8 // ml_locked needs positive block number
680 int ml_flags; 685 int ml_flags;
681 686
682 infoptr_T *ml_stack; /* stack of pointer blocks (array of IPTRs) */ 687 infoptr_T *ml_stack; // stack of pointer blocks (array of IPTRs)
683 int ml_stack_top; /* current top of ml_stack */ 688 int ml_stack_top; // current top of ml_stack
684 int ml_stack_size; /* total number of entries in ml_stack */ 689 int ml_stack_size; // total number of entries in ml_stack
685 690
686 linenr_T ml_line_lnum; /* line number of cached line, 0 if not valid */ 691 linenr_T ml_line_lnum; // line number of cached line, 0 if not valid
687 char_u *ml_line_ptr; /* pointer to cached line */ 692 char_u *ml_line_ptr; // pointer to cached line
688 colnr_T ml_line_len; /* length of the cached line, including NUL */ 693 colnr_T ml_line_len; // length of the cached line, including NUL
689 694
690 bhdr_T *ml_locked; /* block used by last ml_get */ 695 bhdr_T *ml_locked; // block used by last ml_get
691 linenr_T ml_locked_low; /* first line in ml_locked */ 696 linenr_T ml_locked_low; // first line in ml_locked
692 linenr_T ml_locked_high; /* last line in ml_locked */ 697 linenr_T ml_locked_high; // last line in ml_locked
693 int ml_locked_lineadd; /* number of lines inserted in ml_locked */ 698 int ml_locked_lineadd; // number of lines inserted in ml_locked
694 #ifdef FEAT_BYTEOFF 699 #ifdef FEAT_BYTEOFF
695 chunksize_T *ml_chunksize; 700 chunksize_T *ml_chunksize;
696 int ml_numchunks; 701 int ml_numchunks;
697 int ml_usedchunks; 702 int ml_usedchunks;
698 #endif 703 #endif
743 748
744 typedef struct signlist signlist_T; 749 typedef struct signlist signlist_T;
745 750
746 struct signlist 751 struct signlist
747 { 752 {
748 int id; /* unique identifier for each placed sign */ 753 int id; // unique identifier for each placed sign
749 linenr_T lnum; /* line number which has this sign */ 754 linenr_T lnum; // line number which has this sign
750 int typenr; /* typenr of sign */ 755 int typenr; // typenr of sign
751 signgroup_T *group; /* sign group */ 756 signgroup_T *group; // sign group
752 int priority; /* priority for highlighting */ 757 int priority; // priority for highlighting
753 signlist_T *next; /* next signlist entry */ 758 signlist_T *next; // next signlist entry
754 signlist_T *prev; /* previous entry -- for easy reordering */ 759 signlist_T *prev; // previous entry -- for easy reordering
755 }; 760 };
756 761
757 #if defined(FEAT_SIGNS) || defined(PROTO) 762 #if defined(FEAT_SIGNS) || defined(PROTO)
758 // Macros to get the sign group structure from the group name 763 // Macros to get the sign group structure from the group name
759 #define SGN_KEY_OFF offsetof(signgroup_T, sg_name) 764 #define SGN_KEY_OFF offsetof(signgroup_T, sg_name)
773 * Argument list: Array of file names. 778 * Argument list: Array of file names.
774 * Used for the global argument list and the argument lists local to a window. 779 * Used for the global argument list and the argument lists local to a window.
775 */ 780 */
776 typedef struct arglist 781 typedef struct arglist
777 { 782 {
778 garray_T al_ga; /* growarray with the array of file names */ 783 garray_T al_ga; // growarray with the array of file names
779 int al_refcount; /* number of windows using this arglist */ 784 int al_refcount; // number of windows using this arglist
780 int id; /* id of this arglist */ 785 int id; // id of this arglist
781 } alist_T; 786 } alist_T;
782 787
783 /* 788 /*
784 * For each argument remember the file name as it was given, and the buffer 789 * For each argument remember the file name as it was given, and the buffer
785 * number that contains the expanded file name (required for when ":cd" is 790 * number that contains the expanded file name (required for when ":cd" is
786 * used. 791 * used.
787 */ 792 */
788 typedef struct argentry 793 typedef struct argentry
789 { 794 {
790 char_u *ae_fname; /* file name as specified */ 795 char_u *ae_fname; // file name as specified
791 int ae_fnum; /* buffer number with expanded file name */ 796 int ae_fnum; // buffer number with expanded file name
792 } aentry_T; 797 } aentry_T;
793 798
794 #define ALIST(win) (win)->w_alist 799 #define ALIST(win) (win)->w_alist
795 #define GARGLIST ((aentry_T *)global_alist.al_ga.ga_data) 800 #define GARGLIST ((aentry_T *)global_alist.al_ga.ga_data)
796 #define ARGLIST ((aentry_T *)ALIST(curwin)->al_ga.ga_data) 801 #define ARGLIST ((aentry_T *)ALIST(curwin)->al_ga.ga_data)
807 */ 812 */
808 813
809 typedef struct eslist_elem eslist_T; 814 typedef struct eslist_elem eslist_T;
810 struct eslist_elem 815 struct eslist_elem
811 { 816 {
812 int saved_emsg_silent; /* saved value of "emsg_silent" */ 817 int saved_emsg_silent; // saved value of "emsg_silent"
813 eslist_T *next; /* next element on the list */ 818 eslist_T *next; // next element on the list
814 }; 819 };
815 820
816 /* 821 /*
817 * For conditional commands a stack is kept of nested conditionals. 822 * For conditional commands a stack is kept of nested conditionals.
818 * When cs_idx < 0, there is no conditional command. 823 * When cs_idx < 0, there is no conditional command.
819 */ 824 */
820 #define CSTACK_LEN 50 825 #define CSTACK_LEN 50
821 826
822 struct condstack 827 struct condstack
823 { 828 {
824 short cs_flags[CSTACK_LEN]; /* CSF_ flags */ 829 short cs_flags[CSTACK_LEN]; // CSF_ flags
825 char cs_pending[CSTACK_LEN]; /* CSTP_: what's pending in ":finally"*/ 830 char cs_pending[CSTACK_LEN]; // CSTP_: what's pending in ":finally"
826 union { 831 union {
827 void *csp_rv[CSTACK_LEN]; /* return typeval for pending return */ 832 void *csp_rv[CSTACK_LEN]; // return typeval for pending return
828 void *csp_ex[CSTACK_LEN]; /* exception for pending throw */ 833 void *csp_ex[CSTACK_LEN]; // exception for pending throw
829 } cs_pend; 834 } cs_pend;
830 void *cs_forinfo[CSTACK_LEN]; /* info used by ":for" */ 835 void *cs_forinfo[CSTACK_LEN]; // info used by ":for"
831 int cs_line[CSTACK_LEN]; /* line nr of ":while"/":for" line */ 836 int cs_line[CSTACK_LEN]; // line nr of ":while"/":for" line
832 int cs_idx; /* current entry, or -1 if none */ 837 int cs_idx; // current entry, or -1 if none
833 int cs_looplevel; /* nr of nested ":while"s and ":for"s */ 838 int cs_looplevel; // nr of nested ":while"s and ":for"s
834 int cs_trylevel; /* nr of nested ":try"s */ 839 int cs_trylevel; // nr of nested ":try"s
835 eslist_T *cs_emsg_silent_list; /* saved values of "emsg_silent" */ 840 eslist_T *cs_emsg_silent_list; // saved values of "emsg_silent"
836 char cs_lflags; /* loop flags: CSL_ flags */ 841 char cs_lflags; // loop flags: CSL_ flags
837 }; 842 };
838 # define cs_rettv cs_pend.csp_rv 843 # define cs_rettv cs_pend.csp_rv
839 # define cs_exception cs_pend.csp_ex 844 # define cs_exception cs_pend.csp_ex
840 845
841 /* There is no CSF_IF, the lack of CSF_WHILE, CSF_FOR and CSF_TRY means ":if" 846 // There is no CSF_IF, the lack of CSF_WHILE, CSF_FOR and CSF_TRY means ":if"
842 * was used. */ 847 // was used.
843 # define CSF_TRUE 0x0001 /* condition was TRUE */ 848 # define CSF_TRUE 0x0001 // condition was TRUE
844 # define CSF_ACTIVE 0x0002 /* current state is active */ 849 # define CSF_ACTIVE 0x0002 // current state is active
845 # define CSF_ELSE 0x0004 /* ":else" has been passed */ 850 # define CSF_ELSE 0x0004 // ":else" has been passed
846 # define CSF_WHILE 0x0008 /* is a ":while" */ 851 # define CSF_WHILE 0x0008 // is a ":while"
847 # define CSF_FOR 0x0010 /* is a ":for" */ 852 # define CSF_FOR 0x0010 // is a ":for"
848 853
849 # define CSF_TRY 0x0100 /* is a ":try" */ 854 # define CSF_TRY 0x0100 // is a ":try"
850 # define CSF_FINALLY 0x0200 /* ":finally" has been passed */ 855 # define CSF_FINALLY 0x0200 // ":finally" has been passed
851 # define CSF_THROWN 0x0400 /* exception thrown to this try conditional */ 856 # define CSF_THROWN 0x0400 // exception thrown to this try conditional
852 # define CSF_CAUGHT 0x0800 /* exception caught by this try conditional */ 857 # define CSF_CAUGHT 0x0800 // exception caught by this try conditional
853 # define CSF_SILENT 0x1000 /* "emsg_silent" reset by ":try" */ 858 # define CSF_SILENT 0x1000 // "emsg_silent" reset by ":try"
854 /* Note that CSF_ELSE is only used when CSF_TRY and CSF_WHILE are unset 859 // Note that CSF_ELSE is only used when CSF_TRY and CSF_WHILE are unset
855 * (an ":if"), and CSF_SILENT is only used when CSF_TRY is set. */ 860 // (an ":if"), and CSF_SILENT is only used when CSF_TRY is set.
856 861
857 /* 862 /*
858 * What's pending for being reactivated at the ":endtry" of this try 863 * What's pending for being reactivated at the ":endtry" of this try
859 * conditional: 864 * conditional:
860 */ 865 */
861 # define CSTP_NONE 0 /* nothing pending in ":finally" clause */ 866 # define CSTP_NONE 0 // nothing pending in ":finally" clause
862 # define CSTP_ERROR 1 /* an error is pending */ 867 # define CSTP_ERROR 1 // an error is pending
863 # define CSTP_INTERRUPT 2 /* an interrupt is pending */ 868 # define CSTP_INTERRUPT 2 // an interrupt is pending
864 # define CSTP_THROW 4 /* a throw is pending */ 869 # define CSTP_THROW 4 // a throw is pending
865 # define CSTP_BREAK 8 /* ":break" is pending */ 870 # define CSTP_BREAK 8 // ":break" is pending
866 # define CSTP_CONTINUE 16 /* ":continue" is pending */ 871 # define CSTP_CONTINUE 16 // ":continue" is pending
867 # define CSTP_RETURN 24 /* ":return" is pending */ 872 # define CSTP_RETURN 24 // ":return" is pending
868 # define CSTP_FINISH 32 /* ":finish" is pending */ 873 # define CSTP_FINISH 32 // ":finish" is pending
869 874
870 /* 875 /*
871 * Flags for the cs_lflags item in struct condstack. 876 * Flags for the cs_lflags item in struct condstack.
872 */ 877 */
873 # define CSL_HAD_LOOP 1 /* just found ":while" or ":for" */ 878 # define CSL_HAD_LOOP 1 // just found ":while" or ":for"
874 # define CSL_HAD_ENDLOOP 2 /* just found ":endwhile" or ":endfor" */ 879 # define CSL_HAD_ENDLOOP 2 // just found ":endwhile" or ":endfor"
875 # define CSL_HAD_CONT 4 /* just found ":continue" */ 880 # define CSL_HAD_CONT 4 // just found ":continue"
876 # define CSL_HAD_FINA 8 /* just found ":finally" */ 881 # define CSL_HAD_FINA 8 // just found ":finally"
877 882
878 /* 883 /*
879 * A list of error messages that can be converted to an exception. "throw_msg" 884 * A list of error messages that can be converted to an exception. "throw_msg"
880 * is only set in the first element of the list. Usually, it points to the 885 * is only set in the first element of the list. Usually, it points to the
881 * original message stored in that element, but sometimes it points to a later 886 * original message stored in that element, but sometimes it points to a later
882 * message in the list. See cause_errthrow() below. 887 * message in the list. See cause_errthrow() below.
883 */ 888 */
884 struct msglist 889 struct msglist
885 { 890 {
886 char *msg; /* original message */ 891 char *msg; // original message
887 char *throw_msg; /* msg to throw: usually original one */ 892 char *throw_msg; // msg to throw: usually original one
888 struct msglist *next; /* next of several messages in a row */ 893 struct msglist *next; // next of several messages in a row
889 }; 894 };
890 895
891 /* 896 /*
892 * The exception types. 897 * The exception types.
893 */ 898 */
903 * (don't use "struct exception", it's used by the math library). 908 * (don't use "struct exception", it's used by the math library).
904 */ 909 */
905 typedef struct vim_exception except_T; 910 typedef struct vim_exception except_T;
906 struct vim_exception 911 struct vim_exception
907 { 912 {
908 except_type_T type; /* exception type */ 913 except_type_T type; // exception type
909 char *value; /* exception value */ 914 char *value; // exception value
910 struct msglist *messages; /* message(s) causing error exception */ 915 struct msglist *messages; // message(s) causing error exception
911 char_u *throw_name; /* name of the throw point */ 916 char_u *throw_name; // name of the throw point
912 linenr_T throw_lnum; /* line number of the throw point */ 917 linenr_T throw_lnum; // line number of the throw point
913 except_T *caught; /* next exception on the caught stack */ 918 except_T *caught; // next exception on the caught stack
914 }; 919 };
915 920
916 /* 921 /*
917 * Structure to save the error/interrupt/exception state between calls to 922 * Structure to save the error/interrupt/exception state between calls to
918 * enter_cleanup() and leave_cleanup(). Must be allocated as an automatic 923 * enter_cleanup() and leave_cleanup(). Must be allocated as an automatic
919 * variable by the (common) caller of these functions. 924 * variable by the (common) caller of these functions.
920 */ 925 */
921 typedef struct cleanup_stuff cleanup_T; 926 typedef struct cleanup_stuff cleanup_T;
922 struct cleanup_stuff 927 struct cleanup_stuff
923 { 928 {
924 int pending; /* error/interrupt/exception state */ 929 int pending; // error/interrupt/exception state
925 except_T *exception; /* exception value */ 930 except_T *exception; // exception value
926 }; 931 };
927 932
928 #ifdef FEAT_SYN_HL 933 #ifdef FEAT_SYN_HL
929 /* struct passed to in_id_list() */ 934 // struct passed to in_id_list()
930 struct sp_syn 935 struct sp_syn
931 { 936 {
932 int inc_tag; /* ":syn include" unique tag */ 937 int inc_tag; // ":syn include" unique tag
933 short id; /* highlight group ID of item */ 938 short id; // highlight group ID of item
934 short *cont_in_list; /* cont.in group IDs, if non-zero */ 939 short *cont_in_list; // cont.in group IDs, if non-zero
935 }; 940 };
936 941
937 /* 942 /*
938 * Each keyword has one keyentry, which is linked in a hash list. 943 * Each keyword has one keyentry, which is linked in a hash list.
939 */ 944 */
940 typedef struct keyentry keyentry_T; 945 typedef struct keyentry keyentry_T;
941 946
942 struct keyentry 947 struct keyentry
943 { 948 {
944 keyentry_T *ke_next; /* next entry with identical "keyword[]" */ 949 keyentry_T *ke_next; // next entry with identical "keyword[]"
945 struct sp_syn k_syn; /* struct passed to in_id_list() */ 950 struct sp_syn k_syn; // struct passed to in_id_list()
946 short *next_list; /* ID list for next match (if non-zero) */ 951 short *next_list; // ID list for next match (if non-zero)
947 int flags; 952 int flags;
948 int k_char; /* conceal substitute character */ 953 int k_char; // conceal substitute character
949 char_u keyword[1]; /* actually longer */ 954 char_u keyword[1]; // actually longer
950 }; 955 };
951 956
952 /* 957 /*
953 * Struct used to store one state of the state stack. 958 * Struct used to store one state of the state stack.
954 */ 959 */
955 typedef struct buf_state 960 typedef struct buf_state
956 { 961 {
957 int bs_idx; /* index of pattern */ 962 int bs_idx; // index of pattern
958 int bs_flags; /* flags for pattern */ 963 int bs_flags; // flags for pattern
959 #ifdef FEAT_CONCEAL 964 #ifdef FEAT_CONCEAL
960 int bs_seqnr; /* stores si_seqnr */ 965 int bs_seqnr; // stores si_seqnr
961 int bs_cchar; /* stores si_cchar */ 966 int bs_cchar; // stores si_cchar
962 #endif 967 #endif
963 reg_extmatch_T *bs_extmatch; /* external matches from start pattern */ 968 reg_extmatch_T *bs_extmatch; // external matches from start pattern
964 } bufstate_T; 969 } bufstate_T;
965 970
966 /* 971 /*
967 * syn_state contains the syntax state stack for the start of one line. 972 * syn_state contains the syntax state stack for the start of one line.
968 * Used by b_sst_array[]. 973 * Used by b_sst_array[].
969 */ 974 */
970 typedef struct syn_state synstate_T; 975 typedef struct syn_state synstate_T;
971 976
972 struct syn_state 977 struct syn_state
973 { 978 {
974 synstate_T *sst_next; /* next entry in used or free list */ 979 synstate_T *sst_next; // next entry in used or free list
975 linenr_T sst_lnum; /* line number for this state */ 980 linenr_T sst_lnum; // line number for this state
976 union 981 union
977 { 982 {
978 bufstate_T sst_stack[SST_FIX_STATES]; /* short state stack */ 983 bufstate_T sst_stack[SST_FIX_STATES]; // short state stack
979 garray_T sst_ga; /* growarray for long state stack */ 984 garray_T sst_ga; // growarray for long state stack
980 } sst_union; 985 } sst_union;
981 int sst_next_flags; /* flags for sst_next_list */ 986 int sst_next_flags; // flags for sst_next_list
982 int sst_stacksize; /* number of states on the stack */ 987 int sst_stacksize; // number of states on the stack
983 short *sst_next_list; /* "nextgroup" list in this state 988 short *sst_next_list; // "nextgroup" list in this state
984 * (this is a copy, don't free it! */ 989 // (this is a copy, don't free it!
985 disptick_T sst_tick; /* tick when last displayed */ 990 disptick_T sst_tick; // tick when last displayed
986 linenr_T sst_change_lnum;/* when non-zero, change in this line 991 linenr_T sst_change_lnum;// when non-zero, change in this line
987 * may have made the state invalid */ 992 // may have made the state invalid
988 }; 993 };
989 #endif /* FEAT_SYN_HL */ 994 #endif // FEAT_SYN_HL
990 995
991 /* 996 /*
992 * Structure shared between syntax.c, screen.c and gui_x11.c. 997 * Structure shared between syntax.c, screen.c and gui_x11.c.
993 */ 998 */
994 typedef struct attr_entry 999 typedef struct attr_entry
995 { 1000 {
996 short ae_attr; /* HL_BOLD, etc. */ 1001 short ae_attr; // HL_BOLD, etc.
997 union 1002 union
998 { 1003 {
999 struct 1004 struct
1000 { 1005 {
1001 char_u *start; /* start escape sequence */ 1006 char_u *start; // start escape sequence
1002 char_u *stop; /* stop escape sequence */ 1007 char_u *stop; // stop escape sequence
1003 } term; 1008 } term;
1004 struct 1009 struct
1005 { 1010 {
1006 /* These colors need to be > 8 bits to hold 256. */ 1011 // These colors need to be > 8 bits to hold 256.
1007 short_u fg_color; /* foreground color number */ 1012 short_u fg_color; // foreground color number
1008 short_u bg_color; /* background color number */ 1013 short_u bg_color; // background color number
1009 # ifdef FEAT_TERMGUICOLORS 1014 # ifdef FEAT_TERMGUICOLORS
1010 guicolor_T fg_rgb; /* foreground color RGB */ 1015 guicolor_T fg_rgb; // foreground color RGB
1011 guicolor_T bg_rgb; /* background color RGB */ 1016 guicolor_T bg_rgb; // background color RGB
1012 # endif 1017 # endif
1013 } cterm; 1018 } cterm;
1014 # ifdef FEAT_GUI 1019 # ifdef FEAT_GUI
1015 struct 1020 struct
1016 { 1021 {
1017 guicolor_T fg_color; /* foreground color handle */ 1022 guicolor_T fg_color; // foreground color handle
1018 guicolor_T bg_color; /* background color handle */ 1023 guicolor_T bg_color; // background color handle
1019 guicolor_T sp_color; /* special color handle */ 1024 guicolor_T sp_color; // special color handle
1020 GuiFont font; /* font handle */ 1025 GuiFont font; // font handle
1021 # ifdef FEAT_XFONTSET 1026 # ifdef FEAT_XFONTSET
1022 GuiFontset fontset; /* fontset handle */ 1027 GuiFontset fontset; // fontset handle
1023 # endif 1028 # endif
1024 } gui; 1029 } gui;
1025 # endif 1030 # endif
1026 } ae_u; 1031 } ae_u;
1027 } attrentry_T; 1032 } attrentry_T;
1031 # include <iconv.h> 1036 # include <iconv.h>
1032 # else 1037 # else
1033 # if defined(MACOS_X) 1038 # if defined(MACOS_X)
1034 # include <sys/errno.h> 1039 # include <sys/errno.h>
1035 # ifndef EILSEQ 1040 # ifndef EILSEQ
1036 # define EILSEQ ENOENT /* Early MacOS X does not have EILSEQ */ 1041 # define EILSEQ ENOENT // Early MacOS X does not have EILSEQ
1037 # endif 1042 # endif
1038 typedef struct _iconv_t *iconv_t; 1043 typedef struct _iconv_t *iconv_t;
1039 # else 1044 # else
1040 # include <errno.h> 1045 # include <errno.h>
1041 # endif 1046 # endif
1046 /* 1051 /*
1047 * Used for the typeahead buffer: typebuf. 1052 * Used for the typeahead buffer: typebuf.
1048 */ 1053 */
1049 typedef struct 1054 typedef struct
1050 { 1055 {
1051 char_u *tb_buf; /* buffer for typed characters */ 1056 char_u *tb_buf; // buffer for typed characters
1052 char_u *tb_noremap; /* mapping flags for characters in tb_buf[] */ 1057 char_u *tb_noremap; // mapping flags for characters in tb_buf[]
1053 int tb_buflen; /* size of tb_buf[] */ 1058 int tb_buflen; // size of tb_buf[]
1054 int tb_off; /* current position in tb_buf[] */ 1059 int tb_off; // current position in tb_buf[]
1055 int tb_len; /* number of valid bytes in tb_buf[] */ 1060 int tb_len; // number of valid bytes in tb_buf[]
1056 int tb_maplen; /* nr of mapped bytes in tb_buf[] */ 1061 int tb_maplen; // nr of mapped bytes in tb_buf[]
1057 int tb_silent; /* nr of silently mapped bytes in tb_buf[] */ 1062 int tb_silent; // nr of silently mapped bytes in tb_buf[]
1058 int tb_no_abbr_cnt; /* nr of bytes without abbrev. in tb_buf[] */ 1063 int tb_no_abbr_cnt; // nr of bytes without abbrev. in tb_buf[]
1059 int tb_change_cnt; /* nr of time tb_buf was changed; never zero */ 1064 int tb_change_cnt; // nr of time tb_buf was changed; never zero
1060 } typebuf_T; 1065 } typebuf_T;
1061 1066
1062 /* Struct to hold the saved typeahead for save_typeahead(). */ 1067 /* Struct to hold the saved typeahead for save_typeahead(). */
1063 typedef struct 1068 typedef struct
1064 { 1069 {
1065 typebuf_T save_typebuf; 1070 typebuf_T save_typebuf;
1066 int typebuf_valid; /* TRUE when save_typebuf valid */ 1071 int typebuf_valid; // TRUE when save_typebuf valid
1067 int old_char; 1072 int old_char;
1068 int old_mod_mask; 1073 int old_mod_mask;
1069 buffheader_T save_readbuf1; 1074 buffheader_T save_readbuf1;
1070 buffheader_T save_readbuf2; 1075 buffheader_T save_readbuf2;
1071 #ifdef USE_INPUT_BUF 1076 #ifdef USE_INPUT_BUF
1076 /* 1081 /*
1077 * Used for conversion of terminal I/O and script files. 1082 * Used for conversion of terminal I/O and script files.
1078 */ 1083 */
1079 typedef struct 1084 typedef struct
1080 { 1085 {
1081 int vc_type; /* zero or one of the CONV_ values */ 1086 int vc_type; // zero or one of the CONV_ values
1082 int vc_factor; /* max. expansion factor */ 1087 int vc_factor; // max. expansion factor
1083 # ifdef MSWIN 1088 # ifdef MSWIN
1084 int vc_cpfrom; /* codepage to convert from (CONV_CODEPAGE) */ 1089 int vc_cpfrom; // codepage to convert from (CONV_CODEPAGE)
1085 int vc_cpto; /* codepage to convert to (CONV_CODEPAGE) */ 1090 int vc_cpto; // codepage to convert to (CONV_CODEPAGE)
1086 # endif 1091 # endif
1087 # ifdef USE_ICONV 1092 # ifdef USE_ICONV
1088 iconv_t vc_fd; /* for CONV_ICONV */ 1093 iconv_t vc_fd; // for CONV_ICONV
1089 # endif 1094 # endif
1090 int vc_fail; /* fail for invalid char, don't use '?' */ 1095 int vc_fail; // fail for invalid char, don't use '?'
1091 } vimconv_T; 1096 } vimconv_T;
1092 1097
1093 /* 1098 /*
1094 * Structure used for reading from the viminfo file. 1099 * Structure used for reading from the viminfo file.
1095 */ 1100 */
1096 typedef struct 1101 typedef struct
1097 { 1102 {
1098 char_u *vir_line; /* text of the current line */ 1103 char_u *vir_line; // text of the current line
1099 FILE *vir_fd; /* file descriptor */ 1104 FILE *vir_fd; // file descriptor
1100 vimconv_T vir_conv; /* encoding conversion */ 1105 vimconv_T vir_conv; // encoding conversion
1101 int vir_version; /* viminfo version detected or -1 */ 1106 int vir_version; // viminfo version detected or -1
1102 garray_T vir_barlines; /* lines starting with | */ 1107 garray_T vir_barlines; // lines starting with |
1103 } vir_T; 1108 } vir_T;
1104 1109
1105 #define CONV_NONE 0 1110 #define CONV_NONE 0
1106 #define CONV_TO_UTF8 1 1111 #define CONV_TO_UTF8 1
1107 #define CONV_9_TO_UTF8 2 1112 #define CONV_9_TO_UTF8 2
1108 #define CONV_TO_LATIN1 3 1113 #define CONV_TO_LATIN1 3
1109 #define CONV_TO_LATIN9 4 1114 #define CONV_TO_LATIN9 4
1110 #define CONV_ICONV 5 1115 #define CONV_ICONV 5
1111 #ifdef MSWIN 1116 #ifdef MSWIN
1112 # define CONV_CODEPAGE 10 /* codepage -> codepage */ 1117 # define CONV_CODEPAGE 10 // codepage -> codepage
1113 #endif 1118 #endif
1114 #ifdef MACOS_X 1119 #ifdef MACOS_X
1115 # define CONV_MAC_LATIN1 20 1120 # define CONV_MAC_LATIN1 20
1116 # define CONV_LATIN1_MAC 21 1121 # define CONV_LATIN1_MAC 21
1117 # define CONV_MAC_UTF8 22 1122 # define CONV_MAC_UTF8 22
1122 * Structure used for mappings and abbreviations. 1127 * Structure used for mappings and abbreviations.
1123 */ 1128 */
1124 typedef struct mapblock mapblock_T; 1129 typedef struct mapblock mapblock_T;
1125 struct mapblock 1130 struct mapblock
1126 { 1131 {
1127 mapblock_T *m_next; /* next mapblock in list */ 1132 mapblock_T *m_next; // next mapblock in list
1128 char_u *m_keys; /* mapped from, lhs */ 1133 char_u *m_keys; // mapped from, lhs
1129 char_u *m_str; /* mapped to, rhs */ 1134 char_u *m_str; // mapped to, rhs
1130 char_u *m_orig_str; /* rhs as entered by the user */ 1135 char_u *m_orig_str; // rhs as entered by the user
1131 int m_keylen; /* strlen(m_keys) */ 1136 int m_keylen; // strlen(m_keys)
1132 int m_mode; /* valid mode */ 1137 int m_mode; // valid mode
1133 int m_noremap; /* if non-zero no re-mapping for m_str */ 1138 int m_noremap; // if non-zero no re-mapping for m_str
1134 char m_silent; /* <silent> used, don't echo commands */ 1139 char m_silent; // <silent> used, don't echo commands
1135 char m_nowait; /* <nowait> used */ 1140 char m_nowait; // <nowait> used
1136 #ifdef FEAT_EVAL 1141 #ifdef FEAT_EVAL
1137 char m_expr; /* <expr> used, m_str is an expression */ 1142 char m_expr; // <expr> used, m_str is an expression
1138 sctx_T m_script_ctx; /* SCTX where map was defined */ 1143 sctx_T m_script_ctx; // SCTX where map was defined
1139 #endif 1144 #endif
1140 }; 1145 };
1141 1146
1142 /* 1147 /*
1143 * Used for highlighting in the status line. 1148 * Used for highlighting in the status line.
1144 */ 1149 */
1145 struct stl_hlrec 1150 struct stl_hlrec
1146 { 1151 {
1147 char_u *start; 1152 char_u *start;
1148 int userhl; /* 0: no HL, 1-9: User HL, < 0 for syn ID */ 1153 int userhl; // 0: no HL, 1-9: User HL, < 0 for syn ID
1149 }; 1154 };
1150 1155
1151 1156
1152 /* 1157 /*
1153 * Syntax items - usually buffer-specific. 1158 * Syntax items - usually buffer-specific.
1160 * inside the item, subtract an offset to locate the item. 1165 * inside the item, subtract an offset to locate the item.
1161 * This reduces the size of hashitem by 1/3. 1166 * This reduces the size of hashitem by 1/3.
1162 */ 1167 */
1163 typedef struct hashitem_S 1168 typedef struct hashitem_S
1164 { 1169 {
1165 long_u hi_hash; /* cached hash number of hi_key */ 1170 long_u hi_hash; // cached hash number of hi_key
1166 char_u *hi_key; 1171 char_u *hi_key;
1167 } hashitem_T; 1172 } hashitem_T;
1168 1173
1169 /* The address of "hash_removed" is used as a magic number for hi_key to 1174 // The address of "hash_removed" is used as a magic number for hi_key to
1170 * indicate a removed item. */ 1175 // indicate a removed item.
1171 #define HI_KEY_REMOVED &hash_removed 1176 #define HI_KEY_REMOVED &hash_removed
1172 #define HASHITEM_EMPTY(hi) ((hi)->hi_key == NULL || (hi)->hi_key == &hash_removed) 1177 #define HASHITEM_EMPTY(hi) ((hi)->hi_key == NULL || (hi)->hi_key == &hash_removed)
1173 1178
1174 /* Initial size for a hashtable. Our items are relatively small and growing 1179 // Initial size for a hashtable. Our items are relatively small and growing
1175 * is expensive, thus use 16 as a start. Must be a power of 2. */ 1180 // is expensive, thus use 16 as a start. Must be a power of 2.
1176 #define HT_INIT_SIZE 16 1181 #define HT_INIT_SIZE 16
1177 1182
1178 typedef struct hashtable_S 1183 typedef struct hashtable_S
1179 { 1184 {
1180 long_u ht_mask; /* mask used for hash value (nr of items in 1185 long_u ht_mask; // mask used for hash value (nr of items in
1181 * array is "ht_mask" + 1) */ 1186 // array is "ht_mask" + 1)
1182 long_u ht_used; /* number of items used */ 1187 long_u ht_used; // number of items used
1183 long_u ht_filled; /* number of items used + removed */ 1188 long_u ht_filled; // number of items used + removed
1184 int ht_locked; /* counter for hash_lock() */ 1189 int ht_locked; // counter for hash_lock()
1185 int ht_error; /* when set growing failed, can't add more 1190 int ht_error; // when set growing failed, can't add more
1186 items before growing works */ 1191 // items before growing works
1187 hashitem_T *ht_array; /* points to the array, allocated when it's 1192 hashitem_T *ht_array; // points to the array, allocated when it's
1188 not "ht_smallarray" */ 1193 // not "ht_smallarray"
1189 hashitem_T ht_smallarray[HT_INIT_SIZE]; /* initial array */ 1194 hashitem_T ht_smallarray[HT_INIT_SIZE]; // initial array
1190 } hashtab_T; 1195 } hashtab_T;
1191 1196
1192 typedef long_u hash_T; /* Type for hi_hash */ 1197 typedef long_u hash_T; // Type for hi_hash
1193 1198
1194 1199
1195 #ifdef FEAT_NUM64 1200 #ifdef FEAT_NUM64
1196 /* Use 64-bit Number. */ 1201 // Use 64-bit Number.
1197 # ifdef MSWIN 1202 # ifdef MSWIN
1198 # ifdef PROTO 1203 # ifdef PROTO
1199 typedef long varnumber_T; 1204 typedef long varnumber_T;
1200 typedef unsigned long uvarnumber_T; 1205 typedef unsigned long uvarnumber_T;
1201 # define VARNUM_MIN LONG_MIN 1206 # define VARNUM_MIN LONG_MIN
1220 # define VARNUM_MIN LONG_MIN 1225 # define VARNUM_MIN LONG_MIN
1221 # define VARNUM_MAX LONG_MAX 1226 # define VARNUM_MAX LONG_MAX
1222 # define UVARNUM_MAX ULONG_MAX 1227 # define UVARNUM_MAX ULONG_MAX
1223 # endif 1228 # endif
1224 #else 1229 #else
1225 /* Use 32-bit Number. */ 1230 // Use 32-bit Number.
1226 typedef int varnumber_T; 1231 typedef int varnumber_T;
1227 typedef unsigned int uvarnumber_T; 1232 typedef unsigned int uvarnumber_T;
1228 # define VARNUM_MIN INT_MIN 1233 # define VARNUM_MIN INT_MIN
1229 # define VARNUM_MAX INT_MAX 1234 # define VARNUM_MAX INT_MAX
1230 # define UVARNUM_MAX UINT_MAX 1235 # define UVARNUM_MAX UINT_MAX
1275 * Structure to hold an internal variable without a name. 1280 * Structure to hold an internal variable without a name.
1276 */ 1281 */
1277 typedef struct 1282 typedef struct
1278 { 1283 {
1279 vartype_T v_type; 1284 vartype_T v_type;
1280 char v_lock; /* see below: VAR_LOCKED, VAR_FIXED */ 1285 char v_lock; // see below: VAR_LOCKED, VAR_FIXED
1281 union 1286 union
1282 { 1287 {
1283 varnumber_T v_number; /* number value */ 1288 varnumber_T v_number; // number value
1284 #ifdef FEAT_FLOAT 1289 #ifdef FEAT_FLOAT
1285 float_T v_float; /* floating number value */ 1290 float_T v_float; // floating number value
1286 #endif 1291 #endif
1287 char_u *v_string; /* string value (can be NULL!) */ 1292 char_u *v_string; // string value (can be NULL!)
1288 list_T *v_list; /* list value (can be NULL!) */ 1293 list_T *v_list; // list value (can be NULL!)
1289 dict_T *v_dict; /* dict value (can be NULL!) */ 1294 dict_T *v_dict; // dict value (can be NULL!)
1290 partial_T *v_partial; /* closure: function with args */ 1295 partial_T *v_partial; // closure: function with args
1291 #ifdef FEAT_JOB_CHANNEL 1296 #ifdef FEAT_JOB_CHANNEL
1292 job_T *v_job; /* job value (can be NULL!) */ 1297 job_T *v_job; // job value (can be NULL!)
1293 channel_T *v_channel; /* channel value (can be NULL!) */ 1298 channel_T *v_channel; // channel value (can be NULL!)
1294 #endif 1299 #endif
1295 blob_T *v_blob; /* blob value (can be NULL!) */ 1300 blob_T *v_blob; // blob value (can be NULL!)
1296 } vval; 1301 } vval;
1297 } typval_T; 1302 } typval_T;
1298 1303
1299 /* Values for "dv_scope". */ 1304 // Values for "dv_scope".
1300 #define VAR_SCOPE 1 /* a:, v:, s:, etc. scope dictionaries */ 1305 #define VAR_SCOPE 1 // a:, v:, s:, etc. scope dictionaries
1301 #define VAR_DEF_SCOPE 2 /* l:, g: scope dictionaries: here funcrefs are not 1306 #define VAR_DEF_SCOPE 2 // l:, g: scope dictionaries: here funcrefs are not
1302 allowed to mask existing functions */ 1307 // allowed to mask existing functions
1303 1308
1304 /* Values for "v_lock". */ 1309 // Values for "v_lock".
1305 #define VAR_LOCKED 1 /* locked with lock(), can use unlock() */ 1310 #define VAR_LOCKED 1 // locked with lock(), can use unlock()
1306 #define VAR_FIXED 2 /* locked forever */ 1311 #define VAR_FIXED 2 // locked forever
1307 1312
1308 /* 1313 /*
1309 * Structure to hold an item of a list: an internal variable without a name. 1314 * Structure to hold an item of a list: an internal variable without a name.
1310 */ 1315 */
1311 typedef struct listitem_S listitem_T; 1316 typedef struct listitem_S listitem_T;
1312 1317
1313 struct listitem_S 1318 struct listitem_S
1314 { 1319 {
1315 listitem_T *li_next; /* next item in list */ 1320 listitem_T *li_next; // next item in list
1316 listitem_T *li_prev; /* previous item in list */ 1321 listitem_T *li_prev; // previous item in list
1317 typval_T li_tv; /* type and value of the variable */ 1322 typval_T li_tv; // type and value of the variable
1318 }; 1323 };
1319 1324
1320 /* 1325 // Struct used by those that are using an item in a list.
1321 * Struct used by those that are using an item in a list.
1322 */
1323 typedef struct listwatch_S listwatch_T; 1326 typedef struct listwatch_S listwatch_T;
1324 1327
1325 struct listwatch_S 1328 struct listwatch_S
1326 { 1329 {
1327 listitem_T *lw_item; /* item being watched */ 1330 listitem_T *lw_item; // item being watched
1328 listwatch_T *lw_next; /* next watcher */ 1331 listwatch_T *lw_next; // next watcher
1329 }; 1332 };
1330 1333
1331 /* 1334 /*
1332 * Structure to hold info about a list. 1335 * Structure to hold info about a list.
1333 * Order of members is optimized to reduce padding. 1336 * Order of members is optimized to reduce padding.
1334 */ 1337 */
1335 struct listvar_S 1338 struct listvar_S
1336 { 1339 {
1337 listitem_T *lv_first; /* first item, NULL if none */ 1340 listitem_T *lv_first; // first item, NULL if none
1338 listitem_T *lv_last; /* last item, NULL if none */ 1341 listitem_T *lv_last; // last item, NULL if none
1339 listwatch_T *lv_watch; /* first watcher, NULL if none */ 1342 listwatch_T *lv_watch; // first watcher, NULL if none
1340 listitem_T *lv_idx_item; /* when not NULL item at index "lv_idx" */ 1343 listitem_T *lv_idx_item; // when not NULL item at index "lv_idx"
1341 list_T *lv_copylist; /* copied list used by deepcopy() */ 1344 list_T *lv_copylist; // copied list used by deepcopy()
1342 list_T *lv_used_next; /* next list in used lists list */ 1345 list_T *lv_used_next; // next list in used lists list
1343 list_T *lv_used_prev; /* previous list in used lists list */ 1346 list_T *lv_used_prev; // previous list in used lists list
1344 int lv_refcount; /* reference count */ 1347 int lv_refcount; // reference count
1345 int lv_len; /* number of items */ 1348 int lv_len; // number of items
1346 int lv_idx; /* cached index of an item */ 1349 int lv_idx; // cached index of an item
1347 int lv_copyID; /* ID used by deepcopy() */ 1350 int lv_copyID; // ID used by deepcopy()
1348 char lv_lock; /* zero, VAR_LOCKED, VAR_FIXED */ 1351 char lv_lock; // zero, VAR_LOCKED, VAR_FIXED
1349 }; 1352 };
1350 1353
1351 /* 1354 /*
1352 * Static list with 10 items. Use init_static_list() to initialize. 1355 * Static list with 10 items. Use init_static_list() to initialize.
1353 */ 1356 */
1354 typedef struct { 1357 typedef struct {
1355 list_T sl_list; /* must be first */ 1358 list_T sl_list; // must be first
1356 listitem_T sl_items[10]; 1359 listitem_T sl_items[10];
1357 } staticList10_T; 1360 } staticList10_T;
1358 1361
1359 /* 1362 /*
1360 * Structure to hold an item of a Dictionary. 1363 * Structure to hold an item of a Dictionary.
1361 * Also used for a variable. 1364 * Also used for a variable.
1362 * The key is copied into "di_key" to avoid an extra alloc/free for it. 1365 * The key is copied into "di_key" to avoid an extra alloc/free for it.
1363 */ 1366 */
1364 struct dictitem_S 1367 struct dictitem_S
1365 { 1368 {
1366 typval_T di_tv; /* type and value of the variable */ 1369 typval_T di_tv; // type and value of the variable
1367 char_u di_flags; /* flags (only used for variable) */ 1370 char_u di_flags; // flags (only used for variable)
1368 char_u di_key[1]; /* key (actually longer!) */ 1371 char_u di_key[1]; // key (actually longer!)
1369 }; 1372 };
1370 typedef struct dictitem_S dictitem_T; 1373 typedef struct dictitem_S dictitem_T;
1371 1374
1372 /* 1375 /*
1373 * A dictitem with a 16 character key (plus NUL). This is an efficient way to 1376 * A dictitem with a 16 character key (plus NUL). This is an efficient way to
1374 * have a fixed-size dictitem. 1377 * have a fixed-size dictitem.
1375 */ 1378 */
1376 #define DICTITEM16_KEY_LEN 16 1379 #define DICTITEM16_KEY_LEN 16
1377 struct dictitem16_S 1380 struct dictitem16_S
1378 { 1381 {
1379 typval_T di_tv; /* type and value of the variable */ 1382 typval_T di_tv; // type and value of the variable
1380 char_u di_flags; /* flags (only used for variable) */ 1383 char_u di_flags; // flags (only used for variable)
1381 char_u di_key[DICTITEM16_KEY_LEN + 1]; /* key */ 1384 char_u di_key[DICTITEM16_KEY_LEN + 1]; // key
1382 }; 1385 };
1383 typedef struct dictitem16_S dictitem16_T; 1386 typedef struct dictitem16_S dictitem16_T;
1384 1387
1385 #define DI_FLAGS_RO 1 /* "di_flags" value: read-only variable */ 1388 #define DI_FLAGS_RO 1 // "di_flags" value: read-only variable
1386 #define DI_FLAGS_RO_SBX 2 /* "di_flags" value: read-only in the sandbox */ 1389 #define DI_FLAGS_RO_SBX 2 // "di_flags" value: read-only in the sandbox
1387 #define DI_FLAGS_FIX 4 /* "di_flags" value: fixed: no :unlet or remove() */ 1390 #define DI_FLAGS_FIX 4 // "di_flags" value: fixed: no :unlet or remove()
1388 #define DI_FLAGS_LOCK 8 /* "di_flags" value: locked variable */ 1391 #define DI_FLAGS_LOCK 8 // "di_flags" value: locked variable
1389 #define DI_FLAGS_ALLOC 16 /* "di_flags" value: separately allocated */ 1392 #define DI_FLAGS_ALLOC 16 // "di_flags" value: separately allocated
1390 1393
1391 /* 1394 /*
1392 * Structure to hold info about a Dictionary. 1395 * Structure to hold info about a Dictionary.
1393 */ 1396 */
1394 struct dictvar_S 1397 struct dictvar_S
1395 { 1398 {
1396 char dv_lock; /* zero, VAR_LOCKED, VAR_FIXED */ 1399 char dv_lock; // zero, VAR_LOCKED, VAR_FIXED
1397 char dv_scope; /* zero, VAR_SCOPE, VAR_DEF_SCOPE */ 1400 char dv_scope; // zero, VAR_SCOPE, VAR_DEF_SCOPE
1398 int dv_refcount; /* reference count */ 1401 int dv_refcount; // reference count
1399 int dv_copyID; /* ID used by deepcopy() */ 1402 int dv_copyID; // ID used by deepcopy()
1400 hashtab_T dv_hashtab; /* hashtab that refers to the items */ 1403 hashtab_T dv_hashtab; // hashtab that refers to the items
1401 dict_T *dv_copydict; /* copied dict used by deepcopy() */ 1404 dict_T *dv_copydict; // copied dict used by deepcopy()
1402 dict_T *dv_used_next; /* next dict in used dicts list */ 1405 dict_T *dv_used_next; // next dict in used dicts list
1403 dict_T *dv_used_prev; /* previous dict in used dicts list */ 1406 dict_T *dv_used_prev; // previous dict in used dicts list
1404 }; 1407 };
1405 1408
1406 /* 1409 /*
1407 * Structure to hold info about a blob. 1410 * Structure to hold info about a blob.
1408 */ 1411 */
1460 #define FIXVAR_CNT 12 // number of fixed variables 1463 #define FIXVAR_CNT 12 // number of fixed variables
1461 1464
1462 /* structure to hold info for a function that is currently being executed. */ 1465 /* structure to hold info for a function that is currently being executed. */
1463 struct funccall_S 1466 struct funccall_S
1464 { 1467 {
1465 ufunc_T *func; /* function being called */ 1468 ufunc_T *func; // function being called
1466 int linenr; /* next line to be executed */ 1469 int linenr; // next line to be executed
1467 int returned; /* ":return" used */ 1470 int returned; // ":return" used
1468 struct /* fixed variables for arguments */ 1471 struct // fixed variables for arguments
1469 { 1472 {
1470 dictitem_T var; /* variable (without room for name) */ 1473 dictitem_T var; // variable (without room for name)
1471 char_u room[VAR_SHORT_LEN]; /* room for the name */ 1474 char_u room[VAR_SHORT_LEN]; // room for the name
1472 } fixvar[FIXVAR_CNT]; 1475 } fixvar[FIXVAR_CNT];
1473 dict_T l_vars; /* l: local function variables */ 1476 dict_T l_vars; // l: local function variables
1474 dictitem_T l_vars_var; /* variable for l: scope */ 1477 dictitem_T l_vars_var; // variable for l: scope
1475 dict_T l_avars; /* a: argument variables */ 1478 dict_T l_avars; // a: argument variables
1476 dictitem_T l_avars_var; /* variable for a: scope */ 1479 dictitem_T l_avars_var; // variable for a: scope
1477 list_T l_varlist; /* list for a:000 */ 1480 list_T l_varlist; // list for a:000
1478 listitem_T l_listitems[MAX_FUNC_ARGS]; /* listitems for a:000 */ 1481 listitem_T l_listitems[MAX_FUNC_ARGS]; // listitems for a:000
1479 typval_T *rettv; /* return value */ 1482 typval_T *rettv; // return value
1480 linenr_T breakpoint; /* next line with breakpoint or zero */ 1483 linenr_T breakpoint; // next line with breakpoint or zero
1481 int dbg_tick; /* debug_tick when breakpoint was set */ 1484 int dbg_tick; // debug_tick when breakpoint was set
1482 int level; /* top nesting level of executed function */ 1485 int level; // top nesting level of executed function
1483 #ifdef FEAT_PROFILE 1486 #ifdef FEAT_PROFILE
1484 proftime_T prof_child; /* time spent in a child */ 1487 proftime_T prof_child; // time spent in a child
1485 #endif 1488 #endif
1486 funccall_T *caller; /* calling function or NULL */ 1489 funccall_T *caller; // calling function or NULL
1487 1490
1488 /* for closure */ 1491 // for closure
1489 int fc_refcount; /* number of user functions that reference this 1492 int fc_refcount; // number of user functions that reference this
1490 * funccal */ 1493 // funccal
1491 int fc_copyID; /* for garbage collection */ 1494 int fc_copyID; // for garbage collection
1492 garray_T fc_funcs; /* list of ufunc_T* which keep a reference to 1495 garray_T fc_funcs; // list of ufunc_T* which keep a reference to
1493 * "func" */ 1496 // "func"
1494 }; 1497 };
1495 1498
1496 /* 1499 /*
1497 * Struct used by trans_function_name() 1500 * Struct used by trans_function_name()
1498 */ 1501 */
1499 typedef struct 1502 typedef struct
1500 { 1503 {
1501 dict_T *fd_dict; /* Dictionary used */ 1504 dict_T *fd_dict; // Dictionary used
1502 char_u *fd_newkey; /* new key in "dict" in allocated memory */ 1505 char_u *fd_newkey; // new key in "dict" in allocated memory
1503 dictitem_T *fd_di; /* Dictionary item used */ 1506 dictitem_T *fd_di; // Dictionary item used
1504 } funcdict_T; 1507 } funcdict_T;
1505 1508
1506 typedef struct funccal_entry funccal_entry_T; 1509 typedef struct funccal_entry funccal_entry_T;
1507 struct funccal_entry { 1510 struct funccal_entry {
1508 void *top_funccal; 1511 void *top_funccal;
1509 funccal_entry_T *next; 1512 funccal_entry_T *next;
1510 }; 1513 };
1511 1514
1512 #else 1515 #else
1513 /* dummy typedefs for function prototypes */ 1516 // dummy typedefs for use in function prototypes
1514 typedef struct 1517 typedef struct
1515 { 1518 {
1516 int dummy; 1519 int dummy;
1517 } ufunc_T; 1520 } ufunc_T;
1518 typedef struct 1521 typedef struct
1525 } funccal_entry_T; 1528 } funccal_entry_T;
1526 #endif 1529 #endif
1527 1530
1528 struct partial_S 1531 struct partial_S
1529 { 1532 {
1530 int pt_refcount; /* reference count */ 1533 int pt_refcount; // reference count
1531 char_u *pt_name; /* function name; when NULL use 1534 char_u *pt_name; // function name; when NULL use
1532 * pt_func->uf_name */ 1535 // pt_func->uf_name
1533 ufunc_T *pt_func; /* function pointer; when NULL lookup function 1536 ufunc_T *pt_func; // function pointer; when NULL lookup function
1534 * with pt_name */ 1537 // with pt_name
1535 int pt_auto; /* when TRUE the partial was created for using 1538 int pt_auto; // when TRUE the partial was created for using
1536 dict.member in handle_subscript() */ 1539 // dict.member in handle_subscript()
1537 int pt_argc; /* number of arguments */ 1540 int pt_argc; // number of arguments
1538 typval_T *pt_argv; /* arguments in allocated array */ 1541 typval_T *pt_argv; // arguments in allocated array
1539 dict_T *pt_dict; /* dict for "self" */ 1542 dict_T *pt_dict; // dict for "self"
1540 }; 1543 };
1541 1544
1542 /* Information returned by get_tty_info(). */ 1545 // Information returned by get_tty_info().
1543 typedef struct { 1546 typedef struct {
1544 int backspace; /* what the Backspace key produces */ 1547 int backspace; // what the Backspace key produces
1545 int enter; /* what the Enter key produces */ 1548 int enter; // what the Enter key produces
1546 int interrupt; /* interrupt character */ 1549 int interrupt; // interrupt character
1547 int nl_does_cr; /* TRUE when a NL is expanded to CR-NL on output */ 1550 int nl_does_cr; // TRUE when a NL is expanded to CR-NL on output
1548 } ttyinfo_T; 1551 } ttyinfo_T;
1549 1552
1550 /* Status of a job. Order matters! */ 1553 // Status of a job. Order matters!
1551 typedef enum 1554 typedef enum
1552 { 1555 {
1553 JOB_FAILED, 1556 JOB_FAILED,
1554 JOB_STARTED, 1557 JOB_STARTED,
1555 JOB_ENDED, // detected job done 1558 JOB_ENDED, // detected job done
1568 #endif 1571 #endif
1569 #ifdef MSWIN 1572 #ifdef MSWIN
1570 PROCESS_INFORMATION jv_proc_info; 1573 PROCESS_INFORMATION jv_proc_info;
1571 HANDLE jv_job_object; 1574 HANDLE jv_job_object;
1572 #endif 1575 #endif
1573 char_u *jv_tty_in; /* controlling tty input, allocated */ 1576 char_u *jv_tty_in; // controlling tty input, allocated
1574 char_u *jv_tty_out; /* controlling tty output, allocated */ 1577 char_u *jv_tty_out; // controlling tty output, allocated
1575 jobstatus_T jv_status; 1578 jobstatus_T jv_status;
1576 char_u *jv_stoponexit; /* allocated */ 1579 char_u *jv_stoponexit; // allocated
1577 #ifdef UNIX 1580 #ifdef UNIX
1578 char_u *jv_termsig; /* allocated */ 1581 char_u *jv_termsig; // allocated
1579 #endif 1582 #endif
1580 #ifdef MSWIN 1583 #ifdef MSWIN
1581 char_u *jv_tty_type; // allocated 1584 char_u *jv_tty_type; // allocated
1582 #endif 1585 #endif
1583 int jv_exitval; 1586 int jv_exitval;
1584 callback_T jv_exit_cb; 1587 callback_T jv_exit_cb;
1585 1588
1586 buf_T *jv_in_buf; /* buffer from "in-name" */ 1589 buf_T *jv_in_buf; // buffer from "in-name"
1587 1590
1588 int jv_refcount; /* reference count */ 1591 int jv_refcount; // reference count
1589 int jv_copyID; 1592 int jv_copyID;
1590 1593
1591 channel_T *jv_channel; /* channel for I/O, reference counted */ 1594 channel_T *jv_channel; // channel for I/O, reference counted
1592 char **jv_argv; /* command line used to start the job */ 1595 char **jv_argv; // command line used to start the job
1593 }; 1596 };
1594 1597
1595 /* 1598 /*
1596 * Structures to hold info about a Channel. 1599 * Structures to hold info about a Channel.
1597 */ 1600 */
1613 struct jsonq_S 1616 struct jsonq_S
1614 { 1617 {
1615 typval_T *jq_value; 1618 typval_T *jq_value;
1616 jsonq_T *jq_next; 1619 jsonq_T *jq_next;
1617 jsonq_T *jq_prev; 1620 jsonq_T *jq_prev;
1618 int jq_no_callback; /* TRUE when no callback was found */ 1621 int jq_no_callback; // TRUE when no callback was found
1619 }; 1622 };
1620 1623
1621 struct cbq_S 1624 struct cbq_S
1622 { 1625 {
1623 callback_T cq_callback; 1626 callback_T cq_callback;
1624 int cq_seq_nr; 1627 int cq_seq_nr;
1625 cbq_T *cq_next; 1628 cbq_T *cq_next;
1626 cbq_T *cq_prev; 1629 cbq_T *cq_prev;
1627 }; 1630 };
1628 1631
1629 /* mode for a channel */ 1632 // mode for a channel
1630 typedef enum 1633 typedef enum
1631 { 1634 {
1632 MODE_NL = 0, 1635 MODE_NL = 0,
1633 MODE_RAW, 1636 MODE_RAW,
1634 MODE_JSON, 1637 MODE_JSON,
1643 JIO_OUT 1646 JIO_OUT
1644 } job_io_T; 1647 } job_io_T;
1645 1648
1646 #define CH_PART_FD(part) ch_part[part].ch_fd 1649 #define CH_PART_FD(part) ch_part[part].ch_fd
1647 1650
1648 /* Ordering matters, it is used in for loops: IN is last, only SOCK/OUT/ERR 1651 // Ordering matters, it is used in for loops: IN is last, only SOCK/OUT/ERR
1649 * are polled. */ 1652 // are polled.
1650 typedef enum { 1653 typedef enum {
1651 PART_SOCK = 0, 1654 PART_SOCK = 0,
1652 #define CH_SOCK_FD CH_PART_FD(PART_SOCK) 1655 #define CH_SOCK_FD CH_PART_FD(PART_SOCK)
1653 #ifdef FEAT_JOB_CHANNEL 1656 #ifdef FEAT_JOB_CHANNEL
1654 PART_OUT, 1657 PART_OUT,
1661 PART_COUNT, 1664 PART_COUNT,
1662 } ch_part_T; 1665 } ch_part_T;
1663 1666
1664 #define INVALID_FD (-1) 1667 #define INVALID_FD (-1)
1665 1668
1666 /* The per-fd info for a channel. */ 1669 // The per-fd info for a channel.
1667 typedef struct { 1670 typedef struct {
1668 sock_T ch_fd; /* socket/stdin/stdout/stderr, -1 if not used */ 1671 sock_T ch_fd; // socket/stdin/stdout/stderr, -1 if not used
1669 1672
1670 # if defined(UNIX) && !defined(HAVE_SELECT) 1673 # if defined(UNIX) && !defined(HAVE_SELECT)
1671 int ch_poll_idx; /* used by channel_poll_setup() */ 1674 int ch_poll_idx; // used by channel_poll_setup()
1672 # endif 1675 # endif
1673 1676
1674 #ifdef FEAT_GUI_X11 1677 #ifdef FEAT_GUI_X11
1675 XtInputId ch_inputHandler; /* Cookie for input */ 1678 XtInputId ch_inputHandler; // Cookie for input
1676 #endif 1679 #endif
1677 #ifdef FEAT_GUI_GTK 1680 #ifdef FEAT_GUI_GTK
1678 gint ch_inputHandler; /* Cookie for input */ 1681 gint ch_inputHandler; // Cookie for input
1679 #endif 1682 #endif
1680 1683
1681 ch_mode_T ch_mode; 1684 ch_mode_T ch_mode;
1682 job_io_T ch_io; 1685 job_io_T ch_io;
1683 int ch_timeout; /* request timeout in msec */ 1686 int ch_timeout; // request timeout in msec
1684 1687
1685 readq_T ch_head; /* header for circular raw read queue */ 1688 readq_T ch_head; // header for circular raw read queue
1686 jsonq_T ch_json_head; /* header for circular json read queue */ 1689 jsonq_T ch_json_head; // header for circular json read queue
1687 garray_T ch_block_ids; /* list of IDs that channel_read_json_block() 1690 garray_T ch_block_ids; // list of IDs that channel_read_json_block()
1688 is waiting for */ 1691 // is waiting for
1689 /* When ch_wait_len is non-zero use ch_deadline to wait for incomplete 1692 // When ch_wait_len is non-zero use ch_deadline to wait for incomplete
1690 * message to be complete. The value is the length of the incomplete 1693 // message to be complete. The value is the length of the incomplete
1691 * message when the deadline was set. If it gets longer (something was 1694 // message when the deadline was set. If it gets longer (something was
1692 * received) the deadline is reset. */ 1695 // received) the deadline is reset.
1693 size_t ch_wait_len; 1696 size_t ch_wait_len;
1694 #ifdef MSWIN 1697 #ifdef MSWIN
1695 DWORD ch_deadline; 1698 DWORD ch_deadline;
1696 #else 1699 #else
1697 struct timeval ch_deadline; 1700 struct timeval ch_deadline;
1698 #endif 1701 #endif
1699 int ch_block_write; /* for testing: 0 when not used, -1 when write 1702 int ch_block_write; // for testing: 0 when not used, -1 when write
1700 * does not block, 1 simulate blocking */ 1703 // does not block, 1 simulate blocking
1701 int ch_nonblocking; /* write() is non-blocking */ 1704 int ch_nonblocking; // write() is non-blocking
1702 writeq_T ch_writeque; /* header for write queue */ 1705 writeq_T ch_writeque; // header for write queue
1703 1706
1704 cbq_T ch_cb_head; /* dummy node for per-request callbacks */ 1707 cbq_T ch_cb_head; // dummy node for per-request callbacks
1705 callback_T ch_callback; /* call when a msg is not handled */ 1708 callback_T ch_callback; // call when a msg is not handled
1706 1709
1707 bufref_T ch_bufref; /* buffer to read from or write to */ 1710 bufref_T ch_bufref; // buffer to read from or write to
1708 int ch_nomodifiable; /* TRUE when buffer can be 'nomodifiable' */ 1711 int ch_nomodifiable; // TRUE when buffer can be 'nomodifiable'
1709 int ch_nomod_error; /* TRUE when e_modifiable was given */ 1712 int ch_nomod_error; // TRUE when e_modifiable was given
1710 int ch_buf_append; /* write appended lines instead top-bot */ 1713 int ch_buf_append; // write appended lines instead top-bot
1711 linenr_T ch_buf_top; /* next line to send */ 1714 linenr_T ch_buf_top; // next line to send
1712 linenr_T ch_buf_bot; /* last line to send */ 1715 linenr_T ch_buf_bot; // last line to send
1713 } chanpart_T; 1716 } chanpart_T;
1714 1717
1715 struct channel_S { 1718 struct channel_S {
1716 channel_T *ch_next; 1719 channel_T *ch_next;
1717 channel_T *ch_prev; 1720 channel_T *ch_prev;
1718 1721
1719 int ch_id; /* ID of the channel */ 1722 int ch_id; // ID of the channel
1720 int ch_last_msg_id; /* ID of the last message */ 1723 int ch_last_msg_id; // ID of the last message
1721 1724
1722 chanpart_T ch_part[PART_COUNT]; /* info for socket, out, err and in */ 1725 chanpart_T ch_part[PART_COUNT]; // info for socket, out, err and in
1723 int ch_write_text_mode; /* write buffer lines with CR, not NL */ 1726 int ch_write_text_mode; // write buffer lines with CR, not NL
1724 1727
1725 char *ch_hostname; /* only for socket, allocated */ 1728 char *ch_hostname; // only for socket, allocated
1726 int ch_port; /* only for socket */ 1729 int ch_port; // only for socket
1727 1730
1728 int ch_to_be_closed; /* bitset of readable fds to be closed. 1731 int ch_to_be_closed; // bitset of readable fds to be closed.
1729 * When all readable fds have been closed, 1732 // When all readable fds have been closed,
1730 * set to (1 << PART_COUNT). */ 1733 // set to (1 << PART_COUNT).
1731 int ch_to_be_freed; /* When TRUE channel must be freed when it's 1734 int ch_to_be_freed; // When TRUE channel must be freed when it's
1732 * safe to invoke callbacks. */ 1735 // safe to invoke callbacks.
1733 int ch_error; /* When TRUE an error was reported. Avoids 1736 int ch_error; // When TRUE an error was reported. Avoids
1734 * giving pages full of error messages when 1737 // giving pages full of error messages when
1735 * the other side has exited, only mention the 1738 // the other side has exited, only mention the
1736 * first error until the connection works 1739 // first error until the connection works
1737 * again. */ 1740 // again.
1738 1741
1739 void (*ch_nb_close_cb)(void); 1742 void (*ch_nb_close_cb)(void);
1740 /* callback for Netbeans when channel is 1743 // callback for Netbeans when channel is
1741 * closed */ 1744 // closed
1742 1745
1743 #ifdef MSWIN 1746 #ifdef MSWIN
1744 int ch_named_pipe; /* using named pipe instead of pty */ 1747 int ch_named_pipe; // using named pipe instead of pty
1745 #endif 1748 #endif
1746 callback_T ch_callback; /* call when any msg is not handled */ 1749 callback_T ch_callback; // call when any msg is not handled
1747 callback_T ch_close_cb; /* call when channel is closed */ 1750 callback_T ch_close_cb; // call when channel is closed
1748 int ch_drop_never; 1751 int ch_drop_never;
1749 int ch_keep_open; /* do not close on read error */ 1752 int ch_keep_open; // do not close on read error
1750 int ch_nonblock; 1753 int ch_nonblock;
1751 1754
1752 job_T *ch_job; // Job that uses this channel; this does not 1755 job_T *ch_job; // Job that uses this channel; this does not
1753 // count as a reference to avoid a circular 1756 // count as a reference to avoid a circular
1754 // reference, the job refers to the channel. 1757 // reference, the job refers to the channel.
1759 1762
1760 int ch_refcount; // reference count 1763 int ch_refcount; // reference count
1761 int ch_copyID; 1764 int ch_copyID;
1762 }; 1765 };
1763 1766
1764 #define JO_MODE 0x0001 /* channel mode */ 1767 #define JO_MODE 0x0001 // channel mode
1765 #define JO_IN_MODE 0x0002 /* stdin mode */ 1768 #define JO_IN_MODE 0x0002 // stdin mode
1766 #define JO_OUT_MODE 0x0004 /* stdout mode */ 1769 #define JO_OUT_MODE 0x0004 // stdout mode
1767 #define JO_ERR_MODE 0x0008 /* stderr mode */ 1770 #define JO_ERR_MODE 0x0008 // stderr mode
1768 #define JO_CALLBACK 0x0010 /* channel callback */ 1771 #define JO_CALLBACK 0x0010 // channel callback
1769 #define JO_OUT_CALLBACK 0x0020 /* stdout callback */ 1772 #define JO_OUT_CALLBACK 0x0020 // stdout callback
1770 #define JO_ERR_CALLBACK 0x0040 /* stderr callback */ 1773 #define JO_ERR_CALLBACK 0x0040 // stderr callback
1771 #define JO_CLOSE_CALLBACK 0x0080 /* "close_cb" */ 1774 #define JO_CLOSE_CALLBACK 0x0080 // "close_cb"
1772 #define JO_WAITTIME 0x0100 /* only for ch_open() */ 1775 #define JO_WAITTIME 0x0100 // only for ch_open()
1773 #define JO_TIMEOUT 0x0200 /* all timeouts */ 1776 #define JO_TIMEOUT 0x0200 // all timeouts
1774 #define JO_OUT_TIMEOUT 0x0400 /* stdout timeouts */ 1777 #define JO_OUT_TIMEOUT 0x0400 // stdout timeouts
1775 #define JO_ERR_TIMEOUT 0x0800 /* stderr timeouts */ 1778 #define JO_ERR_TIMEOUT 0x0800 // stderr timeouts
1776 #define JO_PART 0x1000 /* "part" */ 1779 #define JO_PART 0x1000 // "part"
1777 #define JO_ID 0x2000 /* "id" */ 1780 #define JO_ID 0x2000 // "id"
1778 #define JO_STOPONEXIT 0x4000 /* "stoponexit" */ 1781 #define JO_STOPONEXIT 0x4000 // "stoponexit"
1779 #define JO_EXIT_CB 0x8000 /* "exit_cb" */ 1782 #define JO_EXIT_CB 0x8000 // "exit_cb"
1780 #define JO_OUT_IO 0x10000 /* "out_io" */ 1783 #define JO_OUT_IO 0x10000 // "out_io"
1781 #define JO_ERR_IO 0x20000 /* "err_io" (JO_OUT_IO << 1) */ 1784 #define JO_ERR_IO 0x20000 // "err_io" (JO_OUT_IO << 1)
1782 #define JO_IN_IO 0x40000 /* "in_io" (JO_OUT_IO << 2) */ 1785 #define JO_IN_IO 0x40000 // "in_io" (JO_OUT_IO << 2)
1783 #define JO_OUT_NAME 0x80000 /* "out_name" */ 1786 #define JO_OUT_NAME 0x80000 // "out_name"
1784 #define JO_ERR_NAME 0x100000 /* "err_name" (JO_OUT_NAME << 1) */ 1787 #define JO_ERR_NAME 0x100000 // "err_name" (JO_OUT_NAME << 1)
1785 #define JO_IN_NAME 0x200000 /* "in_name" (JO_OUT_NAME << 2) */ 1788 #define JO_IN_NAME 0x200000 // "in_name" (JO_OUT_NAME << 2)
1786 #define JO_IN_TOP 0x400000 /* "in_top" */ 1789 #define JO_IN_TOP 0x400000 // "in_top"
1787 #define JO_IN_BOT 0x800000 /* "in_bot" */ 1790 #define JO_IN_BOT 0x800000 // "in_bot"
1788 #define JO_OUT_BUF 0x1000000 /* "out_buf" */ 1791 #define JO_OUT_BUF 0x1000000 // "out_buf"
1789 #define JO_ERR_BUF 0x2000000 /* "err_buf" (JO_OUT_BUF << 1) */ 1792 #define JO_ERR_BUF 0x2000000 // "err_buf" (JO_OUT_BUF << 1)
1790 #define JO_IN_BUF 0x4000000 /* "in_buf" (JO_OUT_BUF << 2) */ 1793 #define JO_IN_BUF 0x4000000 // "in_buf" (JO_OUT_BUF << 2)
1791 #define JO_CHANNEL 0x8000000 /* "channel" */ 1794 #define JO_CHANNEL 0x8000000 // "channel"
1792 #define JO_BLOCK_WRITE 0x10000000 /* "block_write" */ 1795 #define JO_BLOCK_WRITE 0x10000000 // "block_write"
1793 #define JO_OUT_MODIFIABLE 0x20000000 /* "out_modifiable" */ 1796 #define JO_OUT_MODIFIABLE 0x20000000 // "out_modifiable"
1794 #define JO_ERR_MODIFIABLE 0x40000000 /* "err_modifiable" (JO_OUT_ << 1) */ 1797 #define JO_ERR_MODIFIABLE 0x40000000 // "err_modifiable" (JO_OUT_ << 1)
1795 #define JO_ALL 0x7fffffff 1798 #define JO_ALL 0x7fffffff
1796 1799
1797 #define JO2_OUT_MSG 0x0001 /* "out_msg" */ 1800 #define JO2_OUT_MSG 0x0001 // "out_msg"
1798 #define JO2_ERR_MSG 0x0002 /* "err_msg" (JO_OUT_ << 1) */ 1801 #define JO2_ERR_MSG 0x0002 // "err_msg" (JO_OUT_ << 1)
1799 #define JO2_TERM_NAME 0x0004 /* "term_name" */ 1802 #define JO2_TERM_NAME 0x0004 // "term_name"
1800 #define JO2_TERM_FINISH 0x0008 /* "term_finish" */ 1803 #define JO2_TERM_FINISH 0x0008 // "term_finish"
1801 #define JO2_ENV 0x0010 /* "env" */ 1804 #define JO2_ENV 0x0010 // "env"
1802 #define JO2_CWD 0x0020 /* "cwd" */ 1805 #define JO2_CWD 0x0020 // "cwd"
1803 #define JO2_TERM_ROWS 0x0040 /* "term_rows" */ 1806 #define JO2_TERM_ROWS 0x0040 // "term_rows"
1804 #define JO2_TERM_COLS 0x0080 /* "term_cols" */ 1807 #define JO2_TERM_COLS 0x0080 // "term_cols"
1805 #define JO2_VERTICAL 0x0100 /* "vertical" */ 1808 #define JO2_VERTICAL 0x0100 // "vertical"
1806 #define JO2_CURWIN 0x0200 /* "curwin" */ 1809 #define JO2_CURWIN 0x0200 // "curwin"
1807 #define JO2_HIDDEN 0x0400 /* "hidden" */ 1810 #define JO2_HIDDEN 0x0400 // "hidden"
1808 #define JO2_TERM_OPENCMD 0x0800 /* "term_opencmd" */ 1811 #define JO2_TERM_OPENCMD 0x0800 // "term_opencmd"
1809 #define JO2_EOF_CHARS 0x1000 /* "eof_chars" */ 1812 #define JO2_EOF_CHARS 0x1000 // "eof_chars"
1810 #define JO2_NORESTORE 0x2000 /* "norestore" */ 1813 #define JO2_NORESTORE 0x2000 // "norestore"
1811 #define JO2_TERM_KILL 0x4000 /* "term_kill" */ 1814 #define JO2_TERM_KILL 0x4000 // "term_kill"
1812 #define JO2_ANSI_COLORS 0x8000 /* "ansi_colors" */ 1815 #define JO2_ANSI_COLORS 0x8000 // "ansi_colors"
1813 #define JO2_TTY_TYPE 0x10000 /* "tty_type" */ 1816 #define JO2_TTY_TYPE 0x10000 // "tty_type"
1814 #define JO2_BUFNR 0x20000 /* "bufnr" */ 1817 #define JO2_BUFNR 0x20000 // "bufnr"
1815 1818
1816 #define JO_MODE_ALL (JO_MODE + JO_IN_MODE + JO_OUT_MODE + JO_ERR_MODE) 1819 #define JO_MODE_ALL (JO_MODE + JO_IN_MODE + JO_OUT_MODE + JO_ERR_MODE)
1817 #define JO_CB_ALL \ 1820 #define JO_CB_ALL \
1818 (JO_CALLBACK + JO_OUT_CALLBACK + JO_ERR_CALLBACK + JO_CLOSE_CALLBACK) 1821 (JO_CALLBACK + JO_OUT_CALLBACK + JO_ERR_CALLBACK + JO_CLOSE_CALLBACK)
1819 #define JO_TIMEOUT_ALL (JO_TIMEOUT + JO_OUT_TIMEOUT + JO_ERR_TIMEOUT) 1822 #define JO_TIMEOUT_ALL (JO_TIMEOUT + JO_OUT_TIMEOUT + JO_ERR_TIMEOUT)
1821 /* 1824 /*
1822 * Options for job and channel commands. 1825 * Options for job and channel commands.
1823 */ 1826 */
1824 typedef struct 1827 typedef struct
1825 { 1828 {
1826 int jo_set; /* JO_ bits for values that were set */ 1829 int jo_set; // JO_ bits for values that were set
1827 int jo_set2; /* JO2_ bits for values that were set */ 1830 int jo_set2; // JO2_ bits for values that were set
1828 1831
1829 ch_mode_T jo_mode; 1832 ch_mode_T jo_mode;
1830 ch_mode_T jo_in_mode; 1833 ch_mode_T jo_in_mode;
1831 ch_mode_T jo_out_mode; 1834 ch_mode_T jo_out_mode;
1832 ch_mode_T jo_err_mode; 1835 ch_mode_T jo_err_mode;
1833 int jo_noblock; 1836 int jo_noblock;
1834 1837
1835 job_io_T jo_io[4]; /* PART_OUT, PART_ERR, PART_IN */ 1838 job_io_T jo_io[4]; // PART_OUT, PART_ERR, PART_IN
1836 char_u jo_io_name_buf[4][NUMBUFLEN]; 1839 char_u jo_io_name_buf[4][NUMBUFLEN];
1837 char_u *jo_io_name[4]; /* not allocated! */ 1840 char_u *jo_io_name[4]; // not allocated!
1838 int jo_io_buf[4]; 1841 int jo_io_buf[4];
1839 int jo_pty; 1842 int jo_pty;
1840 int jo_modifiable[4]; 1843 int jo_modifiable[4];
1841 int jo_message[4]; 1844 int jo_message[4];
1842 channel_T *jo_channel; 1845 channel_T *jo_channel;
1852 int jo_drop_never; 1855 int jo_drop_never;
1853 int jo_waittime; 1856 int jo_waittime;
1854 int jo_timeout; 1857 int jo_timeout;
1855 int jo_out_timeout; 1858 int jo_out_timeout;
1856 int jo_err_timeout; 1859 int jo_err_timeout;
1857 int jo_block_write; /* for testing only */ 1860 int jo_block_write; // for testing only
1858 int jo_part; 1861 int jo_part;
1859 int jo_id; 1862 int jo_id;
1860 char_u jo_soe_buf[NUMBUFLEN]; 1863 char_u jo_soe_buf[NUMBUFLEN];
1861 char_u *jo_stoponexit; 1864 char_u *jo_stoponexit;
1862 dict_T *jo_env; /* environment variables */ 1865 dict_T *jo_env; // environment variables
1863 char_u jo_cwd_buf[NUMBUFLEN]; 1866 char_u jo_cwd_buf[NUMBUFLEN];
1864 char_u *jo_cwd; 1867 char_u *jo_cwd;
1865 1868
1866 #ifdef FEAT_TERMINAL 1869 #ifdef FEAT_TERMINAL
1867 /* when non-zero run the job in a terminal window of this size */ 1870 // when non-zero run the job in a terminal window of this size
1868 int jo_term_rows; 1871 int jo_term_rows;
1869 int jo_term_cols; 1872 int jo_term_cols;
1870 int jo_vertical; 1873 int jo_vertical;
1871 int jo_curwin; 1874 int jo_curwin;
1872 buf_T *jo_bufnr_buf; 1875 buf_T *jo_bufnr_buf;
1895 int lr_id; 1898 int lr_id;
1896 callback_T lr_callback; 1899 callback_T lr_callback;
1897 }; 1900 };
1898 #endif 1901 #endif
1899 1902
1900 /* structure used for explicit stack while garbage collecting hash tables */ 1903 /*
1904 * structure used for explicit stack while garbage collecting hash tables
1905 */
1901 typedef struct ht_stack_S 1906 typedef struct ht_stack_S
1902 { 1907 {
1903 hashtab_T *ht; 1908 hashtab_T *ht;
1904 struct ht_stack_S *prev; 1909 struct ht_stack_S *prev;
1905 } ht_stack_T; 1910 } ht_stack_T;
1906 1911
1907 /* structure used for explicit stack while garbage collecting lists */ 1912 /*
1913 * structure used for explicit stack while garbage collecting lists
1914 */
1908 typedef struct list_stack_S 1915 typedef struct list_stack_S
1909 { 1916 {
1910 list_T *list; 1917 list_T *list;
1911 struct list_stack_S *prev; 1918 struct list_stack_S *prev;
1912 } list_stack_T; 1919 } list_stack_T;
1919 { 1926 {
1920 long_u dit_todo; 1927 long_u dit_todo;
1921 hashitem_T *dit_hi; 1928 hashitem_T *dit_hi;
1922 } dict_iterator_T; 1929 } dict_iterator_T;
1923 1930
1924 /* values for b_syn_spell: what to do with toplevel text */ 1931 // values for b_syn_spell: what to do with toplevel text
1925 #define SYNSPL_DEFAULT 0 /* spell check if @Spell not defined */ 1932 #define SYNSPL_DEFAULT 0 // spell check if @Spell not defined
1926 #define SYNSPL_TOP 1 /* spell check toplevel text */ 1933 #define SYNSPL_TOP 1 // spell check toplevel text
1927 #define SYNSPL_NOTOP 2 /* don't spell check toplevel text */ 1934 #define SYNSPL_NOTOP 2 // don't spell check toplevel text
1928 1935
1929 /* avoid #ifdefs for when b_spell is not available */ 1936 // avoid #ifdefs for when b_spell is not available
1930 #ifdef FEAT_SPELL 1937 #ifdef FEAT_SPELL
1931 # define B_SPELL(buf) ((buf)->b_spell) 1938 # define B_SPELL(buf) ((buf)->b_spell)
1932 #else 1939 #else
1933 # define B_SPELL(buf) (0) 1940 # define B_SPELL(buf) (0)
1934 #endif 1941 #endif
1940 #ifdef FEAT_PROFILE 1947 #ifdef FEAT_PROFILE
1941 /* 1948 /*
1942 * Used for :syntime: timing of executing a syntax pattern. 1949 * Used for :syntime: timing of executing a syntax pattern.
1943 */ 1950 */
1944 typedef struct { 1951 typedef struct {
1945 proftime_T total; /* total time used */ 1952 proftime_T total; // total time used
1946 proftime_T slowest; /* time of slowest call */ 1953 proftime_T slowest; // time of slowest call
1947 long count; /* nr of times used */ 1954 long count; // nr of times used
1948 long match; /* nr of times matched */ 1955 long match; // nr of times matched
1949 } syn_time_T; 1956 } syn_time_T;
1950 #endif 1957 #endif
1951 1958
1952 typedef struct timer_S timer_T; 1959 typedef struct timer_S timer_T;
1953 struct timer_S 1960 struct timer_S
1971 * Structure to hold the type of encryption and the state of encryption or 1978 * Structure to hold the type of encryption and the state of encryption or
1972 * decryption. 1979 * decryption.
1973 */ 1980 */
1974 typedef struct { 1981 typedef struct {
1975 int method_nr; 1982 int method_nr;
1976 void *method_state; /* method-specific state information */ 1983 void *method_state; // method-specific state information
1977 } cryptstate_T; 1984 } cryptstate_T;
1978 1985
1979 /* values for method_nr */ 1986 // values for method_nr
1980 # define CRYPT_M_ZIP 0 1987 # define CRYPT_M_ZIP 0
1981 # define CRYPT_M_BF 1 1988 # define CRYPT_M_BF 1
1982 # define CRYPT_M_BF2 2 1989 # define CRYPT_M_BF2 2
1983 # define CRYPT_M_COUNT 3 /* number of crypt methods */ 1990 # define CRYPT_M_COUNT 3 // number of crypt methods
1984 1991
1985 // Currently all crypt methods work inplace. If one is added that isn't then 1992 // Currently all crypt methods work inplace. If one is added that isn't then
1986 // define this. 1993 // define this.
1987 // # define CRYPT_NOT_INPLACE 1 1994 // # define CRYPT_NOT_INPLACE 1
1988 #endif 1995 #endif
2012 * These are items normally related to a buffer. But when using ":ownsyntax" 2019 * These are items normally related to a buffer. But when using ":ownsyntax"
2013 * a window may have its own instance. 2020 * a window may have its own instance.
2014 */ 2021 */
2015 typedef struct { 2022 typedef struct {
2016 #ifdef FEAT_SYN_HL 2023 #ifdef FEAT_SYN_HL
2017 hashtab_T b_keywtab; /* syntax keywords hash table */ 2024 hashtab_T b_keywtab; // syntax keywords hash table
2018 hashtab_T b_keywtab_ic; /* idem, ignore case */ 2025 hashtab_T b_keywtab_ic; // idem, ignore case
2019 int b_syn_error; /* TRUE when error occurred in HL */ 2026 int b_syn_error; // TRUE when error occurred in HL
2020 # ifdef FEAT_RELTIME 2027 # ifdef FEAT_RELTIME
2021 int b_syn_slow; /* TRUE when 'redrawtime' reached */ 2028 int b_syn_slow; // TRUE when 'redrawtime' reached
2022 # endif 2029 # endif
2023 int b_syn_ic; /* ignore case for :syn cmds */ 2030 int b_syn_ic; // ignore case for :syn cmds
2024 int b_syn_spell; /* SYNSPL_ values */ 2031 int b_syn_spell; // SYNSPL_ values
2025 garray_T b_syn_patterns; /* table for syntax patterns */ 2032 garray_T b_syn_patterns; // table for syntax patterns
2026 garray_T b_syn_clusters; /* table for syntax clusters */ 2033 garray_T b_syn_clusters; // table for syntax clusters
2027 int b_spell_cluster_id; /* @Spell cluster ID or 0 */ 2034 int b_spell_cluster_id; // @Spell cluster ID or 0
2028 int b_nospell_cluster_id; /* @NoSpell cluster ID or 0 */ 2035 int b_nospell_cluster_id; // @NoSpell cluster ID or 0
2029 int b_syn_containedin; /* TRUE when there is an item with a 2036 int b_syn_containedin; // TRUE when there is an item with a
2030 "containedin" argument */ 2037 // "containedin" argument
2031 int b_syn_sync_flags; /* flags about how to sync */ 2038 int b_syn_sync_flags; // flags about how to sync
2032 short b_syn_sync_id; /* group to sync on */ 2039 short b_syn_sync_id; // group to sync on
2033 long b_syn_sync_minlines; /* minimal sync lines offset */ 2040 long b_syn_sync_minlines; // minimal sync lines offset
2034 long b_syn_sync_maxlines; /* maximal sync lines offset */ 2041 long b_syn_sync_maxlines; // maximal sync lines offset
2035 long b_syn_sync_linebreaks; /* offset for multi-line pattern */ 2042 long b_syn_sync_linebreaks; // offset for multi-line pattern
2036 char_u *b_syn_linecont_pat; /* line continuation pattern */ 2043 char_u *b_syn_linecont_pat; // line continuation pattern
2037 regprog_T *b_syn_linecont_prog; /* line continuation program */ 2044 regprog_T *b_syn_linecont_prog; // line continuation program
2038 #ifdef FEAT_PROFILE 2045 #ifdef FEAT_PROFILE
2039 syn_time_T b_syn_linecont_time; 2046 syn_time_T b_syn_linecont_time;
2040 #endif 2047 #endif
2041 int b_syn_linecont_ic; /* ignore-case flag for above */ 2048 int b_syn_linecont_ic; // ignore-case flag for above
2042 int b_syn_topgrp; /* for ":syntax include" */ 2049 int b_syn_topgrp; // for ":syntax include"
2043 # ifdef FEAT_CONCEAL 2050 # ifdef FEAT_CONCEAL
2044 int b_syn_conceal; /* auto-conceal for :syn cmds */ 2051 int b_syn_conceal; // auto-conceal for :syn cmds
2045 # endif 2052 # endif
2046 # ifdef FEAT_FOLDING 2053 # ifdef FEAT_FOLDING
2047 int b_syn_folditems; /* number of patterns with the HL_FOLD 2054 int b_syn_folditems; // number of patterns with the HL_FOLD
2048 flag set */ 2055 // flag set
2049 # endif 2056 # endif
2050 /* 2057 /*
2051 * b_sst_array[] contains the state stack for a number of lines, for the 2058 * b_sst_array[] contains the state stack for a number of lines, for the
2052 * start of that line (col == 0). This avoids having to recompute the 2059 * start of that line (col == 0). This avoids having to recompute the
2053 * syntax state too often. 2060 * syntax state too often.
2065 int b_sst_len; 2072 int b_sst_len;
2066 synstate_T *b_sst_first; 2073 synstate_T *b_sst_first;
2067 synstate_T *b_sst_firstfree; 2074 synstate_T *b_sst_firstfree;
2068 int b_sst_freecount; 2075 int b_sst_freecount;
2069 linenr_T b_sst_check_lnum; 2076 linenr_T b_sst_check_lnum;
2070 short_u b_sst_lasttick; /* last display tick */ 2077 short_u b_sst_lasttick; // last display tick
2071 #endif /* FEAT_SYN_HL */ 2078 #endif // FEAT_SYN_HL
2072 2079
2073 #ifdef FEAT_SPELL 2080 #ifdef FEAT_SPELL
2074 /* for spell checking */ 2081 // for spell checking
2075 garray_T b_langp; /* list of pointers to slang_T, see spell.c */ 2082 garray_T b_langp; // list of pointers to slang_T, see spell.c
2076 char_u b_spell_ismw[256];/* flags: is midword char */ 2083 char_u b_spell_ismw[256]; // flags: is midword char
2077 char_u *b_spell_ismw_mb; /* multi-byte midword chars */ 2084 char_u *b_spell_ismw_mb; // multi-byte midword chars
2078 char_u *b_p_spc; /* 'spellcapcheck' */ 2085 char_u *b_p_spc; // 'spellcapcheck'
2079 regprog_T *b_cap_prog; /* program for 'spellcapcheck' */ 2086 regprog_T *b_cap_prog; // program for 'spellcapcheck'
2080 char_u *b_p_spf; /* 'spellfile' */ 2087 char_u *b_p_spf; // 'spellfile'
2081 char_u *b_p_spl; /* 'spelllang' */ 2088 char_u *b_p_spl; // 'spelllang'
2082 int b_cjk; /* all CJK letters as OK */ 2089 int b_cjk; // all CJK letters as OK
2083 #endif 2090 #endif
2084 #if !defined(FEAT_SYN_HL) && !defined(FEAT_SPELL) 2091 #if !defined(FEAT_SYN_HL) && !defined(FEAT_SPELL)
2085 int dummy; 2092 int dummy;
2086 #endif 2093 #endif
2087 char_u b_syn_chartab[32]; /* syntax iskeyword option */ 2094 char_u b_syn_chartab[32]; // syntax iskeyword option
2088 char_u *b_syn_isk; /* iskeyword option */ 2095 char_u *b_syn_isk; // iskeyword option
2089 } synblock_T; 2096 } synblock_T;
2090 2097
2091 2098
2092 /* 2099 /*
2093 * buffer: structure that holds information about one file 2100 * buffer: structure that holds information about one file
2097 * A buffer is new if the associated file has never been loaded yet. 2104 * A buffer is new if the associated file has never been loaded yet.
2098 */ 2105 */
2099 2106
2100 struct file_buffer 2107 struct file_buffer
2101 { 2108 {
2102 memline_T b_ml; /* associated memline (also contains line 2109 memline_T b_ml; // associated memline (also contains line
2103 count) */ 2110 // count)
2104 2111
2105 buf_T *b_next; /* links in list of buffers */ 2112 buf_T *b_next; // links in list of buffers
2106 buf_T *b_prev; 2113 buf_T *b_prev;
2107 2114
2108 int b_nwindows; /* nr of windows open on this buffer */ 2115 int b_nwindows; // nr of windows open on this buffer
2109 2116
2110 int b_flags; /* various BF_ flags */ 2117 int b_flags; // various BF_ flags
2111 int b_locked; /* Buffer is being closed or referenced, don't 2118 int b_locked; // Buffer is being closed or referenced, don't
2112 let autocommands wipe it out. */ 2119 // let autocommands wipe it out.
2113 2120
2114 /* 2121 /*
2115 * b_ffname has the full path of the file (NULL for no name). 2122 * b_ffname has the full path of the file (NULL for no name).
2116 * b_sfname is the name as the user typed it (or NULL). 2123 * b_sfname is the name as the user typed it (or NULL).
2117 * b_fname is the same as b_sfname, unless ":cd" has been done, 2124 * b_fname is the same as b_sfname, unless ":cd" has been done,
2122 // b_ffname 2129 // b_ffname
2123 char_u *b_fname; // current file name, points to b_ffname or 2130 char_u *b_fname; // current file name, points to b_ffname or
2124 // b_sfname 2131 // b_sfname
2125 2132
2126 #ifdef UNIX 2133 #ifdef UNIX
2127 int b_dev_valid; /* TRUE when b_dev has a valid number */ 2134 int b_dev_valid; // TRUE when b_dev has a valid number
2128 dev_t b_dev; /* device number */ 2135 dev_t b_dev; // device number
2129 ino_t b_ino; /* inode number */ 2136 ino_t b_ino; // inode number
2130 #endif 2137 #endif
2131 #ifdef FEAT_CW_EDITOR 2138 #ifdef FEAT_CW_EDITOR
2132 FSSpec b_FSSpec; /* MacOS File Identification */ 2139 FSSpec b_FSSpec; // MacOS File Identification
2133 #endif 2140 #endif
2134 #ifdef VMS 2141 #ifdef VMS
2135 char b_fab_rfm; /* Record format */ 2142 char b_fab_rfm; // Record format
2136 char b_fab_rat; /* Record attribute */ 2143 char b_fab_rat; // Record attribute
2137 unsigned int b_fab_mrs; /* Max record size */ 2144 unsigned int b_fab_mrs; // Max record size
2138 #endif 2145 #endif
2139 int b_fnum; /* buffer number for this file. */ 2146 int b_fnum; // buffer number for this file.
2140 char_u b_key[VIM_SIZEOF_INT * 2 + 1]; 2147 char_u b_key[VIM_SIZEOF_INT * 2 + 1];
2141 /* key used for buf_hashtab, holds b_fnum as 2148 // key used for buf_hashtab, holds b_fnum as
2142 hex string */ 2149 // hex string
2143 2150
2144 int b_changed; /* 'modified': Set to TRUE if something in the 2151 int b_changed; // 'modified': Set to TRUE if something in the
2145 file has been changed and not written out. */ 2152 // file has been changed and not written out.
2146 dictitem16_T b_ct_di; /* holds the b:changedtick value in 2153 dictitem16_T b_ct_di; // holds the b:changedtick value in
2147 b_ct_di.di_tv.vval.v_number; 2154 // b_ct_di.di_tv.vval.v_number;
2148 incremented for each change, also for undo */ 2155 // incremented for each change, also for undo
2149 #define CHANGEDTICK(buf) ((buf)->b_ct_di.di_tv.vval.v_number) 2156 #define CHANGEDTICK(buf) ((buf)->b_ct_di.di_tv.vval.v_number)
2150 2157
2151 varnumber_T b_last_changedtick; /* b:changedtick when TextChanged or 2158 varnumber_T b_last_changedtick; // b:changedtick when TextChanged or
2152 TextChangedI was last triggered. */ 2159 // TextChangedI was last triggered.
2153 #ifdef FEAT_INS_EXPAND 2160 #ifdef FEAT_INS_EXPAND
2154 varnumber_T b_last_changedtick_pum; /* b:changedtick when TextChangedP was 2161 varnumber_T b_last_changedtick_pum; // b:changedtick when TextChangedP was
2155 last triggered. */ 2162 // last triggered.
2156 #endif 2163 #endif
2157 2164
2158 int b_saving; /* Set to TRUE if we are in the middle of 2165 int b_saving; // Set to TRUE if we are in the middle of
2159 saving the buffer. */ 2166 // saving the buffer.
2160 2167
2161 /* 2168 /*
2162 * Changes to a buffer require updating of the display. To minimize the 2169 * Changes to a buffer require updating of the display. To minimize the
2163 * work, remember changes made and update everything at once. 2170 * work, remember changes made and update everything at once.
2164 */ 2171 */
2165 int b_mod_set; /* TRUE when there are changes since the last 2172 int b_mod_set; // TRUE when there are changes since the last
2166 time the display was updated */ 2173 // time the display was updated
2167 linenr_T b_mod_top; /* topmost lnum that was changed */ 2174 linenr_T b_mod_top; // topmost lnum that was changed
2168 linenr_T b_mod_bot; /* lnum below last changed line, AFTER the 2175 linenr_T b_mod_bot; // lnum below last changed line, AFTER the
2169 change */ 2176 // change
2170 long b_mod_xlines; /* number of extra buffer lines inserted; 2177 long b_mod_xlines; // number of extra buffer lines inserted;
2171 negative when lines were deleted */ 2178 // negative when lines were deleted
2172 2179
2173 wininfo_T *b_wininfo; /* list of last used info for each window */ 2180 wininfo_T *b_wininfo; // list of last used info for each window
2174 2181
2175 long b_mtime; /* last change time of original file */ 2182 long b_mtime; // last change time of original file
2176 long b_mtime_read; /* last change time when reading */ 2183 long b_mtime_read; // last change time when reading
2177 off_T b_orig_size; /* size of original file in bytes */ 2184 off_T b_orig_size; // size of original file in bytes
2178 int b_orig_mode; /* mode of original file */ 2185 int b_orig_mode; // mode of original file
2179 #ifdef FEAT_VIMINFO 2186 #ifdef FEAT_VIMINFO
2180 time_T b_last_used; /* time when the buffer was last used; used 2187 time_T b_last_used; // time when the buffer was last used; used
2181 * for viminfo */ 2188 // for viminfo
2182 #endif 2189 #endif
2183 2190
2184 pos_T b_namedm[NMARKS]; /* current named marks (mark.c) */ 2191 pos_T b_namedm[NMARKS]; // current named marks (mark.c)
2185 2192
2186 /* These variables are set when VIsual_active becomes FALSE */ 2193 // These variables are set when VIsual_active becomes FALSE
2187 visualinfo_T b_visual; 2194 visualinfo_T b_visual;
2188 #ifdef FEAT_EVAL 2195 #ifdef FEAT_EVAL
2189 int b_visual_mode_eval; /* b_visual.vi_mode for visualmode() */ 2196 int b_visual_mode_eval; // b_visual.vi_mode for visualmode()
2190 #endif 2197 #endif
2191 2198
2192 pos_T b_last_cursor; /* cursor position when last unloading this 2199 pos_T b_last_cursor; // cursor position when last unloading this
2193 buffer */ 2200 // buffer
2194 pos_T b_last_insert; /* where Insert mode was left */ 2201 pos_T b_last_insert; // where Insert mode was left
2195 pos_T b_last_change; /* position of last change: '. mark */ 2202 pos_T b_last_change; // position of last change: '. mark
2196 2203
2197 #ifdef FEAT_JUMPLIST 2204 #ifdef FEAT_JUMPLIST
2198 /* 2205 /*
2199 * the changelist contains old change positions 2206 * the changelist contains old change positions
2200 */ 2207 */
2201 pos_T b_changelist[JUMPLISTSIZE]; 2208 pos_T b_changelist[JUMPLISTSIZE];
2202 int b_changelistlen; /* number of active entries */ 2209 int b_changelistlen; // number of active entries
2203 int b_new_change; /* set by u_savecommon() */ 2210 int b_new_change; // set by u_savecommon()
2204 #endif 2211 #endif
2205 2212
2206 /* 2213 /*
2207 * Character table, only used in charset.c for 'iskeyword' 2214 * Character table, only used in charset.c for 'iskeyword'
2208 * 32 bytes of 8 bits: 1 bit per character 0-255. 2215 * 32 bytes of 8 bits: 1 bit per character 0-255.
2209 */ 2216 */
2210 char_u b_chartab[32]; 2217 char_u b_chartab[32];
2211 2218
2212 #ifdef FEAT_LOCALMAP 2219 #ifdef FEAT_LOCALMAP
2213 /* Table used for mappings local to a buffer. */ 2220 // Table used for mappings local to a buffer.
2214 mapblock_T *(b_maphash[256]); 2221 mapblock_T *(b_maphash[256]);
2215 2222
2216 /* First abbreviation local to a buffer. */ 2223 // First abbreviation local to a buffer.
2217 mapblock_T *b_first_abbr; 2224 mapblock_T *b_first_abbr;
2218 #endif 2225 #endif
2219 // User commands local to the buffer. 2226 // User commands local to the buffer.
2220 garray_T b_ucmds; 2227 garray_T b_ucmds;
2221 /* 2228 // start and end of an operator, also used for '[ and ']
2222 * start and end of an operator, also used for '[ and ']
2223 */
2224 pos_T b_op_start; 2229 pos_T b_op_start;
2225 pos_T b_op_start_orig; /* used for Insstart_orig */ 2230 pos_T b_op_start_orig; /* used for Insstart_orig */
2226 pos_T b_op_end; 2231 pos_T b_op_end;
2227 2232
2228 #ifdef FEAT_VIMINFO 2233 #ifdef FEAT_VIMINFO
2229 int b_marks_read; /* Have we read viminfo marks yet? */ 2234 int b_marks_read; // Have we read viminfo marks yet?
2230 #endif 2235 #endif
2231 2236
2232 /* 2237 /*
2233 * The following only used in undo.c. 2238 * The following only used in undo.c.
2234 */ 2239 */
2235 u_header_T *b_u_oldhead; /* pointer to oldest header */ 2240 u_header_T *b_u_oldhead; // pointer to oldest header
2236 u_header_T *b_u_newhead; /* pointer to newest header; may not be valid 2241 u_header_T *b_u_newhead; // pointer to newest header; may not be valid
2237 if b_u_curhead is not NULL */ 2242 // if b_u_curhead is not NULL
2238 u_header_T *b_u_curhead; /* pointer to current header */ 2243 u_header_T *b_u_curhead; // pointer to current header
2239 int b_u_numhead; /* current number of headers */ 2244 int b_u_numhead; // current number of headers
2240 int b_u_synced; /* entry lists are synced */ 2245 int b_u_synced; // entry lists are synced
2241 long b_u_seq_last; /* last used undo sequence number */ 2246 long b_u_seq_last; // last used undo sequence number
2242 long b_u_save_nr_last; /* counter for last file write */ 2247 long b_u_save_nr_last; // counter for last file write
2243 long b_u_seq_cur; /* hu_seq of header below which we are now */ 2248 long b_u_seq_cur; // hu_seq of header below which we are now
2244 time_T b_u_time_cur; /* uh_time of header below which we are now */ 2249 time_T b_u_time_cur; // uh_time of header below which we are now
2245 long b_u_save_nr_cur; /* file write nr after which we are now */ 2250 long b_u_save_nr_cur; // file write nr after which we are now
2246 2251
2247 /* 2252 /*
2248 * variables for "U" command in undo.c 2253 * variables for "U" command in undo.c
2249 */ 2254 */
2250 undoline_T b_u_line_ptr; /* saved line for "U" command */ 2255 undoline_T b_u_line_ptr; // saved line for "U" command
2251 linenr_T b_u_line_lnum; /* line number of line in u_line */ 2256 linenr_T b_u_line_lnum; // line number of line in u_line
2252 colnr_T b_u_line_colnr; /* optional column number */ 2257 colnr_T b_u_line_colnr; // optional column number
2253 2258
2254 #ifdef FEAT_INS_EXPAND 2259 #ifdef FEAT_INS_EXPAND
2255 int b_scanned; /* ^N/^P have scanned this buffer */ 2260 int b_scanned; // ^N/^P have scanned this buffer
2256 #endif 2261 #endif
2257 2262
2258 /* flags for use of ":lmap" and IM control */ 2263 // flags for use of ":lmap" and IM control
2259 long b_p_iminsert; /* input mode for insert */ 2264 long b_p_iminsert; // input mode for insert
2260 long b_p_imsearch; /* input mode for search */ 2265 long b_p_imsearch; // input mode for search
2261 #define B_IMODE_USE_INSERT -1 /* Use b_p_iminsert value for search */ 2266 #define B_IMODE_USE_INSERT -1 // Use b_p_iminsert value for search
2262 #define B_IMODE_NONE 0 /* Input via none */ 2267 #define B_IMODE_NONE 0 // Input via none
2263 #define B_IMODE_LMAP 1 /* Input via langmap */ 2268 #define B_IMODE_LMAP 1 // Input via langmap
2264 #define B_IMODE_IM 2 /* Input via input method */ 2269 #define B_IMODE_IM 2 // Input via input method
2265 #define B_IMODE_LAST 2 2270 #define B_IMODE_LAST 2
2266 2271
2267 #ifdef FEAT_KEYMAP 2272 #ifdef FEAT_KEYMAP
2268 short b_kmap_state; /* using "lmap" mappings */ 2273 short b_kmap_state; // using "lmap" mappings
2269 # define KEYMAP_INIT 1 /* 'keymap' was set, call keymap_init() */ 2274 # define KEYMAP_INIT 1 // 'keymap' was set, call keymap_init()
2270 # define KEYMAP_LOADED 2 /* 'keymap' mappings have been loaded */ 2275 # define KEYMAP_LOADED 2 // 'keymap' mappings have been loaded
2271 garray_T b_kmap_ga; /* the keymap table */ 2276 garray_T b_kmap_ga; // the keymap table
2272 #endif 2277 #endif
2273 2278
2274 /* 2279 /*
2275 * Options local to a buffer. 2280 * Options local to a buffer.
2276 * They are here because their value depends on the type of file 2281 * They are here because their value depends on the type of file
2277 * or contents of the file being edited. 2282 * or contents of the file being edited.
2278 */ 2283 */
2279 int b_p_initialized; /* set when options initialized */ 2284 int b_p_initialized; // set when options initialized
2280 2285
2281 #ifdef FEAT_EVAL 2286 #ifdef FEAT_EVAL
2282 sctx_T b_p_script_ctx[BV_COUNT]; /* SCTXs for buffer-local options */ 2287 sctx_T b_p_script_ctx[BV_COUNT]; // SCTXs for buffer-local options
2283 #endif 2288 #endif
2284 2289
2285 int b_p_ai; /* 'autoindent' */ 2290 int b_p_ai; // 'autoindent'
2286 int b_p_ai_nopaste; /* b_p_ai saved for paste mode */ 2291 int b_p_ai_nopaste; // b_p_ai saved for paste mode
2287 char_u *b_p_bkc; /* 'backupcopy' */ 2292 char_u *b_p_bkc; // 'backupcopy'
2288 unsigned b_bkc_flags; /* flags for 'backupcopy' */ 2293 unsigned b_bkc_flags; // flags for 'backupcopy'
2289 int b_p_ci; /* 'copyindent' */ 2294 int b_p_ci; // 'copyindent'
2290 int b_p_bin; /* 'binary' */ 2295 int b_p_bin; // 'binary'
2291 int b_p_bomb; /* 'bomb' */ 2296 int b_p_bomb; // 'bomb'
2292 char_u *b_p_bh; /* 'bufhidden' */ 2297 char_u *b_p_bh; // 'bufhidden'
2293 char_u *b_p_bt; /* 'buftype' */ 2298 char_u *b_p_bt; // 'buftype'
2294 #ifdef FEAT_QUICKFIX 2299 #ifdef FEAT_QUICKFIX
2295 #define BUF_HAS_QF_ENTRY 1 2300 #define BUF_HAS_QF_ENTRY 1
2296 #define BUF_HAS_LL_ENTRY 2 2301 #define BUF_HAS_LL_ENTRY 2
2297 int b_has_qf_entry; 2302 int b_has_qf_entry;
2298 #endif 2303 #endif
2299 int b_p_bl; /* 'buflisted' */ 2304 int b_p_bl; // 'buflisted'
2300 #ifdef FEAT_CINDENT 2305 #ifdef FEAT_CINDENT
2301 int b_p_cin; /* 'cindent' */ 2306 int b_p_cin; // 'cindent'
2302 char_u *b_p_cino; /* 'cinoptions' */ 2307 char_u *b_p_cino; // 'cinoptions'
2303 char_u *b_p_cink; /* 'cinkeys' */ 2308 char_u *b_p_cink; // 'cinkeys'
2304 #endif 2309 #endif
2305 #if defined(FEAT_CINDENT) || defined(FEAT_SMARTINDENT) 2310 #if defined(FEAT_CINDENT) || defined(FEAT_SMARTINDENT)
2306 char_u *b_p_cinw; /* 'cinwords' */ 2311 char_u *b_p_cinw; // 'cinwords'
2307 #endif 2312 #endif
2308 #ifdef FEAT_COMMENTS 2313 #ifdef FEAT_COMMENTS
2309 char_u *b_p_com; /* 'comments' */ 2314 char_u *b_p_com; // 'comments'
2310 #endif 2315 #endif
2311 #ifdef FEAT_FOLDING 2316 #ifdef FEAT_FOLDING
2312 char_u *b_p_cms; /* 'commentstring' */ 2317 char_u *b_p_cms; // 'commentstring'
2313 #endif 2318 #endif
2314 #ifdef FEAT_INS_EXPAND 2319 #ifdef FEAT_INS_EXPAND
2315 char_u *b_p_cpt; /* 'complete' */ 2320 char_u *b_p_cpt; // 'complete'
2316 #endif 2321 #endif
2317 #ifdef FEAT_COMPL_FUNC 2322 #ifdef FEAT_COMPL_FUNC
2318 char_u *b_p_cfu; /* 'completefunc' */ 2323 char_u *b_p_cfu; // 'completefunc'
2319 char_u *b_p_ofu; /* 'omnifunc' */ 2324 char_u *b_p_ofu; // 'omnifunc'
2320 #endif 2325 #endif
2321 #ifdef FEAT_EVAL 2326 #ifdef FEAT_EVAL
2322 char_u *b_p_tfu; /* 'tagfunc' */ 2327 char_u *b_p_tfu; // 'tagfunc'
2323 #endif 2328 #endif
2324 int b_p_eol; /* 'endofline' */ 2329 int b_p_eol; // 'endofline'
2325 int b_p_fixeol; /* 'fixendofline' */ 2330 int b_p_fixeol; // 'fixendofline'
2326 int b_p_et; /* 'expandtab' */ 2331 int b_p_et; // 'expandtab'
2327 int b_p_et_nobin; /* b_p_et saved for binary mode */ 2332 int b_p_et_nobin; // b_p_et saved for binary mode
2328 int b_p_et_nopaste; /* b_p_et saved for paste mode */ 2333 int b_p_et_nopaste; // b_p_et saved for paste mode
2329 char_u *b_p_fenc; /* 'fileencoding' */ 2334 char_u *b_p_fenc; // 'fileencoding'
2330 char_u *b_p_ff; /* 'fileformat' */ 2335 char_u *b_p_ff; // 'fileformat'
2331 char_u *b_p_ft; /* 'filetype' */ 2336 char_u *b_p_ft; // 'filetype'
2332 char_u *b_p_fo; /* 'formatoptions' */ 2337 char_u *b_p_fo; // 'formatoptions'
2333 char_u *b_p_flp; /* 'formatlistpat' */ 2338 char_u *b_p_flp; // 'formatlistpat'
2334 int b_p_inf; /* 'infercase' */ 2339 int b_p_inf; // 'infercase'
2335 char_u *b_p_isk; /* 'iskeyword' */ 2340 char_u *b_p_isk; // 'iskeyword'
2336 #ifdef FEAT_FIND_ID 2341 #ifdef FEAT_FIND_ID
2337 char_u *b_p_def; /* 'define' local value */ 2342 char_u *b_p_def; // 'define' local value
2338 char_u *b_p_inc; /* 'include' */ 2343 char_u *b_p_inc; // 'include'
2339 # ifdef FEAT_EVAL 2344 # ifdef FEAT_EVAL
2340 char_u *b_p_inex; /* 'includeexpr' */ 2345 char_u *b_p_inex; // 'includeexpr'
2341 long_u b_p_inex_flags; /* flags for 'includeexpr' */ 2346 long_u b_p_inex_flags; // flags for 'includeexpr'
2342 # endif 2347 # endif
2343 #endif 2348 #endif
2344 #if defined(FEAT_CINDENT) && defined(FEAT_EVAL) 2349 #if defined(FEAT_CINDENT) && defined(FEAT_EVAL)
2345 char_u *b_p_inde; /* 'indentexpr' */ 2350 char_u *b_p_inde; // 'indentexpr'
2346 long_u b_p_inde_flags; /* flags for 'indentexpr' */ 2351 long_u b_p_inde_flags; // flags for 'indentexpr'
2347 char_u *b_p_indk; /* 'indentkeys' */ 2352 char_u *b_p_indk; // 'indentkeys'
2348 #endif 2353 #endif
2349 char_u *b_p_fp; /* 'formatprg' */ 2354 char_u *b_p_fp; // 'formatprg'
2350 #if defined(FEAT_EVAL) 2355 #if defined(FEAT_EVAL)
2351 char_u *b_p_fex; /* 'formatexpr' */ 2356 char_u *b_p_fex; // 'formatexpr'
2352 long_u b_p_fex_flags; /* flags for 'formatexpr' */ 2357 long_u b_p_fex_flags; // flags for 'formatexpr'
2353 #endif 2358 #endif
2354 #ifdef FEAT_CRYPT 2359 #ifdef FEAT_CRYPT
2355 char_u *b_p_key; /* 'key' */ 2360 char_u *b_p_key; // 'key'
2356 #endif 2361 #endif
2357 char_u *b_p_kp; /* 'keywordprg' */ 2362 char_u *b_p_kp; // 'keywordprg'
2358 #ifdef FEAT_LISP 2363 #ifdef FEAT_LISP
2359 int b_p_lisp; /* 'lisp' */ 2364 int b_p_lisp; // 'lisp'
2360 #endif 2365 #endif
2361 char_u *b_p_menc; /* 'makeencoding' */ 2366 char_u *b_p_menc; // 'makeencoding'
2362 char_u *b_p_mps; /* 'matchpairs' */ 2367 char_u *b_p_mps; // 'matchpairs'
2363 int b_p_ml; /* 'modeline' */ 2368 int b_p_ml; // 'modeline'
2364 int b_p_ml_nobin; /* b_p_ml saved for binary mode */ 2369 int b_p_ml_nobin; // b_p_ml saved for binary mode
2365 int b_p_ma; /* 'modifiable' */ 2370 int b_p_ma; // 'modifiable'
2366 char_u *b_p_nf; /* 'nrformats' */ 2371 char_u *b_p_nf; // 'nrformats'
2367 int b_p_pi; /* 'preserveindent' */ 2372 int b_p_pi; // 'preserveindent'
2368 #ifdef FEAT_TEXTOBJ 2373 #ifdef FEAT_TEXTOBJ
2369 char_u *b_p_qe; /* 'quoteescape' */ 2374 char_u *b_p_qe; // 'quoteescape'
2370 #endif 2375 #endif
2371 int b_p_ro; /* 'readonly' */ 2376 int b_p_ro; // 'readonly'
2372 long b_p_sw; /* 'shiftwidth' */ 2377 long b_p_sw; // 'shiftwidth'
2373 int b_p_sn; /* 'shortname' */ 2378 int b_p_sn; // 'shortname'
2374 #ifdef FEAT_SMARTINDENT 2379 #ifdef FEAT_SMARTINDENT
2375 int b_p_si; /* 'smartindent' */ 2380 int b_p_si; // 'smartindent'
2376 #endif 2381 #endif
2377 long b_p_sts; /* 'softtabstop' */ 2382 long b_p_sts; // 'softtabstop'
2378 long b_p_sts_nopaste; /* b_p_sts saved for paste mode */ 2383 long b_p_sts_nopaste; // b_p_sts saved for paste mode
2379 #ifdef FEAT_SEARCHPATH 2384 #ifdef FEAT_SEARCHPATH
2380 char_u *b_p_sua; /* 'suffixesadd' */ 2385 char_u *b_p_sua; // 'suffixesadd'
2381 #endif 2386 #endif
2382 int b_p_swf; /* 'swapfile' */ 2387 int b_p_swf; // 'swapfile'
2383 #ifdef FEAT_SYN_HL 2388 #ifdef FEAT_SYN_HL
2384 long b_p_smc; /* 'synmaxcol' */ 2389 long b_p_smc; // 'synmaxcol'
2385 char_u *b_p_syn; /* 'syntax' */ 2390 char_u *b_p_syn; // 'syntax'
2386 #endif 2391 #endif
2387 long b_p_ts; /* 'tabstop' */ 2392 long b_p_ts; // 'tabstop'
2388 int b_p_tx; /* 'textmode' */ 2393 int b_p_tx; // 'textmode'
2389 long b_p_tw; /* 'textwidth' */ 2394 long b_p_tw; // 'textwidth'
2390 long b_p_tw_nobin; /* b_p_tw saved for binary mode */ 2395 long b_p_tw_nobin; // b_p_tw saved for binary mode
2391 long b_p_tw_nopaste; /* b_p_tw saved for paste mode */ 2396 long b_p_tw_nopaste; // b_p_tw saved for paste mode
2392 long b_p_wm; /* 'wrapmargin' */ 2397 long b_p_wm; // 'wrapmargin'
2393 long b_p_wm_nobin; /* b_p_wm saved for binary mode */ 2398 long b_p_wm_nobin; // b_p_wm saved for binary mode
2394 long b_p_wm_nopaste; /* b_p_wm saved for paste mode */ 2399 long b_p_wm_nopaste; // b_p_wm saved for paste mode
2395 #ifdef FEAT_VARTABS 2400 #ifdef FEAT_VARTABS
2396 char_u *b_p_vsts; /* 'varsofttabstop' */ 2401 char_u *b_p_vsts; // 'varsofttabstop'
2397 int *b_p_vsts_array; /* 'varsofttabstop' in internal format */ 2402 int *b_p_vsts_array; // 'varsofttabstop' in internal format
2398 char_u *b_p_vsts_nopaste; /* b_p_vsts saved for paste mode */ 2403 char_u *b_p_vsts_nopaste; // b_p_vsts saved for paste mode
2399 char_u *b_p_vts; /* 'vartabstop' */ 2404 char_u *b_p_vts; // 'vartabstop'
2400 int *b_p_vts_array; /* 'vartabstop' in internal format */ 2405 int *b_p_vts_array; // 'vartabstop' in internal format
2401 #endif 2406 #endif
2402 #ifdef FEAT_KEYMAP 2407 #ifdef FEAT_KEYMAP
2403 char_u *b_p_keymap; /* 'keymap' */ 2408 char_u *b_p_keymap; // 'keymap'
2404 #endif 2409 #endif
2405 2410
2406 /* local values for options which are normally global */ 2411 /*
2412 * local values for options which are normally global
2413 */
2407 #ifdef FEAT_QUICKFIX 2414 #ifdef FEAT_QUICKFIX
2408 char_u *b_p_gp; /* 'grepprg' local value */ 2415 char_u *b_p_gp; // 'grepprg' local value
2409 char_u *b_p_mp; /* 'makeprg' local value */ 2416 char_u *b_p_mp; // 'makeprg' local value
2410 char_u *b_p_efm; /* 'errorformat' local value */ 2417 char_u *b_p_efm; // 'errorformat' local value
2411 #endif 2418 #endif
2412 char_u *b_p_ep; /* 'equalprg' local value */ 2419 char_u *b_p_ep; // 'equalprg' local value
2413 char_u *b_p_path; /* 'path' local value */ 2420 char_u *b_p_path; // 'path' local value
2414 int b_p_ar; /* 'autoread' local value */ 2421 int b_p_ar; // 'autoread' local value
2415 char_u *b_p_tags; /* 'tags' local value */ 2422 char_u *b_p_tags; // 'tags' local value
2416 char_u *b_p_tc; /* 'tagcase' local value */ 2423 char_u *b_p_tc; // 'tagcase' local value
2417 unsigned b_tc_flags; /* flags for 'tagcase' */ 2424 unsigned b_tc_flags; // flags for 'tagcase'
2418 #ifdef FEAT_INS_EXPAND 2425 #ifdef FEAT_INS_EXPAND
2419 char_u *b_p_dict; /* 'dictionary' local value */ 2426 char_u *b_p_dict; // 'dictionary' local value
2420 char_u *b_p_tsr; /* 'thesaurus' local value */ 2427 char_u *b_p_tsr; // 'thesaurus' local value
2421 #endif 2428 #endif
2422 long b_p_ul; /* 'undolevels' local value */ 2429 long b_p_ul; // 'undolevels' local value
2423 #ifdef FEAT_PERSISTENT_UNDO 2430 #ifdef FEAT_PERSISTENT_UNDO
2424 int b_p_udf; /* 'undofile' */ 2431 int b_p_udf; // 'undofile'
2425 #endif 2432 #endif
2426 #ifdef FEAT_LISP 2433 #ifdef FEAT_LISP
2427 char_u *b_p_lw; /* 'lispwords' local value */ 2434 char_u *b_p_lw; // 'lispwords' local value
2428 #endif 2435 #endif
2429 #ifdef FEAT_TERMINAL 2436 #ifdef FEAT_TERMINAL
2430 long b_p_twsl; /* 'termwinscroll' */ 2437 long b_p_twsl; // 'termwinscroll'
2431 #endif 2438 #endif
2432 2439
2433 /* end of buffer options */ 2440 /*
2441 * end of buffer options
2442 */
2434 2443
2435 #ifdef FEAT_CINDENT 2444 #ifdef FEAT_CINDENT
2436 /* values set from b_p_cino */ 2445 // values set from b_p_cino
2437 int b_ind_level; 2446 int b_ind_level;
2438 int b_ind_open_imag; 2447 int b_ind_open_imag;
2439 int b_ind_no_brace; 2448 int b_ind_no_brace;
2440 int b_ind_first_open; 2449 int b_ind_first_open;
2441 int b_ind_open_extra; 2450 int b_ind_open_extra;
2470 int b_ind_cpp_namespace; 2479 int b_ind_cpp_namespace;
2471 int b_ind_if_for_while; 2480 int b_ind_if_for_while;
2472 int b_ind_cpp_extern_c; 2481 int b_ind_cpp_extern_c;
2473 #endif 2482 #endif
2474 2483
2475 linenr_T b_no_eol_lnum; /* non-zero lnum when last line of next binary 2484 linenr_T b_no_eol_lnum; // non-zero lnum when last line of next binary
2476 * write should not have an end-of-line */ 2485 // write should not have an end-of-line
2477 2486
2478 int b_start_eol; /* last line had eol when it was read */ 2487 int b_start_eol; // last line had eol when it was read
2479 int b_start_ffc; /* first char of 'ff' when edit started */ 2488 int b_start_ffc; // first char of 'ff' when edit started
2480 char_u *b_start_fenc; /* 'fileencoding' when edit started or NULL */ 2489 char_u *b_start_fenc; // 'fileencoding' when edit started or NULL
2481 int b_bad_char; /* "++bad=" argument when edit started or 0 */ 2490 int b_bad_char; // "++bad=" argument when edit started or 0
2482 int b_start_bomb; /* 'bomb' when it was read */ 2491 int b_start_bomb; // 'bomb' when it was read
2483 2492
2484 #ifdef FEAT_EVAL 2493 #ifdef FEAT_EVAL
2485 dictitem_T b_bufvar; /* variable for "b:" Dictionary */ 2494 dictitem_T b_bufvar; // variable for "b:" Dictionary
2486 dict_T *b_vars; /* internal variables, local to buffer */ 2495 dict_T *b_vars; // internal variables, local to buffer
2487 2496
2488 listener_T *b_listener; 2497 listener_T *b_listener;
2489 list_T *b_recorded_changes; 2498 list_T *b_recorded_changes;
2490 #endif 2499 #endif
2491 #ifdef FEAT_TEXT_PROP 2500 #ifdef FEAT_TEXT_PROP
2492 int b_has_textprop; // TRUE when text props were added 2501 int b_has_textprop; // TRUE when text props were added
2493 hashtab_T *b_proptypes; // text property types local to buffer 2502 hashtab_T *b_proptypes; // text property types local to buffer
2494 #endif 2503 #endif
2495 2504
2496 #if defined(FEAT_BEVAL) && defined(FEAT_EVAL) 2505 #if defined(FEAT_BEVAL) && defined(FEAT_EVAL)
2497 char_u *b_p_bexpr; /* 'balloonexpr' local value */ 2506 char_u *b_p_bexpr; // 'balloonexpr' local value
2498 long_u b_p_bexpr_flags;/* flags for 'balloonexpr' */ 2507 long_u b_p_bexpr_flags;// flags for 'balloonexpr'
2499 #endif 2508 #endif
2500 #ifdef FEAT_CRYPT 2509 #ifdef FEAT_CRYPT
2501 char_u *b_p_cm; /* 'cryptmethod' */ 2510 char_u *b_p_cm; // 'cryptmethod'
2502 #endif 2511 #endif
2503 2512
2504 /* When a buffer is created, it starts without a swap file. b_may_swap is 2513 // When a buffer is created, it starts without a swap file. b_may_swap is
2505 * then set to indicate that a swap file may be opened later. It is reset 2514 // then set to indicate that a swap file may be opened later. It is reset
2506 * if a swap file could not be opened. 2515 // if a swap file could not be opened.
2507 */
2508 int b_may_swap; 2516 int b_may_swap;
2509 int b_did_warn; /* Set to 1 if user has been warned on first 2517 int b_did_warn; // Set to 1 if user has been warned on first
2510 change of a read-only file */ 2518 // change of a read-only file
2511 2519
2512 /* Two special kinds of buffers: 2520 // Two special kinds of buffers:
2513 * help buffer - used for help files, won't use a swap file. 2521 // help buffer - used for help files, won't use a swap file.
2514 * spell buffer - used for spell info, never displayed and doesn't have a 2522 // spell buffer - used for spell info, never displayed and doesn't have a
2515 * file name. 2523 // file name.
2516 */ 2524 int b_help; // TRUE for help file buffer (when set b_p_bt
2517 int b_help; /* TRUE for help file buffer (when set b_p_bt 2525 // is "help")
2518 is "help") */
2519 #ifdef FEAT_SPELL 2526 #ifdef FEAT_SPELL
2520 int b_spell; /* TRUE for a spell file buffer, most fields 2527 int b_spell; // TRUE for a spell file buffer, most fields
2521 are not used! Use the B_SPELL macro to 2528 // are not used! Use the B_SPELL macro to
2522 access b_spell without #ifdef. */ 2529 // access b_spell without #ifdef.
2523 #endif 2530 #endif
2524 2531
2525 int b_shortname; /* this file has an 8.3 file name */ 2532 int b_shortname; // this file has an 8.3 file name
2526 2533
2527 #ifdef FEAT_JOB_CHANNEL 2534 #ifdef FEAT_JOB_CHANNEL
2528 char_u *b_prompt_text; // set by prompt_setprompt() 2535 char_u *b_prompt_text; // set by prompt_setprompt()
2529 callback_T b_prompt_callback; // set by prompt_setcallback() 2536 callback_T b_prompt_callback; // set by prompt_setcallback()
2530 callback_T b_prompt_interrupt; // set by prompt_setinterrupt() 2537 callback_T b_prompt_interrupt; // set by prompt_setinterrupt()
2531 int b_prompt_insert; // value for restart_edit when entering 2538 int b_prompt_insert; // value for restart_edit when entering
2532 // a prompt buffer window. 2539 // a prompt buffer window.
2533 #endif 2540 #endif
2534 #ifdef FEAT_MZSCHEME 2541 #ifdef FEAT_MZSCHEME
2535 void *b_mzscheme_ref; /* The MzScheme reference to this buffer */ 2542 void *b_mzscheme_ref; // The MzScheme reference to this buffer
2536 #endif 2543 #endif
2537 2544
2538 #ifdef FEAT_PERL 2545 #ifdef FEAT_PERL
2539 void *b_perl_private; 2546 void *b_perl_private;
2540 #endif 2547 #endif
2541 2548
2542 #ifdef FEAT_PYTHON 2549 #ifdef FEAT_PYTHON
2543 void *b_python_ref; /* The Python reference to this buffer */ 2550 void *b_python_ref; // The Python reference to this buffer
2544 #endif 2551 #endif
2545 2552
2546 #ifdef FEAT_PYTHON3 2553 #ifdef FEAT_PYTHON3
2547 void *b_python3_ref; /* The Python3 reference to this buffer */ 2554 void *b_python3_ref; // The Python3 reference to this buffer
2548 #endif 2555 #endif
2549 2556
2550 #ifdef FEAT_TCL 2557 #ifdef FEAT_TCL
2551 void *b_tcl_ref; 2558 void *b_tcl_ref;
2552 #endif 2559 #endif
2554 #ifdef FEAT_RUBY 2561 #ifdef FEAT_RUBY
2555 void *b_ruby_ref; 2562 void *b_ruby_ref;
2556 #endif 2563 #endif
2557 2564
2558 #if defined(FEAT_SYN_HL) || defined(FEAT_SPELL) 2565 #if defined(FEAT_SYN_HL) || defined(FEAT_SPELL)
2559 synblock_T b_s; /* Info related to syntax highlighting. w_s 2566 synblock_T b_s; // Info related to syntax highlighting. w_s
2560 * normally points to this, but some windows 2567 // normally points to this, but some windows
2561 * may use a different synblock_T. */ 2568 // may use a different synblock_T.
2562 #endif 2569 #endif
2563 2570
2564 #ifdef FEAT_SIGNS 2571 #ifdef FEAT_SIGNS
2565 signlist_T *b_signlist; /* list of signs to draw */ 2572 signlist_T *b_signlist; // list of signs to draw
2566 # ifdef FEAT_NETBEANS_INTG 2573 # ifdef FEAT_NETBEANS_INTG
2567 int b_has_sign_column; /* Flag that is set when a first sign is 2574 int b_has_sign_column; // Flag that is set when a first sign is
2568 * added and remains set until the end of 2575 // added and remains set until the end of
2569 * the netbeans session. */ 2576 // the netbeans session.
2570 # endif 2577 # endif
2571 #endif 2578 #endif
2572 2579
2573 #ifdef FEAT_NETBEANS_INTG 2580 #ifdef FEAT_NETBEANS_INTG
2574 int b_netbeans_file; /* TRUE when buffer is owned by NetBeans */ 2581 int b_netbeans_file; // TRUE when buffer is owned by NetBeans
2575 int b_was_netbeans_file;/* TRUE if b_netbeans_file was once set */ 2582 int b_was_netbeans_file;// TRUE if b_netbeans_file was once set
2576 #endif 2583 #endif
2577 #ifdef FEAT_JOB_CHANNEL 2584 #ifdef FEAT_JOB_CHANNEL
2578 int b_write_to_channel; /* TRUE when appended lines are written to 2585 int b_write_to_channel; // TRUE when appended lines are written to
2579 * a channel. */ 2586 // a channel.
2580 #endif 2587 #endif
2581 2588
2582 #ifdef FEAT_CRYPT 2589 #ifdef FEAT_CRYPT
2583 cryptstate_T *b_cryptstate; /* Encryption state while reading or writing 2590 cryptstate_T *b_cryptstate; // Encryption state while reading or writing
2584 * the file. NULL when not using encryption. */ 2591 // the file. NULL when not using encryption.
2585 #endif 2592 #endif
2586 int b_mapped_ctrl_c; /* modes where CTRL-C is mapped */ 2593 int b_mapped_ctrl_c; // modes where CTRL-C is mapped
2587 2594
2588 #ifdef FEAT_TERMINAL 2595 #ifdef FEAT_TERMINAL
2589 term_T *b_term; /* When not NULL this buffer is for a terminal 2596 term_T *b_term; // When not NULL this buffer is for a terminal
2590 * window. */ 2597 // window.
2591 #endif 2598 #endif
2592 #ifdef FEAT_DIFF 2599 #ifdef FEAT_DIFF
2593 int b_diff_failed; // internal diff failed for this buffer 2600 int b_diff_failed; // internal diff failed for this buffer
2594 #endif 2601 #endif
2595 }; /* file_buffer */ 2602 }; // file_buffer
2596 2603
2597 2604
2598 #ifdef FEAT_DIFF 2605 #ifdef FEAT_DIFF
2599 /* 2606 /*
2600 * Stuff for diff mode. 2607 * Stuff for diff mode.
2601 */ 2608 */
2602 # define DB_COUNT 8 /* up to eight buffers can be diff'ed */ 2609 # define DB_COUNT 8 // up to eight buffers can be diff'ed
2603 2610
2604 /* 2611 /*
2605 * Each diffblock defines where a block of lines starts in each of the buffers 2612 * Each diffblock defines where a block of lines starts in each of the buffers
2606 * and how many lines it occupies in that buffer. When the lines are missing 2613 * and how many lines it occupies in that buffer. When the lines are missing
2607 * in the buffer the df_count[] is zero. This is all counted in 2614 * in the buffer the df_count[] is zero. This is all counted in
2617 */ 2624 */
2618 typedef struct diffblock_S diff_T; 2625 typedef struct diffblock_S diff_T;
2619 struct diffblock_S 2626 struct diffblock_S
2620 { 2627 {
2621 diff_T *df_next; 2628 diff_T *df_next;
2622 linenr_T df_lnum[DB_COUNT]; /* line number in buffer */ 2629 linenr_T df_lnum[DB_COUNT]; // line number in buffer
2623 linenr_T df_count[DB_COUNT]; /* nr of inserted/changed lines */ 2630 linenr_T df_count[DB_COUNT]; // nr of inserted/changed lines
2624 }; 2631 };
2625 #endif 2632 #endif
2626 2633
2627 #define SNAP_HELP_IDX 0 2634 #define SNAP_HELP_IDX 0
2628 #define SNAP_AUCMD_IDX 1 2635 #define SNAP_AUCMD_IDX 1
2690 * the entries can only be used to count the number of displayed lines used. 2697 * the entries can only be used to count the number of displayed lines used.
2691 * wl_lnum and wl_lastlnum are invalid too. 2698 * wl_lnum and wl_lastlnum are invalid too.
2692 */ 2699 */
2693 typedef struct w_line 2700 typedef struct w_line
2694 { 2701 {
2695 linenr_T wl_lnum; /* buffer line number for logical line */ 2702 linenr_T wl_lnum; // buffer line number for logical line
2696 short_u wl_size; /* height in screen lines */ 2703 short_u wl_size; // height in screen lines
2697 char wl_valid; /* TRUE values are valid for text in buffer */ 2704 char wl_valid; // TRUE values are valid for text in buffer
2698 #ifdef FEAT_FOLDING 2705 #ifdef FEAT_FOLDING
2699 char wl_folded; /* TRUE when this is a range of folded lines */ 2706 char wl_folded; // TRUE when this is a range of folded lines
2700 linenr_T wl_lastlnum; /* last buffer line number for logical line */ 2707 linenr_T wl_lastlnum; // last buffer line number for logical line
2701 #endif 2708 #endif
2702 } wline_T; 2709 } wline_T;
2703 2710
2704 /* 2711 /*
2705 * Windows are kept in a tree of frames. Each frame has a column (FR_COL) 2712 * Windows are kept in a tree of frames. Each frame has a column (FR_COL)
2720 // fr_child and fr_win are mutually exclusive 2727 // fr_child and fr_win are mutually exclusive
2721 frame_T *fr_child; // first contained frame 2728 frame_T *fr_child; // first contained frame
2722 win_T *fr_win; // window that fills this frame 2729 win_T *fr_win; // window that fills this frame
2723 }; 2730 };
2724 2731
2725 #define FR_LEAF 0 /* frame is a leaf */ 2732 #define FR_LEAF 0 // frame is a leaf
2726 #define FR_ROW 1 /* frame with a row of windows */ 2733 #define FR_ROW 1 // frame with a row of windows
2727 #define FR_COL 2 /* frame with a column of windows */ 2734 #define FR_COL 2 // frame with a column of windows
2728 2735
2729 /* 2736 /*
2730 * Struct used for highlighting 'hlsearch' matches, matches defined by 2737 * Struct used for highlighting 'hlsearch' matches, matches defined by
2731 * ":match" and matches defined by match functions. 2738 * ":match" and matches defined by match functions.
2732 * For 'hlsearch' there is one pattern for all windows. For ":match" and the 2739 * For 'hlsearch' there is one pattern for all windows. For ":match" and the
2733 * match functions there is a different pattern for each window. 2740 * match functions there is a different pattern for each window.
2734 */ 2741 */
2735 typedef struct 2742 typedef struct
2736 { 2743 {
2737 regmmatch_T rm; /* points to the regexp program; contains last found 2744 regmmatch_T rm; // points to the regexp program; contains last
2738 match (may continue in next line) */ 2745 // found match (may continue in next line)
2739 buf_T *buf; /* the buffer to search for a match */ 2746 buf_T *buf; // the buffer to search for a match
2740 linenr_T lnum; /* the line to search for a match */ 2747 linenr_T lnum; // the line to search for a match
2741 int attr; /* attributes to be used for a match */ 2748 int attr; // attributes to be used for a match
2742 int attr_cur; /* attributes currently active in win_line() */ 2749 int attr_cur; // attributes currently active in win_line()
2743 linenr_T first_lnum; /* first lnum to search for multi-line pat */ 2750 linenr_T first_lnum; // first lnum to search for multi-line pat
2744 colnr_T startcol; /* in win_line() points to char where HL starts */ 2751 colnr_T startcol; // in win_line() points to char where HL starts
2745 colnr_T endcol; /* in win_line() points to char where HL ends */ 2752 colnr_T endcol; // in win_line() points to char where HL ends
2746 int is_addpos; /* position specified directly by 2753 int is_addpos; // position specified directly by
2747 matchaddpos(). TRUE/FALSE */ 2754 // matchaddpos(). TRUE/FALSE
2748 #ifdef FEAT_RELTIME 2755 #ifdef FEAT_RELTIME
2749 proftime_T tm; /* for a time limit */ 2756 proftime_T tm; // for a time limit
2750 #endif 2757 #endif
2751 } match_T; 2758 } match_T;
2752 2759
2753 /* number of positions supported by matchaddpos() */ 2760 // number of positions supported by matchaddpos()
2754 #define MAXPOSMATCH 8 2761 #define MAXPOSMATCH 8
2755 2762
2756 /* 2763 /*
2757 * Same as lpos_T, but with additional field len. 2764 * Same as lpos_T, but with additional field len.
2758 */ 2765 */
2759 typedef struct 2766 typedef struct
2760 { 2767 {
2761 linenr_T lnum; /* line number */ 2768 linenr_T lnum; // line number
2762 colnr_T col; /* column number */ 2769 colnr_T col; // column number
2763 int len; /* length: 0 - to the end of line */ 2770 int len; // length: 0 - to the end of line
2764 } llpos_T; 2771 } llpos_T;
2765 2772
2766 /* 2773 /*
2767 * posmatch_T provides an array for storing match items for matchaddpos() 2774 * posmatch_T provides an array for storing match items for matchaddpos()
2768 * function. 2775 * function.
2769 */ 2776 */
2770 typedef struct posmatch posmatch_T; 2777 typedef struct posmatch posmatch_T;
2771 struct posmatch 2778 struct posmatch
2772 { 2779 {
2773 llpos_T pos[MAXPOSMATCH]; /* array of positions */ 2780 llpos_T pos[MAXPOSMATCH]; // array of positions
2774 int cur; /* internal position counter */ 2781 int cur; // internal position counter
2775 linenr_T toplnum; /* top buffer line */ 2782 linenr_T toplnum; // top buffer line
2776 linenr_T botlnum; /* bottom buffer line */ 2783 linenr_T botlnum; // bottom buffer line
2777 }; 2784 };
2778 2785
2779 /* 2786 /*
2780 * matchitem_T provides a linked list for storing match items for ":match" and 2787 * matchitem_T provides a linked list for storing match items for ":match" and
2781 * the match functions. 2788 * the match functions.
2782 */ 2789 */
2783 typedef struct matchitem matchitem_T; 2790 typedef struct matchitem matchitem_T;
2784 struct matchitem 2791 struct matchitem
2785 { 2792 {
2786 matchitem_T *next; 2793 matchitem_T *next;
2787 int id; /* match ID */ 2794 int id; // match ID
2788 int priority; /* match priority */ 2795 int priority; // match priority
2789 char_u *pattern; /* pattern to highlight */ 2796 char_u *pattern; // pattern to highlight
2790 int hlg_id; /* highlight group ID */ 2797 int hlg_id; // highlight group ID
2791 regmmatch_T match; /* regexp program for pattern */ 2798 regmmatch_T match; // regexp program for pattern
2792 posmatch_T pos; /* position matches */ 2799 posmatch_T pos; // position matches
2793 match_T hl; /* struct for doing the actual highlighting */ 2800 match_T hl; // struct for doing the actual highlighting
2794 #ifdef FEAT_CONCEAL 2801 #ifdef FEAT_CONCEAL
2795 int conceal_char; /* cchar for Conceal highlighting */ 2802 int conceal_char; // cchar for Conceal highlighting
2796 #endif 2803 #endif
2797 }; 2804 };
2798 2805
2799 // Structure to store last cursor position and topline. Used by check_lnums() 2806 // Structure to store last cursor position and topline. Used by check_lnums()
2800 // and reset_lnums(). 2807 // and reset_lnums().
2819 * 2826 *
2820 * All row numbers are relative to the start of the window, except w_winrow. 2827 * All row numbers are relative to the start of the window, except w_winrow.
2821 */ 2828 */
2822 struct window_S 2829 struct window_S
2823 { 2830 {
2824 int w_id; /* unique window ID */ 2831 int w_id; // unique window ID
2825 2832
2826 buf_T *w_buffer; /* buffer we are a window into */ 2833 buf_T *w_buffer; // buffer we are a window into
2827 2834
2828 win_T *w_prev; /* link to previous window */ 2835 win_T *w_prev; // link to previous window
2829 win_T *w_next; /* link to next window */ 2836 win_T *w_next; // link to next window
2830 2837
2831 #if defined(FEAT_SYN_HL) || defined(FEAT_SPELL) 2838 #if defined(FEAT_SYN_HL) || defined(FEAT_SPELL)
2832 synblock_T *w_s; /* for :ownsyntax */ 2839 synblock_T *w_s; // for :ownsyntax
2833 #endif 2840 #endif
2834 2841
2835 int w_closing; /* window is being closed, don't let 2842 int w_closing; // window is being closed, don't let
2836 autocommands close it too. */ 2843 // autocommands close it too.
2837 2844
2838 frame_T *w_frame; /* frame containing this window */ 2845 frame_T *w_frame; // frame containing this window
2839 2846
2840 pos_T w_cursor; /* cursor position in buffer */ 2847 pos_T w_cursor; // cursor position in buffer
2841 2848
2842 colnr_T w_curswant; /* The column we'd like to be at. This is 2849 colnr_T w_curswant; // The column we'd like to be at. This is
2843 used to try to stay in the same column 2850 // used to try to stay in the same column
2844 for up/down cursor motions. */ 2851 // for up/down cursor motions.
2845 2852
2846 int w_set_curswant; /* If set, then update w_curswant the next 2853 int w_set_curswant; // If set, then update w_curswant the next
2847 time through cursupdate() to the 2854 // time through cursupdate() to the
2848 current virtual column */ 2855 // current virtual column
2849 2856
2850 #ifdef FEAT_SYN_HL 2857 #ifdef FEAT_SYN_HL
2851 linenr_T w_last_cursorline; // where last time 'cursorline' was drawn 2858 linenr_T w_last_cursorline; // where last time 'cursorline' was drawn
2852 #endif 2859 #endif
2853 2860
2854 /* 2861 /*
2855 * the next seven are used to update the visual part 2862 * the next seven are used to update the Visual highlighting
2856 */ 2863 */
2857 char w_old_visual_mode; /* last known VIsual_mode */ 2864 char w_old_visual_mode; // last known VIsual_mode
2858 linenr_T w_old_cursor_lnum; /* last known end of visual part */ 2865 linenr_T w_old_cursor_lnum; // last known end of visual part
2859 colnr_T w_old_cursor_fcol; /* first column for block visual part */ 2866 colnr_T w_old_cursor_fcol; // first column for block visual part
2860 colnr_T w_old_cursor_lcol; /* last column for block visual part */ 2867 colnr_T w_old_cursor_lcol; // last column for block visual part
2861 linenr_T w_old_visual_lnum; /* last known start of visual part */ 2868 linenr_T w_old_visual_lnum; // last known start of visual part
2862 colnr_T w_old_visual_col; /* last known start of visual part */ 2869 colnr_T w_old_visual_col; // last known start of visual part
2863 colnr_T w_old_curswant; /* last known value of Curswant */ 2870 colnr_T w_old_curswant; // last known value of Curswant
2864 2871
2865 /* 2872 /*
2866 * "w_topline", "w_leftcol" and "w_skipcol" specify the offsets for 2873 * "w_topline", "w_leftcol" and "w_skipcol" specify the offsets for
2867 * displaying the buffer. 2874 * displaying the buffer.
2868 */ 2875 */
2869 linenr_T w_topline; /* buffer line number of the line at the 2876 linenr_T w_topline; // buffer line number of the line at the
2870 top of the window */ 2877 // top of the window
2871 char w_topline_was_set; /* flag set to TRUE when topline is set, 2878 char w_topline_was_set; // flag set to TRUE when topline is set,
2872 e.g. by winrestview() */ 2879 // e.g. by winrestview()
2873 #ifdef FEAT_DIFF 2880 #ifdef FEAT_DIFF
2874 int w_topfill; /* number of filler lines above w_topline */ 2881 int w_topfill; // number of filler lines above w_topline
2875 int w_old_topfill; /* w_topfill at last redraw */ 2882 int w_old_topfill; // w_topfill at last redraw
2876 int w_botfill; /* TRUE when filler lines are actually 2883 int w_botfill; // TRUE when filler lines are actually
2877 below w_topline (at end of file) */ 2884 // below w_topline (at end of file)
2878 int w_old_botfill; /* w_botfill at last redraw */ 2885 int w_old_botfill; // w_botfill at last redraw
2879 #endif 2886 #endif
2880 colnr_T w_leftcol; /* window column number of the left most 2887 colnr_T w_leftcol; // window column number of the left most
2881 character in the window; used when 2888 // character in the window; used when
2882 'wrap' is off */ 2889 // 'wrap' is off
2883 colnr_T w_skipcol; /* starting column when a single line 2890 colnr_T w_skipcol; // starting column when a single line
2884 doesn't fit in the window */ 2891 // doesn't fit in the window
2885 2892
2886 /* 2893 /*
2887 * Layout of the window in the screen. 2894 * Layout of the window in the screen.
2888 * May need to add "msg_scrolled" to "w_winrow" in rare situations. 2895 * May need to add "msg_scrolled" to "w_winrow" in rare situations.
2889 */ 2896 */
2890 int w_winrow; /* first row of window in screen */ 2897 int w_winrow; // first row of window in screen
2891 int w_height; /* number of rows in window, excluding 2898 int w_height; // number of rows in window, excluding
2892 status/command/winbar line(s) */ 2899 // status/command/winbar line(s)
2893 int w_status_height; /* number of status lines (0 or 1) */ 2900 int w_status_height; // number of status lines (0 or 1)
2894 int w_wincol; /* Leftmost column of window in screen. */ 2901 int w_wincol; // Leftmost column of window in screen.
2895 int w_width; /* Width of window, excluding separation. */ 2902 int w_width; // Width of window, excluding separation.
2896 int w_vsep_width; /* Number of separator columns (0 or 1). */ 2903 int w_vsep_width; // Number of separator columns (0 or 1).
2897 pos_save_T w_save_cursor; /* backup of cursor pos and topline */ 2904 pos_save_T w_save_cursor; // backup of cursor pos and topline
2898 #ifdef FEAT_TEXT_PROP 2905 #ifdef FEAT_TEXT_PROP
2899 int w_popup_flags; // POPF_ values 2906 int w_popup_flags; // POPF_ values
2900 char_u *w_popup_title; 2907 char_u *w_popup_title;
2901 poppos_T w_popup_pos; 2908 poppos_T w_popup_pos;
2902 int w_popup_fixed; // do not shift popup to fit on screen 2909 int w_popup_fixed; // do not shift popup to fit on screen
2946 * Use functions in screen.c to check if they are valid and to update. 2953 * Use functions in screen.c to check if they are valid and to update.
2947 * w_valid is a bitfield of flags, which indicate if specific values are 2954 * w_valid is a bitfield of flags, which indicate if specific values are
2948 * valid or need to be recomputed. See screen.c for values. 2955 * valid or need to be recomputed. See screen.c for values.
2949 */ 2956 */
2950 int w_valid; 2957 int w_valid;
2951 pos_T w_valid_cursor; /* last known position of w_cursor, used 2958 pos_T w_valid_cursor; // last known position of w_cursor, used
2952 to adjust w_valid */ 2959 // to adjust w_valid
2953 colnr_T w_valid_leftcol; /* last known w_leftcol */ 2960 colnr_T w_valid_leftcol; // last known w_leftcol
2954 2961
2955 /* 2962 /*
2956 * w_cline_height is the number of physical lines taken by the buffer line 2963 * w_cline_height is the number of physical lines taken by the buffer line
2957 * that the cursor is on. We use this to avoid extra calls to plines(). 2964 * that the cursor is on. We use this to avoid extra calls to plines().
2958 */ 2965 */
2959 int w_cline_height; /* current size of cursor line */ 2966 int w_cline_height; // current size of cursor line
2960 #ifdef FEAT_FOLDING 2967 #ifdef FEAT_FOLDING
2961 int w_cline_folded; /* cursor line is folded */ 2968 int w_cline_folded; // cursor line is folded
2962 #endif 2969 #endif
2963 2970
2964 int w_cline_row; /* starting row of the cursor line */ 2971 int w_cline_row; // starting row of the cursor line
2965 2972
2966 colnr_T w_virtcol; /* column number of the cursor in the 2973 colnr_T w_virtcol; // column number of the cursor in the
2967 buffer line, as opposed to the column 2974 // buffer line, as opposed to the column
2968 number we're at on the screen. This 2975 // number we're at on the screen. This
2969 makes a difference on lines which span 2976 // makes a difference on lines which span
2970 more than one screen line or when 2977 // more than one screen line or when
2971 w_leftcol is non-zero */ 2978 // w_leftcol is non-zero
2972 2979
2973 /* 2980 /*
2974 * w_wrow and w_wcol specify the cursor position in the window. 2981 * w_wrow and w_wcol specify the cursor position in the window.
2975 * This is related to positions in the window, not in the display or 2982 * This is related to positions in the window, not in the display or
2976 * buffer, thus w_wrow is relative to w_winrow. 2983 * buffer, thus w_wrow is relative to w_winrow.
2977 */ 2984 */
2978 int w_wrow, w_wcol; /* cursor position in window */ 2985 int w_wrow, w_wcol; // cursor position in window
2979 2986
2980 linenr_T w_botline; /* number of the line below the bottom of 2987 linenr_T w_botline; // number of the line below the bottom of
2981 the window */ 2988 // the window
2982 int w_empty_rows; /* number of ~ rows in window */ 2989 int w_empty_rows; // number of ~ rows in window
2983 #ifdef FEAT_DIFF 2990 #ifdef FEAT_DIFF
2984 int w_filler_rows; /* number of filler rows at the end of the 2991 int w_filler_rows; // number of filler rows at the end of the
2985 window */ 2992 // window
2986 #endif 2993 #endif
2987 2994
2988 /* 2995 /*
2989 * Info about the lines currently in the window is remembered to avoid 2996 * Info about the lines currently in the window is remembered to avoid
2990 * recomputing it every time. The allocated size of w_lines[] is Rows. 2997 * recomputing it every time. The allocated size of w_lines[] is Rows.
2993 * and w_lines[w_lines_valid - 1].wl_lnum is equal to w_botline. 3000 * and w_lines[w_lines_valid - 1].wl_lnum is equal to w_botline.
2994 * Between changing text and updating the display w_lines[] represents 3001 * Between changing text and updating the display w_lines[] represents
2995 * what is currently displayed. wl_valid is reset to indicated this. 3002 * what is currently displayed. wl_valid is reset to indicated this.
2996 * This is used for efficient redrawing. 3003 * This is used for efficient redrawing.
2997 */ 3004 */
2998 int w_lines_valid; /* number of valid entries */ 3005 int w_lines_valid; // number of valid entries
2999 wline_T *w_lines; 3006 wline_T *w_lines;
3000 3007
3001 #ifdef FEAT_FOLDING 3008 #ifdef FEAT_FOLDING
3002 garray_T w_folds; /* array of nested folds */ 3009 garray_T w_folds; // array of nested folds
3003 char w_fold_manual; /* when TRUE: some folds are opened/closed 3010 char w_fold_manual; // when TRUE: some folds are opened/closed
3004 manually */ 3011 // manually
3005 char w_foldinvalid; /* when TRUE: folding needs to be 3012 char w_foldinvalid; // when TRUE: folding needs to be
3006 recomputed */ 3013 // recomputed
3007 #endif 3014 #endif
3008 #ifdef FEAT_LINEBREAK 3015 #ifdef FEAT_LINEBREAK
3009 int w_nrwidth; /* width of 'number' and 'relativenumber' 3016 int w_nrwidth; // width of 'number' and 'relativenumber'
3010 column being used */ 3017 // column being used
3011 #endif 3018 #endif
3012 3019
3013 /* 3020 /*
3014 * === end of cached values === 3021 * === end of cached values ===
3015 */ 3022 */
3016 3023
3017 int w_redr_type; /* type of redraw to be performed on win */ 3024 int w_redr_type; // type of redraw to be performed on win
3018 int w_upd_rows; /* number of window lines to update when 3025 int w_upd_rows; // number of window lines to update when
3019 w_redr_type is REDRAW_TOP */ 3026 // w_redr_type is REDRAW_TOP
3020 linenr_T w_redraw_top; /* when != 0: first line needing redraw */ 3027 linenr_T w_redraw_top; // when != 0: first line needing redraw
3021 linenr_T w_redraw_bot; /* when != 0: last line needing redraw */ 3028 linenr_T w_redraw_bot; // when != 0: last line needing redraw
3022 int w_redr_status; /* if TRUE status line must be redrawn */ 3029 int w_redr_status; // if TRUE status line must be redrawn
3023 3030
3024 #ifdef FEAT_CMDL_INFO 3031 #ifdef FEAT_CMDL_INFO
3025 /* remember what is shown in the ruler for this window (if 'ruler' set) */ 3032 // remember what is shown in the ruler for this window (if 'ruler' set)
3026 pos_T w_ru_cursor; /* cursor position shown in ruler */ 3033 pos_T w_ru_cursor; // cursor position shown in ruler
3027 colnr_T w_ru_virtcol; /* virtcol shown in ruler */ 3034 colnr_T w_ru_virtcol; // virtcol shown in ruler
3028 linenr_T w_ru_topline; /* topline shown in ruler */ 3035 linenr_T w_ru_topline; // topline shown in ruler
3029 linenr_T w_ru_line_count; /* line count used for ruler */ 3036 linenr_T w_ru_line_count; // line count used for ruler
3030 # ifdef FEAT_DIFF 3037 # ifdef FEAT_DIFF
3031 int w_ru_topfill; /* topfill shown in ruler */ 3038 int w_ru_topfill; // topfill shown in ruler
3032 # endif 3039 # endif
3033 char w_ru_empty; /* TRUE if ruler shows 0-1 (empty line) */ 3040 char w_ru_empty; // TRUE if ruler shows 0-1 (empty line)
3034 #endif 3041 #endif
3035 3042
3036 int w_alt_fnum; /* alternate file (for # and CTRL-^) */ 3043 int w_alt_fnum; // alternate file (for # and CTRL-^)
3037 3044
3038 alist_T *w_alist; /* pointer to arglist for this window */ 3045 alist_T *w_alist; // pointer to arglist for this window
3039 int w_arg_idx; /* current index in argument list (can be 3046 int w_arg_idx; // current index in argument list (can be
3040 out of range!) */ 3047 // out of range!)
3041 int w_arg_idx_invalid; /* editing another file than w_arg_idx */ 3048 int w_arg_idx_invalid; // editing another file than w_arg_idx
3042 3049
3043 char_u *w_localdir; /* absolute path of local directory or 3050 char_u *w_localdir; // absolute path of local directory or
3044 NULL */ 3051 // NULL
3045 #ifdef FEAT_MENU 3052 #ifdef FEAT_MENU
3046 vimmenu_T *w_winbar; /* The root of the WinBar menu hierarchy. */ 3053 vimmenu_T *w_winbar; // The root of the WinBar menu hierarchy.
3047 winbar_item_T *w_winbar_items; /* list of items in the WinBar */ 3054 winbar_item_T *w_winbar_items; // list of items in the WinBar
3048 int w_winbar_height; /* 1 if there is a window toolbar */ 3055 int w_winbar_height; // 1 if there is a window toolbar
3049 #endif 3056 #endif
3050 3057
3051 /* 3058 /*
3052 * Options local to a window. 3059 * Options local to a window.
3053 * They are local because they influence the layout of the window or 3060 * They are local because they influence the layout of the window or
3056 * this window, w_allbuf_opt is for all buffers in this window. 3063 * this window, w_allbuf_opt is for all buffers in this window.
3057 */ 3064 */
3058 winopt_T w_onebuf_opt; 3065 winopt_T w_onebuf_opt;
3059 winopt_T w_allbuf_opt; 3066 winopt_T w_allbuf_opt;
3060 3067
3061 /* A few options have local flags for P_INSECURE. */ 3068 // A few options have local flags for P_INSECURE.
3062 #ifdef FEAT_STL_OPT 3069 #ifdef FEAT_STL_OPT
3063 long_u w_p_stl_flags; /* flags for 'statusline' */ 3070 long_u w_p_stl_flags; // flags for 'statusline'
3064 #endif 3071 #endif
3065 #ifdef FEAT_EVAL 3072 #ifdef FEAT_EVAL
3066 long_u w_p_fde_flags; /* flags for 'foldexpr' */ 3073 long_u w_p_fde_flags; // flags for 'foldexpr'
3067 long_u w_p_fdt_flags; /* flags for 'foldtext' */ 3074 long_u w_p_fdt_flags; // flags for 'foldtext'
3068 #endif 3075 #endif
3069 #ifdef FEAT_SYN_HL 3076 #ifdef FEAT_SYN_HL
3070 int *w_p_cc_cols; /* array of columns to highlight or NULL */ 3077 int *w_p_cc_cols; // array of columns to highlight or NULL
3071 #endif 3078 #endif
3072 #ifdef FEAT_LINEBREAK 3079 #ifdef FEAT_LINEBREAK
3073 int w_p_brimin; /* minimum width for breakindent */ 3080 int w_p_brimin; // minimum width for breakindent
3074 int w_p_brishift; /* additional shift for breakindent */ 3081 int w_p_brishift; // additional shift for breakindent
3075 int w_p_brisbr; /* sbr in 'briopt' */ 3082 int w_p_brisbr; // sbr in 'briopt'
3076 #endif 3083 #endif
3077 long w_p_siso; /* 'sidescrolloff' local value */ 3084 long w_p_siso; // 'sidescrolloff' local value
3078 long w_p_so; /* 'scrolloff' local value */ 3085 long w_p_so; // 'scrolloff' local value
3079 3086
3080 /* transform a pointer to a "onebuf" option into a "allbuf" option */ 3087 // transform a pointer to a "onebuf" option into a "allbuf" option
3081 #define GLOBAL_WO(p) ((char *)p + sizeof(winopt_T)) 3088 #define GLOBAL_WO(p) ((char *)p + sizeof(winopt_T))
3082 3089
3083 long w_scbind_pos; 3090 long w_scbind_pos;
3084 3091
3085 #ifdef FEAT_EVAL 3092 #ifdef FEAT_EVAL
3090 /* 3097 /*
3091 * The w_prev_pcmark field is used to check whether we really did jump to 3098 * The w_prev_pcmark field is used to check whether we really did jump to
3092 * a new line after setting the w_pcmark. If not, then we revert to 3099 * a new line after setting the w_pcmark. If not, then we revert to
3093 * using the previous w_pcmark. 3100 * using the previous w_pcmark.
3094 */ 3101 */
3095 pos_T w_pcmark; /* previous context mark */ 3102 pos_T w_pcmark; // previous context mark
3096 pos_T w_prev_pcmark; /* previous w_pcmark */ 3103 pos_T w_prev_pcmark; // previous w_pcmark
3097 3104
3098 #ifdef FEAT_JUMPLIST 3105 #ifdef FEAT_JUMPLIST
3099 /* 3106 /*
3100 * the jumplist contains old cursor positions 3107 * the jumplist contains old cursor positions
3101 */ 3108 */
3102 xfmark_T w_jumplist[JUMPLISTSIZE]; 3109 xfmark_T w_jumplist[JUMPLISTSIZE];
3103 int w_jumplistlen; /* number of active entries */ 3110 int w_jumplistlen; // number of active entries
3104 int w_jumplistidx; /* current position */ 3111 int w_jumplistidx; // current position
3105 3112
3106 int w_changelistidx; /* current position in b_changelist */ 3113 int w_changelistidx; // current position in b_changelist
3107 #endif 3114 #endif
3108 3115
3109 #ifdef FEAT_SEARCH_EXTRA 3116 #ifdef FEAT_SEARCH_EXTRA
3110 matchitem_T *w_match_head; /* head of match list */ 3117 matchitem_T *w_match_head; // head of match list
3111 int w_next_match_id; /* next match ID */ 3118 int w_next_match_id; // next match ID
3112 #endif 3119 #endif
3113 3120
3114 /* 3121 /*
3115 * the tagstack grows from 0 upwards: 3122 * the tagstack grows from 0 upwards:
3116 * entry 0: older 3123 * entry 0: older
3117 * entry 1: newer 3124 * entry 1: newer
3118 * entry 2: newest 3125 * entry 2: newest
3119 */ 3126 */
3120 taggy_T w_tagstack[TAGSTACKSIZE]; /* the tag stack */ 3127 taggy_T w_tagstack[TAGSTACKSIZE]; // the tag stack
3121 int w_tagstackidx; /* idx just below active entry */ 3128 int w_tagstackidx; // idx just below active entry
3122 int w_tagstacklen; /* number of tags on stack */ 3129 int w_tagstacklen; // number of tags on stack
3123 3130
3124 /* 3131 /*
3125 * w_fraction is the fractional row of the cursor within the window, from 3132 * w_fraction is the fractional row of the cursor within the window, from
3126 * 0 at the top row to FRACTION_MULT at the last row. 3133 * 0 at the top row to FRACTION_MULT at the last row.
3127 * w_prev_fraction_row was the actual cursor row when w_fraction was last 3134 * w_prev_fraction_row was the actual cursor row when w_fraction was last
3129 */ 3136 */
3130 int w_fraction; 3137 int w_fraction;
3131 int w_prev_fraction_row; 3138 int w_prev_fraction_row;
3132 3139
3133 #ifdef FEAT_GUI 3140 #ifdef FEAT_GUI
3134 scrollbar_T w_scrollbars[2]; /* vert. Scrollbars for this window */ 3141 scrollbar_T w_scrollbars[2]; // vert. Scrollbars for this window
3135 #endif 3142 #endif
3136 #ifdef FEAT_LINEBREAK 3143 #ifdef FEAT_LINEBREAK
3137 linenr_T w_nrwidth_line_count; /* line count when ml_nrwidth_width 3144 linenr_T w_nrwidth_line_count; // line count when ml_nrwidth_width
3138 * was computed. */ 3145 // was computed.
3139 long w_nuw_cached; /* 'numberwidth' option cached */ 3146 long w_nuw_cached; // 'numberwidth' option cached
3140 int w_nrwidth_width; /* nr of chars to print line count. */ 3147 int w_nrwidth_width; // nr of chars to print line count.
3141 #endif 3148 #endif
3142 3149
3143 #ifdef FEAT_QUICKFIX 3150 #ifdef FEAT_QUICKFIX
3144 qf_info_T *w_llist; /* Location list for this window */ 3151 qf_info_T *w_llist; // Location list for this window
3145 /* 3152 /*
3146 * Location list reference used in the location list window. 3153 * Location list reference used in the location list window.
3147 * In a non-location list window, w_llist_ref is NULL. 3154 * In a non-location list window, w_llist_ref is NULL.
3148 */ 3155 */
3149 qf_info_T *w_llist_ref; 3156 qf_info_T *w_llist_ref;
3150 #endif 3157 #endif
3151 3158
3152 3159
3153 #ifdef FEAT_MZSCHEME 3160 #ifdef FEAT_MZSCHEME
3154 void *w_mzscheme_ref; /* The MzScheme value for this window */ 3161 void *w_mzscheme_ref; // The MzScheme value for this window
3155 #endif 3162 #endif
3156 3163
3157 #ifdef FEAT_PERL 3164 #ifdef FEAT_PERL
3158 void *w_perl_private; 3165 void *w_perl_private;
3159 #endif 3166 #endif
3160 3167
3161 #ifdef FEAT_PYTHON 3168 #ifdef FEAT_PYTHON
3162 void *w_python_ref; /* The Python value for this window */ 3169 void *w_python_ref; // The Python value for this window
3163 #endif 3170 #endif
3164 3171
3165 #ifdef FEAT_PYTHON3 3172 #ifdef FEAT_PYTHON3
3166 void *w_python3_ref; /* The Python value for this window */ 3173 void *w_python3_ref; // The Python value for this window
3167 #endif 3174 #endif
3168 3175
3169 #ifdef FEAT_TCL 3176 #ifdef FEAT_TCL
3170 void *w_tcl_ref; 3177 void *w_tcl_ref;
3171 #endif 3178 #endif
3178 /* 3185 /*
3179 * Arguments for operators. 3186 * Arguments for operators.
3180 */ 3187 */
3181 typedef struct oparg_S 3188 typedef struct oparg_S
3182 { 3189 {
3183 int op_type; /* current pending operator type */ 3190 int op_type; // current pending operator type
3184 int regname; /* register to use for the operator */ 3191 int regname; // register to use for the operator
3185 int motion_type; /* type of the current cursor motion */ 3192 int motion_type; // type of the current cursor motion
3186 int motion_force; /* force motion type: 'v', 'V' or CTRL-V */ 3193 int motion_force; // force motion type: 'v', 'V' or CTRL-V
3187 int use_reg_one; /* TRUE if delete uses reg 1 even when not 3194 int use_reg_one; // TRUE if delete uses reg 1 even when not
3188 linewise */ 3195 // linewise
3189 int inclusive; /* TRUE if char motion is inclusive (only 3196 int inclusive; // TRUE if char motion is inclusive (only
3190 valid when motion_type is MCHAR */ 3197 // valid when motion_type is MCHAR
3191 int end_adjusted; /* backuped b_op_end one char (only used by 3198 int end_adjusted; // backuped b_op_end one char (only used by
3192 do_format()) */ 3199 // do_format())
3193 pos_T start; /* start of the operator */ 3200 pos_T start; // start of the operator
3194 pos_T end; /* end of the operator */ 3201 pos_T end; // end of the operator
3195 pos_T cursor_start; /* cursor position before motion for "gw" */ 3202 pos_T cursor_start; // cursor position before motion for "gw"
3196 3203
3197 long line_count; /* number of lines from op_start to op_end 3204 long line_count; // number of lines from op_start to op_end
3198 (inclusive) */ 3205 // (inclusive)
3199 int empty; /* op_start and op_end the same (only used by 3206 int empty; // op_start and op_end the same (only used by
3200 do_change()) */ 3207 // do_change())
3201 int is_VIsual; /* operator on Visual area */ 3208 int is_VIsual; // operator on Visual area
3202 int block_mode; /* current operator is Visual block mode */ 3209 int block_mode; // current operator is Visual block mode
3203 colnr_T start_vcol; /* start col for block mode operator */ 3210 colnr_T start_vcol; // start col for block mode operator
3204 colnr_T end_vcol; /* end col for block mode operator */ 3211 colnr_T end_vcol; // end col for block mode operator
3205 long prev_opcount; /* ca.opcount saved for K_CURSORHOLD */ 3212 long prev_opcount; // ca.opcount saved for K_CURSORHOLD
3206 long prev_count0; /* ca.count0 saved for K_CURSORHOLD */ 3213 long prev_count0; // ca.count0 saved for K_CURSORHOLD
3207 } oparg_T; 3214 } oparg_T;
3208 3215
3209 /* 3216 /*
3210 * Arguments for Normal mode commands. 3217 * Arguments for Normal mode commands.
3211 */ 3218 */
3212 typedef struct cmdarg_S 3219 typedef struct cmdarg_S
3213 { 3220 {
3214 oparg_T *oap; /* Operator arguments */ 3221 oparg_T *oap; // Operator arguments
3215 int prechar; /* prefix character (optional, always 'g') */ 3222 int prechar; // prefix character (optional, always 'g')
3216 int cmdchar; /* command character */ 3223 int cmdchar; // command character
3217 int nchar; /* next command character (optional) */ 3224 int nchar; // next command character (optional)
3218 int ncharC1; /* first composing character (optional) */ 3225 int ncharC1; // first composing character (optional)
3219 int ncharC2; /* second composing character (optional) */ 3226 int ncharC2; // second composing character (optional)
3220 int extra_char; /* yet another character (optional) */ 3227 int extra_char; // yet another character (optional)
3221 long opcount; /* count before an operator */ 3228 long opcount; // count before an operator
3222 long count0; /* count before command, default 0 */ 3229 long count0; // count before command, default 0
3223 long count1; /* count before command, default 1 */ 3230 long count1; // count before command, default 1
3224 int arg; /* extra argument from nv_cmds[] */ 3231 int arg; // extra argument from nv_cmds[]
3225 int retval; /* return: CA_* values */ 3232 int retval; // return: CA_* values
3226 char_u *searchbuf; /* return: pointer to search pattern or NULL */ 3233 char_u *searchbuf; // return: pointer to search pattern or NULL
3227 } cmdarg_T; 3234 } cmdarg_T;
3228 3235
3229 /* values for retval: */ 3236 // values for retval:
3230 #define CA_COMMAND_BUSY 1 /* skip restarting edit() once */ 3237 #define CA_COMMAND_BUSY 1 // skip restarting edit() once
3231 #define CA_NO_ADJ_OP_END 2 /* don't adjust operator end */ 3238 #define CA_NO_ADJ_OP_END 2 // don't adjust operator end
3232 3239
3233 #ifdef CURSOR_SHAPE 3240 #ifdef CURSOR_SHAPE
3234 /* 3241 /*
3235 * struct to store values from 'guicursor' and 'mouseshape' 3242 * struct to store values from 'guicursor' and 'mouseshape'
3236 */ 3243 */
3237 /* Indexes in shape_table[] */ 3244 /* Indexes in shape_table[] */
3238 #define SHAPE_IDX_N 0 /* Normal mode */ 3245 #define SHAPE_IDX_N 0 // Normal mode
3239 #define SHAPE_IDX_V 1 /* Visual mode */ 3246 #define SHAPE_IDX_V 1 // Visual mode
3240 #define SHAPE_IDX_I 2 /* Insert mode */ 3247 #define SHAPE_IDX_I 2 // Insert mode
3241 #define SHAPE_IDX_R 3 /* Replace mode */ 3248 #define SHAPE_IDX_R 3 // Replace mode
3242 #define SHAPE_IDX_C 4 /* Command line Normal mode */ 3249 #define SHAPE_IDX_C 4 // Command line Normal mode
3243 #define SHAPE_IDX_CI 5 /* Command line Insert mode */ 3250 #define SHAPE_IDX_CI 5 // Command line Insert mode
3244 #define SHAPE_IDX_CR 6 /* Command line Replace mode */ 3251 #define SHAPE_IDX_CR 6 // Command line Replace mode
3245 #define SHAPE_IDX_O 7 /* Operator-pending mode */ 3252 #define SHAPE_IDX_O 7 // Operator-pending mode
3246 #define SHAPE_IDX_VE 8 /* Visual mode with 'selection' exclusive */ 3253 #define SHAPE_IDX_VE 8 // Visual mode with 'selection' exclusive
3247 #define SHAPE_IDX_CLINE 9 /* On command line */ 3254 #define SHAPE_IDX_CLINE 9 // On command line
3248 #define SHAPE_IDX_STATUS 10 /* A status line */ 3255 #define SHAPE_IDX_STATUS 10 // A status line
3249 #define SHAPE_IDX_SDRAG 11 /* dragging a status line */ 3256 #define SHAPE_IDX_SDRAG 11 // dragging a status line
3250 #define SHAPE_IDX_VSEP 12 /* A vertical separator line */ 3257 #define SHAPE_IDX_VSEP 12 // A vertical separator line
3251 #define SHAPE_IDX_VDRAG 13 /* dragging a vertical separator line */ 3258 #define SHAPE_IDX_VDRAG 13 // dragging a vertical separator line
3252 #define SHAPE_IDX_MORE 14 /* Hit-return or More */ 3259 #define SHAPE_IDX_MORE 14 // Hit-return or More
3253 #define SHAPE_IDX_MOREL 15 /* Hit-return or More in last line */ 3260 #define SHAPE_IDX_MOREL 15 // Hit-return or More in last line
3254 #define SHAPE_IDX_SM 16 /* showing matching paren */ 3261 #define SHAPE_IDX_SM 16 // showing matching paren
3255 #define SHAPE_IDX_COUNT 17 3262 #define SHAPE_IDX_COUNT 17
3256 3263
3257 #define SHAPE_BLOCK 0 /* block cursor */ 3264 #define SHAPE_BLOCK 0 // block cursor
3258 #define SHAPE_HOR 1 /* horizontal bar cursor */ 3265 #define SHAPE_HOR 1 // horizontal bar cursor
3259 #define SHAPE_VER 2 /* vertical bar cursor */ 3266 #define SHAPE_VER 2 // vertical bar cursor
3260 3267
3261 #define MSHAPE_NUMBERED 1000 /* offset for shapes identified by number */ 3268 #define MSHAPE_NUMBERED 1000 // offset for shapes identified by number
3262 #define MSHAPE_HIDE 1 /* hide mouse pointer */ 3269 #define MSHAPE_HIDE 1 // hide mouse pointer
3263 3270
3264 #define SHAPE_MOUSE 1 /* used for mouse pointer shape */ 3271 #define SHAPE_MOUSE 1 // used for mouse pointer shape
3265 #define SHAPE_CURSOR 2 /* used for text cursor shape */ 3272 #define SHAPE_CURSOR 2 // used for text cursor shape
3266 3273
3267 typedef struct cursor_entry 3274 typedef struct cursor_entry
3268 { 3275 {
3269 int shape; /* one of the SHAPE_ defines */ 3276 int shape; // one of the SHAPE_ defines
3270 int mshape; /* one of the MSHAPE defines */ 3277 int mshape; // one of the MSHAPE defines
3271 int percentage; /* percentage of cell for bar */ 3278 int percentage; // percentage of cell for bar
3272 long blinkwait; /* blinking, wait time before blinking starts */ 3279 long blinkwait; // blinking, wait time before blinking starts
3273 long blinkon; /* blinking, on time */ 3280 long blinkon; // blinking, on time
3274 long blinkoff; /* blinking, off time */ 3281 long blinkoff; // blinking, off time
3275 int id; /* highlight group ID */ 3282 int id; // highlight group ID
3276 int id_lm; /* highlight group ID for :lmap mode */ 3283 int id_lm; // highlight group ID for :lmap mode
3277 char *name; /* mode name (fixed) */ 3284 char *name; // mode name (fixed)
3278 char used_for; /* SHAPE_MOUSE and/or SHAPE_CURSOR */ 3285 char used_for; // SHAPE_MOUSE and/or SHAPE_CURSOR
3279 } cursorentry_T; 3286 } cursorentry_T;
3280 #endif /* CURSOR_SHAPE */ 3287 #endif // CURSOR_SHAPE
3281 3288
3282 #ifdef FEAT_MENU 3289 #ifdef FEAT_MENU
3283 3290
3284 /* Indices into vimmenu_T->strings[] and vimmenu_T->noremap[] for each mode */ 3291 // Indices into vimmenu_T->strings[] and vimmenu_T->noremap[] for each mode
3285 #define MENU_INDEX_INVALID -1 3292 #define MENU_INDEX_INVALID -1
3286 #define MENU_INDEX_NORMAL 0 3293 #define MENU_INDEX_NORMAL 0
3287 #define MENU_INDEX_VISUAL 1 3294 #define MENU_INDEX_VISUAL 1
3288 #define MENU_INDEX_SELECT 2 3295 #define MENU_INDEX_SELECT 2
3289 #define MENU_INDEX_OP_PENDING 3 3296 #define MENU_INDEX_OP_PENDING 3
3291 #define MENU_INDEX_CMDLINE 5 3298 #define MENU_INDEX_CMDLINE 5
3292 #define MENU_INDEX_TERMINAL 6 3299 #define MENU_INDEX_TERMINAL 6
3293 #define MENU_INDEX_TIP 7 3300 #define MENU_INDEX_TIP 7
3294 #define MENU_MODES 8 3301 #define MENU_MODES 8
3295 3302
3296 /* Menu modes */ 3303 // Menu modes
3297 #define MENU_NORMAL_MODE (1 << MENU_INDEX_NORMAL) 3304 #define MENU_NORMAL_MODE (1 << MENU_INDEX_NORMAL)
3298 #define MENU_VISUAL_MODE (1 << MENU_INDEX_VISUAL) 3305 #define MENU_VISUAL_MODE (1 << MENU_INDEX_VISUAL)
3299 #define MENU_SELECT_MODE (1 << MENU_INDEX_SELECT) 3306 #define MENU_SELECT_MODE (1 << MENU_INDEX_SELECT)
3300 #define MENU_OP_PENDING_MODE (1 << MENU_INDEX_OP_PENDING) 3307 #define MENU_OP_PENDING_MODE (1 << MENU_INDEX_OP_PENDING)
3301 #define MENU_INSERT_MODE (1 << MENU_INDEX_INSERT) 3308 #define MENU_INSERT_MODE (1 << MENU_INDEX_INSERT)
3302 #define MENU_CMDLINE_MODE (1 << MENU_INDEX_CMDLINE) 3309 #define MENU_CMDLINE_MODE (1 << MENU_INDEX_CMDLINE)
3303 #define MENU_TERMINAL_MODE (1 << MENU_INDEX_TERMINAL) 3310 #define MENU_TERMINAL_MODE (1 << MENU_INDEX_TERMINAL)
3304 #define MENU_TIP_MODE (1 << MENU_INDEX_TIP) 3311 #define MENU_TIP_MODE (1 << MENU_INDEX_TIP)
3305 #define MENU_ALL_MODES ((1 << MENU_INDEX_TIP) - 1) 3312 #define MENU_ALL_MODES ((1 << MENU_INDEX_TIP) - 1)
3306 /*note MENU_INDEX_TIP is not a 'real' mode*/ 3313 // note MENU_INDEX_TIP is not a 'real' mode
3307 3314
3308 /* Start a menu name with this to not include it on the main menu bar */ 3315 // Start a menu name with this to not include it on the main menu bar
3309 #define MNU_HIDDEN_CHAR ']' 3316 #define MNU_HIDDEN_CHAR ']'
3310 3317
3311 struct VimMenu 3318 struct VimMenu
3312 { 3319 {
3313 int modes; /* Which modes is this menu visible for? */ 3320 int modes; // Which modes is this menu visible for?
3314 int enabled; /* for which modes the menu is enabled */ 3321 int enabled; // for which modes the menu is enabled
3315 char_u *name; /* Name of menu, possibly translated */ 3322 char_u *name; // Name of menu, possibly translated
3316 char_u *dname; /* Displayed Name ("name" without '&') */ 3323 char_u *dname; // Displayed Name ("name" without '&')
3317 #ifdef FEAT_MULTI_LANG 3324 #ifdef FEAT_MULTI_LANG
3318 char_u *en_name; /* "name" untranslated, NULL when "name" 3325 char_u *en_name; // "name" untranslated, NULL when "name"
3319 * was not translated */ 3326 // was not translated
3320 char_u *en_dname; /* "dname" untranslated, NULL when "dname" 3327 char_u *en_dname; // "dname" untranslated, NULL when "dname"
3321 * was not translated */ 3328 // was not translated
3322 #endif 3329 #endif
3323 int mnemonic; /* mnemonic key (after '&') */ 3330 int mnemonic; // mnemonic key (after '&')
3324 char_u *actext; /* accelerator text (after TAB) */ 3331 char_u *actext; // accelerator text (after TAB)
3325 int priority; /* Menu order priority */ 3332 int priority; // Menu order priority
3326 #ifdef FEAT_GUI 3333 #ifdef FEAT_GUI
3327 void (*cb)(vimmenu_T *); /* Call-back routine */ 3334 void (*cb)(vimmenu_T *); // Call-back function
3328 #endif 3335 #endif
3329 #ifdef FEAT_TOOLBAR 3336 #ifdef FEAT_TOOLBAR
3330 char_u *iconfile; /* name of file for icon or NULL */ 3337 char_u *iconfile; // name of file for icon or NULL
3331 int iconidx; /* icon index (-1 if not set) */ 3338 int iconidx; // icon index (-1 if not set)
3332 int icon_builtin; /* icon names is BuiltIn{nr} */ 3339 int icon_builtin; // icon names is BuiltIn{nr}
3333 #endif 3340 #endif
3334 char_u *strings[MENU_MODES]; /* Mapped string for each mode */ 3341 char_u *strings[MENU_MODES]; // Mapped string for each mode
3335 int noremap[MENU_MODES]; /* A REMAP_ flag for each mode */ 3342 int noremap[MENU_MODES]; // A REMAP_ flag for each mode
3336 char silent[MENU_MODES]; /* A silent flag for each mode */ 3343 char silent[MENU_MODES]; // A silent flag for each mode
3337 vimmenu_T *children; /* Children of sub-menu */ 3344 vimmenu_T *children; // Children of sub-menu
3338 vimmenu_T *parent; /* Parent of menu */ 3345 vimmenu_T *parent; // Parent of menu
3339 vimmenu_T *next; /* Next item in menu */ 3346 vimmenu_T *next; // Next item in menu
3340 #ifdef FEAT_GUI_X11 3347 #ifdef FEAT_GUI_X11
3341 Widget id; /* Manage this to enable item */ 3348 Widget id; // Manage this to enable item
3342 Widget submenu_id; /* If this is submenu, add children here */ 3349 Widget submenu_id; // If this is submenu, add children here
3343 #endif 3350 #endif
3344 #ifdef FEAT_GUI_GTK 3351 #ifdef FEAT_GUI_GTK
3345 GtkWidget *id; /* Manage this to enable item */ 3352 GtkWidget *id; // Manage this to enable item
3346 GtkWidget *submenu_id; /* If this is submenu, add children here */ 3353 GtkWidget *submenu_id; // If this is submenu, add children here
3347 # if defined(GTK_CHECK_VERSION) && !GTK_CHECK_VERSION(3,4,0) 3354 # if defined(GTK_CHECK_VERSION) && !GTK_CHECK_VERSION(3,4,0)
3348 GtkWidget *tearoff_handle; 3355 GtkWidget *tearoff_handle;
3349 # endif 3356 # endif
3350 GtkWidget *label; /* Used by "set wak=" code. */ 3357 GtkWidget *label; // Used by "set wak=" code.
3351 #endif 3358 #endif
3352 #ifdef FEAT_GUI_MOTIF 3359 #ifdef FEAT_GUI_MOTIF
3353 int sensitive; /* turn button on/off */ 3360 int sensitive; // turn button on/off
3354 char **xpm; /* pixmap data */ 3361 char **xpm; // pixmap data
3355 char *xpm_fname; /* file with pixmap data */ 3362 char *xpm_fname; // file with pixmap data
3356 #endif 3363 #endif
3357 #ifdef FEAT_GUI_ATHENA 3364 #ifdef FEAT_GUI_ATHENA
3358 Pixmap image; /* Toolbar image */ 3365 Pixmap image; // Toolbar image
3359 #endif 3366 #endif
3360 #ifdef FEAT_BEVAL_TIP 3367 #ifdef FEAT_BEVAL_TIP
3361 BalloonEval *tip; /* tooltip for this menu item */ 3368 BalloonEval *tip; // tooltip for this menu item
3362 #endif 3369 #endif
3363 #ifdef FEAT_GUI_MSWIN 3370 #ifdef FEAT_GUI_MSWIN
3364 UINT id; /* Id of menu item */ 3371 UINT id; // Id of menu item
3365 HMENU submenu_id; /* If this is submenu, add children here */ 3372 HMENU submenu_id; // If this is submenu, add children here
3366 HWND tearoff_handle; /* hWnd of tearoff if created */ 3373 HWND tearoff_handle; // hWnd of tearoff if created
3367 #endif 3374 #endif
3368 #ifdef FEAT_GUI_MAC 3375 #ifdef FEAT_GUI_MAC
3369 /* MenuHandle id; */ 3376 // MenuHandle id;
3370 /* short index; */ /* the item index within the father menu */ 3377 // short index; // the item index within the father menu
3371 short menu_id; /* the menu id to which this item belong */ 3378 short menu_id; // the menu id to which this item belong
3372 short submenu_id; /* the menu id of the children (could be 3379 short submenu_id; // the menu id of the children (could be
3373 get through some tricks) */ 3380 // get through some tricks)
3374 MenuHandle menu_handle; 3381 MenuHandle menu_handle;
3375 MenuHandle submenu_handle; 3382 MenuHandle submenu_handle;
3376 #endif 3383 #endif
3377 #ifdef FEAT_GUI_PHOTON 3384 #ifdef FEAT_GUI_PHOTON
3378 PtWidget_t *id; 3385 PtWidget_t *id;
3379 PtWidget_t *submenu_id; 3386 PtWidget_t *submenu_id;
3380 #endif 3387 #endif
3381 }; 3388 };
3382 #else 3389 #else
3383 /* For generating prototypes when FEAT_MENU isn't defined. */ 3390 // For generating prototypes when FEAT_MENU isn't defined.
3384 typedef int vimmenu_T; 3391 typedef int vimmenu_T;
3385 3392
3386 #endif /* FEAT_MENU */ 3393 #endif // FEAT_MENU
3387 3394
3388 /* 3395 /*
3389 * Struct to save values in before executing autocommands for a buffer that is 3396 * Struct to save values in before executing autocommands for a buffer that is
3390 * not the current buffer. 3397 * not the current buffer.
3391 */ 3398 */
3392 typedef struct 3399 typedef struct
3393 { 3400 {
3394 buf_T *save_curbuf; /* saved curbuf */ 3401 buf_T *save_curbuf; // saved curbuf
3395 int use_aucmd_win; /* using aucmd_win */ 3402 int use_aucmd_win; // using aucmd_win
3396 win_T *save_curwin; /* saved curwin */ 3403 win_T *save_curwin; // saved curwin
3397 win_T *new_curwin; /* new curwin */ 3404 win_T *new_curwin; // new curwin
3398 win_T *save_prevwin; /* saved prevwin */ 3405 win_T *save_prevwin; // saved prevwin
3399 bufref_T new_curbuf; /* new curbuf */ 3406 bufref_T new_curbuf; // new curbuf
3400 char_u *globaldir; /* saved value of globaldir */ 3407 char_u *globaldir; // saved value of globaldir
3401 } aco_save_T; 3408 } aco_save_T;
3402 3409
3403 /* 3410 /*
3404 * Generic option table item, only used for printer at the moment. 3411 * Generic option table item, only used for printer at the moment.
3405 */ 3412 */
3406 typedef struct 3413 typedef struct
3407 { 3414 {
3408 const char *name; 3415 const char *name;
3409 int hasnum; 3416 int hasnum;
3410 long number; 3417 long number;
3411 char_u *string; /* points into option string */ 3418 char_u *string; // points into option string
3412 int strlen; 3419 int strlen;
3413 int present; 3420 int present;
3414 } option_table_T; 3421 } option_table_T;
3415 3422
3416 /* 3423 /*
3455 /* 3462 /*
3456 * Used for popup menu items. 3463 * Used for popup menu items.
3457 */ 3464 */
3458 typedef struct 3465 typedef struct
3459 { 3466 {
3460 char_u *pum_text; /* main menu text */ 3467 char_u *pum_text; // main menu text
3461 char_u *pum_kind; /* extra kind text (may be truncated) */ 3468 char_u *pum_kind; // extra kind text (may be truncated)
3462 char_u *pum_extra; /* extra menu text (may be truncated) */ 3469 char_u *pum_extra; // extra menu text (may be truncated)
3463 char_u *pum_info; /* extra info */ 3470 char_u *pum_info; // extra info
3464 } pumitem_T; 3471 } pumitem_T;
3465 3472
3466 /* 3473 /*
3467 * Structure used for get_tagfname(). 3474 * Structure used for get_tagfname().
3468 */ 3475 */
3469 typedef struct 3476 typedef struct
3470 { 3477 {
3471 char_u *tn_tags; /* value of 'tags' when starting */ 3478 char_u *tn_tags; // value of 'tags' when starting
3472 char_u *tn_np; /* current position in tn_tags */ 3479 char_u *tn_np; // current position in tn_tags
3473 int tn_did_filefind_init; 3480 int tn_did_filefind_init;
3474 int tn_hf_idx; 3481 int tn_hf_idx;
3475 void *tn_search_ctx; 3482 void *tn_search_ctx;
3476 } tagname_T; 3483 } tagname_T;
3477 3484
3500 /* 3507 /*
3501 * Structure used for reading in json_decode(). 3508 * Structure used for reading in json_decode().
3502 */ 3509 */
3503 struct js_reader 3510 struct js_reader
3504 { 3511 {
3505 char_u *js_buf; /* text to be decoded */ 3512 char_u *js_buf; // text to be decoded
3506 char_u *js_end; /* NUL in js_buf */ 3513 char_u *js_end; // NUL in js_buf
3507 int js_used; /* bytes used from js_buf */ 3514 int js_used; // bytes used from js_buf
3508 int (*js_fill)(struct js_reader *); 3515 int (*js_fill)(struct js_reader *);
3509 /* function to fill the buffer or NULL; 3516 // function to fill the buffer or NULL;
3510 * return TRUE when the buffer was filled */ 3517 // return TRUE when the buffer was filled
3511 void *js_cookie; /* can be used by js_fill */ 3518 void *js_cookie; // can be used by js_fill
3512 int js_cookie_arg; /* can be used by js_fill */ 3519 int js_cookie_arg; // can be used by js_fill
3513 }; 3520 };
3514 typedef struct js_reader js_read_T; 3521 typedef struct js_reader js_read_T;
3515 3522
3516 /* Maximum number of commands from + or -c arguments. */ 3523 // Maximum number of commands from + or -c arguments.
3517 #define MAX_ARG_CMDS 10 3524 #define MAX_ARG_CMDS 10
3518 3525
3519 /* values for "window_layout" */ 3526 // values for "window_layout"
3520 #define WIN_HOR 1 /* "-o" horizontally split windows */ 3527 #define WIN_HOR 1 // "-o" horizontally split windows
3521 #define WIN_VER 2 /* "-O" vertically split windows */ 3528 #define WIN_VER 2 // "-O" vertically split windows
3522 #define WIN_TABS 3 /* "-p" windows on tab pages */ 3529 #define WIN_TABS 3 // "-p" windows on tab pages
3523 3530
3524 /* Struct for various parameters passed between main() and other functions. */ 3531 // Struct for various parameters passed between main() and other functions.
3525 typedef struct 3532 typedef struct
3526 { 3533 {
3527 int argc; 3534 int argc;
3528 char **argv; 3535 char **argv;
3529 3536
3530 char_u *fname; /* first file to edit */ 3537 char_u *fname; // first file to edit
3531 3538
3532 int evim_mode; /* started as "evim" */ 3539 int evim_mode; // started as "evim"
3533 char_u *use_vimrc; /* vimrc from -u argument */ 3540 char_u *use_vimrc; // vimrc from -u argument
3534 int clean; /* --clean argument */ 3541 int clean; // --clean argument
3535 3542
3536 int n_commands; /* no. of commands from + or -c */ 3543 int n_commands; // no. of commands from + or -c
3537 char_u *commands[MAX_ARG_CMDS]; /* commands from + or -c arg. */ 3544 char_u *commands[MAX_ARG_CMDS]; // commands from + or -c arg.
3538 char_u cmds_tofree[MAX_ARG_CMDS]; /* commands that need free() */ 3545 char_u cmds_tofree[MAX_ARG_CMDS]; // commands that need free()
3539 int n_pre_commands; /* no. of commands from --cmd */ 3546 int n_pre_commands; // no. of commands from --cmd
3540 char_u *pre_commands[MAX_ARG_CMDS]; /* commands from --cmd argument */ 3547 char_u *pre_commands[MAX_ARG_CMDS]; // commands from --cmd argument
3541 3548
3542 int edit_type; /* type of editing to do */ 3549 int edit_type; // type of editing to do
3543 char_u *tagname; /* tag from -t argument */ 3550 char_u *tagname; // tag from -t argument
3544 #ifdef FEAT_QUICKFIX 3551 #ifdef FEAT_QUICKFIX
3545 char_u *use_ef; /* 'errorfile' from -q argument */ 3552 char_u *use_ef; // 'errorfile' from -q argument
3546 #endif 3553 #endif
3547 3554
3548 int want_full_screen; 3555 int want_full_screen;
3549 int not_a_term; /* no warning for missing term? */ 3556 int not_a_term; // no warning for missing term?
3550 int tty_fail; /* exit if not a tty */ 3557 int tty_fail; // exit if not a tty
3551 char_u *term; /* specified terminal name */ 3558 char_u *term; // specified terminal name
3552 #ifdef FEAT_CRYPT 3559 #ifdef FEAT_CRYPT
3553 int ask_for_key; /* -x argument */ 3560 int ask_for_key; // -x argument
3554 #endif 3561 #endif
3555 int no_swap_file; /* "-n" argument used */ 3562 int no_swap_file; // "-n" argument used
3556 #ifdef FEAT_EVAL 3563 #ifdef FEAT_EVAL
3557 int use_debug_break_level; 3564 int use_debug_break_level;
3558 #endif 3565 #endif
3559 int window_count; /* number of windows to use */ 3566 int window_count; // number of windows to use
3560 int window_layout; /* 0, WIN_HOR, WIN_VER or WIN_TABS */ 3567 int window_layout; // 0, WIN_HOR, WIN_VER or WIN_TABS
3561 3568
3562 #ifdef FEAT_CLIENTSERVER 3569 #ifdef FEAT_CLIENTSERVER
3563 int serverArg; /* TRUE when argument for a server */ 3570 int serverArg; // TRUE when argument for a server
3564 char_u *serverName_arg; /* cmdline arg for server name */ 3571 char_u *serverName_arg; // cmdline arg for server name
3565 char_u *serverStr; /* remote server command */ 3572 char_u *serverStr; // remote server command
3566 char_u *serverStrEnc; /* encoding of serverStr */ 3573 char_u *serverStrEnc; // encoding of serverStr
3567 char_u *servername; /* allocated name for our server */ 3574 char_u *servername; // allocated name for our server
3568 #endif 3575 #endif
3569 #if !defined(UNIX) 3576 #if !defined(UNIX)
3570 # define EXPAND_FILENAMES 3577 # define EXPAND_FILENAMES
3571 int literal; /* don't expand file names */ 3578 int literal; // don't expand file names
3572 #endif 3579 #endif
3573 #ifdef MSWIN 3580 #ifdef MSWIN
3574 int full_path; /* file name argument was full path */ 3581 int full_path; // file name argument was full path
3575 #endif 3582 #endif
3576 #ifdef FEAT_DIFF 3583 #ifdef FEAT_DIFF
3577 int diff_mode; /* start with 'diff' set */ 3584 int diff_mode; // start with 'diff' set
3578 #endif 3585 #endif
3579 } mparm_T; 3586 } mparm_T;
3580 3587
3581 /* 3588 /*
3582 * Structure returned by get_lval() and used by set_var_lval(). 3589 * Structure returned by get_lval() and used by set_var_lval().
3605 * "tv" points to the Dictionary typval_T 3612 * "tv" points to the Dictionary typval_T
3606 * "newkey" is the key for the new item. 3613 * "newkey" is the key for the new item.
3607 */ 3614 */
3608 typedef struct lval_S 3615 typedef struct lval_S
3609 { 3616 {
3610 char_u *ll_name; /* start of variable name (can be NULL) */ 3617 char_u *ll_name; // start of variable name (can be NULL)
3611 char_u *ll_exp_name; /* NULL or expanded name in allocated memory. */ 3618 char_u *ll_exp_name; // NULL or expanded name in allocated memory.
3612 typval_T *ll_tv; /* Typeval of item being used. If "newkey" 3619 typval_T *ll_tv; // Typeval of item being used. If "newkey"
3613 isn't NULL it's the Dict to which to add 3620 // isn't NULL it's the Dict to which to add
3614 the item. */ 3621 // the item.
3615 listitem_T *ll_li; /* The list item or NULL. */ 3622 listitem_T *ll_li; // The list item or NULL.
3616 list_T *ll_list; /* The list or NULL. */ 3623 list_T *ll_list; // The list or NULL.
3617 int ll_range; /* TRUE when a [i:j] range was used */ 3624 int ll_range; // TRUE when a [i:j] range was used
3618 long ll_n1; /* First index for list */ 3625 long ll_n1; // First index for list
3619 long ll_n2; /* Second index for list range */ 3626 long ll_n2; // Second index for list range
3620 int ll_empty2; /* Second index is empty: [i:] */ 3627 int ll_empty2; // Second index is empty: [i:]
3621 dict_T *ll_dict; /* The Dictionary or NULL */ 3628 dict_T *ll_dict; // The Dictionary or NULL
3622 dictitem_T *ll_di; /* The dictitem or NULL */ 3629 dictitem_T *ll_di; // The dictitem or NULL
3623 char_u *ll_newkey; /* New key for Dict in alloc. mem or NULL. */ 3630 char_u *ll_newkey; // New key for Dict in alloc. mem or NULL.
3624 blob_T *ll_blob; /* The Blob or NULL */ 3631 blob_T *ll_blob; // The Blob or NULL
3625 } lval_T; 3632 } lval_T;
3626 3633
3627 /* Structure used to save the current state. Used when executing Normal mode 3634 // Structure used to save the current state. Used when executing Normal mode
3628 * commands while in any other mode. */ 3635 // commands while in any other mode.
3629 typedef struct { 3636 typedef struct {
3630 int save_msg_scroll; 3637 int save_msg_scroll;
3631 int save_restart_edit; 3638 int save_restart_edit;
3632 int save_msg_didout; 3639 int save_msg_didout;
3633 int save_State; 3640 int save_State;