mirror of
https://github.com/neovim/neovim.git
synced 2025-09-06 19:38:20 +00:00
Remove more #ifdef dead code
This commit is contained in:
@@ -734,15 +734,12 @@ EXTERN int msg_silent INIT(= 0); /* don't print messages */
|
||||
EXTERN int emsg_silent INIT(= 0); /* don't print error messages */
|
||||
EXTERN int cmd_silent INIT(= FALSE); /* don't echo the command line */
|
||||
|
||||
#if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG) \
|
||||
|| defined(FEAT_AUTOCMD)
|
||||
# define HAS_SWAP_EXISTS_ACTION
|
||||
#define HAS_SWAP_EXISTS_ACTION
|
||||
EXTERN int swap_exists_action INIT(= SEA_NONE);
|
||||
/* For dialog when swap file already
|
||||
* exists. */
|
||||
EXTERN int swap_exists_did_quit INIT(= FALSE);
|
||||
/* Selected "quit" at the dialog. */
|
||||
#endif
|
||||
|
||||
EXTERN char_u *IObuff; /* sprintf's are done in this buffer,
|
||||
size is IOSIZE */
|
||||
@@ -906,12 +903,9 @@ EXTERN int lcs_tab2 INIT(= NUL);
|
||||
EXTERN int lcs_trail INIT(= NUL);
|
||||
EXTERN int lcs_conceal INIT(= '-');
|
||||
|
||||
#if defined(FEAT_WINDOWS) || defined(FEAT_WILDMENU) || defined(FEAT_STL_OPT) \
|
||||
|| defined(FEAT_FOLDING)
|
||||
/* Characters from 'fillchars' option */
|
||||
EXTERN int fill_stl INIT(= ' ');
|
||||
EXTERN int fill_stlnc INIT(= ' ');
|
||||
#endif
|
||||
EXTERN int fill_vert INIT(= ' ');
|
||||
EXTERN int fill_fold INIT(= '-');
|
||||
EXTERN int fill_diff INIT(= '-');
|
||||
@@ -1002,13 +996,8 @@ EXTERN option_table_T printer_opts[OPT_PRINT_NUM_OPTIONS]
|
||||
# define PRT_UNIT_POINT 3
|
||||
# define PRT_UNIT_NAMES {"pc", "in", "mm", "pt"}
|
||||
|
||||
#if (defined(FEAT_PRINTER) && defined(FEAT_STL_OPT)) \
|
||||
|| defined(FEAT_GUI_TABLINE)
|
||||
/* Page number used for %N in 'pageheader' and 'guitablabel'. */
|
||||
EXTERN linenr_T printer_page_num;
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
EXTERN int typebuf_was_filled INIT(= FALSE); /* received text from client
|
||||
@@ -1073,10 +1062,6 @@ EXTERN char_u e_while[] INIT(= N_("E588: :endwhile without :while"));
|
||||
EXTERN char_u e_for[] INIT(= N_("E588: :endfor without :for"));
|
||||
EXTERN char_u e_exists[] INIT(= N_("E13: File exists (add ! to override)"));
|
||||
EXTERN char_u e_failed[] INIT(= N_("E472: Command failed"));
|
||||
#if defined(FEAT_GUI_X11) || defined(FEAT_GUI_GTK) || defined(MACOS) \
|
||||
|| defined(FEAT_GUI_PHOTON) || defined(FEAT_GUI_MSWIN)
|
||||
EXTERN char_u e_font[] INIT(= N_("E235: Unknown font: %s"));
|
||||
#endif
|
||||
EXTERN char_u e_internal[] INIT(= N_("E473: Internal error"));
|
||||
EXTERN char_u e_interr[] INIT(= N_("Interrupted"));
|
||||
EXTERN char_u e_invaddr[] INIT(= N_("E14: Invalid address"));
|
||||
@@ -1089,17 +1074,6 @@ EXTERN char_u e_isadir2[] INIT(= N_("E17: \"%s\" is a directory"));
|
||||
#ifdef FEAT_LIBCALL
|
||||
EXTERN char_u e_libcall[] INIT(= N_("E364: Library call failed for \"%s()\""));
|
||||
#endif
|
||||
#if defined(DYNAMIC_PERL) \
|
||||
|| defined(DYNAMIC_PYTHON) || defined(DYNAMIC_PYTHON3) \
|
||||
|| defined(DYNAMIC_RUBY) \
|
||||
|| defined(DYNAMIC_TCL) \
|
||||
|| defined(DYNAMIC_ICONV) \
|
||||
|| defined(DYNAMIC_GETTEXT) \
|
||||
|| defined(DYNAMIC_MZSCHEME) \
|
||||
|| defined(DYNAMIC_LUA)
|
||||
EXTERN char_u e_loadlib[] INIT(= N_("E370: Could not load library %s"));
|
||||
EXTERN char_u e_loadfunc[] INIT(= N_("E448: Could not load library function %s"));
|
||||
#endif
|
||||
EXTERN char_u e_markinval[] INIT(= N_("E19: Mark has invalid line number"));
|
||||
EXTERN char_u e_marknotset[] INIT(= N_("E20: Mark not set"));
|
||||
EXTERN char_u e_modifiable[] INIT(= N_(
|
||||
@@ -1186,10 +1160,7 @@ EXTERN char_u e_emptybuf[] INIT(= N_("E749: empty buffer"));
|
||||
EXTERN char_u e_invalpat[] INIT(= N_(
|
||||
"E682: Invalid search pattern or delimiter"));
|
||||
EXTERN char_u e_bufloaded[] INIT(= N_("E139: File is loaded in another buffer"));
|
||||
#if defined(FEAT_SYN_HL) || \
|
||||
(defined(FEAT_INS_EXPAND) && defined(FEAT_COMPL_FUNC))
|
||||
EXTERN char_u e_notset[] INIT(= N_("E764: Option '%s' is not set"));
|
||||
#endif
|
||||
EXTERN char_u e_invalidreg[] INIT(= N_("E850: Invalid register name"));
|
||||
|
||||
|
||||
|
321
src/main.c
321
src/main.c
@@ -10,11 +10,6 @@
|
||||
#define EXTERN
|
||||
#include "vim.h"
|
||||
|
||||
#ifdef SPAWNO
|
||||
# include <spawno.h> /* special MS-DOS swapping library */
|
||||
#endif
|
||||
|
||||
|
||||
/* Maximum number of commands from + or -c arguments. */
|
||||
#define MAX_ARG_CMDS 10
|
||||
|
||||
@@ -75,7 +70,6 @@ static int get_number_arg __ARGS((char_u *p, int *idx, int def));
|
||||
static void init_locale __ARGS((void));
|
||||
# endif
|
||||
static void parse_command_name __ARGS((mparm_T *parmp));
|
||||
static void early_arg_scan __ARGS((mparm_T *parmp));
|
||||
static void command_line_scan __ARGS((mparm_T *parmp));
|
||||
static void check_tty __ARGS((mparm_T *parmp));
|
||||
static void read_stdin __ARGS((void));
|
||||
@@ -111,13 +105,10 @@ static char *(main_errors[]) =
|
||||
};
|
||||
|
||||
#ifndef NO_VIM_MAIN /* skip this for unittests */
|
||||
int
|
||||
# ifdef VIMDLL
|
||||
_export
|
||||
# endif
|
||||
int
|
||||
main(argc, argv)
|
||||
int argc;
|
||||
char **argv;
|
||||
int argc;
|
||||
char **argv;
|
||||
{
|
||||
char_u *fname = NULL; /* file name from command line */
|
||||
mparm_T params; /* various parameters passed between
|
||||
@@ -167,17 +158,9 @@ char **argv;
|
||||
qnx_init(); /* PhAttach() for clipboard, (and gui) */
|
||||
#endif
|
||||
|
||||
#ifdef MAC_OS_CLASSIC
|
||||
/* Prepare for possibly starting GUI sometime */
|
||||
/* Macintosh needs this before any memory is allocated. */
|
||||
gui_prepare(¶ms.argc, params.argv);
|
||||
TIME_MSG("GUI prepared");
|
||||
#endif
|
||||
|
||||
/* Init the table of Normal mode commands. */
|
||||
init_normal_cmds();
|
||||
|
||||
|
||||
/*
|
||||
* Allocate space for the generic buffers (needed for set_init_1() and
|
||||
* EMSG2()).
|
||||
@@ -199,17 +182,6 @@ char **argv;
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* Do a first scan of the arguments in "argv[]":
|
||||
* -display or --display
|
||||
* --server...
|
||||
* --socketid
|
||||
* --windowid
|
||||
*/
|
||||
early_arg_scan(¶ms);
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Check if we have an interactive window.
|
||||
* On the Amiga: If there is no window, we open one with a newcli command
|
||||
@@ -358,85 +330,80 @@ char **argv;
|
||||
|
||||
#endif /* NO_VIM_MAIN */
|
||||
|
||||
/* vim_main2() needs to be produced when FEAT_MZSCHEME is defined even when
|
||||
/* vim_main2() needs to be produced when FEAT_MZSCHEME is defined even when
|
||||
* NO_VIM_MAIN is defined. */
|
||||
|
||||
#ifndef NO_VIM_MAIN
|
||||
/* Execute --cmd arguments. */
|
||||
exe_pre_commands(¶ms);
|
||||
/* Execute --cmd arguments. */
|
||||
exe_pre_commands(¶ms);
|
||||
|
||||
/* Source startup scripts. */
|
||||
source_startup_scripts(¶ms);
|
||||
/* Source startup scripts. */
|
||||
source_startup_scripts(¶ms);
|
||||
|
||||
/*
|
||||
/*
|
||||
* Read all the plugin files.
|
||||
* Only when compiled with +eval, since most plugins need it.
|
||||
*/
|
||||
if (p_lpl) {
|
||||
if (p_lpl) {
|
||||
source_runtime((char_u *)"plugin/**/*.vim", TRUE);
|
||||
TIME_MSG("loading plugins");
|
||||
}
|
||||
}
|
||||
|
||||
/* Decide about window layout for diff mode after reading vimrc. */
|
||||
if (params.diff_mode && params.window_layout == 0) {
|
||||
/* Decide about window layout for diff mode after reading vimrc. */
|
||||
if (params.diff_mode && params.window_layout == 0) {
|
||||
if (diffopt_horizontal())
|
||||
params.window_layout = WIN_HOR; /* use horizontal split */
|
||||
else
|
||||
params.window_layout = WIN_VER; /* use vertical split */
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
/*
|
||||
* Recovery mode without a file name: List swap files.
|
||||
* This uses the 'dir' option, therefore it must be after the
|
||||
* initializations.
|
||||
*/
|
||||
if (recoverymode && fname == NULL) {
|
||||
if (recoverymode && fname == NULL) {
|
||||
recover_names(NULL, TRUE, 0, NULL);
|
||||
mch_exit(0);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
/*
|
||||
* Set a few option defaults after reading .vimrc files:
|
||||
* 'title' and 'icon', Unix: 'shellpipe' and 'shellredir'.
|
||||
*/
|
||||
set_init_3();
|
||||
TIME_MSG("inits 3");
|
||||
set_init_3();
|
||||
TIME_MSG("inits 3");
|
||||
|
||||
/*
|
||||
/*
|
||||
* "-n" argument: Disable swap file by setting 'updatecount' to 0.
|
||||
* Note that this overrides anything from a vimrc file.
|
||||
*/
|
||||
if (params.no_swap_file)
|
||||
if (params.no_swap_file)
|
||||
p_uc = 0;
|
||||
|
||||
if (curwin->w_p_rl && p_altkeymap) {
|
||||
if (curwin->w_p_rl && p_altkeymap) {
|
||||
p_hkmap = FALSE; /* Reset the Hebrew keymap mode */
|
||||
curwin->w_p_arab = FALSE; /* Reset the Arabic keymap mode */
|
||||
p_fkmap = TRUE; /* Set the Farsi keymap mode */
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#ifdef SPAWNO /* special MSDOS swapping library */
|
||||
init_SPAWNO("", SWAP_ANY);
|
||||
#endif
|
||||
|
||||
/*
|
||||
/*
|
||||
* Read in registers, history etc, but not marks, from the viminfo file.
|
||||
* This is where v:oldfiles gets filled.
|
||||
*/
|
||||
if (*p_viminfo != NUL) {
|
||||
if (*p_viminfo != NUL) {
|
||||
read_viminfo(NULL, VIF_WANT_INFO | VIF_GET_OLDFILES);
|
||||
TIME_MSG("reading viminfo");
|
||||
}
|
||||
/* It's better to make v:oldfiles an empty list than NULL. */
|
||||
if (get_vim_var_list(VV_OLDFILES) == NULL)
|
||||
}
|
||||
/* It's better to make v:oldfiles an empty list than NULL. */
|
||||
if (get_vim_var_list(VV_OLDFILES) == NULL)
|
||||
set_vim_var_list(VV_OLDFILES, list_alloc());
|
||||
|
||||
/*
|
||||
/*
|
||||
* "-q errorfile": Load the error file now.
|
||||
* If the error file can't be read, exit before doing anything else.
|
||||
*/
|
||||
if (params.edit_type == EDIT_QF) {
|
||||
if (params.edit_type == EDIT_QF) {
|
||||
if (params.use_ef != NULL)
|
||||
set_string_option_direct((char_u *)"ef", -1,
|
||||
params.use_ef, OPT_FREE, SID_CARG);
|
||||
@@ -446,41 +413,37 @@ if (params.edit_type == EDIT_QF) {
|
||||
mch_exit(3);
|
||||
}
|
||||
TIME_MSG("reading errorfile");
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
/*
|
||||
* Start putting things on the screen.
|
||||
* Scroll screen down before drawing over it
|
||||
* Clear screen now, so file message will not be cleared.
|
||||
*/
|
||||
starting = NO_BUFFERS;
|
||||
no_wait_return = FALSE;
|
||||
if (!exmode_active)
|
||||
starting = NO_BUFFERS;
|
||||
no_wait_return = FALSE;
|
||||
if (!exmode_active)
|
||||
msg_scroll = FALSE;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
/*
|
||||
* If "-" argument given: Read file from stdin.
|
||||
* Do this before starting Raw mode, because it may change things that the
|
||||
* writing end of the pipe doesn't like, e.g., in case stdin and stderr
|
||||
* are the same terminal: "cat | vim -".
|
||||
* Using autocommands here may cause trouble...
|
||||
*/
|
||||
if (params.edit_type == EDIT_STDIN && !recoverymode)
|
||||
if (params.edit_type == EDIT_STDIN && !recoverymode)
|
||||
read_stdin();
|
||||
|
||||
#if defined(UNIX) || defined(VMS)
|
||||
/* When switching screens and something caused a message from a vimrc
|
||||
/* When switching screens and something caused a message from a vimrc
|
||||
* script, need to output an extra newline on exit. */
|
||||
if ((did_emsg || msg_didout) && *T_TI != NUL)
|
||||
if ((did_emsg || msg_didout) && *T_TI != NUL)
|
||||
newline_on_exit = TRUE;
|
||||
#endif
|
||||
|
||||
/*
|
||||
/*
|
||||
* When done something that is not allowed or error message call
|
||||
* wait_return. This must be done before starttermcap(), because it may
|
||||
* switch to another screen. It must be done after settmode(TMODE_RAW),
|
||||
@@ -488,92 +451,92 @@ if ((did_emsg || msg_didout) && *T_TI != NUL)
|
||||
* Call settmode and starttermcap here, so the T_KS and T_TI may be
|
||||
* defined by termcapinit and redefined in .exrc.
|
||||
*/
|
||||
settmode(TMODE_RAW);
|
||||
TIME_MSG("setting raw mode");
|
||||
settmode(TMODE_RAW);
|
||||
TIME_MSG("setting raw mode");
|
||||
|
||||
if (need_wait_return || msg_didany) {
|
||||
if (need_wait_return || msg_didany) {
|
||||
wait_return(TRUE);
|
||||
TIME_MSG("waiting for return");
|
||||
}
|
||||
}
|
||||
|
||||
starttermcap(); /* start termcap if not done by wait_return() */
|
||||
TIME_MSG("start termcap");
|
||||
may_req_ambiguous_char_width();
|
||||
starttermcap(); /* start termcap if not done by wait_return() */
|
||||
TIME_MSG("start termcap");
|
||||
may_req_ambiguous_char_width();
|
||||
|
||||
setmouse(); /* may start using the mouse */
|
||||
if (scroll_region)
|
||||
setmouse(); /* may start using the mouse */
|
||||
if (scroll_region)
|
||||
scroll_region_reset(); /* In case Rows changed */
|
||||
scroll_start(); /* may scroll the screen to the right position */
|
||||
scroll_start(); /* may scroll the screen to the right position */
|
||||
|
||||
/*
|
||||
/*
|
||||
* Don't clear the screen when starting in Ex mode, unless using the GUI.
|
||||
*/
|
||||
if (exmode_active
|
||||
if (exmode_active
|
||||
)
|
||||
must_redraw = CLEAR;
|
||||
else {
|
||||
else {
|
||||
screenclear(); /* clear screen */
|
||||
TIME_MSG("clearing screen");
|
||||
}
|
||||
}
|
||||
|
||||
if (params.ask_for_key) {
|
||||
if (params.ask_for_key) {
|
||||
(void)blowfish_self_test();
|
||||
(void)get_crypt_key(TRUE, TRUE);
|
||||
TIME_MSG("getting crypt key");
|
||||
}
|
||||
}
|
||||
|
||||
no_wait_return = TRUE;
|
||||
no_wait_return = TRUE;
|
||||
|
||||
/*
|
||||
/*
|
||||
* Create the requested number of windows and edit buffers in them.
|
||||
* Also does recovery if "recoverymode" set.
|
||||
*/
|
||||
create_windows(¶ms);
|
||||
TIME_MSG("opening buffers");
|
||||
create_windows(¶ms);
|
||||
TIME_MSG("opening buffers");
|
||||
|
||||
/* clear v:swapcommand */
|
||||
set_vim_var_string(VV_SWAPCOMMAND, NULL, -1);
|
||||
/* clear v:swapcommand */
|
||||
set_vim_var_string(VV_SWAPCOMMAND, NULL, -1);
|
||||
|
||||
/* Ex starts at last line of the file */
|
||||
if (exmode_active)
|
||||
/* Ex starts at last line of the file */
|
||||
if (exmode_active)
|
||||
curwin->w_cursor.lnum = curbuf->b_ml.ml_line_count;
|
||||
|
||||
apply_autocmds(EVENT_BUFENTER, NULL, NULL, FALSE, curbuf);
|
||||
TIME_MSG("BufEnter autocommands");
|
||||
setpcmark();
|
||||
apply_autocmds(EVENT_BUFENTER, NULL, NULL, FALSE, curbuf);
|
||||
TIME_MSG("BufEnter autocommands");
|
||||
setpcmark();
|
||||
|
||||
/*
|
||||
/*
|
||||
* When started with "-q errorfile" jump to first error now.
|
||||
*/
|
||||
if (params.edit_type == EDIT_QF) {
|
||||
if (params.edit_type == EDIT_QF) {
|
||||
qf_jump(NULL, 0, 0, FALSE);
|
||||
TIME_MSG("jump to first error");
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
/*
|
||||
* If opened more than one window, start editing files in the other
|
||||
* windows.
|
||||
*/
|
||||
edit_buffers(¶ms);
|
||||
edit_buffers(¶ms);
|
||||
|
||||
if (params.diff_mode) {
|
||||
if (params.diff_mode) {
|
||||
win_T *wp;
|
||||
|
||||
/* set options in each window for "vimdiff". */
|
||||
for (wp = firstwin; wp != NULL; wp = wp->w_next)
|
||||
diff_win_options(wp, TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
/*
|
||||
* Shorten any of the filenames, but only when absolute.
|
||||
*/
|
||||
shorten_fnames(FALSE);
|
||||
shorten_fnames(FALSE);
|
||||
|
||||
/*
|
||||
/*
|
||||
* Need to jump to the tag before executing the '-c command'.
|
||||
* Makes "vim -c '/return' -t main" work.
|
||||
*/
|
||||
if (params.tagname != NULL) {
|
||||
if (params.tagname != NULL) {
|
||||
#if defined(HAS_SWAP_EXISTS_ACTION)
|
||||
swap_exists_did_quit = FALSE;
|
||||
#endif
|
||||
@@ -587,53 +550,53 @@ if (params.tagname != NULL) {
|
||||
if (swap_exists_did_quit)
|
||||
getout(1);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
/* Execute any "+", "-c" and "-S" arguments. */
|
||||
if (params.n_commands > 0)
|
||||
/* Execute any "+", "-c" and "-S" arguments. */
|
||||
if (params.n_commands > 0)
|
||||
exe_commands(¶ms);
|
||||
|
||||
RedrawingDisabled = 0;
|
||||
redraw_all_later(NOT_VALID);
|
||||
no_wait_return = FALSE;
|
||||
starting = 0;
|
||||
RedrawingDisabled = 0;
|
||||
redraw_all_later(NOT_VALID);
|
||||
no_wait_return = FALSE;
|
||||
starting = 0;
|
||||
|
||||
/* Requesting the termresponse is postponed until here, so that a "-c q"
|
||||
/* Requesting the termresponse is postponed until here, so that a "-c q"
|
||||
* argument doesn't make it appear in the shell Vim was started from. */
|
||||
may_req_termresponse();
|
||||
may_req_termresponse();
|
||||
|
||||
/* start in insert mode */
|
||||
if (p_im)
|
||||
/* start in insert mode */
|
||||
if (p_im)
|
||||
need_start_insertmode = TRUE;
|
||||
|
||||
apply_autocmds(EVENT_VIMENTER, NULL, NULL, FALSE, curbuf);
|
||||
TIME_MSG("VimEnter autocommands");
|
||||
apply_autocmds(EVENT_VIMENTER, NULL, NULL, FALSE, curbuf);
|
||||
TIME_MSG("VimEnter autocommands");
|
||||
|
||||
|
||||
/* When a startup script or session file setup for diff'ing and
|
||||
/* When a startup script or session file setup for diff'ing and
|
||||
* scrollbind, sync the scrollbind now. */
|
||||
if (curwin->w_p_diff && curwin->w_p_scb) {
|
||||
if (curwin->w_p_diff && curwin->w_p_scb) {
|
||||
update_topline();
|
||||
check_scrollbind((linenr_T)0, 0L);
|
||||
TIME_MSG("diff scrollbinding");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* If ":startinsert" command used, stuff a dummy command to be able to
|
||||
/* If ":startinsert" command used, stuff a dummy command to be able to
|
||||
* call normal_cmd(), which will then start Insert mode. */
|
||||
if (restart_edit != 0)
|
||||
if (restart_edit != 0)
|
||||
stuffcharReadbuff(K_NOP);
|
||||
|
||||
|
||||
TIME_MSG("before starting main loop");
|
||||
TIME_MSG("before starting main loop");
|
||||
|
||||
/*
|
||||
/*
|
||||
* Call the main command loop. This never returns.
|
||||
*/
|
||||
main_loop(FALSE, FALSE);
|
||||
main_loop(FALSE, FALSE);
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
#endif /* NO_VIM_MAIN */
|
||||
|
||||
@@ -645,8 +608,8 @@ return 0;
|
||||
* commands, return when entering Ex mode. "noexmode" is TRUE then.
|
||||
*/
|
||||
void main_loop(cmdwin, noexmode)
|
||||
int cmdwin; /* TRUE when working in the command-line window */
|
||||
int noexmode; /* TRUE when return on entering Ex mode */
|
||||
int cmdwin; /* TRUE when working in the command-line window */
|
||||
int noexmode; /* TRUE when return on entering Ex mode */
|
||||
{
|
||||
oparg_T oa; /* operator arguments */
|
||||
int previous_got_int = FALSE; /* "got_int" was TRUE */
|
||||
@@ -854,7 +817,7 @@ int noexmode; /* TRUE when return on entering Ex mode */
|
||||
|
||||
/* Exit properly */
|
||||
void getout(exitval)
|
||||
int exitval;
|
||||
int exitval;
|
||||
{
|
||||
buf_T *buf;
|
||||
win_T *wp;
|
||||
@@ -941,9 +904,9 @@ int exitval;
|
||||
* Get a (optional) count for a Vim argument.
|
||||
*/
|
||||
static int get_number_arg(p, idx, def)
|
||||
char_u *p; /* pointer to argument */
|
||||
int *idx; /* index in argument, is incremented */
|
||||
int def; /* default value */
|
||||
char_u *p; /* pointer to argument */
|
||||
int *idx; /* index in argument, is incremented */
|
||||
int def; /* default value */
|
||||
{
|
||||
if (vim_isdigit(p[*idx])) {
|
||||
def = atoi((char *)&(p[*idx]));
|
||||
@@ -996,7 +959,7 @@ static void init_locale() {
|
||||
* by "im" use improved Ex mode.
|
||||
*/
|
||||
static void parse_command_name(parmp)
|
||||
mparm_T *parmp;
|
||||
mparm_T *parmp;
|
||||
{
|
||||
char_u *initstr;
|
||||
|
||||
@@ -1045,39 +1008,11 @@ mparm_T *parmp;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Get the name of the display, before gui_prepare() removes it from
|
||||
* argv[]. Used for the xterm-clipboard display.
|
||||
*
|
||||
* Also find the --server... arguments and --socketid and --windowid
|
||||
*/
|
||||
static void early_arg_scan(parmp)
|
||||
mparm_T *parmp UNUSED;
|
||||
{
|
||||
#if defined(FEAT_XCLIPBOARD) || defined(FEAT_CLIENTSERVER) \
|
||||
|| !defined(FEAT_NETBEANS_INTG)
|
||||
int argc = parmp->argc;
|
||||
char **argv = parmp->argv;
|
||||
int i;
|
||||
|
||||
for (i = 1; i < argc; i++) {
|
||||
if (STRCMP(argv[i], "--") == 0)
|
||||
break;
|
||||
|
||||
else if (strncmp(argv[i], "-nb", (size_t)3) == 0) {
|
||||
mch_errmsg(_("'-nb' cannot be used: not enabled at compile time\n"));
|
||||
mch_exit(2);
|
||||
}
|
||||
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
* Scan the command line arguments.
|
||||
*/
|
||||
static void command_line_scan(parmp)
|
||||
mparm_T *parmp;
|
||||
mparm_T *parmp;
|
||||
{
|
||||
int argc = parmp->argc;
|
||||
char **argv = parmp->argv;
|
||||
@@ -1574,7 +1509,7 @@ scripterror:
|
||||
* When starting in Ex mode and commands come from a file, set Silent mode.
|
||||
*/
|
||||
static void check_tty(parmp)
|
||||
mparm_T *parmp;
|
||||
mparm_T *parmp;
|
||||
{
|
||||
int input_isatty; /* is active input a terminal? */
|
||||
|
||||
@@ -1629,7 +1564,7 @@ static void read_stdin() {
|
||||
* Also does recovery if "recoverymode" set.
|
||||
*/
|
||||
static void create_windows(parmp)
|
||||
mparm_T *parmp UNUSED;
|
||||
mparm_T *parmp UNUSED;
|
||||
{
|
||||
int dorewind;
|
||||
int done = 0;
|
||||
@@ -1745,7 +1680,7 @@ mparm_T *parmp UNUSED;
|
||||
* windows. make_windows() has already opened the windows.
|
||||
*/
|
||||
static void edit_buffers(parmp)
|
||||
mparm_T *parmp;
|
||||
mparm_T *parmp;
|
||||
{
|
||||
int arg_idx; /* index in argument list */
|
||||
int i;
|
||||
@@ -1848,7 +1783,7 @@ mparm_T *parmp;
|
||||
* Execute the commands from --cmd arguments "cmds[cnt]".
|
||||
*/
|
||||
static void exe_pre_commands(parmp)
|
||||
mparm_T *parmp;
|
||||
mparm_T *parmp;
|
||||
{
|
||||
char_u **cmds = parmp->pre_commands;
|
||||
int cnt = parmp->n_pre_commands;
|
||||
@@ -1870,7 +1805,7 @@ mparm_T *parmp;
|
||||
* Execute "+", "-c" and "-S" arguments.
|
||||
*/
|
||||
static void exe_commands(parmp)
|
||||
mparm_T *parmp;
|
||||
mparm_T *parmp;
|
||||
{
|
||||
int i;
|
||||
|
||||
@@ -1907,7 +1842,7 @@ mparm_T *parmp;
|
||||
* Source startup scripts.
|
||||
*/
|
||||
static void source_startup_scripts(parmp)
|
||||
mparm_T *parmp;
|
||||
mparm_T *parmp;
|
||||
{
|
||||
int i;
|
||||
|
||||
@@ -2049,8 +1984,8 @@ static void main_start_gui() {
|
||||
* Returns FAIL if the environment variable was not executed, OK otherwise.
|
||||
*/
|
||||
int process_env(env, is_viminit)
|
||||
char_u *env;
|
||||
int is_viminit; /* when TRUE, called for VIMINIT */
|
||||
char_u *env;
|
||||
int is_viminit; /* when TRUE, called for VIMINIT */
|
||||
{
|
||||
char_u *initstr;
|
||||
char_u *save_sourcing_name;
|
||||
@@ -2082,7 +2017,7 @@ int is_viminit; /* when TRUE, called for VIMINIT */
|
||||
* Use both stat() and lstat() for extra security.
|
||||
*/
|
||||
static int file_owned(fname)
|
||||
char *fname;
|
||||
char *fname;
|
||||
{
|
||||
struct stat s;
|
||||
# ifdef UNIX
|
||||
@@ -2103,8 +2038,8 @@ char *fname;
|
||||
* Give an error message main_errors["n"] and exit.
|
||||
*/
|
||||
static void mainerr(n, str)
|
||||
int n; /* one of the ME_ defines */
|
||||
char_u *str; /* extra argument or NULL */
|
||||
int n; /* one of the ME_ defines */
|
||||
char_u *str; /* extra argument or NULL */
|
||||
{
|
||||
#if defined(UNIX) || defined(__EMX__) || defined(VMS)
|
||||
reset_signals(); /* kill us with CTRL-C here, if you like */
|
||||
@@ -2124,7 +2059,7 @@ char_u *str; /* extra argument or NULL */
|
||||
}
|
||||
|
||||
void mainerr_arg_missing(str)
|
||||
char_u *str;
|
||||
char_u *str;
|
||||
{
|
||||
mainerr(ME_ARG_MISSING, str);
|
||||
}
|
||||
@@ -2134,7 +2069,7 @@ char_u *str;
|
||||
* print a message with three spaces prepended and '\n' appended.
|
||||
*/
|
||||
static void main_msg(s)
|
||||
char *s;
|
||||
char *s;
|
||||
{
|
||||
mch_msg(" ");
|
||||
mch_msg(s);
|
||||
@@ -2254,7 +2189,7 @@ static struct timeval prev_timeval;
|
||||
* set "*tv_rel" to the time elapsed so far.
|
||||
*/
|
||||
void time_push(tv_rel, tv_start)
|
||||
void *tv_rel, *tv_start;
|
||||
void *tv_rel, *tv_start;
|
||||
{
|
||||
*((struct timeval *)tv_rel) = prev_timeval;
|
||||
gettimeofday(&prev_timeval, NULL);
|
||||
@@ -2276,7 +2211,7 @@ void *tv_rel, *tv_start;
|
||||
* have struct timeval.
|
||||
*/
|
||||
void time_pop(tp)
|
||||
void *tp; /* actually (struct timeval *) */
|
||||
void *tp; /* actually (struct timeval *) */
|
||||
{
|
||||
prev_timeval.tv_usec -= ((struct timeval *)tp)->tv_usec;
|
||||
prev_timeval.tv_sec -= ((struct timeval *)tp)->tv_sec;
|
||||
@@ -2287,8 +2222,8 @@ void *tp; /* actually (struct timeval *) */
|
||||
}
|
||||
|
||||
static void time_diff(then, now)
|
||||
struct timeval *then;
|
||||
struct timeval *now;
|
||||
struct timeval *then;
|
||||
struct timeval *now;
|
||||
{
|
||||
long usec;
|
||||
long msec;
|
||||
@@ -2300,8 +2235,8 @@ struct timeval *now;
|
||||
}
|
||||
|
||||
void time_msg(mesg, tv_start)
|
||||
char *mesg;
|
||||
void *tv_start; /* only for do_source: start time; actually
|
||||
char *mesg;
|
||||
void *tv_start; /* only for do_source: start time; actually
|
||||
(struct timeval *) */
|
||||
{
|
||||
static struct timeval start;
|
||||
|
@@ -102,13 +102,6 @@ static RETSIGTYPE catch_sigint __ARGS(SIGPROTOARG);
|
||||
#if defined(SIGPWR)
|
||||
static RETSIGTYPE catch_sigpwr __ARGS(SIGPROTOARG);
|
||||
#endif
|
||||
#if defined(SIGALRM) && defined(FEAT_X11) \
|
||||
&& defined(FEAT_TITLE) && !defined(FEAT_GUI_GTK)
|
||||
# define SET_SIG_ALARM
|
||||
static RETSIGTYPE sig_alarm __ARGS(SIGPROTOARG);
|
||||
/* volatile because it is used in signal handler sig_alarm(). */
|
||||
static volatile int sig_alarm_called;
|
||||
#endif
|
||||
static RETSIGTYPE deathtrap __ARGS(SIGPROTOARG);
|
||||
|
||||
static void catch_int_signal __ARGS((void));
|
||||
@@ -179,7 +172,7 @@ static struct signalinfo {
|
||||
#ifdef SIGBUS
|
||||
{SIGBUS, "BUS", TRUE},
|
||||
#endif
|
||||
#if defined(SIGSEGV) && !defined(FEAT_MZSCHEME)
|
||||
#if defined(SIGSEGV)
|
||||
/* MzScheme uses SEGV in its garbage collector */
|
||||
{SIGSEGV, "SEGV", TRUE},
|
||||
#endif
|
||||
@@ -192,10 +185,10 @@ static struct signalinfo {
|
||||
#ifdef SIGTERM
|
||||
{SIGTERM, "TERM", TRUE},
|
||||
#endif
|
||||
#if defined(SIGVTALRM) && !defined(FEAT_RUBY)
|
||||
#if defined(SIGVTALRM)
|
||||
{SIGVTALRM, "VTALRM", TRUE},
|
||||
#endif
|
||||
#if defined(SIGPROF) && !defined(FEAT_MZSCHEME) && !defined(WE_ARE_PROFILING)
|
||||
#if defined(SIGPROF) && !defined(WE_ARE_PROFILING)
|
||||
/* MzScheme uses SIGPROF for its own needs; On Linux with profiling
|
||||
* this makes Vim exit. WE_ARE_PROFILING is defined in Makefile. */
|
||||
{SIGPROF, "PROF", TRUE},
|
||||
@@ -682,23 +675,7 @@ catch_sigpwr SIGDEFARG(sigarg) {
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef SET_SIG_ALARM
|
||||
/*
|
||||
* signal function for alarm().
|
||||
*/
|
||||
static RETSIGTYPE
|
||||
sig_alarm SIGDEFARG(sigarg) {
|
||||
/* doesn't do anything, just to break a system call */
|
||||
sig_alarm_called = TRUE;
|
||||
SIGRETURN;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#if (defined(HAVE_SETJMP_H) \
|
||||
&& ((defined(FEAT_X11) && defined(FEAT_XCLIPBOARD)) \
|
||||
|| defined(FEAT_LIBCALL))) \
|
||||
|| defined(PROTO)
|
||||
#if (defined(HAVE_SETJMP_H) && defined(FEAT_LIBCALL)) || defined(PROTO)
|
||||
/*
|
||||
* A simplistic version of setjmp() that only allows one level of using.
|
||||
* Don't call twice before calling mch_endjmp()!.
|
||||
@@ -1192,11 +1169,6 @@ char_u *icon;
|
||||
|
||||
if (*T_TS != NUL) /* it's OK if t_fs is empty */
|
||||
term_settitle(title);
|
||||
#if defined(FEAT_GUI_GTK) \
|
||||
|| defined(FEAT_GUI_PHOTON) || defined(FEAT_GUI_MAC)
|
||||
else
|
||||
gui_mch_settitle(title, icon);
|
||||
#endif
|
||||
did_set_title = TRUE;
|
||||
}
|
||||
|
||||
@@ -2152,42 +2124,6 @@ int on;
|
||||
ison = on;
|
||||
}
|
||||
|
||||
|
||||
|
||||
# ifdef FEAT_MOUSE_JSB
|
||||
else {
|
||||
if (on) {
|
||||
/* D - Enable Mouse up/down messages
|
||||
* L - Enable Left Button Reporting
|
||||
* M - Enable Middle Button Reporting
|
||||
* R - Enable Right Button Reporting
|
||||
* K - Enable SHIFT and CTRL key Reporting
|
||||
* + - Enable Advanced messaging of mouse moves and up/down messages
|
||||
* Q - Quiet No Ack
|
||||
* # - Numeric value of mouse pointer required
|
||||
* 0 = Multiview 2000 cursor, used as standard
|
||||
* 1 = Windows Arrow
|
||||
* 2 = Windows I Beam
|
||||
* 3 = Windows Hour Glass
|
||||
* 4 = Windows Cross Hair
|
||||
* 5 = Windows UP Arrow
|
||||
*/
|
||||
# ifdef JSBTERM_MOUSE_NONADVANCED
|
||||
/* Disables full feedback of pointer movements */
|
||||
out_str_nf((char_u *)IF_EB("\033[0~ZwLMRK1Q\033\\",
|
||||
ESC_STR "[0~ZwLMRK1Q" ESC_STR "\\"));
|
||||
# else
|
||||
out_str_nf((char_u *)IF_EB("\033[0~ZwLMRK+1Q\033\\",
|
||||
ESC_STR "[0~ZwLMRK+1Q" ESC_STR "\\"));
|
||||
# endif
|
||||
ison = TRUE;
|
||||
} else {
|
||||
out_str_nf((char_u *)IF_EB("\033[0~ZwQ\033\\",
|
||||
ESC_STR "[0~ZwQ" ESC_STR "\\"));
|
||||
ison = FALSE;
|
||||
}
|
||||
}
|
||||
# endif
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -2210,17 +2146,6 @@ void check_mouse_termcode() {
|
||||
del_mouse_termcode(KS_MOUSE);
|
||||
|
||||
|
||||
|
||||
# ifdef FEAT_MOUSE_JSB
|
||||
/* conflicts with xterm mouse: "\033[" and "\033[M" ??? */
|
||||
if (!use_xterm_mouse()
|
||||
)
|
||||
set_mouse_termcode(KS_JSBTERM_MOUSE,
|
||||
(char_u *)IF_EB("\033[0~zw", ESC_STR "[0~zw"));
|
||||
else
|
||||
del_mouse_termcode(KS_JSBTERM_MOUSE);
|
||||
# endif
|
||||
|
||||
/* There is no conflict, but one may type "ESC }" from Insert mode. Don't
|
||||
* define it in the GUI or when using an xterm. */
|
||||
if (!use_xterm_mouse()
|
||||
|
151
src/vim.h
151
src/vim.h
@@ -18,13 +18,6 @@
|
||||
#define RUNTIME_DIRNAME "runtime"
|
||||
/* end */
|
||||
|
||||
/* use fastcall for Borland, when compiling for Win32 (not for DOS16) */
|
||||
|
||||
#if defined(MSDOS) || defined(WIN16) || defined(WIN32) || defined(_WIN64) \
|
||||
|| defined(__EMX__)
|
||||
# include "vimio.h"
|
||||
#endif
|
||||
|
||||
/* ============ the header file puzzle (ca. 50-100 pieces) ========= */
|
||||
|
||||
#ifdef HAVE_CONFIG_H /* GNU autoconf (or something else) was here */
|
||||
@@ -64,65 +57,12 @@ Error: configure did not run properly.Check auto/config.log.
|
||||
# define ROOT_UID 0
|
||||
|
||||
|
||||
/*
|
||||
* MACOS_CLASSIC compiling for MacOS prior to MacOS X
|
||||
* MACOS_X_UNIX compiling for MacOS X (using os_unix.c)
|
||||
* MACOS_X compiling for MacOS X (using os_unix.c)
|
||||
* MACOS compiling for either one
|
||||
*/
|
||||
/* Unless made through the Makefile enforce GUI on Mac */
|
||||
|
||||
#if defined(FEAT_GUI_MOTIF) \
|
||||
|| defined(FEAT_GUI_GTK) \
|
||||
|| defined(FEAT_GUI_ATHENA) \
|
||||
|| defined(FEAT_GUI_MAC) \
|
||||
|| defined(FEAT_GUI_W32) \
|
||||
|| defined(FEAT_GUI_W16) \
|
||||
|| defined(FEAT_GUI_PHOTON)
|
||||
# define FEAT_GUI_ENABLED /* also defined with NO_X11_INCLUDES */
|
||||
# if !defined(FEAT_GUI) && !defined(NO_X11_INCLUDES)
|
||||
# define FEAT_GUI
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* Visual Studio 2005 has 'deprecated' many of the standard CRT functions */
|
||||
|
||||
/* Practically everything is common to both Win32 and Win64 */
|
||||
|
||||
/*
|
||||
* SIZEOF_INT is used in feature.h, and the system-specific included files
|
||||
* need items from feature.h. Therefore define SIZEOF_INT here.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
/* +x11 is only enabled when it's both available and wanted. */
|
||||
|
||||
#ifdef NO_X11_INCLUDES
|
||||
/* In os_mac_conv.c and os_macosx.m NO_X11_INCLUDES is defined to avoid
|
||||
* X11 headers. Disable all X11 related things to avoid conflicts. */
|
||||
#endif
|
||||
|
||||
/* The Mac conversion stuff doesn't work under X11. */
|
||||
|
||||
/* Can't use "PACKAGE" here, conflicts with a Perl include file. */
|
||||
#ifndef VIMPACKAGE
|
||||
# define VIMPACKAGE "vim"
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Find out if function definitions should include argument types
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#if (defined(UNIX) || defined(__EMX__) || defined(VMS)) \
|
||||
&& (!defined(MACOS_X) || defined(HAVE_CONFIG_H))
|
||||
# include "os_unix.h" /* bring lots of system header files */
|
||||
#endif
|
||||
#include "os_unix.h" /* bring lots of system header files */
|
||||
|
||||
#ifndef __ARGS
|
||||
# if defined(__STDC__) || defined(__GNUC__) || defined(WIN3264)
|
||||
@@ -132,11 +72,6 @@ Error: configure did not run properly.Check auto/config.log.
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* __ARGS and __PARMS are the same thing. */
|
||||
#ifndef __PARMS
|
||||
# define __PARMS(x) __ARGS(x)
|
||||
#endif
|
||||
|
||||
/* Mark unused function arguments with UNUSED, so that gcc -Wunused-parameter
|
||||
* can be used to check for mistakes. */
|
||||
#ifdef HAVE_ATTRIBUTE_UNUSED
|
||||
@@ -145,26 +80,6 @@ Error: configure did not run properly.Check auto/config.log.
|
||||
# define UNUSED
|
||||
#endif
|
||||
|
||||
/* if we're compiling in C++ (currently only KVim), the system
|
||||
* headers must have the correct prototypes or nothing will build.
|
||||
* conversely, our prototypes might clash due to throw() specifiers and
|
||||
* cause compilation failures even though the headers are correct. For
|
||||
* a concrete example, gcc-3.2 enforces exception specifications, and
|
||||
* glibc-2.2.5 has them in their system headers.
|
||||
*/
|
||||
#if !defined(__cplusplus) && defined(UNIX) \
|
||||
&& !defined(MACOS_X) /* MACOS_X doesn't yet support osdef.h */
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# ifdef HAVE_LOCALE_H
|
||||
# include <locale.h>
|
||||
# endif
|
||||
@@ -245,46 +160,12 @@ typedef unsigned long u8char_T; /* long should be 32 bits or more */
|
||||
# endif
|
||||
# endif
|
||||
|
||||
#ifndef UNIX /* For Unix this is included in os_unix.h */
|
||||
# include <stdio.h>
|
||||
# include <ctype.h>
|
||||
#endif
|
||||
|
||||
#include "ascii.h"
|
||||
#include "keymap.h"
|
||||
#include "term.h"
|
||||
#include "macros.h"
|
||||
|
||||
#ifdef LATTICE
|
||||
# include <sys/types.h>
|
||||
# include <sys/stat.h>
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_ERRNO_H) || defined(DJGPP) || defined(WIN16) \
|
||||
|| defined(WIN32) || defined(_WIN64) || defined(__EMX__)
|
||||
# include <errno.h>
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Allow other (non-unix) systems to configure themselves now
|
||||
* These are also in os_unix.h, because osdef.sh needs them there.
|
||||
*/
|
||||
#ifndef UNIX
|
||||
/* Note: Some systems need both string.h and strings.h (Savage). If the
|
||||
* system can't handle this, define NO_STRINGS_WITH_STRING_H. */
|
||||
# ifdef HAVE_STRING_H
|
||||
# include <string.h>
|
||||
# endif
|
||||
# if defined(HAVE_STRINGS_H) && !defined(NO_STRINGS_WITH_STRING_H)
|
||||
# include <strings.h>
|
||||
# endif
|
||||
# ifdef HAVE_STAT_H
|
||||
# include <stat.h>
|
||||
# endif
|
||||
# ifdef HAVE_STDLIB_H
|
||||
# include <stdlib.h>
|
||||
# endif
|
||||
#endif /* NON-UNIX */
|
||||
#include <errno.h>
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
@@ -306,36 +187,8 @@ typedef unsigned long u8char_T; /* long should be 32 bits or more */
|
||||
# include <sys/select.h>
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_SELECT
|
||||
# ifdef HAVE_SYS_POLL_H
|
||||
# include <sys/poll.h>
|
||||
# define HAVE_POLL
|
||||
# else
|
||||
# ifdef HAVE_POLL_H
|
||||
# include <poll.h>
|
||||
# define HAVE_POLL
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* ================ end of the header file puzzle =============== */
|
||||
|
||||
/*
|
||||
* For dynamically loaded imm library. Currently, only for Win32.
|
||||
*/
|
||||
#ifdef DYNAMIC_IME
|
||||
# define FEAT_MBYTE_IME
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Check input method control.
|
||||
*/
|
||||
#if defined(FEAT_XIM) \
|
||||
|| (defined(FEAT_GUI) && (defined(FEAT_MBYTE_IME) || defined(GLOBAL_IME))) \
|
||||
|| (defined(FEAT_GUI_MAC) && defined(FEAT_MBYTE))
|
||||
# define USE_IM_CONTROL
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_WORKING_LIBINTL
|
||||
# include <libintl.h>
|
||||
# define _(x) gettext((char *)(x))
|
||||
|
Reference in New Issue
Block a user