Annotation of src/usr.bin/vim/globals.h, Revision 1.1
1.1 ! downsj 1: /* $OpenBSD$ */
! 2: /* vi:set ts=4 sw=4:
! 3: *
! 4: * VIM - Vi IMproved by Bram Moolenaar
! 5: *
! 6: * Do ":help uganda" in Vim to read copying and usage conditions.
! 7: * Do ":help credits" in Vim to see a list of people who contributed.
! 8: */
! 9:
! 10: /*
! 11: * definition of global variables
! 12: *
! 13: * EXTERN is only defined in main.c (and in option.h)
! 14: */
! 15:
! 16: #ifndef EXTERN
! 17: # define EXTERN extern
! 18: # define INIT(x)
! 19: #else
! 20: # ifndef INIT
! 21: # define INIT(x) x
! 22: # endif
! 23: #endif
! 24:
! 25: /*
! 26: * Number of Rows and Columns in the screen.
! 27: * Must be long to be able to use them as options in option.c.
! 28: */
! 29: EXTERN long Rows; /* number of rows in the screen */
! 30: EXTERN long Columns; /* number of columns in the screen */
! 31:
! 32: /*
! 33: * The characters that are currently on the screen are kept in NextScreen.
! 34: * It is a single block of characters, twice the size of the screen.
! 35: * First come the characters for one line, then the attributes for that line.
! 36: *
! 37: * "LinePointers[n]" points into NextScreen, at the start of line 'n'.
! 38: * "LinePointers[n] + Columns" points to the attibutes of line 'n'.
! 39: */
! 40: EXTERN char_u *NextScreen INIT(= NULL);
! 41: EXTERN char_u **LinePointers INIT(= NULL);
! 42:
! 43: EXTERN int screen_Rows INIT(= 0); /* actual size of NextScreen */
! 44: EXTERN int screen_Columns INIT(= 0); /* actual size of NextScreen */
! 45:
! 46: /*
! 47: * Positioning the cursor is reduced by remembering the last position.
! 48: * Mostly used by screen_char().
! 49: */
! 50: EXTERN int screen_cur_row, screen_cur_col; /* last known cursor position */
! 51:
! 52: /*
! 53: * When vgetc() is called, it sets mod_mask to the set of modifiers that are
! 54: * held down based on the KSMOD_* symbols that are read first.
! 55: */
! 56: EXTERN int mod_mask INIT(= 0x0); /* current key modifiers */
! 57:
! 58: /*
! 59: * Cmdline_row is the row where the command line starts, just below the
! 60: * last window.
! 61: * When the cmdline gets longer than the available space the screen gets
! 62: * scrolled up. After a CTRL-D (show matches), after hitting ':' after
! 63: * "hit return", and for the :global command, the command line is
! 64: * temporarily moved. The old position is restored with the next call to
! 65: * updateScreen().
! 66: */
! 67: EXTERN int cmdline_row;
! 68:
! 69: EXTERN int redraw_cmdline INIT(= FALSE); /* cmdline must be redrawn */
! 70: EXTERN int clear_cmdline INIT(= FALSE); /* cmdline must be cleared */
! 71: EXTERN int modified INIT(= FALSE); /* buffer was modified since
! 72: last redraw */
! 73: EXTERN int screen_cleared INIT(= FALSE); /* screen has been cleared */
! 74:
! 75: /*
! 76: * When '$' is included in 'cpoptions' option set:
! 77: * When a change command is given that deletes only part of a line, a dollar
! 78: * is put at the end of the changed text. dollar_vcol is set to the virtual
! 79: * column of this '$'.
! 80: */
! 81: EXTERN colnr_t dollar_vcol INIT(= 0);
! 82:
! 83: /*
! 84: * used for completion on the command line
! 85: */
! 86: EXTERN int expand_context INIT(= CONTEXT_UNKNOWN);
! 87: EXTERN char_u *expand_pattern INIT(= NULL);
! 88: EXTERN int expand_interactively INIT(= FALSE);
! 89:
! 90: /*
! 91: * Functions for putting characters in the command line,
! 92: * while keeping NextScreen updated.
! 93: */
! 94: EXTERN int msg_col;
! 95: EXTERN int msg_row;
! 96: EXTERN int msg_scrolled;
! 97:
! 98: EXTERN char_u *keep_msg INIT(= NULL); /* msg to be shown after redraw */
! 99: EXTERN int keep_msg_highlight INIT(= 0);/* highlight for keep_msg */
! 100: #ifdef SLEEP_IN_EMSG
! 101: EXTERN int need_sleep INIT(= FALSE); /* call sleep() before redraw */
! 102: #endif
! 103: EXTERN int need_fileinfo INIT(= FALSE);/* do fileinfo() after redraw */
! 104: EXTERN int msg_scroll INIT(= FALSE); /* msg_start() will scroll */
! 105: EXTERN int msg_didout INIT(= FALSE); /* msg_outstr() was used in line */
! 106: EXTERN int msg_didany INIT(= FALSE); /* msg_outstr() was used at all */
! 107: EXTERN int emsg_off INIT(= FALSE); /* don't display errors for now */
! 108: EXTERN int did_emsg; /* set by emsg() for DoOneCmd() */
! 109: EXTERN int emsg_on_display INIT(= FALSE); /* there is an error message */
! 110: EXTERN char_u *sourcing_name INIT( = NULL);/* name of error message source */
! 111: EXTERN linenr_t sourcing_lnum INIT(= 0); /* line number of the source file */
! 112:
! 113: EXTERN int msg_highlight INIT(= FALSE);/* message should be highlighted */
! 114: EXTERN char_u *highlight INIT(= NULL); /* string for start of highlighting */
! 115: EXTERN char_u *unhighlight INIT(= NULL); /* string for end of highlighting */
! 116: EXTERN int scroll_region INIT(= FALSE);/* terminal supports scroll region */
! 117: EXTERN int highlight_match INIT(= FALSE); /* show search match pos */
! 118: EXTERN int search_match_len; /* length of matched string */
! 119: EXTERN int no_smartcase INIT(= FALSE); /* don't use 'smartcase' once */
! 120: EXTERN int need_check_timestamps INIT(= FALSE); /* got STOP signal */
! 121:
! 122: #ifdef AUTOCMD
! 123: EXTERN int autocmd_busy INIT(= FALSE); /* Is apply_autocmds() busy? */
! 124: #endif
! 125:
! 126: #ifdef USE_MOUSE
! 127: /*
! 128: * Mouse coordinates, set by check_termcode()
! 129: */
! 130: EXTERN int mouse_row;
! 131: EXTERN int mouse_col;
! 132: EXTERN int mouse_past_bottom INIT(= FALSE);/* mouse below last line */
! 133: EXTERN int mouse_past_eol INIT(= FALSE); /* mouse right of line */
! 134: #endif
! 135:
! 136: #ifdef USE_GUI
! 137: /*
! 138: * Menu item just selected, set by check_termcode()
! 139: */
! 140: EXTERN GuiMenu *current_menu;
! 141:
! 142: /*
! 143: * Scrollbar moved and new value, set by check_termcode()
! 144: */
! 145: EXTERN int current_scrollbar;
! 146: EXTERN long_u scrollbar_value;
! 147: #endif
! 148:
! 149: /*
! 150: * All windows are linked in a list. firstwin points to the first entry, lastwin
! 151: * to the last entry (can be the same as firstwin) and curwin to the currently
! 152: * active window.
! 153: */
! 154: EXTERN WIN *firstwin; /* first window */
! 155: EXTERN WIN *lastwin; /* last window */
! 156: EXTERN WIN *curwin; /* currently active window */
! 157:
! 158: /*
! 159: * All buffers are linked in a list. 'firstbuf' points to the first entry,
! 160: * 'lastbuf' to the last entry and 'curbuf' to the currently active buffer.
! 161: */
! 162: EXTERN BUF *firstbuf INIT(= NULL); /* first buffer */
! 163: EXTERN BUF *lastbuf INIT(= NULL); /* last buffer */
! 164: EXTERN BUF *curbuf INIT(= NULL); /* currently active buffer */
! 165:
! 166: /*
! 167: * list of files being edited (argument list)
! 168: */
! 169: EXTERN char_u **arg_files; /* list of files */
! 170: EXTERN int arg_count; /* number of files */
! 171: EXTERN int arg_exp; /* when TRUE arg_files must be freed */
! 172: EXTERN int arg_had_last INIT(= FALSE); /* accessed last file in arglist */
! 173:
! 174: EXTERN int ru_col; /* column for ruler */
! 175: EXTERN int sc_col; /* column for shown command */
! 176:
! 177: /*
! 178: * When starting or exiting some things are done differently (e.g. screen
! 179: * updating).
! 180: */
! 181: EXTERN int starting INIT(= TRUE);
! 182: /* set to FALSE when starting up finished */
! 183: EXTERN int exiting INIT(= FALSE);
! 184: /* set to TRUE when abandoning Vim */
! 185: EXTERN int full_screen INIT(= TRUE);
! 186: /* set to FALSE when not doing full-screen
! 187: * output and only writing some messages */
! 188:
! 189: EXTERN int secure INIT(= FALSE);
! 190: /* set to TRUE when only "safe" commands are
! 191: * allowed, e.g. when sourcing .exrc or .vimrc
! 192: * in current directory */
! 193:
! 194: EXTERN int found_version INIT(= 0);
! 195: /* version nr found after :version command */
! 196:
! 197: EXTERN FPOS VIsual; /* start position of Visual */
! 198: EXTERN FPOS VIsual_save; /* copy of VIsual before 'v' command */
! 199: EXTERN int VIsual_active INIT(= FALSE);
! 200: /* wheter Visual mode is active */
! 201: EXTERN FPOS VIsual_end; /* end position of Visual; set when
! 202: VIsual_active becomes FALSE */
! 203:
! 204: EXTERN int VIsual_mode INIT(= 'v');
! 205: /* type of Visual mode */
! 206: EXTERN int VIsual_mode_save;
! 207: /* copy of VIsual_mode before 'v' command */
! 208: EXTERN int redo_VIsual_busy INIT(= FALSE);
! 209: /* TRUE when redo-ing a visual */
! 210:
! 211: #ifdef USE_MOUSE
! 212: /*
! 213: * When pasting text with the middle mouse button in visual mode with
! 214: * restart_edit set, remember where it started so we can set Insstart.
! 215: */
! 216: EXTERN FPOS where_paste_started;
! 217: #endif
! 218:
! 219: /*
! 220: * This flag is used to make auto-indent work right on lines where only a
! 221: * <RETURN> or <ESC> is typed. It is set when an auto-indent is done, and
! 222: * reset when any other editting is done on the line. If an <ESC> or <RETURN>
! 223: * is received, and did_ai is TRUE, the line is truncated.
! 224: */
! 225: EXTERN int did_ai INIT(= FALSE);
! 226:
! 227: /*
! 228: * This flag is set when a smart indent has been performed. When the next typed
! 229: * character is a '{' the inserted tab will be deleted again.
! 230: */
! 231: EXTERN int did_si INIT(= FALSE);
! 232:
! 233: /*
! 234: * This flag is set after an auto indent. If the next typed character is a '}'
! 235: * one indent will be removed.
! 236: */
! 237: EXTERN int can_si INIT(= FALSE);
! 238:
! 239: /*
! 240: * This flag is set after an "O" command. If the next typed character is a '{'
! 241: * one indent will be removed.
! 242: */
! 243: EXTERN int can_si_back INIT(= FALSE);
! 244:
! 245: EXTERN int old_indent INIT(= 0); /* for ^^D command in insert mode */
! 246:
! 247: EXTERN int State INIT(= NORMAL); /* This is the current state of the
! 248: * command interpreter. */
! 249: EXTERN int no_mapping INIT(= FALSE); /* currently no mapping allowed */
! 250: EXTERN int allow_keys INIT(= FALSE); /* allow key codes when no_mapping
! 251: * is set */
! 252:
! 253: EXTERN int restart_edit INIT(= 0); /* call edit when next command finished
! 254: */
! 255: EXTERN int arrow_used; /* Normally FALSE, set to TRUE after
! 256: * hitting cursor key in insert mode.
! 257: * Used by vgetorpeek() to decide when
! 258: * to call u_sync() */
! 259: #ifdef INSERT_EXPAND
! 260: EXTERN char_u *edit_submode INIT(= NULL); /* msg for CTRL-X submode */
! 261: EXTERN char_u *edit_submode_extra INIT(= NULL);/* extra info for msg */
! 262: EXTERN int edit_submode_highl; /* extra info highlighted */
! 263: EXTERN int ctrl_x_mode INIT(= 0); /* Which Ctrl-X mode are we in? */
! 264: #endif
! 265:
! 266: EXTERN int Recording INIT(= FALSE);/* TRUE when recording into a register
! 267: */
! 268: EXTERN int Exec_reg INIT(= FALSE); /* TRUE when executing a register */
! 269:
! 270: EXTERN int did_cd INIT(= FALSE); /* TRUE when :cd dir used */
! 271: EXTERN int no_abbr INIT(= TRUE); /* TRUE when no abbreviations loaded */
! 272: EXTERN int fo_do_comments INIT(= FALSE);
! 273: /* TRUE when comments are to be
! 274: * formatted */
! 275: #if defined MSDOS || defined WIN32
! 276: EXTERN int beep_count INIT(= 0); /* nr of beeps since last char typed */
! 277: #endif
! 278:
! 279: EXTERN char_u *IObuff; /* sprintf's are done in this buffer */
! 280: EXTERN char_u *NameBuff; /* file names are expanded in this
! 281: * buffer */
! 282: EXTERN char_u msg_buf[MSG_BUF_LEN]; /* small buffer for messages */
! 283:
! 284: EXTERN int RedrawingDisabled INIT(= FALSE);
! 285: /* Set to TRUE if doing :g */
! 286:
! 287: EXTERN int readonlymode INIT(= FALSE); /* Set to TRUE for "view" */
! 288: EXTERN int recoverymode INIT(= FALSE); /* Set to TRUE for "-r" option */
! 289:
! 290: EXTERN char_u *typebuf INIT(= NULL); /* buffer for typed characters */
! 291: EXTERN int typebuflen; /* size of typebuf */
! 292: EXTERN int typeoff; /* current position in typebuf */
! 293: EXTERN int typelen; /* number of valid chars in typebuf */
! 294: EXTERN int KeyTyped; /* TRUE if user typed current char */
! 295: EXTERN int KeyStuffed; /* TRUE if current char from stuffbuf */
! 296:
! 297: EXTERN int must_redraw INIT(= 0); /* type of redraw necessary */
! 298: EXTERN int skip_redraw INIT(= FALSE); /* skip redraw once */
! 299: EXTERN int do_redraw INIT(= FALSE); /* extra redraw once */
! 300:
! 301: EXTERN char_u *use_viminfo INIT(= NULL); /* name of viminfo file to use */
! 302:
! 303: #define NSCRIPT 15
! 304: EXTERN FILE *scriptin[NSCRIPT]; /* streams to read script from */
! 305: EXTERN int curscript INIT(= 0); /* index in scriptin[] */
! 306: EXTERN FILE *scriptout INIT(= NULL); /* stream to write script to */
! 307:
! 308: EXTERN int got_int INIT(= FALSE); /* set to TRUE when interrupt
! 309: signal occurred */
! 310: EXTERN int term_console INIT(= FALSE); /* set to TRUE when consule used */
! 311: EXTERN int termcap_active INIT(= FALSE); /* set by starttermcap() */
! 312: EXTERN int bangredo INIT(= FALSE); /* set to TRUE whith ! command */
! 313: EXTERN int searchcmdlen; /* length of previous search cmd */
! 314: EXTERN int reg_ic INIT(= 0); /* p_ic passed to vim_regexec() */
! 315: EXTERN int reg_magic; /* p_magic passed to ergexec() */
! 316:
! 317: EXTERN int did_outofmem_msg INIT(= FALSE);
! 318: /* set after out of memory msg */
! 319: EXTERN int did_swapwrite_msg INIT(= FALSE);
! 320: /* set after swap write error msg */
! 321: EXTERN int undo_off INIT(= FALSE); /* undo switched off for now */
! 322: EXTERN int global_busy INIT(= 0); /* set when :global is executing */
! 323: #ifdef SLEEP_IN_EMSG
! 324: EXTERN int dont_sleep INIT(= FALSE); /* set when sleep() in emsg() not
! 325: wanted */
! 326: #endif
! 327: EXTERN int need_start_insertmode INIT(= FALSE);
! 328: /* start insert mode soon */
! 329: EXTERN int rc_did_emsg INIT(= FALSE); /* vim_regcomp() called emsg() */
! 330: EXTERN int no_wait_return INIT(= 0); /* don't wait for return now */
! 331: EXTERN int need_wait_return INIT(= 0); /* need to wait for return later */
! 332: EXTERN int dont_wait_return INIT(= 0); /* no need to wait for return */
! 333: EXTERN int quit_more INIT(= FALSE); /* 'q' hit at "--more--" msg */
! 334: EXTERN char_u *last_cmdline INIT(= NULL); /* last command line (for ":) */
! 335: EXTERN char_u *new_last_cmdline INIT(= NULL); /* new value for last_cmdline */
! 336: EXTERN char_u *autocmd_fname INIT(= NULL); /* fname for "^Vf" on cmdline */
! 337:
! 338: EXTERN int postponed_split INIT(= FALSE); /* for CTRL-W CTRL-] command */
! 339: EXTERN int replace_offset INIT(= 0); /* offset for replace_push() */
! 340:
! 341: EXTERN char_u *escape_chars INIT(= (char_u *)" \t\\\"|");
! 342: /* need backslash in cmd line */
! 343:
! 344: EXTERN char_u *help_save_isk INIT(= NULL);/* 'isk' saved by do_help() */
! 345: EXTERN long help_save_ts INIT(= 0); /* 'ts' saved by do_help() */
! 346: EXTERN int keep_help_flag INIT(= FALSE); /* doing :ta from help file */
! 347:
! 348: /*
! 349: * When a string option is NULL (which only happens in out-of-memory
! 350: * situations), it is set to empty_option, to avoid having to check for NULL
! 351: * everywhere.
! 352: */
! 353: EXTERN char_u *empty_option INIT(= (char_u *)"");
! 354:
! 355: #ifdef DEBUG
! 356: EXTERN FILE *debugfp INIT(=NULL);
! 357: #endif
! 358:
! 359: #ifdef HAVE_LANGMAP
! 360: EXTERN char_u langmap_mapchar[256]; /* mapping for language keys */
! 361: #endif
! 362:
! 363: EXTERN char breakat_flags[256]; /* which characters are in 'breakat' */
! 364:
! 365: extern char *Version; /* this is in version.c */
! 366: extern char *longVersion; /* this is in version.c */
! 367:
! 368: /*
! 369: * Some file names for Unix are stored in pathdef.c, to make their value
! 370: * depend on the Makefile.
! 371: */
! 372: #if defined(HAVE_CONFIG_H) || defined(OS2)
! 373: extern char_u *sys_vimrc_fname; /* this is in pathdef.c */
! 374: extern char_u *sys_compatrc_fname; /* this is in pathdef.c */
! 375: extern char_u *sys_gvimrc_fname; /* this is in pathdef.c */
! 376: extern char_u *help_fname; /* this is in pathdef.c */
! 377: extern char_u *all_cflags; /* this is in pathdef.c */
! 378: #endif
! 379:
! 380: EXTERN char_u no_lines_msg[] INIT(="--No lines in buffer--");
! 381:
! 382: /*
! 383: * The error messages that can be shared are included here.
! 384: * Excluded are very specific errors and debugging messages.
! 385: */
! 386: EXTERN char_u e_abbr[] INIT(="No such abbreviation");
! 387: EXTERN char_u e_abort[] INIT(="Command aborted");
! 388: EXTERN char_u e_ambmap[] INIT(="Ambiguous mapping");
! 389: EXTERN char_u e_argreq[] INIT(="Argument required");
! 390: EXTERN char_u e_backslash[] INIT(="\\ should be followed by /, ? or &");
! 391: EXTERN char_u e_curdir[] INIT(="Command not allowed from from .exrc/.vimrc in current dir");
! 392: EXTERN char_u e_errorf[] INIT(="No errorfile name");
! 393: EXTERN char_u e_exists[] INIT(="File exists (use ! to override)");
! 394: EXTERN char_u e_failed[] INIT(="Command failed");
! 395: EXTERN char_u e_internal[] INIT(="Internal error");
! 396: EXTERN char_u e_interr[] INIT(="Interrupted");
! 397: EXTERN char_u e_invaddr[] INIT(="Invalid address");
! 398: EXTERN char_u e_invarg[] INIT(="Invalid argument");
! 399: EXTERN char_u e_invrange[] INIT(="Invalid range");
! 400: EXTERN char_u e_invcmd[] INIT(="Invalid command");
! 401: EXTERN char_u e_markinval[] INIT(="Mark has invalid line number");
! 402: EXTERN char_u e_marknotset[] INIT(="Mark not set");
! 403: EXTERN char_u e_nesting[] INIT(="Scripts nested too deep");
! 404: EXTERN char_u e_noalt[] INIT(="No alternate file");
! 405: EXTERN char_u e_nobang[] INIT(="No ! allowed");
! 406: EXTERN char_u e_nogvim[] INIT(="GUI cannot be used: Not enabled at compile time\n");
! 407: EXTERN char_u e_nohebrew[] INIT(="Hebrew cannot be used: Not enabled at compile time\n");
! 408: EXTERN char_u e_noinstext[] INIT(="No inserted text yet");
! 409: EXTERN char_u e_nolastcmd[] INIT(="No previous command line");
! 410: EXTERN char_u e_nomap[] INIT(="No such mapping");
! 411: EXTERN char_u e_nomatch[] INIT(="No match");
! 412: EXTERN char_u e_nomore[] INIT(="No more files to edit");
! 413: EXTERN char_u e_noname[] INIT(="No file name");
! 414: EXTERN char_u e_nopresub[] INIT(="No previous substitute regular expression");
! 415: EXTERN char_u e_noprev[] INIT(="No previous command");
! 416: EXTERN char_u e_noprevre[] INIT(="No previous regular expression");
! 417: EXTERN char_u e_norange[] INIT(="No range allowed");
! 418: EXTERN char_u e_noroom[] INIT(="Not enough room");
! 419: EXTERN char_u e_notcreate[] INIT(="Can't create file %s");
! 420: EXTERN char_u e_notmp[] INIT(="Can't get temp file name");
! 421: EXTERN char_u e_notopen[] INIT(="Can't open file %s");
! 422: EXTERN char_u e_notread[] INIT(="Can't read file %s");
! 423: EXTERN char_u e_nowrtmsg[] INIT(="No write since last change (use ! to override)");
! 424: EXTERN char_u e_null[] INIT(="Null argument");
! 425: EXTERN char_u e_number[] INIT(="Number expected");
! 426: EXTERN char_u e_openerrf[] INIT(="Can't open errorfile %s");
! 427: EXTERN char_u e_outofmem[] INIT(="Out of memory!");
! 428: EXTERN char_u e_patnotf[] INIT(="Pattern not found");
! 429: EXTERN char_u e_positive[] INIT(="Argument must be positive");
! 430: EXTERN char_u e_quickfix[] INIT(="No Errors");
! 431: EXTERN char_u e_re_damg[] INIT(="Damaged match string");
! 432: EXTERN char_u e_re_corr[] INIT(="Corrupted regexp program");
! 433: EXTERN char_u e_readonly[] INIT(="'readonly' option is set (use ! to override)");
! 434: EXTERN char_u e_readerrf[] INIT(="Error while reading errorfile");
! 435: EXTERN char_u e_scroll[] INIT(="Invalid scroll size");
! 436: EXTERN char_u e_toocompl[] INIT(="Command too complex");
! 437: EXTERN char_u e_toombra[] INIT(="Too many (");
! 438: EXTERN char_u e_toomket[] INIT(="Too many )");
! 439: EXTERN char_u e_toomsbra[] INIT(="Too many [");
! 440: EXTERN char_u e_toolong[] INIT(="Command too long");
! 441: EXTERN char_u e_toomany[] INIT(="Too many file names");
! 442: EXTERN char_u e_trailing[] INIT(="Trailing characters");
! 443: EXTERN char_u e_umark[] INIT(="Unknown mark");
! 444: EXTERN char_u e_unknown[] INIT(="Unknown");
! 445: EXTERN char_u e_write[] INIT(="Error while writing");
! 446: EXTERN char_u e_zerocount[] INIT(="Zero count");