From 9fd2cae4827321075cef7216545e11fcd7877dcd Mon Sep 17 00:00:00 2001 From: Hirohito Higashi Date: Tue, 13 Jan 2026 21:14:33 +0000 Subject: [PATCH] patch 9.1.2083: style: wrong indentation of nested ifdefs Problem: style: wrong indentation of nested ifdefs Solution: Fix indentation (Hirohito Higashi) related: #19165 Signed-off-by: Hirohito Higashi Signed-off-by: Christian Brabandt --- src/alloc.c | 4 +- src/autocmd.c | 20 +- src/beval.c | 24 +- src/buffer.c | 52 +-- src/bufwrite.c | 18 +- src/channel.c | 28 +- src/charset.c | 8 +- src/clientserver.c | 240 ++++++------ src/clipboard.c | 441 +++++++++++----------- src/cmdexpand.c | 4 +- src/crypt.c | 36 +- src/debugger.c | 44 +-- src/diff.c | 172 ++++----- src/digraph.c | 94 ++--- src/dosinst.h | 12 +- src/drawline.c | 28 +- src/drawscreen.c | 90 ++--- src/edit.c | 28 +- src/errors.h | 20 +- src/evalbuffer.c | 24 +- src/evalfunc.c | 18 +- src/evalvars.c | 8 +- src/evalwindow.c | 80 ++-- src/ex_cmds.h | 18 +- src/ex_cmds2.c | 16 +- src/ex_docmd.c | 74 ++-- src/ex_getln.c | 72 ++-- src/feature.h | 4 +- src/fileio.c | 24 +- src/filepath.c | 50 +-- src/findfile.c | 58 +-- src/float.c | 4 +- src/fold.c | 88 ++--- src/getchar.c | 24 +- src/globals.h | 208 +++++------ src/gui_beval.c | 194 +++++----- src/gui_gtk.c | 6 +- src/gui_gtk_f.h | 22 +- src/gui_gtk_x11.c | 50 +-- src/gui_motif.c | 186 +++++----- src/gui_photon.c | 20 +- src/gui_x11.c | 26 +- src/gui_xim.c | 104 +++--- src/hardcopy.c | 144 ++++---- src/highlight.c | 94 ++--- src/if_cscope.c | 188 +++++----- src/if_lua.c | 418 ++++++++++----------- src/if_mzsch.c | 278 +++++++------- src/if_py_both.h | 4 +- src/if_ruby.c | 2 +- src/if_xcmdsrv.c | 48 +-- src/indent.c | 4 +- src/insexpand.c | 102 +++--- src/iscygpty.h | 4 +- src/job.c | 8 +- src/macros.h | 12 +- src/main.c | 716 ++++++++++++++++++------------------ src/match.c | 14 +- src/mbyte.c | 80 ++-- src/memline.c | 60 +-- src/menu.c | 24 +- src/message.c | 108 +++--- src/misc1.c | 42 +-- src/misc2.c | 46 +-- src/mouse.c | 18 +- src/move.c | 36 +- src/netbeans.c | 30 +- src/normal.c | 20 +- src/nv_cmds.h | 68 ++-- src/option.c | 70 ++-- src/option.h | 20 +- src/optiondefs.h | 30 +- src/optionstr.c | 36 +- src/os_amiga.c | 24 +- src/os_amiga.h | 2 +- src/os_mac_conv.c | 8 +- src/os_mswin.c | 6 +- src/os_qnx.c | 4 +- src/os_unix.c | 888 ++++++++++++++++++++++----------------------- src/os_unix.h | 6 +- src/os_unixx.h | 2 +- src/os_vms.c | 24 +- src/os_vms_conf.h | 122 +++---- src/os_win32.h | 4 +- src/popupwin.c | 24 +- src/profiler.c | 88 ++--- src/proto.h | 6 +- src/pty.c | 28 +- src/quickfix.c | 168 ++++----- src/regexp_bt.c | 14 +- src/regexp_nfa.c | 32 +- src/register.c | 20 +- src/screen.c | 12 +- src/search.c | 50 +-- src/session.c | 54 +-- src/sha256.c | 24 +- src/spell.h | 12 +- src/spellfile.c | 6 +- src/strings.c | 28 +- src/structs.h | 370 +++++++++---------- src/tag.c | 32 +- src/terminal.c | 74 ++-- src/testing.c | 42 +-- src/textformat.c | 4 +- src/time.c | 44 +-- src/typval.c | 8 +- src/ui.c | 94 ++--- src/undo.c | 164 ++++----- src/usercmd.c | 36 +- src/version.c | 28 +- src/version.h | 8 +- src/vim.h | 46 +-- src/viminfo.c | 4 +- src/wayland.c | 112 +++--- src/wayland.h | 10 +- src/window.c | 52 +-- src/xxd/xxd.c | 8 +- 117 files changed, 4129 insertions(+), 4128 deletions(-) diff --git a/src/alloc.c b/src/alloc.c index 8092049239..7baf02ecb6 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -297,10 +297,10 @@ theend: void * lalloc_id(size_t size, int message, alloc_id_T id UNUSED) { -#ifdef FEAT_EVAL +# ifdef FEAT_EVAL if (alloc_fail_id == id && alloc_does_fail(size)) return NULL; -#endif +# endif return (lalloc(size, message)); } #endif diff --git a/src/autocmd.c b/src/autocmd.c index 025a952589..7c0cc50a7f 100644 --- a/src/autocmd.c +++ b/src/autocmd.c @@ -850,7 +850,7 @@ check_ei(char_u *ei) return OK; } -# if defined(FEAT_SYN_HL) +#if defined(FEAT_SYN_HL) /* * Add "what" to 'eventignore' to skip loading syntax highlighting for every @@ -896,7 +896,7 @@ au_event_restore(char_u *old_ei) vim_free(old_ei); } } -# endif // FEAT_SYN_HL +#endif // FEAT_SYN_HL /* * do_autocmd() -- implements the :autocmd command. Can be used in the @@ -1814,10 +1814,10 @@ win_found: && bufref_valid(&aco->new_curbuf) && aco->new_curbuf.br_buf->b_ml.ml_mfp != NULL) { -# if defined(FEAT_SYN_HL) || defined(FEAT_SPELL) +#if defined(FEAT_SYN_HL) || defined(FEAT_SPELL) if (curwin->w_s == &curbuf->b_s) curwin->w_s = &aco->new_curbuf.br_buf->b_s; -# endif +#endif --curbuf->b_nwindows; curbuf = aco->new_curbuf.br_buf; curwin->w_buffer = curbuf; @@ -2530,14 +2530,14 @@ BYPASS_AU: return retval; } -# ifdef FEAT_EVAL +#ifdef FEAT_EVAL static char_u *old_termresponse = NULL; static char_u *old_termu7resp = NULL; static char_u *old_termblinkresp = NULL; static char_u *old_termrbgresp = NULL; static char_u *old_termrfgresp = NULL; static char_u *old_termstyleresp = NULL; -# endif +#endif /* * Block triggering autocommands until unblock_autocmd() is called. @@ -2546,7 +2546,7 @@ static char_u *old_termstyleresp = NULL; void block_autocmds(void) { -# ifdef FEAT_EVAL +#ifdef FEAT_EVAL // Remember the value of v:termresponse. if (autocmd_blocked == 0) { @@ -2557,7 +2557,7 @@ block_autocmds(void) old_termrfgresp = get_vim_var_str(VV_TERMRFGRESP); old_termstyleresp = get_vim_var_str(VV_TERMSTYLERESP); } -# endif +#endif ++autocmd_blocked; } @@ -2566,7 +2566,7 @@ unblock_autocmds(void) { --autocmd_blocked; -# ifdef FEAT_EVAL +#ifdef FEAT_EVAL // When v:termresponse, etc, were set while autocommands were blocked, // trigger the autocommands now. Esp. useful when executing a shell // command during startup (vimdiff). @@ -2598,7 +2598,7 @@ unblock_autocmds(void) apply_autocmds(EVENT_TERMRESPONSEALL, (char_u *)"cursorshape", NULL, FALSE, curbuf); } } -# endif +#endif } int diff --git a/src/beval.c b/src/beval.c index 23c7a2deab..14288e8afd 100644 --- a/src/beval.c +++ b/src/beval.c @@ -207,16 +207,16 @@ post_balloon(BalloonEval *beval UNUSED, char_u *mesg, list_T *list UNUSED) can_use_beval(void) { return (0 -#ifdef FEAT_BEVAL_GUI +# ifdef FEAT_BEVAL_GUI || (gui.in_use && p_beval) -#endif -#ifdef FEAT_BEVAL_TERM +# endif +# ifdef FEAT_BEVAL_TERM || ( -# ifdef FEAT_GUI +# ifdef FEAT_GUI !gui.in_use && -# endif +# endif p_bevalterm) -#endif +# endif ) && msg_scrolled == 0; } @@ -304,13 +304,13 @@ bexpr_eval( void general_beval_cb(BalloonEval *beval, int state UNUSED) { -#ifdef FEAT_EVAL +# ifdef FEAT_EVAL win_T *wp; int col; linenr_T lnum; char_u *text; char_u *bexpr; -#endif +# endif static int recursive = FALSE; // Don't do anything when 'ballooneval' is off, messages scrolled the @@ -324,7 +324,7 @@ general_beval_cb(BalloonEval *beval, int state UNUSED) return; recursive = TRUE; -#ifdef FEAT_EVAL +# ifdef FEAT_EVAL if (get_beval_info(beval, TRUE, &wp, &lnum, &text, &col) == OK) { bexpr = (*wp->w_buffer->b_p_bexpr == NUL) ? p_bexpr @@ -336,11 +336,11 @@ general_beval_cb(BalloonEval *beval, int state UNUSED) return; } } -#endif -#ifdef FEAT_NETBEANS_INTG +# endif +# ifdef FEAT_NETBEANS_INTG if (bevalServers & BEVAL_NETBEANS) netbeans_beval_cb(beval, state); -#endif +# endif recursive = FALSE; } diff --git a/src/buffer.c b/src/buffer.c index 62b57e8f65..7f64bdaab5 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -4292,14 +4292,14 @@ resettitle(void) mch_settitle(lasttitle, lasticon); } -# if defined(EXITFREE) +#if defined(EXITFREE) void free_titles(void) { vim_free(lasttitle); vim_free(lasticon); } -# endif +#endif #if defined(FEAT_STL_OPT) || defined(FEAT_GUI_TABLINE) @@ -4363,10 +4363,10 @@ build_stl_str_hl( char_u *p; char_u *s; int byteval; -#ifdef FEAT_EVAL +# ifdef FEAT_EVAL int use_sandbox; int save_VIsual_active; -#endif +# endif int empty_line; long l; long n; @@ -4380,15 +4380,15 @@ build_stl_str_hl( int itemcnt; int curitem; int groupdepth; -#ifdef FEAT_EVAL +# ifdef FEAT_EVAL int evaldepth; -#endif +# endif int minwid; int maxwid; int zeropad; char_u base; char_u opt; -#define TMPLEN 70 +# define TMPLEN 70 char_u buf_tmp[TMPLEN]; char_u *usefmt = fmt; stl_hlrec_T *sp; @@ -4418,7 +4418,7 @@ build_stl_str_hl( stl_separator_locations = ALLOC_MULT(int, stl_items_len); } -#ifdef FEAT_EVAL +# ifdef FEAT_EVAL // if "fmt" was set insecurely it needs to be evaluated in the sandbox use_sandbox = was_set_insecurely(wp, opt_name, opt_scope); @@ -4438,7 +4438,7 @@ build_stl_str_hl( do_unlet((char_u *)"g:statusline_winid", TRUE); } -#endif +# endif if (fillchar == 0) fillchar = ' '; @@ -4472,9 +4472,9 @@ build_stl_str_hl( byteval = (*mb_ptr2char)(p + wp->w_cursor.col); groupdepth = 0; -#ifdef FEAT_EVAL +# ifdef FEAT_EVAL evaldepth = 0; -#endif +# endif p = out; curitem = 0; prevchar_isflag = TRUE; @@ -4751,7 +4751,7 @@ build_stl_str_hl( curitem++; continue; } -#ifdef FEAT_EVAL +# ifdef FEAT_EVAL // Denotes end of expanded %{} block if (*s == '}' && evaldepth > 0) { @@ -4759,7 +4759,7 @@ build_stl_str_hl( evaldepth--; continue; } -#endif +# endif if (vim_strchr(STL_ALL, *s) == NULL) { if (*s == NUL) // can happen with "%0" @@ -4803,9 +4803,9 @@ build_stl_str_hl( case STL_VIM_EXPR: // '{' { -#ifdef FEAT_EVAL +# ifdef FEAT_EVAL char_u *block_start = s - 1; -#endif +# endif int reevaluate = (*s == '%'); char_u *t; buf_T *save_curbuf; @@ -4826,7 +4826,7 @@ build_stl_str_hl( else *p = NUL; p = t; -#ifdef FEAT_EVAL +# ifdef FEAT_EVAL vim_snprintf((char *)buf_tmp, sizeof(buf_tmp), "%d", curbuf->b_fnum); set_internal_string_var((char_u *)"g:actual_curbuf", buf_tmp); @@ -4896,7 +4896,7 @@ build_stl_str_hl( continue; } } -#endif +# endif break; } case STL_LINE: @@ -4954,11 +4954,11 @@ build_stl_str_hl( str = buf_tmp; break; case STL_PAGENUM: -#if defined(FEAT_PRINTER) || defined(FEAT_GUI_TABLINE) +# if defined(FEAT_PRINTER) || defined(FEAT_GUI_TABLINE) num = printer_page_num; -#else +# else num = 0; -#endif +# endif break; case STL_BUFNO: @@ -4969,12 +4969,12 @@ build_stl_str_hl( base = 'X'; // FALLTHROUGH case STL_OFFSET: -#ifdef FEAT_BYTEOFF +# ifdef FEAT_BYTEOFF l = ml_find_line_or_offset(wp->w_buffer, wp->w_cursor.lnum, NULL); num = (wp->w_buffer->b_ml.ml_flags & ML_EMPTY) || l < 0 ? 0L : l + 1 + ((State & MODE_INSERT) == 0 && empty_line ? 0 : (int)wp->w_cursor.col); -#endif +# endif break; case STL_BYTEVAL_X: @@ -5028,7 +5028,7 @@ build_stl_str_hl( } break; -#if defined(FEAT_QUICKFIX) +# if defined(FEAT_QUICKFIX) case STL_PREVIEWFLAG: case STL_PREVIEWFLAG_ALT: itemisflag = TRUE; @@ -5043,7 +5043,7 @@ build_stl_str_hl( ? _(msg_loclist) : _(msg_qflist)); break; -#endif +# endif case STL_MODIFIED: case STL_MODIFIED_ALT: @@ -5195,10 +5195,10 @@ build_stl_str_hl( outputlen = (size_t)(p - out); itemcnt = curitem; -#ifdef FEAT_EVAL +# ifdef FEAT_EVAL if (usefmt != fmt) vim_free(usefmt); -#endif +# endif width = vim_strsize(out); if (maxwidth > 0 && width > maxwidth) diff --git a/src/bufwrite.c b/src/bufwrite.c index 77efb30ded..1a1322dfc9 100644 --- a/src/bufwrite.c +++ b/src/bufwrite.c @@ -1783,10 +1783,10 @@ buf_write( if (converted && wb_flags == 0 #ifdef USE_ICONV && write_info.bw_iconv_fd == (iconv_t)-1 -# endif -# ifdef FEAT_EVAL +#endif +#ifdef FEAT_EVAL && wfname == fname -# endif +#endif ) { if (!forceit) @@ -2068,7 +2068,7 @@ restore_backup: && *buf->b_p_key != NUL && !filtering && *ptr == NUL) write_info.bw_finish = TRUE; - #endif +#endif if (buf_write_bytes(&write_info) == FAIL) { end = 0; // write error: break loop @@ -2177,7 +2177,7 @@ restore_backup: && (write_info.bw_flags & FIO_ENCRYPTED) && *buf->b_p_key != NUL && !filtering) write_info.bw_finish = TRUE; - #endif +#endif if (buf_write_bytes(&write_info) == FAIL) end = 0; // write error nchars += len; @@ -2223,12 +2223,12 @@ restore_backup: // Probably need to set the security context. if (!backup_copy) { -#if defined(HAVE_SELINUX) || defined(HAVE_SMACK) +# if defined(HAVE_SELINUX) || defined(HAVE_SMACK) mch_copy_sec(backup, wfname); -#endif -#ifdef FEAT_XATTR +# endif +# ifdef FEAT_XATTR mch_copy_xattr(backup, wfname); -#endif +# endif } #endif diff --git a/src/channel.c b/src/channel.c index 38a61d28bf..5c7fb07bd8 100644 --- a/src/channel.c +++ b/src/channel.c @@ -959,7 +959,7 @@ channel_open( sai->sin_port = htons(port); # ifdef HAVE_INET_NTOP src = &sai->sin_addr; -#endif +# endif } # ifdef HAVE_INET_NTOP if (src != NULL) @@ -1388,36 +1388,36 @@ channel_set_pipes(channel_T *channel, sock_T in, sock_T out, sock_T err) { ch_close_part(channel, PART_IN); channel->CH_IN_FD = in; -# if defined(UNIX) +#if defined(UNIX) // Do not end the job when all output channels are closed, wait until // the job ended. if (mch_isatty(in)) channel->ch_to_be_closed |= (1U << PART_IN); -# endif +#endif } if (out != INVALID_FD) { -# if defined(FEAT_GUI) +#if defined(FEAT_GUI) channel_gui_unregister_one(channel, PART_OUT); -# endif +#endif ch_close_part(channel, PART_OUT); channel->CH_OUT_FD = out; channel->ch_to_be_closed |= (1U << PART_OUT); -# if defined(FEAT_GUI) +#if defined(FEAT_GUI) channel_gui_register_one(channel, PART_OUT); -# endif +#endif } if (err != INVALID_FD) { -# if defined(FEAT_GUI) +#if defined(FEAT_GUI) channel_gui_unregister_one(channel, PART_ERR); -# endif +#endif ch_close_part(channel, PART_ERR); channel->CH_ERR_FD = err; channel->ch_to_be_closed |= (1U << PART_ERR); -# if defined(FEAT_GUI) +#if defined(FEAT_GUI) channel_gui_register_one(channel, PART_ERR); -# endif +#endif } } @@ -3587,7 +3587,7 @@ channel_wait(channel_T *channel, sock_T fd, int timeout) if (timeout > 0) ch_log(channel, "Waiting for up to %d msec", timeout); -# ifdef MSWIN +#ifdef MSWIN if (fd != channel->CH_SOCK_FD) { DWORD nread; @@ -4211,7 +4211,7 @@ channel_handle_events(int only_keep_open) } #endif -# if defined(FEAT_GUI) +#if defined(FEAT_GUI) /* * Return TRUE when there is any channel with a keep_open flag. */ @@ -4225,7 +4225,7 @@ channel_any_keep_open(void) return TRUE; return FALSE; } -# endif +#endif /* * Set "channel"/"part" to non-blocking. diff --git a/src/charset.c b/src/charset.c index 74c5913eed..49320fcb64 100644 --- a/src/charset.c +++ b/src/charset.c @@ -1177,7 +1177,7 @@ lbr_chartabsize(chartabsize_T *cts) # endif # ifdef FEAT_PROP_POPUP && !cts->cts_has_prop_with_text -#endif +# endif ) { #endif @@ -1549,13 +1549,13 @@ win_nolbr_chartabsize( if (*s == TAB && (!wp->w_p_list || wp->w_lcs_chars.tab1)) { -# ifdef FEAT_VARTABS +#ifdef FEAT_VARTABS return tabstop_padding(col, wp->w_buffer->b_p_ts, wp->w_buffer->b_p_vts_array); -# else +#else n = wp->w_buffer->b_p_ts; return (int)(n - (col % n)); -# endif +#endif } n = ptr2cells(s); // Add one cell for a double-width character in the last column of the diff --git a/src/clientserver.c b/src/clientserver.c index 813c269c9d..57bdf96d0e 100644 --- a/src/clientserver.c +++ b/src/clientserver.c @@ -15,10 +15,10 @@ #if defined(FEAT_CLIENTSERVER) -#ifdef FEAT_SOCKETSERVER -# include -# include "sys/un.h" -#endif +# ifdef FEAT_SOCKETSERVER +# include +# include "sys/un.h" +# endif static void cmdsrv_main(int *argc, char **argv, char_u *serverName_arg, char_u **serverStr); static char_u *serverMakeName(char_u *arg, char *cmd); @@ -75,9 +75,9 @@ eval_client_expr_to_string(char_u *expr) funccal_entry_T funccal_entry; int did_save_funccal = FALSE; -#if defined(FEAT_EVAL) +# if defined(FEAT_EVAL) ch_log(NULL, "eval_client_expr_to_string(\"%s\")", expr); -#endif +# endif // Evaluate the expression at the toplevel, don't use variables local to // the calling function. Except when in debug mode. @@ -206,7 +206,7 @@ exec_on_server(mparm_T *parmp) serverInitMessaging(); # endif -#ifdef FEAT_SOCKETSERVER +# ifdef FEAT_SOCKETSERVER // If servername is specified and we are using sockets, always init the // sockt server. We may need to receive replies back to us. If --serverlist // is passed, the socket server will be uninitialized before listing @@ -221,7 +221,7 @@ exec_on_server(mparm_T *parmp) TIME_MSG("initialize socket server"); made_name = TRUE; } -#endif +# endif /* * When a command server argument was found, execute it. This may @@ -300,10 +300,10 @@ prepare_server(mparm_T *parmp) # endif vim_free(parmp->servername); } -#ifdef FEAT_X11 +# ifdef FEAT_X11 else serverDelayedStartName = parmp->servername; -#endif +# endif # endif /* @@ -337,15 +337,15 @@ cmdsrv_main( int newArgC = 1, Argc = *argc; int argtype; -#define ARGTYPE_OTHER 0 -#define ARGTYPE_EDIT 1 -#define ARGTYPE_EDIT_WAIT 2 -#define ARGTYPE_SEND 3 +# define ARGTYPE_OTHER 0 +# define ARGTYPE_EDIT 1 +# define ARGTYPE_EDIT_WAIT 2 +# define ARGTYPE_SEND 3 int silent = FALSE; int tabs = FALSE; -#ifdef FEAT_SOCKETSERVER +# ifdef FEAT_SOCKETSERVER char_u *receiver; -#endif +# endif # ifdef MSWIN HWND srv; # elif defined(FEAT_X11) @@ -432,13 +432,13 @@ cmdsrv_main( Argc = i; } -#ifdef FEAT_SOCKETSERVER +# ifdef FEAT_SOCKETSERVER if (clientserver_method == CLIENTSERVER_METHOD_SOCKET) ret = socket_server_send( sname, *serverStr, NULL, &receiver, 0, -1, silent); -#endif -#ifdef FEAT_X11 +# endif +# ifdef FEAT_X11 if (clientserver_method == CLIENTSERVER_METHOD_X11) { if (xterm_dpy == NULL) @@ -450,8 +450,8 @@ cmdsrv_main( ret = serverSendToVim(xterm_dpy, sname, *serverStr, NULL, &srv, 0, 0, 0, silent); } -#endif -#ifdef MSWIN +# endif +# ifdef MSWIN // Win32 always works? ret = serverSendToVim(sname, *serverStr, NULL, &srv, 0, 0, silent); # endif @@ -526,7 +526,7 @@ cmdsrv_main( if (clientserver_method == CLIENTSERVER_METHOD_X11 && serverReadReply(xterm_dpy, srv, &p, TRUE, -1) < 0) break; -# endif +# endif if (p == NULL) break; # endif @@ -648,9 +648,9 @@ expr_fail: if (didone) { -#ifdef FEAT_SOCKETSERVER +# ifdef FEAT_SOCKETSERVER socket_server_uninit(); -#endif +# endif display_errors(); // display any collected messages exit(exiterr); // Mission accomplished - get out } @@ -701,11 +701,11 @@ build_drop_cmd( return NULL; } cdp = vim_strsave_escaped_ext(cwd, -#ifdef BACKSLASH_IN_FILENAME +# ifdef BACKSLASH_IN_FILENAME (char_u *)"", // rem_backslash() will tell what chars to escape -#else +# else PATH_ESC_CHARS, -#endif +# endif '\\', TRUE); vim_free(cwd); if (cdp == NULL) @@ -728,11 +728,11 @@ build_drop_cmd( // do it again in the Vim server. On MS-Windows only escape // non-wildcard characters. p = vim_strsave_escaped((char_u *)filev[i], -#ifdef UNIX +# ifdef UNIX PATH_ESC_CHARS -#else +# else (char_u *)" \t%#" -#endif +# endif ); if (p == NULL) { @@ -762,13 +762,13 @@ build_drop_cmd( // endif // endif ga_concat(&ga, (char_u *)":if !exists('+acd')||!&acd|if haslocaldir()|"); -#ifdef MSWIN +# ifdef MSWIN // in case :set shellslash is set, need to normalize the directory separators // '/' is not valid in a filename so replacing '/' by '\\' should be safe ga_concat(&ga, (char_u *)"cd -|lcd -|elseif getcwd()->tr('/','\\') ==# '"); -#else +# else ga_concat(&ga, (char_u *)"cd -|lcd -|elseif getcwd() ==# '"); -#endif +# endif ga_concat(&ga, cdp); ga_concat(&ga, (char_u *)"'|cd -|endif|endif"); vim_free(cdp); @@ -805,7 +805,7 @@ serverMakeName(char_u *arg, char *cmd) if (arg != NULL && *arg != NUL) { -#ifdef FEAT_SOCKETSERVER +# ifdef FEAT_SOCKETSERVER // If we are using a socket server, we want to preserve the original // name if it is a path, else uppercase it if its just a generic name. if (clientserver_method == CLIENTSERVER_METHOD_SOCKET) @@ -818,9 +818,9 @@ serverMakeName(char_u *arg, char *cmd) } else p = vim_strsave_up(arg); -#else +# else p = vim_strsave_up(arg); -#endif +# endif } else { @@ -874,12 +874,12 @@ remote_common(typval_T *argvars, typval_T *rettv, int expr) # ifdef MSWIN HWND w; # else -#ifdef FEAT_X11 +# ifdef FEAT_X11 Window w; -#endif -#ifdef FEAT_SOCKETSERVER +# endif +# ifdef FEAT_SOCKETSERVER char_u *client = NULL; -#endif +# endif # endif if (check_restricted() || check_secure()) @@ -900,33 +900,33 @@ remote_common(typval_T *argvars, typval_T *rettv, int expr) # ifdef MSWIN if (serverSendToVim(server_name, keys, &r, &w, expr, timeout, TRUE) < 0) # else -#ifdef FEAT_SOCKETSERVER +# ifdef FEAT_SOCKETSERVER if (clientserver_method == CLIENTSERVER_METHOD_SOCKET) if (socket_server_send(server_name, keys, &r, &client, expr, timeout * 1000, TRUE) < 0) goto fail; -#endif -#ifdef FEAT_X11 +# endif +# ifdef FEAT_X11 if (clientserver_method == CLIENTSERVER_METHOD_X11) if (serverSendToVim(X_DISPLAY, server_name, keys, &r, &w, expr, timeout, 0, TRUE) < 0) goto fail; -#endif +# endif # endif -#if !defined(MSWIN) +# if !defined(MSWIN) if (FALSE) { fail: -#else +# else { -#endif +# endif if (r != NULL) { emsg((char *)r); // sending worked but evaluation failed vim_free(r); -#ifdef FEAT_SOCKETSERVER +# ifdef FEAT_SOCKETSERVER vim_free(client); -#endif +# endif } else semsg(_(e_unable_to_send_to_str), server_name); @@ -938,40 +938,40 @@ fail: if (argvars[2].v_type != VAR_UNKNOWN) { dictitem_T v; -#if defined(FEAT_SOCKETSERVER) +# if defined(FEAT_SOCKETSERVER) struct sockaddr_un addr; char_u str[sizeof(addr.sun_path)]; -#else +# else char_u str[30]; -#endif +# endif char_u *idvar; idvar = tv_get_string_chk(&argvars[2]); if (idvar != NULL && *idvar != NUL) { str[0] = NUL; -#ifdef MSWIN +# ifdef MSWIN sprintf((char *)str, PRINTF_HEX_LONG_U, (long_u)w); -#else -#ifdef FEAT_X11 +# else +# ifdef FEAT_X11 if (clientserver_method == CLIENTSERVER_METHOD_X11) sprintf((char *)str, PRINTF_HEX_LONG_U, (long_u)w); -#endif -#ifdef FEAT_SOCKETSERVER +# endif +# ifdef FEAT_SOCKETSERVER if (clientserver_method == CLIENTSERVER_METHOD_SOCKET) vim_snprintf((char *)str, sizeof(addr.sun_path), "%s", client); -#endif -#endif +# endif +# endif v.di_tv.v_type = VAR_STRING; v.di_tv.vval.v_string = vim_strsave(str); set_var(idvar, &v.di_tv, FALSE); vim_free(v.di_tv.vval.v_string); } } -#ifdef FEAT_SOCKETSERVER +# ifdef FEAT_SOCKETSERVER vim_free(client); -#endif +# endif } #endif @@ -985,7 +985,7 @@ f_remote_expr(typval_T *argvars UNUSED, typval_T *rettv) rettv->v_type = VAR_STRING; rettv->vval.v_string = NULL; -#ifdef FEAT_CLIENTSERVER +# ifdef FEAT_CLIENTSERVER if (in_vim9script() && (check_for_string_arg(argvars, 0) == FAIL || check_for_string_arg(argvars, 1) == FAIL @@ -995,7 +995,7 @@ f_remote_expr(typval_T *argvars UNUSED, typval_T *rettv) return; remote_common(argvars, rettv, TRUE); -#endif +# endif } /* @@ -1004,11 +1004,11 @@ f_remote_expr(typval_T *argvars UNUSED, typval_T *rettv) void f_remote_foreground(typval_T *argvars UNUSED, typval_T *rettv UNUSED) { -#ifdef FEAT_CLIENTSERVER +# ifdef FEAT_CLIENTSERVER if (in_vim9script() && check_for_string_arg(argvars, 0) == FAIL) return; -# ifdef MSWIN +# ifdef MSWIN // On Win32 it's done in this application. { char_u *server_name = tv_get_string_chk(&argvars[0]); @@ -1016,7 +1016,7 @@ f_remote_foreground(typval_T *argvars UNUSED, typval_T *rettv UNUSED) if (server_name != NULL) serverForeground(server_name); } -# else +# else // Send a foreground() expression to the server. argvars[1].v_type = VAR_STRING; argvars[1].vval.v_string = vim_strsave((char_u *)"foreground()"); @@ -1025,19 +1025,19 @@ f_remote_foreground(typval_T *argvars UNUSED, typval_T *rettv UNUSED) rettv->vval.v_string = NULL; remote_common(argvars, rettv, TRUE); vim_free(argvars[1].vval.v_string); +# endif # endif -#endif } void f_remote_peek(typval_T *argvars UNUSED, typval_T *rettv) { -#ifdef FEAT_CLIENTSERVER +# ifdef FEAT_CLIENTSERVER dictitem_T v; char_u *s = NULL; -# ifdef MSWIN +# ifdef MSWIN long_u n = 0; -# endif +# endif char_u *serverid; rettv->vval.v_number = -1; @@ -1052,7 +1052,7 @@ f_remote_peek(typval_T *argvars UNUSED, typval_T *rettv) serverid = tv_get_string_chk(&argvars[0]); if (serverid == NULL) return; // type error; errmsg already given -# ifdef MSWIN +# ifdef MSWIN sscanf((const char *)serverid, SCANF_HEX_LONG_U, &n); if (n == 0) rettv->vval.v_number = -1; @@ -1061,12 +1061,12 @@ f_remote_peek(typval_T *argvars UNUSED, typval_T *rettv) s = serverGetReply((HWND)n, FALSE, FALSE, FALSE, 0); rettv->vval.v_number = (s != NULL); } -# else -# ifdef FEAT_SOCKETSERVER +# else +# ifdef FEAT_SOCKETSERVER if (clientserver_method == CLIENTSERVER_METHOD_SOCKET) rettv->vval.v_number = socket_server_peek_reply(serverid, &s); -# endif -# ifdef FEAT_X11 +# endif +# ifdef FEAT_X11 if (clientserver_method == CLIENTSERVER_METHOD_X11) { if (check_connection() == FAIL) @@ -1075,8 +1075,8 @@ f_remote_peek(typval_T *argvars UNUSED, typval_T *rettv) rettv->vval.v_number = serverPeekReply(X_DISPLAY, serverStrToWin(serverid), &s); } +# endif # endif -# endif if (argvars[1].v_type != VAR_UNKNOWN && rettv->vval.v_number > 0) { @@ -1089,9 +1089,9 @@ f_remote_peek(typval_T *argvars UNUSED, typval_T *rettv) set_var(retvar, &v.di_tv, FALSE); vim_free(v.di_tv.vval.v_string); } -#else +# else rettv->vval.v_number = -1; -#endif +# endif } void @@ -1099,7 +1099,7 @@ f_remote_read(typval_T *argvars UNUSED, typval_T *rettv) { char_u *r = NULL; -#ifdef FEAT_CLIENTSERVER +# ifdef FEAT_CLIENTSERVER char_u *serverid; if (in_vim9script() @@ -1111,36 +1111,36 @@ f_remote_read(typval_T *argvars UNUSED, typval_T *rettv) if (serverid != NULL && !check_restricted() && !check_secure()) { int timeout = 0; -# ifdef MSWIN +# ifdef MSWIN // The server's HWND is encoded in the 'id' parameter long_u n = 0; -# endif +# endif if (argvars[1].v_type != VAR_UNKNOWN) timeout = tv_get_number(&argvars[1]); -# ifdef MSWIN +# ifdef MSWIN sscanf((char *)serverid, SCANF_HEX_LONG_U, &n); if (n != 0) r = serverGetReply((HWND)n, FALSE, TRUE, TRUE, timeout); if (r == NULL) emsg(_(e_unable_to_read_server_reply)); -# else -# ifdef FEAT_SOCKETSERVER +# else +# ifdef FEAT_SOCKETSERVER if (clientserver_method == CLIENTSERVER_METHOD_SOCKET && socket_server_read_reply(serverid, &r, timeout * 1000) == FAIL) emsg(_(e_unable_to_read_server_reply)); -# endif -# ifdef FEAT_X11 +# endif +# ifdef FEAT_X11 if (clientserver_method == CLIENTSERVER_METHOD_X11 && (check_connection() == FAIL || serverReadReply(X_DISPLAY, serverStrToWin(serverid), &r, FALSE, timeout) < 0)) emsg(_(e_unable_to_read_server_reply)); +# endif # endif -# endif } -#endif +# endif rettv->v_type = VAR_STRING; rettv->vval.v_string = r; } @@ -1154,7 +1154,7 @@ f_remote_send(typval_T *argvars UNUSED, typval_T *rettv) rettv->v_type = VAR_STRING; rettv->vval.v_string = NULL; -#ifdef FEAT_CLIENTSERVER +# ifdef FEAT_CLIENTSERVER if (in_vim9script() && (check_for_string_arg(argvars, 0) == FAIL || check_for_string_arg(argvars, 1) == FAIL @@ -1162,7 +1162,7 @@ f_remote_send(typval_T *argvars UNUSED, typval_T *rettv) return; remote_common(argvars, rettv, FALSE); -#endif +# endif } /* @@ -1171,7 +1171,7 @@ f_remote_send(typval_T *argvars UNUSED, typval_T *rettv) void f_remote_startserver(typval_T *argvars UNUSED, typval_T *rettv UNUSED) { -#ifdef FEAT_CLIENTSERVER +# ifdef FEAT_CLIENTSERVER if (check_for_nonempty_string_arg(argvars, 0) == FAIL) return; @@ -1182,29 +1182,29 @@ f_remote_startserver(typval_T *argvars UNUSED, typval_T *rettv UNUSED) } char_u *server = tv_get_string_chk(&argvars[0]); -# ifdef MSWIN +# ifdef MSWIN serverSetName(server); -# else -# ifdef FEAT_SOCKETSERVER +# else +# ifdef FEAT_SOCKETSERVER if (clientserver_method == CLIENTSERVER_METHOD_SOCKET) socket_server_init(server); -# endif -# ifdef FEAT_X11 +# endif +# ifdef FEAT_X11 if (clientserver_method == CLIENTSERVER_METHOD_X11 && check_connection() == OK) serverRegisterName(X_DISPLAY, server); -# endif -# endif +# endif +# endif -#else +# else emsg(_(e_clientserver_feature_not_available)); -#endif +# endif } void f_server2client(typval_T *argvars UNUSED, typval_T *rettv) { -#ifdef FEAT_CLIENTSERVER +# ifdef FEAT_CLIENTSERVER char_u buf[NUMBUFLEN]; char_u *server; char_u *reply; @@ -1223,37 +1223,37 @@ f_server2client(typval_T *argvars UNUSED, typval_T *rettv) if (server == NULL || reply == NULL) return; -#ifdef FEAT_SOCKETSERVER +# ifdef FEAT_SOCKETSERVER if (clientserver_method == CLIENTSERVER_METHOD_SOCKET && socket_server_send_reply(server, reply) == FAIL) goto fail; -#endif +# endif -#ifdef FEAT_X11 +# ifdef FEAT_X11 if (clientserver_method == CLIENTSERVER_METHOD_X11 && check_connection() == FAIL) return; if (clientserver_method == CLIENTSERVER_METHOD_X11 && serverSendReply(server, reply) < 0) -#endif -#ifdef MSWIN +# endif +# ifdef MSWIN if (serverSendReply(server, reply) < 0) -#endif -#if defined(FEAT_SOCKETSERVER) && !defined(FEAT_X11) && !defined(MSWIN) +# endif +# if defined(FEAT_SOCKETSERVER) && !defined(FEAT_X11) && !defined(MSWIN) if (FALSE) -#endif +# endif { -#ifdef FEAT_SOCKETSERVER +# ifdef FEAT_SOCKETSERVER fail: -#endif +# endif emsg(_(e_unable_to_send_to_client)); return; } rettv->vval.v_number = 0; -#else +# else rettv->vval.v_number = -1; -#endif +# endif } void @@ -1261,24 +1261,24 @@ f_serverlist(typval_T *argvars UNUSED, typval_T *rettv) { char_u *r = NULL; -#ifdef FEAT_CLIENTSERVER -# ifdef MSWIN +# ifdef FEAT_CLIENTSERVER +# ifdef MSWIN r = serverGetVimNames(); -# else -# ifdef FEAT_SOCKETSERVER +# else +# ifdef FEAT_SOCKETSERVER if (clientserver_method == CLIENTSERVER_METHOD_SOCKET) r = socket_server_list_sockets(); -# endif -# ifdef FEAT_X11 +# endif +# ifdef FEAT_X11 if (clientserver_method == CLIENTSERVER_METHOD_X11) { make_connection(); if (X_DISPLAY != NULL) r = serverGetVimNames(X_DISPLAY); } +# endif # endif # endif -#endif rettv->v_type = VAR_STRING; rettv->vval.v_string = r; } diff --git a/src/clipboard.c b/src/clipboard.c index ae80ab42ee..2471158ea1 100644 --- a/src/clipboard.c +++ b/src/clipboard.c @@ -38,11 +38,11 @@ static int clip_provider_is_available(char_u *provider); #if defined(FEAT_CLIPBOARD) -#if defined(FEAT_WAYLAND_CLIPBOARD) +# if defined(FEAT_WAYLAND_CLIPBOARD) -# include "wayland.h" +# include "wayland.h" -# ifdef FEAT_WAYLAND_CLIPBOARD_FS +# ifdef FEAT_WAYLAND_CLIPBOARD_FS // Structures used for focus stealing typedef struct { @@ -73,7 +73,7 @@ typedef struct { bool got_focus; } clip_wl_fs_surface_T; // fs = focus steal -# endif // FEAT_WAYLAND_CLIPBOARD_FS +# endif // FEAT_WAYLAND_CLIPBOARD_FS // Represents either the regular or primary selection typedef struct { @@ -84,10 +84,10 @@ typedef struct { // else NULL if we don't. vwl_data_offer_T *offer; // Current offer for the selection -# ifdef FEAT_WAYLAND_CLIPBOARD_FS +# ifdef FEAT_WAYLAND_CLIPBOARD_FS bool requires_focus; // If focus needs to be given to us to // work -# endif +# endif bool own_success; // Used by clip_wl_own_selection() bool available; // If selection is ready to serve/use @@ -101,9 +101,9 @@ typedef struct { typedef struct { vwl_seat_T *seat; -#ifdef FEAT_WAYLAND_CLIPBOARD_FS +# ifdef FEAT_WAYLAND_CLIPBOARD_FS clip_wl_buffer_store_T *fs_buffer; -#endif +# endif clip_wl_selection_T regular; clip_wl_selection_T primary; @@ -131,11 +131,11 @@ static int clip_wl_own_selection(Clipboard_T *cbd); static void clip_wl_lose_selection(Clipboard_T *cbd); static void clip_wl_set_selection(Clipboard_T *cbd); -# if defined(USE_SYSTEM) +# if defined(USE_SYSTEM) static bool clip_wl_owner_exists(Clipboard_T *cbd); -# endif +# endif -#endif // FEAT_WAYLAND_CLIPBOARD +# endif // FEAT_WAYLAND_CLIPBOARD /* * Selection stuff using Visual mode, for cutting and pasting text to other @@ -220,30 +220,30 @@ clip_update_selection(Clipboard_T *clip) static int clip_gen_own_selection(Clipboard_T *cbd) { -#if defined(FEAT_XCLIPBOARD) || defined(FEAT_WAYLAND_CLIPBOARD) -# ifdef FEAT_GUI +# if defined(FEAT_XCLIPBOARD) || defined(FEAT_WAYLAND_CLIPBOARD) +# ifdef FEAT_GUI if (gui.in_use) return clip_mch_own_selection(cbd); else -# endif +# endif { if (clipmethod == CLIPMETHOD_WAYLAND) { -#ifdef FEAT_WAYLAND_CLIPBOARD +# ifdef FEAT_WAYLAND_CLIPBOARD return clip_wl_own_selection(cbd); -#endif +# endif } else if (clipmethod == CLIPMETHOD_X11) { -#ifdef FEAT_XCLIPBOARD +# ifdef FEAT_XCLIPBOARD return clip_xterm_own_selection(cbd); -#endif +# endif } } return FAIL; -#else +# else return clip_mch_own_selection(cbd); -#endif +# endif } void @@ -253,7 +253,7 @@ clip_own_selection(Clipboard_T *cbd) * Also want to check somehow that we are reading from the keyboard rather * than a mapping etc. */ -#if defined(FEAT_X11) || defined(FEAT_WAYLAND_CLIPBOARD) +# if defined(FEAT_X11) || defined(FEAT_WAYLAND_CLIPBOARD) // Always own the selection, we might have lost it without being // notified, e.g. during a ":sh" command. if (cbd->available) @@ -275,47 +275,47 @@ clip_own_selection(Clipboard_T *cbd) redraw_curbuf_later(UPD_INVERTED_ALL); } } -#else +# else // Only own the clipboard when we didn't own it yet. if (!cbd->owned && cbd->available) cbd->owned = (clip_gen_own_selection(cbd) == OK); -#endif +# endif } static void clip_gen_lose_selection(Clipboard_T *cbd) { -#if defined(FEAT_XCLIPBOARD) || defined(FEAT_WAYLAND_CLIPBOARD) -# ifdef FEAT_GUI +# if defined(FEAT_XCLIPBOARD) || defined(FEAT_WAYLAND_CLIPBOARD) +# ifdef FEAT_GUI if (gui.in_use) clip_mch_lose_selection(cbd); else -# endif +# endif { if (clipmethod == CLIPMETHOD_WAYLAND) { -#ifdef FEAT_WAYLAND_CLIPBOARD +# ifdef FEAT_WAYLAND_CLIPBOARD clip_wl_lose_selection(cbd); -#endif +# endif } else if (clipmethod == CLIPMETHOD_X11) { -#ifdef FEAT_XCLIPBOARD +# ifdef FEAT_XCLIPBOARD clip_xterm_lose_selection(cbd); -#endif +# endif } } -#else +# else clip_mch_lose_selection(cbd); -#endif +# endif } void clip_lose_selection(Clipboard_T *cbd) { -#ifdef FEAT_X11 +# ifdef FEAT_X11 int was_owned = cbd->owned; -#endif +# endif int visual_selection = FALSE; if (cbd == &clip_star || cbd == &clip_plus) @@ -326,7 +326,7 @@ clip_lose_selection(Clipboard_T *cbd) if (visual_selection) clip_clear_selection(cbd); clip_gen_lose_selection(cbd); -#ifdef FEAT_X11 +# ifdef FEAT_X11 if (visual_selection) { // May have to show a different kind of highlighting for the selected @@ -346,7 +346,7 @@ clip_lose_selection(Clipboard_T *cbd) out_flush_cursor(TRUE, FALSE); } } -#endif +# endif } static void @@ -453,9 +453,9 @@ clip_auto_select(void) clip_isautosel_star(void) { return ( -#ifdef FEAT_GUI +# ifdef FEAT_GUI gui.in_use ? (vim_strchr(p_go, GO_ASEL) != NULL) : -#endif +# endif clip_autoselect_star); } @@ -467,9 +467,9 @@ clip_isautosel_star(void) clip_isautosel_plus(void) { return ( -#ifdef FEAT_GUI +# ifdef FEAT_GUI gui.in_use ? (vim_strchr(p_go, GO_ASELPLUS) != NULL) : -#endif +# endif clip_autoselect_plus); } @@ -496,9 +496,9 @@ clip_compare_pos( } // "how" flags for clip_invert_area() -#define CLIP_CLEAR 1 -#define CLIP_SET 2 -#define CLIP_TOGGLE 3 +# define CLIP_CLEAR 1 +# define CLIP_SET 2 +# define CLIP_TOGGLE 3 /* * Invert or un-invert a rectangle of the screen. @@ -518,7 +518,7 @@ clip_invert_rectangle( int height = height_arg; int width = width_arg; -#ifdef FEAT_PROP_POPUP +# ifdef FEAT_PROP_POPUP // this goes on top of all popup windows screen_zindex = CLIP_ZINDEX; @@ -536,16 +536,16 @@ clip_invert_rectangle( } if (height > cbd->max_row - row + 1) height = cbd->max_row - row + 1; -#endif -#ifdef FEAT_GUI +# endif +# ifdef FEAT_GUI if (gui.in_use) gui_mch_invert_rectangle(row, col, height, width); else -#endif +# endif screen_draw_rectangle(row, col, height, width, invert); -#ifdef FEAT_PROP_POPUP +# ifdef FEAT_PROP_POPUP screen_zindex = 0; -#endif +# endif } /* @@ -568,11 +568,11 @@ clip_invert_area( int invert = FALSE; int max_col; -#ifdef FEAT_PROP_POPUP +# ifdef FEAT_PROP_POPUP max_col = cbd->max_col - 1; -#else +# else max_col = Columns - 1; -#endif +# endif if (how == CLIP_SET) invert = TRUE; @@ -691,7 +691,7 @@ clip_update_modeless_selection( * Find the starting and ending positions of the word at the given row and * column. Only white-separated words are recognized here. */ -#define CHAR_CLASS(c) (c <= ' ' ? ' ' : vim_iswordc(c)) +# define CHAR_CLASS(c) (c <= ' ' ? ' ' : vim_iswordc(c)) static void clip_get_word_boundaries(Clipboard_T *cb, int row, int col) @@ -744,11 +744,11 @@ clip_get_line_end(Clipboard_T *cbd UNUSED, int row) if (row >= screen_Rows || ScreenLines == NULL) return 0; for (i = -#ifdef FEAT_PROP_POPUP +# ifdef FEAT_PROP_POPUP cbd->max_col; -#else +# else screen_Columns; -#endif +# endif i > 0; i--) if (ScreenLines[LineOffset[row] + i - 1] != ' ') break; @@ -762,7 +762,7 @@ clip_get_line_end(Clipboard_T *cbd UNUSED, int row) clip_start_selection(int col, int row, int repeated_click) { Clipboard_T *cb = &clip_star; -#ifdef FEAT_PROP_POPUP +# ifdef FEAT_PROP_POPUP win_T *wp; int row_cp = row; int col_cp = col; @@ -772,7 +772,7 @@ clip_start_selection(int col, int row, int repeated_click) && popup_is_in_scrollbar(wp, row_cp, col_cp)) // click or double click in scrollbar does not start a selection return; -#endif +# endif if (cb->state == SELECT_DONE) clip_clear_selection(cb); @@ -786,7 +786,7 @@ clip_start_selection(int col, int row, int repeated_click) cb->end = cb->start; cb->origin_row = (short_u)cb->start.lnum; cb->state = SELECT_IN_PROGRESS; -#ifdef FEAT_PROP_POPUP +# ifdef FEAT_PROP_POPUP if (wp != NULL && WIN_IS_POPUP(wp)) { // Click in a popup window restricts selection to that window, @@ -807,7 +807,7 @@ clip_start_selection(int col, int row, int repeated_click) cb->min_row = 0; cb->max_row = screen_Rows; } -#endif +# endif if (repeated_click) { @@ -817,11 +817,11 @@ clip_start_selection(int col, int row, int repeated_click) else cb->mode = SELECT_MODE_CHAR; -#ifdef FEAT_GUI +# ifdef FEAT_GUI // clear the cursor until the selection is made if (gui.in_use) gui_undraw_cursor(); -#endif +# endif switch (cb->mode) { @@ -851,9 +851,9 @@ clip_start_selection(int col, int row, int repeated_click) cb->prev = cb->start; -#ifdef DEBUG_SELECTION +# ifdef DEBUG_SELECTION printf("Selection started at (%ld,%d)\n", cb->start.lnum, cb->start.col); -#endif +# endif } /* @@ -878,29 +878,29 @@ clip_process_selection( // Check to make sure we have something selected if (cb->start.lnum == cb->end.lnum && cb->start.col == cb->end.col) { -#ifdef FEAT_GUI +# ifdef FEAT_GUI if (gui.in_use) gui_update_cursor(FALSE, FALSE); -#endif +# endif cb->state = SELECT_CLEARED; return; } -#ifdef DEBUG_SELECTION +# ifdef DEBUG_SELECTION printf("Selection ended: (%ld,%d) to (%ld,%d)\n", cb->start.lnum, cb->start.col, cb->end.lnum, cb->end.col); -#endif +# endif if (clip_isautosel_star() || clip_isautosel_plus() || ( -#ifdef FEAT_GUI +# ifdef FEAT_GUI gui.in_use ? (vim_strchr(p_go, GO_ASELML) != NULL) : -#endif +# endif clip_autoselectml)) clip_copy_modeless_selection(FALSE); -#ifdef FEAT_GUI +# ifdef FEAT_GUI if (gui.in_use) gui_update_cursor(FALSE, FALSE); -#endif +# endif cb->state = SELECT_DONE; return; @@ -951,9 +951,9 @@ clip_process_selection( // set state, for when using the right mouse button cb->state = SELECT_IN_PROGRESS; -#ifdef DEBUG_SELECTION +# ifdef DEBUG_SELECTION printf("Selection extending to (%d,%d)\n", row, col); -#endif +# endif if (repeated_click && ++cb->mode > SELECT_MODE_LINE) cb->mode = SELECT_MODE_CHAR; @@ -1030,10 +1030,10 @@ clip_process_selection( cb->prev.lnum = row; cb->prev.col = col; -#ifdef DEBUG_SELECTION +# ifdef DEBUG_SELECTION printf("Selection is: (%ld,%d) to (%ld,%d)\n", cb->start.lnum, cb->start.col, cb->end.lnum, cb->end.col); -#endif +# endif } # if defined(FEAT_GUI) @@ -1160,7 +1160,7 @@ clip_copy_modeless_selection(int both UNUSED) { row = col1; col1 = col2; col2 = row; } -#ifdef FEAT_PROP_POPUP +# ifdef FEAT_PROP_POPUP if (col1 < clip_star.min_col) col1 = clip_star.min_col; if (col2 > clip_star.max_col) @@ -1171,7 +1171,7 @@ clip_copy_modeless_selection(int both UNUSED) row1 = clip_star.min_row; if (row2 > clip_star.max_row) row2 = clip_star.max_row; -#endif +# endif // correct starting point for being on right half of double-wide char p = ScreenLines + LineOffset[row1]; if (enc_dbcs != 0) @@ -1195,30 +1195,30 @@ clip_copy_modeless_selection(int both UNUSED) if (row == row1) start_col = col1; else -#ifdef FEAT_PROP_POPUP +# ifdef FEAT_PROP_POPUP start_col = clip_star.min_col; -#else +# else start_col = 0; -#endif +# endif if (row == row2) end_col = col2; else -#ifdef FEAT_PROP_POPUP +# ifdef FEAT_PROP_POPUP end_col = clip_star.max_col; -#else +# else end_col = Columns; -#endif +# endif line_end_col = clip_get_line_end(&clip_star, row); // See if we need to nuke some trailing whitespace if (end_col >= -#ifdef FEAT_PROP_POPUP +# ifdef FEAT_PROP_POPUP clip_star.max_col -#else +# else Columns -#endif +# endif && (row < row2 || end_col > line_end_col)) { // Get rid of trailing whitespace @@ -1310,7 +1310,7 @@ clip_copy_modeless_selection(int both UNUSED) // Make the register contents available to the outside world. clip_gen_set_selection(cbd); -#ifdef FEAT_X11 +# ifdef FEAT_X11 if (both) { Clipboard_T *other = cbd == &clip_star ? &clip_plus : &clip_star; @@ -1320,7 +1320,7 @@ clip_copy_modeless_selection(int both UNUSED) clip_yank_selection(MCHAR, buffer, (long)(bufp - buffer), other); clip_gen_set_selection(other); } -#endif +# endif vim_free(buffer); } @@ -1338,108 +1338,107 @@ clip_gen_set_selection(Clipboard_T *cbd) return; } } -#if defined(FEAT_XCLIPBOARD) || defined(FEAT_WAYLAND_CLIPBOARD) -# ifdef FEAT_GUI +# if defined(FEAT_XCLIPBOARD) || defined(FEAT_WAYLAND_CLIPBOARD) +# ifdef FEAT_GUI if (gui.in_use) clip_mch_set_selection(cbd); else -# endif +# endif { if (clipmethod == CLIPMETHOD_WAYLAND) { -#ifdef FEAT_WAYLAND_CLIPBOARD +# ifdef FEAT_WAYLAND_CLIPBOARD clip_wl_set_selection(cbd); -#endif +# endif } else if (clipmethod == CLIPMETHOD_X11) { -#ifdef FEAT_XCLIPBOARD +# ifdef FEAT_XCLIPBOARD clip_xterm_set_selection(cbd); -#endif +# endif } } -#else +# else clip_mch_set_selection(cbd); -#endif +# endif } static void clip_gen_request_selection(Clipboard_T *cbd) { -#if defined(FEAT_XCLIPBOARD) || defined(FEAT_WAYLAND_CLIPBOARD) -# ifdef FEAT_GUI +# if defined(FEAT_XCLIPBOARD) || defined(FEAT_WAYLAND_CLIPBOARD) +# ifdef FEAT_GUI if (gui.in_use) clip_mch_request_selection(cbd); else -# endif +# endif { if (clipmethod == CLIPMETHOD_WAYLAND) { -#ifdef FEAT_WAYLAND_CLIPBOARD +# ifdef FEAT_WAYLAND_CLIPBOARD clip_wl_request_selection(cbd); -#endif +# endif } else if (clipmethod == CLIPMETHOD_X11) { -#ifdef FEAT_XCLIPBOARD +# ifdef FEAT_XCLIPBOARD clip_xterm_request_selection(cbd); -#endif +# endif } } -#else +# else clip_mch_request_selection(cbd); -#endif +# endif } -#if (defined(FEAT_X11) && defined(FEAT_XCLIPBOARD) && defined(USE_SYSTEM)) \ - +# if (defined(FEAT_X11) && defined(FEAT_XCLIPBOARD) && defined(USE_SYSTEM)) static int clip_x11_owner_exists(Clipboard_T *cbd) { return XGetSelectionOwner(X_DISPLAY, cbd->sel_atom) != None; } -#endif +# endif -#if (defined(FEAT_X11) || defined(FEAT_WAYLAND_CLIPBOARD)) \ +# if (defined(FEAT_X11) || defined(FEAT_WAYLAND_CLIPBOARD)) \ && defined(USE_SYSTEM) int clip_gen_owner_exists(Clipboard_T *cbd UNUSED) { -#if defined(FEAT_XCLIPBOARD) || defined(FEAT_WAYLAND_CLIPBOARD) -# ifdef FEAT_GUI_GTK +# if defined(FEAT_XCLIPBOARD) || defined(FEAT_WAYLAND_CLIPBOARD) +# ifdef FEAT_GUI_GTK if (gui.in_use) return clip_gtk_owner_exists(cbd); else -# endif +# endif { if (clipmethod == CLIPMETHOD_WAYLAND) { -#ifdef FEAT_WAYLAND_CLIPBOARD +# ifdef FEAT_WAYLAND_CLIPBOARD return clip_wl_owner_exists(cbd); -#endif +# endif } else if (clipmethod == CLIPMETHOD_X11) { -#ifdef FEAT_XCLIPBOARD +# ifdef FEAT_XCLIPBOARD return clip_x11_owner_exists(cbd); -#endif +# endif } else return FALSE; } -#else +# else return TRUE; -#endif +# endif } -#endif +# endif /* * Stuff for the X clipboard. Shared between VMS and Unix. */ -#if defined(FEAT_XCLIPBOARD) || defined(FEAT_GUI_X11) -# include -# include +# if defined(FEAT_XCLIPBOARD) || defined(FEAT_GUI_X11) +# include +# include /* * Open the application context (if it hasn't been opened yet). @@ -1629,7 +1628,7 @@ clip_x11_notify_cb(Widget w UNUSED, Atom *sel_atom UNUSED, Atom *target UNUSED) /* * Property callback to get a timestamp for XtOwnSelection. */ -# if defined(FEAT_X11) && defined(FEAT_XCLIPBOARD) +# if defined(FEAT_X11) && defined(FEAT_XCLIPBOARD) static void clip_x11_timestamp_cb( Widget w, @@ -1682,7 +1681,7 @@ x11_setup_selection(Widget w) XtAddEventHandler(w, PropertyChangeMask, False, /*(XtEventHandler)*/clip_x11_timestamp_cb, (XtPointer)NULL); } -# endif +# endif static void clip_x11_request_selection_cb( @@ -1760,12 +1759,12 @@ clip_x11_request_selection_cb( text_prop.encoding = *type; text_prop.format = *format; text_prop.nitems = len; -#if defined(X_HAVE_UTF8_STRING) +# if defined(X_HAVE_UTF8_STRING) if (*type == utf8_atom) status = Xutf8TextPropertyToTextList(X_DISPLAY, &text_prop, &text_list, &n_text); else -#endif +# endif status = XmbTextPropertyToTextList(X_DISPLAY, &text_prop, &text_list, &n_text); if (status != Success || n_text < 1) @@ -1810,9 +1809,9 @@ clip_x11_request_selection( default: type = XA_STRING; } if (type == utf8_atom -# if defined(X_HAVE_UTF8_STRING) +# if defined(X_HAVE_UTF8_STRING) && !enc_utf8 -# endif +# endif ) // Only request utf-8 when 'encoding' is utf8 and // Xutf8TextPropertyToTextList is available. @@ -1892,7 +1891,7 @@ clip_x11_own_selection(Widget myShell, Clipboard_T *cbd) // event. When in the console we don't get events (the terminal gets // them), Get the time by a zero-length append, clip_x11_timestamp_cb will // be called with the current timestamp. -#ifdef FEAT_GUI +# ifdef FEAT_GUI if (gui.in_use) { if (XtOwnSelection(myShell, cbd->sel_atom, @@ -1902,7 +1901,7 @@ clip_x11_own_selection(Widget myShell, Clipboard_T *cbd) return FAIL; } else -#endif +# endif { if (!XChangeProperty(XtDisplay(myShell), XtWindow(myShell), cbd->sel_atom, timestamp_atom, 32, PropModeAppend, NULL, 0)) @@ -1922,9 +1921,9 @@ clip_x11_set_selection(Clipboard_T *cbd UNUSED) { } -#endif +# endif -#if defined(FEAT_XCLIPBOARD) || defined(FEAT_GUI_X11) || defined(FEAT_GUI_GTK) +# if defined(FEAT_XCLIPBOARD) || defined(FEAT_GUI_X11) || defined(FEAT_GUI_GTK) /* * Get the contents of the X CUT_BUFFER0 and put it in "cbd". */ @@ -1971,7 +1970,7 @@ yank_cut_buffer0(Display *dpy, Clipboard_T *cbd) } } } -#endif +# endif /* * SELECTION / PRIMARY ('*') @@ -2000,7 +1999,7 @@ yank_cut_buffer0(Display *dpy, Clipboard_T *cbd) * 'permanent' of the two), otherwise the PRIMARY one. * For now, use a hard-coded sanity limit of 1Mb of data. */ -#if defined(FEAT_X11) && defined(FEAT_CLIPBOARD) +# if defined(FEAT_X11) && defined(FEAT_CLIPBOARD) void x11_export_final_selection(void) { @@ -2009,16 +2008,16 @@ x11_export_final_selection(void) long_u len = 0; int motion_type = -1; -# ifdef FEAT_GUI +# ifdef FEAT_GUI if (gui.in_use) dpy = X_DISPLAY; else -# endif -# ifdef FEAT_XCLIPBOARD +# endif +# ifdef FEAT_XCLIPBOARD dpy = xterm_dpy; -# else +# else return; -# endif +# endif // Get selection to export if (clip_plus.owned) @@ -2076,7 +2075,7 @@ x11_export_final_selection(void) vim_free(str); } -#endif +# endif void clip_free_selection(Clipboard_T *cbd) @@ -2301,7 +2300,7 @@ may_set_selection(void) } } -#if defined(FEAT_WAYLAND_CLIPBOARD) +# if defined(FEAT_WAYLAND_CLIPBOARD) static clip_wl_selection_T * clip_wl_get_selection(wayland_selection_T sel) @@ -2350,7 +2349,7 @@ clip_wl_get_selection_type(clip_wl_selection_T *sel) return WAYLAND_SELECTION_NONE; } -#ifdef FEAT_WAYLAND_CLIPBOARD_FS +# ifdef FEAT_WAYLAND_CLIPBOARD_FS /* * If globals required for focus stealing method are available. */ @@ -2540,9 +2539,9 @@ clip_wl_init_fs_surface( void *user_data) { clip_wl_fs_surface_T *store; -#ifdef ELAPSED_FUNC +# ifdef ELAPSED_FUNC elapsed_T start_tv; -#endif +# endif if (wayland_ct->gobjects.wl_compositor == NULL || wayland_ct->gobjects.xdg_wm_base == NULL @@ -2606,19 +2605,19 @@ clip_wl_init_fs_surface( // Dispatch events until we receive the enter event. Add a max delay of // 'p_wtm' when waiting for it (may be longer depending on how long we poll // when dispatching events) -#ifdef ELAPSED_FUNC +# ifdef ELAPSED_FUNC ELAPSED_INIT(start_tv); -#endif +# endif while (vwl_connection_dispatch(wayland_ct) >= 0) { if (store->got_focus) break; -#ifdef ELAPSED_FUNC +# ifdef ELAPSED_FUNC if (ELAPSED_FUNC(start_tv) >= p_wtm) goto fail; -#endif +# endif } early_exit: clip_wl_destroy_fs_surface(store); @@ -2632,7 +2631,7 @@ fail: return FAIL; } -#endif // FEAT_WAYLAND_CLIPBOARD_FS +# endif // FEAT_WAYLAND_CLIPBOARD_FS static bool wl_data_offer_listener_event_offer( @@ -2800,7 +2799,7 @@ clip_init_wayland(void) clip_wl.primary.device = clip_wl.regular.device; } -#ifdef FEAT_WAYLAND_CLIPBOARD_FS +# ifdef FEAT_WAYLAND_CLIPBOARD_FS if (clip_wl.regular.available && clip_wl.regular.manager->protocol == VWL_DATA_PROTOCOL_CORE && clip_wl_focus_stealing_available()) @@ -2815,7 +2814,7 @@ clip_init_wayland(void) // Initialize buffer to use for focus stealing clip_wl.fs_buffer = clip_wl_init_buffer_store(1, 1); } -#endif +# endif if (!clip_wl.regular.available && !clip_wl.primary.available) return FAIL; @@ -2846,9 +2845,9 @@ clip_uninit_wayland(void) clip_lose_selection(&clip_plus); } -#ifdef FEAT_WAYLAND_CLIPBOARD_FS +# ifdef FEAT_WAYLAND_CLIPBOARD_FS clip_wl_destroy_buffer_store(clip_wl.fs_buffer); -#endif +# endif // Don't want to double free if (clip_wl.regular.manager != clip_wl.primary.manager) @@ -2898,18 +2897,18 @@ clip_wl_receive_data(Clipboard_T *cbd, const char *mime_type, int fd) garray_T buf; int motion_type = MAUTO; ssize_t r = 0; -#ifndef HAVE_SELECT +# ifndef HAVE_SELECT struct pollfd pfd; pfd.fd = fd; pfd.events = POLLIN; -#else +# else fd_set rfds; struct timeval tv; FD_ZERO(&rfds); FD_SET(fd, &rfds); -#endif +# endif // Make pipe (read end) non-blocking if (fcntl(fd, F_SETFL, fcntl(fd, F_GETFL) | O_NONBLOCK) == -1) @@ -2924,12 +2923,12 @@ clip_wl_receive_data(Clipboard_T *cbd, const char *mime_type, int fd) start = buf.ga_data; -#ifndef HAVE_SELECT +# ifndef HAVE_SELECT while (poll(&pfd, 1, p_wtm) > 0) -#else +# else while (tv.tv_sec = p_wtm / 1000, tv.tv_usec = (p_wtm % 1000) * 1000, select(fd + 1, &rfds, NULL, NULL, &tv) > 0) -#endif +# endif { r = read(fd, start, buf.ga_maxlen - 1 - buf.ga_len); @@ -3021,7 +3020,7 @@ clip_wl_request_selection(Clipboard_T *cbd) if (!sel->available) goto clear; -#ifdef FEAT_WAYLAND_CLIPBOARD_FS +# ifdef FEAT_WAYLAND_CLIPBOARD_FS if (sel->requires_focus) { // We don't care about the on_focus callback since once we gain @@ -3031,7 +3030,7 @@ clip_wl_request_selection(Clipboard_T *cbd) goto clear; } else -#endif +# endif { // Dispatch any events that still queued up before checking for a data // offer. @@ -3091,18 +3090,18 @@ vwl_data_source_listener_event_send( int offset = 0; bool is_vim, is_vimenc; size_t total = 0; -#ifndef HAVE_SELECT +# ifndef HAVE_SELECT struct pollfd pfd; pfd.fd = fd; pfd.events = POLLOUT; -#else +# else fd_set wfds; struct timeval tv; FD_ZERO(&wfds); FD_SET(fd, &wfds); -#endif +# endif // Check if we actually have mime type for (int i = 0; i < (int)ARRAY_LENGTH(supported_mimes); i++) @@ -3144,12 +3143,12 @@ vwl_data_source_listener_event_send( while (total < (size_t)length && -#ifndef HAVE_SELECT +# ifndef HAVE_SELECT poll(&pfd, 1, p_wtm) > 0) -#else +# else ((tv.tv_sec = p_wtm / 1000, tv.tv_usec = (p_wtm % 1000) * 1000), select(fd + 1, NULL, &wfds, NULL, &tv) > 0)) -#endif +# endif { ssize_t w = write(fd, string + total, length - total); @@ -3239,7 +3238,7 @@ clip_wl_own_selection(Clipboard_T *cbd) vwl_data_source_offer(sel->source, supported_mimes[i]); sel->own_success = false; -#ifdef FEAT_WAYLAND_CLIPBOARD_FS +# ifdef FEAT_WAYLAND_CLIPBOARD_FS if (sel->requires_focus) { if (clip_wl_init_fs_surface(clip_wl.seat, clip_wl.fs_buffer, @@ -3247,7 +3246,7 @@ clip_wl_own_selection(Clipboard_T *cbd) goto fail; } else -#endif +# endif clip_wl_do_set_selection(sel, 0); if (!sel->own_success) @@ -3284,7 +3283,7 @@ clip_wl_set_selection(Clipboard_T *cbd UNUSED) { } -#if defined(USE_SYSTEM) +# if defined(USE_SYSTEM) /* * Return true if we own the selection corresponding to cbd or another client * does. @@ -3299,9 +3298,9 @@ clip_wl_owner_exists(Clipboard_T *cbd) return sel->available && (sel->source != NULL || sel->offer != NULL); } -#endif +# endif -#endif // FEAT_WAYLAND_CLIPBOARD +# endif // FEAT_WAYLAND_CLIPBOARD #endif // FEAT_CLIPBOARD @@ -3331,23 +3330,23 @@ get_clipmethod(char_u *str) if (STRCMP(buf, "wayland") == 0) { -#ifdef FEAT_GUI +# ifdef FEAT_GUI if (!gui.in_use) -#endif +# endif { -#ifdef FEAT_WAYLAND_CLIPBOARD +# ifdef FEAT_WAYLAND_CLIPBOARD if (clip_wl.regular.available || clip_wl.primary.available) method = CLIPMETHOD_WAYLAND; -#endif +# endif } } else if (STRCMP(buf, "x11") == 0) { -#ifdef FEAT_GUI +# ifdef FEAT_GUI if (!gui.in_use) -#endif +# endif { -#ifdef FEAT_XCLIPBOARD +# ifdef FEAT_XCLIPBOARD // x_IOerror_handler() in os_unix.c should set xterm_dpy to NULL if // we lost connection to the X server. if (xterm_dpy != NULL) @@ -3359,12 +3358,12 @@ get_clipmethod(char_u *str) xterm_update(); method = CLIPMETHOD_X11; } -#endif +# endif } } else { -#ifdef FEAT_CLIPBOARD_PROVIDER +# ifdef FEAT_CLIPBOARD_PROVIDER // Check if name matches a clipboard provider int r = clip_provider_is_available(buf); @@ -3380,11 +3379,11 @@ get_clipmethod(char_u *str) } } else if (r == -1) -#endif +# endif { -#ifdef FEAT_CLIPBOARD_PROVIDER +# ifdef FEAT_CLIPBOARD_PROVIDER fail: -#endif +# endif ret = CLIPMETHOD_FAIL; goto exit; } @@ -3417,9 +3416,9 @@ clipmethod_to_str(clipmethod_T method) case CLIPMETHOD_X11: return (char_u *)"x11"; case CLIPMETHOD_PROVIDER: -#ifdef FEAT_EVAL +# ifdef FEAT_EVAL return clip_provider; -#endif +# endif default: return (char_u *)"none"; } @@ -3440,34 +3439,34 @@ choose_clipmethod(void) // If GUI is running or we are not on a system with Wayland or X11, then always // return CLIPMETHOD_NONE. System or GUI clipboard handling always overrides. // This is unless a provider is being used. -#if defined(FEAT_XCLIPBOARD) || defined(FEAT_WAYLAND_CLIPBOARD) -# if defined(FEAT_GUI) +# if defined(FEAT_XCLIPBOARD) || defined(FEAT_WAYLAND_CLIPBOARD) +# if defined(FEAT_GUI) if (method != CLIPMETHOD_PROVIDER && gui.in_use) { -# ifdef FEAT_WAYLAND +# ifdef FEAT_WAYLAND // We only interact with Wayland for the clipboard, we can just deinit // everything. wayland_uninit_connection(); -# endif +# endif method = CLIPMETHOD_NONE; goto lose_sel_exit; } -# endif -#else +# endif +# else // If on a system like windows or macos, then clipmethod is irrelevant, we // use their way of accessing the clipboard. This is unless we are using the // clipboard provider -#ifdef FEAT_CLIPBOARD_PROVIDER +# ifdef FEAT_CLIPBOARD_PROVIDER if (method != CLIPMETHOD_PROVIDER) -#endif +# endif { method = CLIPMETHOD_NONE; goto exit; } -#endif +# endif -#ifdef FEAT_CLIPBOARD +# ifdef FEAT_CLIPBOARD // Deinitialize clipboard if there is no way to access clipboard if (method == CLIPMETHOD_NONE) clip_init(FALSE); @@ -3480,34 +3479,34 @@ choose_clipmethod(void) // Disown clipboard if we are switching to a new method else if (clipmethod != CLIPMETHOD_NONE && method != clipmethod) { -#if (defined(FEAT_XCLIPBOARD) || defined(FEAT_WAYLAND_CLIPBOARD)) \ +# if (defined(FEAT_XCLIPBOARD) || defined(FEAT_WAYLAND_CLIPBOARD)) \ && defined(FEAT_GUI) lose_sel_exit: -#endif +# endif if (clip_star.owned) clip_lose_selection(&clip_star); if (clip_plus.owned) clip_lose_selection(&clip_plus); -#if defined(FEAT_GUI) +# if defined(FEAT_GUI) if (!gui.in_use) -#endif +# endif { clip_init(TRUE); did_warn_clipboard = false; } } -#endif // FEAT_CLIPBOARD +# endif // FEAT_CLIPBOARD -#if !defined(FEAT_XCLIPBOARD) && !defined(FEAT_WAYLAND_CLIPBOARD) +# if !defined(FEAT_XCLIPBOARD) && !defined(FEAT_WAYLAND_CLIPBOARD) exit: -#endif +# endif clipmethod = method; -#ifdef FEAT_EVAL +# ifdef FEAT_EVAL set_vim_var_string(VV_CLIPMETHOD, (char_u*)clipmethod_to_str(method), -1); -#endif +# endif return NULL; } @@ -3536,15 +3535,15 @@ ex_clipreset(exarg_T *eap UNUSED) void adjust_clip_reg(int *rp) { -#ifdef FEAT_CLIPBOARD_PROVIDER +# ifdef FEAT_CLIPBOARD_PROVIDER if (clipmethod == CLIPMETHOD_PROVIDER) { if (*rp == 0 && clip_unnamed != 0) *rp = ((clip_unnamed & CLIP_UNNAMED_PLUS)) ? '+' : '*'; return; } -#endif -#ifdef FEAT_CLIPBOARD +# endif +# ifdef FEAT_CLIPBOARD // If no reg. specified, and "unnamed" or "unnamedplus" is in 'clipboard', // use '*' or '+' reg, respectively. "unnamedplus" prevails. if (*rp == 0 && (clip_unnamed != 0 || clip_unnamed_saved != 0)) @@ -3562,7 +3561,7 @@ adjust_clip_reg(int *rp) msg_warn_missing_clipboard(); *rp = 0; } -#endif +# endif } /* @@ -3573,12 +3572,12 @@ adjust_clip_reg(int *rp) did_set_clipboard(optset_T *args UNUSED) { int new_unnamed = 0; -#ifdef FEAT_CLIPBOARD +# ifdef FEAT_CLIPBOARD int new_autoselect_star = FALSE; int new_autoselect_plus = FALSE; int new_autoselectml = FALSE; int new_html = FALSE; -#endif +# endif regprog_T *new_exclude_prog = NULL; char *errmsg = NULL; char_u *p; @@ -3597,7 +3596,7 @@ did_set_clipboard(optset_T *args UNUSED) new_unnamed |= CLIP_UNNAMED_PLUS; p += 11; } -#ifdef FEAT_CLIPBOARD +# ifdef FEAT_CLIPBOARD else if (STRNCMP(p, "autoselect", 10) == 0 && (p[10] == ',' || p[10] == NUL)) { @@ -3629,7 +3628,7 @@ did_set_clipboard(optset_T *args UNUSED) errmsg = e_invalid_argument; break; } -#endif +# endif else { errmsg = e_invalid_argument; @@ -3640,30 +3639,30 @@ did_set_clipboard(optset_T *args UNUSED) } if (errmsg == NULL) { -#ifdef FEAT_CLIPBOARD +# ifdef FEAT_CLIPBOARD if (global_busy) // clip_unnamed will be reset to clip_unnamed_saved // at end_global_changes clip_unnamed_saved = new_unnamed; else -#endif +# endif clip_unnamed = new_unnamed; -#ifdef FEAT_CLIPBOARD +# ifdef FEAT_CLIPBOARD clip_autoselect_star = new_autoselect_star; clip_autoselect_plus = new_autoselect_plus; clip_autoselectml = new_autoselectml; clip_html = new_html; vim_regfree(clip_exclude_prog); clip_exclude_prog = new_exclude_prog; -#endif -#ifdef FEAT_GUI_GTK +# endif +# ifdef FEAT_GUI_GTK if (gui.in_use) { gui_gtk_set_selection_targets((GdkAtom)GDK_SELECTION_PRIMARY); gui_gtk_set_selection_targets((GdkAtom)clip_plus.gtk_sel_atom); gui_gtk_set_dnd_targets(); } -#endif +# endif } else vim_regfree(new_exclude_prog); diff --git a/src/cmdexpand.c b/src/cmdexpand.c index 143f4c4917..cac8aa90bf 100644 --- a/src/cmdexpand.c +++ b/src/cmdexpand.c @@ -4177,9 +4177,9 @@ globpath( #if defined(MSWIN) // Using the platform's path separator (\) makes vim incorrectly // treat it as an escape character, use '/' instead. - #define TMP_PATHSEPSTR "/" +# define TMP_PATHSEPSTR "/" #else - #define TMP_PATHSEPSTR PATHSEPSTR +# define TMP_PATHSEPSTR PATHSEPSTR #endif // Loop over all entries in {path}. diff --git a/src/crypt.c b/src/crypt.c index d2777b5f1c..da1022644d 100644 --- a/src/crypt.c +++ b/src/crypt.c @@ -77,7 +77,7 @@ typedef struct { static int crypt_sodium_init_(cryptstate_T *state, char_u *key, crypt_arg_T *arg); static long crypt_sodium_buffer_decode(cryptstate_T *state, char_u *from, size_t len, char_u **buf_out, int last); static long crypt_sodium_buffer_encode(cryptstate_T *state, char_u *from, size_t len, char_u **buf_out, int last); -# if defined(FEAT_SODIUM) +#if defined(FEAT_SODIUM) static void crypt_long_long_to_char(long long n, char_u *s); static void crypt_int_to_char(int n, char_u *s); static long long crypt_char_to_long_long(char_u *s); @@ -924,7 +924,7 @@ crypt_sodium_init_( char_u *key UNUSED, crypt_arg_T *arg UNUSED) { -# ifdef FEAT_SODIUM +#ifdef FEAT_SODIUM // crypto_box_SEEDBYTES == crypto_secretstream_xchacha20poly1305_KEYBYTES unsigned char dkey[crypto_box_SEEDBYTES]; // 32 sodium_state_T *sd_state; @@ -946,14 +946,14 @@ crypt_sodium_init_( memlimit = crypto_pwhash_MEMLIMIT_INTERACTIVE; alg = crypto_pwhash_ALG_DEFAULT; -#if 0 +# if 0 // For testing if (state->method_nr == CRYPT_M_SOD2) { opslimit = crypto_pwhash_OPSLIMIT_MODERATE; memlimit = crypto_pwhash_MEMLIMIT_MODERATE; } -#endif +# endif // derive a key from the password if (crypto_pwhash(dkey, sizeof(dkey), (const char *)key, STRLEN(key), @@ -1017,12 +1017,12 @@ crypt_sodium_init_( alg = crypt_char_to_int(p); p += sizeof(alg); -#ifdef FEAT_EVAL +# ifdef FEAT_EVAL crypt_sodium_report_hash_params(opslimit, crypto_pwhash_OPSLIMIT_INTERACTIVE, (size_t)memlimit, crypto_pwhash_MEMLIMIT_INTERACTIVE, alg, crypto_pwhash_ALG_DEFAULT); -#endif +# endif if (crypto_pwhash(dkey, sizeof(dkey), (const char *)key, STRLEN(key), arg->cat_salt, opslimit, (size_t)memlimit, alg) != 0) @@ -1047,10 +1047,10 @@ crypt_sodium_init_( state->method_state = sd_state; return OK; -# else +#else emsg(_(e_libsodium_not_built_in)); return FAIL; -# endif +#endif } /* @@ -1190,7 +1190,7 @@ crypt_sodium_buffer_encode( char_u **buf_out UNUSED, int last UNUSED) { -# ifdef FEAT_SODIUM +#ifdef FEAT_SODIUM // crypto_box_SEEDBYTES == crypto_secretstream_xchacha20poly1305_KEYBYTES unsigned long long out_len; char_u *ptr; @@ -1223,9 +1223,9 @@ crypt_sodium_buffer_encode( sod_st->count++; return out_len + (first ? crypto_secretstream_xchacha20poly1305_HEADERBYTES : 0); -# else +#else return -1; -# endif +#endif } /* @@ -1240,7 +1240,7 @@ crypt_sodium_buffer_decode( char_u **buf_out UNUSED, int last UNUSED) { -# ifdef FEAT_SODIUM +#ifdef FEAT_SODIUM // crypto_box_SEEDBYTES == crypto_secretstream_xchacha20poly1305_KEYBYTES sodium_state_T *sod_st = state->method_state; unsigned char tag; @@ -1282,12 +1282,12 @@ crypt_sodium_buffer_decode( if (tag == crypto_secretstream_xchacha20poly1305_TAG_FINAL && !last) emsg(_(e_libsodium_decryption_failed_premature)); return (long) out_len; -# else +#else return -1; -# endif +#endif } -# if defined(FEAT_SODIUM) +#if defined(FEAT_SODIUM) void crypt_sodium_lock_key(char_u *key) { @@ -1319,7 +1319,7 @@ crypt_sodium_randombytes_random(void) return randombytes_random(); } -#if defined(FEAT_EVAL) +# if defined(FEAT_EVAL) static void crypt_sodium_report_hash_params( unsigned long long opslimit, @@ -1347,7 +1347,7 @@ crypt_sodium_report_hash_params( verbose_leave(); } } -#endif +# endif static void crypt_long_long_to_char(long long n, char_u *s) @@ -1405,6 +1405,6 @@ crypt_char_to_int(char_u *s) } return retval; } -# endif +#endif #endif // FEAT_CRYPT diff --git a/src/debugger.c b/src/debugger.c index f553a8e6a6..dc8a5b3e94 100644 --- a/src/debugger.c +++ b/src/debugger.c @@ -530,33 +530,33 @@ static int has_expr_breakpoint = FALSE; static garray_T prof_ga = {0, 0, sizeof(struct debuggy), 4, NULL}; // Profiling caches results of regexp lookups for function/script name. -#define N_PROF_HTAB 2 +# define N_PROF_HTAB 2 static hashtab_T prof_cache[N_PROF_HTAB]; -#define PROF_HTAB_FUNCS 0 -#define PROF_HTAB_FILES 1 +# define PROF_HTAB_FUNCS 0 +# define PROF_HTAB_FILES 1 static int prof_cache_initialized; typedef struct profentry_S { char pen_flags; // cache data booleans: profiling, forceit char_u pen_name[1]; // actually longer } profentry_T; -#define PEN_FLAG_PROFILING 1 -#define PEN_FLAG_FORCEIT 2 -#define PEN_SET_PROFILING(pe) ((pe)->pen_flags |= PEN_FLAG_PROFILING) -#define PEN_SET_FORCEIT(pe) ((pe)->pen_flags |= PEN_FLAG_FORCEIT) -#define PEN_IS_PROFILING(pe) (((pe)->pen_flags & PEN_FLAG_PROFILING) != 0) -#define PEN_IS_FORCEIT(pe) (((pe)->pen_flags & PEN_FLAG_FORCEIT) != 0) +# define PEN_FLAG_PROFILING 1 +# define PEN_FLAG_FORCEIT 2 +# define PEN_SET_PROFILING(pe) ((pe)->pen_flags |= PEN_FLAG_PROFILING) +# define PEN_SET_FORCEIT(pe) ((pe)->pen_flags |= PEN_FLAG_FORCEIT) +# define PEN_IS_PROFILING(pe) (((pe)->pen_flags & PEN_FLAG_PROFILING) != 0) +# define PEN_IS_FORCEIT(pe) (((pe)->pen_flags & PEN_FLAG_FORCEIT) != 0) -#define PE2HIKEY(pe) ((pe)->pen_name) -#define HIKEY2PE(p) ((profentry_T *)((p) - (offsetof(profentry_T, pen_name)))) -#define HI2PE(hi) HIKEY2PE((hi)->hi_key) +# define PE2HIKEY(pe) ((pe)->pen_name) +# define HIKEY2PE(p) ((profentry_T *)((p) - (offsetof(profentry_T, pen_name)))) +# define HI2PE(hi) HIKEY2PE((hi)->hi_key) static void prof_clear_cache(void); -#define PROF_CLEAR_CACHE(gap) do {if ((gap) == &prof_ga) prof_clear_cache();} while (0) +# define PROF_CLEAR_CACHE(gap) do {if ((gap) == &prof_ga) prof_clear_cache();} while (0) // Can enable to get some info about profile caching // #define PROF_CACHE_LOG #else -#define PROF_CLEAR_CACHE(gap) do {} while (0) +# define PROF_CLEAR_CACHE(gap) do {} while (0) #endif #define DBG_FUNC 1 #define DBG_FILE 2 @@ -930,9 +930,9 @@ dbg_find_breakpoint( } #if defined(FEAT_PROFILE) -#if defined(PROF_CACHE_LOG) +# if defined(PROF_CACHE_LOG) static int count_lookups[2]; -#endif +# endif /* * Return TRUE if profiling is on for a function or sourced file. * Cache the results of debuggy_find(). @@ -982,20 +982,20 @@ has_profiling( PEN_SET_FORCEIT(pe); } hash_add_item(ht, hi, pe->pen_name, hash); -#if defined(PROF_CACHE_LOG) +# if defined(PROF_CACHE_LOG) ch_log(NULL, "has_profiling: %s %s forceit %s, profile %s", file ? "file" : "func", fname, PEN_IS_FORCEIT(pe) ? "true" : "false", PEN_IS_PROFILING(pe) ? "true" : "false"); -#endif +# endif } else pe = HI2PE(hi); if (fp) *fp = PEN_IS_FORCEIT(pe); -#if defined(PROF_CACHE_LOG) +# if defined(PROF_CACHE_LOG) count_lookups[file ? PROF_HTAB_FILES : PROF_HTAB_FUNCS]++; -#endif +# endif return PEN_IS_PROFILING(pe); } @@ -1014,14 +1014,14 @@ prof_clear_cache(void) { if (ht->ht_used > 0) { -#if defined(PROF_CACHE_LOG) +# if defined(PROF_CACHE_LOG) int idx = ht == &prof_cache[PROF_HTAB_FUNCS] ? PROF_HTAB_FUNCS : PROF_HTAB_FILES; ch_log(NULL, "prof_clear_cache: %s, used: %ld, lookups: %d", idx == PROF_HTAB_FUNCS ? "function" : "script", ht->ht_used, count_lookups[idx]); count_lookups[idx] = 0; -#endif +# endif hash_clear_all(ht, offsetof(profentry_T, pen_name)); hash_init(ht); } diff --git a/src/diff.c b/src/diff.c index 79c6e3255e..46325d64ca 100644 --- a/src/diff.c +++ b/src/diff.c @@ -25,46 +25,46 @@ static int diff_busy = FALSE; // using diff structs, don't change them static int diff_need_update = FALSE; // ex_diffupdate needs to be called // flags obtained from the 'diffopt' option -#define DIFF_FILLER 0x001 // display filler lines -#define DIFF_IBLANK 0x002 // ignore empty lines -#define DIFF_ICASE 0x004 // ignore case -#define DIFF_IWHITE 0x008 // ignore change in white space -#define DIFF_IWHITEALL 0x010 // ignore all white space changes -#define DIFF_IWHITEEOL 0x020 // ignore change in white space at EOL -#define DIFF_HORIZONTAL 0x040 // horizontal splits -#define DIFF_VERTICAL 0x080 // vertical splits -#define DIFF_HIDDEN_OFF 0x100 // diffoff when hidden -#define DIFF_INTERNAL 0x200 // use internal xdiff algorithm -#define DIFF_CLOSE_OFF 0x400 // diffoff when closing window -#define DIFF_FOLLOWWRAP 0x800 // follow the wrap option -#define DIFF_LINEMATCH 0x1000 // match most similar lines within diff -#define DIFF_INLINE_NONE 0x2000 // no inline highlight -#define DIFF_INLINE_SIMPLE 0x4000 // inline highlight with simple algorithm -#define DIFF_INLINE_CHAR 0x8000 // inline highlight with character diff -#define DIFF_INLINE_WORD 0x10000 // inline highlight with word diff -#define DIFF_ANCHOR 0x20000 // use 'diffanchors' to anchor the diff -#define ALL_WHITE_DIFF (DIFF_IWHITE | DIFF_IWHITEALL | DIFF_IWHITEEOL) -#define ALL_INLINE (DIFF_INLINE_NONE | DIFF_INLINE_SIMPLE | DIFF_INLINE_CHAR | DIFF_INLINE_WORD) -#define ALL_INLINE_DIFF (DIFF_INLINE_CHAR | DIFF_INLINE_WORD) +# define DIFF_FILLER 0x001 // display filler lines +# define DIFF_IBLANK 0x002 // ignore empty lines +# define DIFF_ICASE 0x004 // ignore case +# define DIFF_IWHITE 0x008 // ignore change in white space +# define DIFF_IWHITEALL 0x010 // ignore all white space changes +# define DIFF_IWHITEEOL 0x020 // ignore change in white space at EOL +# define DIFF_HORIZONTAL 0x040 // horizontal splits +# define DIFF_VERTICAL 0x080 // vertical splits +# define DIFF_HIDDEN_OFF 0x100 // diffoff when hidden +# define DIFF_INTERNAL 0x200 // use internal xdiff algorithm +# define DIFF_CLOSE_OFF 0x400 // diffoff when closing window +# define DIFF_FOLLOWWRAP 0x800 // follow the wrap option +# define DIFF_LINEMATCH 0x1000 // match most similar lines within diff +# define DIFF_INLINE_NONE 0x2000 // no inline highlight +# define DIFF_INLINE_SIMPLE 0x4000 // inline highlight with simple algorithm +# define DIFF_INLINE_CHAR 0x8000 // inline highlight with character diff +# define DIFF_INLINE_WORD 0x10000 // inline highlight with word diff +# define DIFF_ANCHOR 0x20000 // use 'diffanchors' to anchor the diff +# define ALL_WHITE_DIFF (DIFF_IWHITE | DIFF_IWHITEALL | DIFF_IWHITEEOL) +# define ALL_INLINE (DIFF_INLINE_NONE | DIFF_INLINE_SIMPLE | DIFF_INLINE_CHAR | DIFF_INLINE_WORD) +# define ALL_INLINE_DIFF (DIFF_INLINE_CHAR | DIFF_INLINE_WORD) static int diff_flags = DIFF_INTERNAL | DIFF_FILLER | DIFF_CLOSE_OFF | DIFF_INLINE_CHAR; static long diff_algorithm = XDF_INDENT_HEURISTIC; -#define LBUFLEN 50 // length of line in diff file +# define LBUFLEN 50 // length of line in diff file // Max file size xdiff is equipped to deal with. The value (1GB - 1MB) comes // from Git's implementation. -#define MAX_XDIFF_SIZE (1024L * 1024 * 1023) +# define MAX_XDIFF_SIZE (1024L * 1024 * 1023) static int diff_a_works = MAYBE; // TRUE when "diff -a" works, FALSE when it // doesn't work, MAYBE when not checked yet -#if defined(MSWIN) +# if defined(MSWIN) static int diff_bin_works = MAYBE; // TRUE when "diff --binary" works, FALSE // when it doesn't work, MAYBE when not // checked yet -#endif +# endif -#define MAX_DIFF_ANCHORS 20 +# define MAX_DIFF_ANCHORS 20 // used for diff input typedef struct { @@ -110,9 +110,9 @@ static int check_external_diff(diffio_T *diffio); static int diff_file(diffio_T *diffio); static int diff_equal_entry(diff_T *dp, int idx1, int idx2); static int diff_cmp(char_u *s1, char_u *s2); -#ifdef FEAT_FOLDING +# ifdef FEAT_FOLDING static void diff_fold_update(diff_T *dp, int skip_idx); -#endif +# endif static void diff_read(int idx_orig, int idx_new, diffio_T *dio); static void diff_copy_entry(diff_T *dprev, diff_T *dp, int idx_orig, int idx_new); static diff_T *diff_alloc_new(tabpage_T *tp, diff_T *dprev, diff_T *dp); @@ -122,7 +122,7 @@ static int xdiff_out_indices(long start_a, long count_a, long start_b, long coun static int xdiff_out_unified(void *priv, mmbuffer_t *mb, int nbuf); static int parse_diffanchors(int check_only, buf_T *buf, linenr_T *anchors, int *num_anchors); -#define FOR_ALL_DIFFBLOCKS_IN_TAB(tp, dp) \ +# define FOR_ALL_DIFFBLOCKS_IN_TAB(tp, dp) \ for ((dp) = (tp)->tp_first_diff; (dp) != NULL; (dp) = (dp)->df_next) static void @@ -734,10 +734,10 @@ diff_redraw( redraw_win_later(wp, UPD_SOME_VALID); if (wp != curwin) wp_other = wp; -#ifdef FEAT_FOLDING +# ifdef FEAT_FOLDING if (dofold && foldmethodIsDiff(wp)) foldUpdateAll(wp); -#endif +# endif // A change may have made filler lines invalid, need to take care of // that for other windows. n = diff_check_fill(wp, wp->w_topline); @@ -1102,9 +1102,9 @@ theend: diff_internal(void) { return (diff_flags & DIFF_INTERNAL) != 0 -#ifdef FEAT_EVAL +# ifdef FEAT_EVAL && *p_dex == NUL -#endif +# endif ; } @@ -1246,13 +1246,13 @@ check_external_diff(diffio_T *diffio) mch_remove(diffio->dio_orig.din_fname); } -#ifdef FEAT_EVAL +# ifdef FEAT_EVAL // When using 'diffexpr' break here. if (*p_dex != NUL) break; -#endif +# endif -#if defined(MSWIN) +# if defined(MSWIN) // If the "-a" argument works, also check if "--binary" works. if (ok && diff_a_works == MAYBE && diff_bin_works == MAYBE) { @@ -1266,7 +1266,7 @@ check_external_diff(diffio_T *diffio) diff_bin_works = FALSE; ok = TRUE; } -#endif +# endif // If we checked if "-a" works already, break here. if (diff_a_works != MAYBE) @@ -1283,9 +1283,9 @@ check_external_diff(diffio_T *diffio) emsg(_(e_cannot_read_or_write_temp_files)); emsg(_(e_cannot_create_diffs)); diff_a_works = MAYBE; -#if defined(MSWIN) +# if defined(MSWIN) diff_bin_works = MAYBE; -#endif +# endif return FAIL; } return OK; @@ -1351,7 +1351,7 @@ diff_file(diffio_T *dio) char_u *tmp_new = dio->dio_new.din_fname; char_u *tmp_diff = dio->dio_diff.dout_fname; -#ifdef FEAT_EVAL +# ifdef FEAT_EVAL if (*p_dex != NUL) { // Use 'diffexpr' to generate the diff file. @@ -1359,7 +1359,7 @@ diff_file(diffio_T *dio) return OK; } else -#endif +# endif // Use xdiff for generating the diff. if (dio->dio_internal) return diff_file_internal(dio); @@ -1379,11 +1379,11 @@ diff_file(diffio_T *dio) // non-zero when differences have been found. vim_snprintf((char *)cmd, len, "diff %s%s%s%s%s%s%s%s %s", diff_a_works == FALSE ? "" : "-a ", -#if defined(MSWIN) +# if defined(MSWIN) diff_bin_works == TRUE ? "--binary " : "", -#else +# else "", -#endif +# endif (diff_flags & DIFF_IWHITE) ? "-b " : "", (diff_flags & DIFF_IWHITEALL) ? "-w " : "", (diff_flags & DIFF_IWHITEEOL) ? "-Z " : "", @@ -1412,18 +1412,18 @@ ex_diffpatch(exarg_T *eap) size_t buflen; win_T *old_curwin = curwin; char_u *newname = NULL; // name of patched file buffer -#ifdef UNIX +# ifdef UNIX char_u dirbuf[MAXPATHL]; char_u *fullname = NULL; -#endif -#ifdef FEAT_BROWSE +# endif +# ifdef FEAT_BROWSE char_u *browseFile = NULL; int save_cmod_flags = cmdmod.cmod_flags; -#endif +# endif stat_T st; char_u *esc_name = NULL; -#ifdef FEAT_BROWSE +# ifdef FEAT_BROWSE if (cmdmod.cmod_flags & CMOD_BROWSE) { browseFile = do_browse(0, (char_u *)_("Patch file"), @@ -1434,7 +1434,7 @@ ex_diffpatch(exarg_T *eap) eap->arg = browseFile; cmdmod.cmod_flags &= ~CMOD_BROWSE; // don't let do_ecmd() browse again } -#endif +# endif // We need two temp file names. tmp_orig = vim_tempname('o', FALSE); @@ -1448,10 +1448,10 @@ ex_diffpatch(exarg_T *eap) NULL, FALSE, FALSE, FALSE, TRUE) == FAIL) goto theend; -#ifdef UNIX +# ifdef UNIX // Get the absolute path of the patchfile, changing directory below. fullname = FullName_save(eap->arg, FALSE); -#endif +# endif esc_name = vim_strsave_shellescape( # ifdef UNIX fullname != NULL ? fullname : @@ -1464,7 +1464,7 @@ ex_diffpatch(exarg_T *eap) if (buf == NULL) goto theend; -#ifdef UNIX +# ifdef UNIX // Temporarily chdir to /tmp, to avoid patching files in the current // directory when the patch file contains more than one patch. When we // have our own temp dir use that instead, it will be cleaned up when we @@ -1474,26 +1474,26 @@ ex_diffpatch(exarg_T *eap) dirbuf[0] = NUL; else { -# ifdef TEMPDIRNAMES +# ifdef TEMPDIRNAMES if (vim_tempdir != NULL) vim_ignored = mch_chdir((char *)vim_tempdir); else -# endif +# endif vim_ignored = mch_chdir("/tmp"); shorten_fnames(TRUE); } -#endif +# endif -#ifdef FEAT_EVAL +# ifdef FEAT_EVAL if (*p_pex != NUL) // Use 'patchexpr' to generate the new file. eval_patch(tmp_orig, -# ifdef UNIX +# ifdef UNIX fullname != NULL ? fullname : -# endif +# endif eap->arg, tmp_new); else -#endif +# endif { if (check_restricted()) goto theend; @@ -1507,14 +1507,14 @@ ex_diffpatch(exarg_T *eap) unblock_autocmds(); } -#ifdef UNIX +# ifdef UNIX if (dirbuf[0] != NUL) { if (mch_chdir((char *)dirbuf) != 0) emsg(_(e_cannot_go_back_to_previous_directory)); shorten_fnames(TRUE); } -#endif +# endif // patch probably has written over the screen redraw_later(UPD_CLEAR); @@ -1540,9 +1540,9 @@ ex_diffpatch(exarg_T *eap) STRCAT(newname, ".new"); } -#ifdef FEAT_GUI +# ifdef FEAT_GUI need_mouse_correct = TRUE; -#endif +# endif // don't use a new tab page, each tab page has its own diffs cmdmod.cmod_tab = 0; @@ -1584,14 +1584,14 @@ theend: vim_free(tmp_new); vim_free(newname); vim_free(buf); -#ifdef UNIX +# ifdef UNIX vim_free(fullname); -#endif +# endif vim_free(esc_name); -#ifdef FEAT_BROWSE +# ifdef FEAT_BROWSE vim_free(browseFile); cmdmod.cmod_flags = save_cmod_flags; -#endif +# endif } /* @@ -1604,9 +1604,9 @@ ex_diffsplit(exarg_T *eap) bufref_T old_curbuf; set_bufref(&old_curbuf, curbuf); -#ifdef FEAT_GUI +# ifdef FEAT_GUI need_mouse_correct = TRUE; -#endif +# endif // Need to compute w_fraction when no redraw happened yet. validate_cursor(); set_fraction(curwin); @@ -1764,7 +1764,7 @@ ex_diffoff(exarg_T *eap) wp->w_leftcol = 0; } } -#ifdef FEAT_FOLDING +# ifdef FEAT_FOLDING free_string_option(wp->w_p_fdm); wp->w_p_fdm = vim_strsave( *wp->w_p_fdm_save ? wp->w_p_fdm_save : (char_u*)"manual"); @@ -1781,7 +1781,7 @@ ex_diffoff(exarg_T *eap) : wp->w_p_fen_save; foldUpdateAll(wp); -#endif +# endif } // remove filler lines wp->w_topfill = 0; @@ -2456,11 +2456,11 @@ diff_check_with_linestatus(win_T *wp, linenr_T lnum, int *linestatus) if (idx == DB_COUNT) return 0; // no diffs for buffer "buf" -#ifdef FEAT_FOLDING +# ifdef FEAT_FOLDING // A closed fold never has filler lines. if (hasFoldingWin(wp, lnum, NULL, NULL, TRUE, NULL)) return 0; -#endif +# endif // search for a change that includes "lnum" in the list of diffblocks. FOR_ALL_DIFFBLOCKS_IN_TAB(curtab, dp) @@ -2753,10 +2753,10 @@ diff_set_topline(win_T *fromwin, win_T *towin) changed_line_abv_curs_win(towin); check_topfill(towin, FALSE); -#ifdef FEAT_FOLDING +# ifdef FEAT_FOLDING (void)hasFoldingWin(towin, towin->w_topline, &towin->w_topline, NULL, TRUE, NULL); -#endif +# endif } /* @@ -3832,7 +3832,7 @@ diff_find_change( return added; } -#if defined(FEAT_FOLDING) +# if defined(FEAT_FOLDING) /* * Return TRUE if line "lnum" is not close to a diff block, this line should * be in a fold. @@ -3880,7 +3880,7 @@ diff_infold(win_T *wp, linenr_T lnum) } return TRUE; } -#endif +# endif /* * "dp" and "do" commands. @@ -3891,13 +3891,13 @@ nv_diffgetput(int put, long count) exarg_T ea; char_u buf[30]; -#ifdef FEAT_JOB_CHANNEL +# ifdef FEAT_JOB_CHANNEL if (bt_prompt(curbuf)) { vim_beep(BO_OPER); return; } -#endif +# endif if (count == 0) ea.arg = (char_u *)""; else @@ -4227,9 +4227,9 @@ ex_diffgetput(exarg_T *eap) if (dfree != NULL) { // Diff is deleted, update folds in other windows. -#ifdef FEAT_FOLDING +# ifdef FEAT_FOLDING diff_fold_update(dfree, idx_to); -#endif +# endif clear_diffblock(dfree); } @@ -4277,7 +4277,7 @@ theend: check_cursor(); changed_line_abv_curs(); -#ifdef FEAT_FOLDING +# ifdef FEAT_FOLDING // If all diffs are gone, update folds in all diff windows. if (curtab->tp_first_diff == NULL) { @@ -4287,7 +4287,7 @@ theend: if (wp->w_p_diff && wp->w_p_fdm[0] == 'd' && wp->w_p_fen) foldUpdateAll(wp); } -#endif +# endif if (diff_need_update) // redraw already done by ex_diffupdate() @@ -4300,7 +4300,7 @@ theend: } } -#ifdef FEAT_FOLDING +# ifdef FEAT_FOLDING /* * Update folds for all diff buffers for entry "dp". * Skip buffer with index "skip_idx". @@ -4318,7 +4318,7 @@ diff_fold_update(diff_T *dp, int skip_idx) foldUpdate(wp, dp->df_lnum[i], dp->df_lnum[i] + dp->df_count[i]); } -#endif +# endif /* * Return TRUE if buffer "buf" is in diff-mode. diff --git a/src/digraph.c b/src/digraph.c index 481cc4a3cf..4320e57a37 100644 --- a/src/digraph.c +++ b/src/digraph.c @@ -116,7 +116,7 @@ static digr_T digraphdefault[] = { {'P', 'M', 0x9e}, {'A', 'C', 0x9f}, {'N', 'S', 0xa0}, -# define DG_START_LATIN 0xa1 +# define DG_START_LATIN 0xa1 {'!', 'I', 0xa1}, {'~', '!', 0xa1}, // ¡ Vim 5.x compatible {'C', 't', 0xa2}, @@ -265,7 +265,7 @@ static digr_T digraphdefault[] = { {'y', ':', 0xff}, {'y', '"', 0xff}, // x XX Vim 5.x compatible -# define USE_UNICODE_DIGRAPHS +# define USE_UNICODE_DIGRAPHS {'A', '-', 0x0100}, {'a', '-', 0x0101}, @@ -440,7 +440,7 @@ static digr_T digraphdefault[] = { {'\'', '0', 0x02da}, {'\'', ';', 0x02db}, {'\'', '"', 0x02dd}, -# define DG_START_GREEK 0x0386 +# define DG_START_GREEK 0x0386 {'A', '%', 0x0386}, {'E', '%', 0x0388}, {'Y', '%', 0x0389}, @@ -522,7 +522,7 @@ static digr_T digraphdefault[] = { {'p', '3', 0x03e1}, {'\'', '%', 0x03f4}, {'j', '3', 0x03f5}, -# define DG_START_CYRILLIC 0x0401 +# define DG_START_CYRILLIC 0x0401 {'I', 'O', 0x0401}, {'D', '%', 0x0402}, {'G', '%', 0x0403}, @@ -627,7 +627,7 @@ static digr_T digraphdefault[] = { {'c', '3', 0x0481}, {'G', '3', 0x0490}, {'g', '3', 0x0491}, -# define DG_START_HEBREW 0x05d0 +# define DG_START_HEBREW 0x05d0 {'A', '+', 0x05d0}, {'B', '+', 0x05d1}, {'G', '+', 0x05d2}, @@ -655,7 +655,7 @@ static digr_T digraphdefault[] = { {'R', '+', 0x05e8}, {'S', 'h', 0x05e9}, {'T', '+', 0x05ea}, -# define DG_START_ARABIC 0x060c +# define DG_START_ARABIC 0x060c {',', '+', 0x060c}, {';', '+', 0x061b}, {'?', '+', 0x061f}, @@ -718,7 +718,7 @@ static digr_T digraphdefault[] = { {'7', 'a', 0x06f7}, {'8', 'a', 0x06f8}, {'9', 'a', 0x06f9}, -# define DG_START_LATIN_EXTENDED 0x1e02 +# define DG_START_LATIN_EXTENDED 0x1e02 {'B', '.', 0x1e02}, {'b', '.', 0x1e03}, {'B', '_', 0x1e06}, @@ -813,7 +813,7 @@ static digr_T digraphdefault[] = { {'y', '2', 0x1ef7}, {'Y', '?', 0x1ef8}, {'y', '?', 0x1ef9}, -# define DG_START_GREEK_EXTENDED 0x1f00 +# define DG_START_GREEK_EXTENDED 0x1f00 {';', '\'', 0x1f00}, {',', '\'', 0x1f01}, {';', '!', 0x1f02}, @@ -822,7 +822,7 @@ static digr_T digraphdefault[] = { {'?', ',', 0x1f05}, {'!', ':', 0x1f06}, {'?', ':', 0x1f07}, -# define DG_START_PUNCTUATION 0x2002 +# define DG_START_PUNCTUATION 0x2002 {'1', 'N', 0x2002}, {'1', 'M', 0x2003}, {'3', 'M', 0x2004}, @@ -863,7 +863,7 @@ static digr_T digraphdefault[] = { {':', 'X', 0x203b}, {'\'', '-', 0x203e}, {'/', 'f', 0x2044}, -# define DG_START_SUB_SUPER 0x2070 +# define DG_START_SUB_SUPER 0x2070 {'0', 'S', 0x2070}, {'4', 'S', 0x2074}, {'5', 'S', 0x2075}, @@ -892,7 +892,7 @@ static digr_T digraphdefault[] = { {'=', 's', 0x208c}, {'(', 's', 0x208d}, {')', 's', 0x208e}, -# define DG_START_CURRENCY 0x20a4 +# define DG_START_CURRENCY 0x20a4 {'L', 'i', 0x20a4}, {'P', 't', 0x20a7}, {'W', '=', 0x20a9}, @@ -900,7 +900,7 @@ static digr_T digraphdefault[] = { {'E', 'u', 0x20ac}, // euro {'=', 'R', 0x20bd}, // rouble {'=', 'P', 0x20bd}, // rouble -# define DG_START_OTHER1 0x2103 +# define DG_START_OTHER1 0x2103 {'o', 'C', 0x2103}, {'c', 'o', 0x2105}, {'o', 'F', 0x2109}, @@ -923,7 +923,7 @@ static digr_T digraphdefault[] = { {'3', '8', 0x215c}, {'5', '8', 0x215d}, {'7', '8', 0x215e}, -# define DG_START_ROMAN 0x2160 +# define DG_START_ROMAN 0x2160 {'1', 'R', 0x2160}, {'2', 'R', 0x2161}, {'3', 'R', 0x2162}, @@ -948,7 +948,7 @@ static digr_T digraphdefault[] = { {'a', 'r', 0x2179}, {'b', 'r', 0x217a}, {'c', 'r', 0x217b}, -# define DG_START_ARROWS 0x2190 +# define DG_START_ARROWS 0x2190 {'<', '-', 0x2190}, {'-', '!', 0x2191}, {'-', '>', 0x2192}, @@ -958,7 +958,7 @@ static digr_T digraphdefault[] = { {'<', '=', 0x21d0}, {'=', '>', 0x21d2}, {'=', '=', 0x21d4}, -# define DG_START_MATH 0x2200 +# define DG_START_MATH 0x2200 {'F', 'A', 0x2200}, {'d', 'P', 0x2202}, {'T', 'E', 0x2203}, @@ -1017,7 +1017,7 @@ static digr_T digraphdefault[] = { {'.', 'P', 0x22c5}, {':', '3', 0x22ee}, {'.', '3', 0x22ef}, -# define DG_START_TECHNICAL 0x2302 +# define DG_START_TECHNICAL 0x2302 {'E', 'h', 0x2302}, {'<', '7', 0x2308}, {'>', '7', 0x2309}, @@ -1030,7 +1030,7 @@ static digr_T digraphdefault[] = { {'I', 'l', 0x2321}, {'<', '[', 0x27e8}, {']', '>', 0x27e9}, -# define DG_START_OTHER2 0x2423 +# define DG_START_OTHER2 0x2423 {'V', 's', 0x2423}, {'1', 'h', 0x2440}, {'3', 'h', 0x2441}, @@ -1049,7 +1049,7 @@ static digr_T digraphdefault[] = { {'7', '.', 0x248e}, {'8', '.', 0x248f}, {'9', '.', 0x2490}, -# define DG_START_DRAWING 0x2500 +# define DG_START_DRAWING 0x2500 {'h', 'h', 0x2500}, {'H', 'H', 0x2501}, {'v', 'v', 0x2502}, @@ -1100,7 +1100,7 @@ static digr_T digraphdefault[] = { {'V', 'H', 0x254b}, {'F', 'D', 0x2571}, {'B', 'D', 0x2572}, -# define DG_START_BLOCK 0x2580 +# define DG_START_BLOCK 0x2580 {'T', 'B', 0x2580}, {'L', 'B', 0x2584}, {'F', 'B', 0x2588}, @@ -1109,7 +1109,7 @@ static digr_T digraphdefault[] = { {'.', 'S', 0x2591}, {':', 'S', 0x2592}, {'?', 'S', 0x2593}, -# define DG_START_SHAPES 0x25a0 +# define DG_START_SHAPES 0x25a0 {'f', 'S', 0x25a0}, {'O', 'S', 0x25a1}, {'R', 'O', 0x25a2}, @@ -1143,7 +1143,7 @@ static digr_T digraphdefault[] = { {'I', 'c', 0x25d9}, {'F', 'd', 0x25e2}, {'B', 'd', 0x25e3}, -# define DG_START_SYMBOLS 0x2605 +# define DG_START_SYMBOLS 0x2605 {'*', '2', 0x2605}, {'*', '1', 0x2606}, {'<', 'H', 0x261c}, @@ -1163,11 +1163,11 @@ static digr_T digraphdefault[] = { {'M', 'b', 0x266d}, {'M', 'x', 0x266e}, {'M', 'X', 0x266f}, -# define DG_START_DINGBATS 0x2713 +# define DG_START_DINGBATS 0x2713 {'O', 'K', 0x2713}, {'X', 'X', 0x2717}, {'-', 'X', 0x2720}, -# define DG_START_CJK_SYMBOLS 0x3000 +# define DG_START_CJK_SYMBOLS 0x3000 {'I', 'S', 0x3000}, {',', '_', 0x3001}, {'.', '_', 0x3002}, @@ -1193,7 +1193,7 @@ static digr_T digraphdefault[] = { {'(', 'I', 0x3016}, {')', 'I', 0x3017}, {'-', '?', 0x301c}, -# define DG_START_HIRAGANA 0x3041 +# define DG_START_HIRAGANA 0x3041 {'A', '5', 0x3041}, {'a', '5', 0x3042}, {'I', '5', 0x3043}, @@ -1282,7 +1282,7 @@ static digr_T digraphdefault[] = { {'0', '5', 0x309c}, {'*', '5', 0x309d}, {'+', '5', 0x309e}, -# define DG_START_KATAKANA 0x30a1 +# define DG_START_KATAKANA 0x30a1 {'a', '6', 0x30a1}, {'A', '6', 0x30a2}, {'i', '6', 0x30a3}, @@ -1377,7 +1377,7 @@ static digr_T digraphdefault[] = { {'-', '6', 0x30fc}, {'*', '6', 0x30fd}, {'+', '6', 0x30fe}, -# define DG_START_BOPOMOFO 0x3105 +# define DG_START_BOPOMOFO 0x3105 {'b', '4', 0x3105}, {'p', '4', 0x3106}, {'m', '4', 0x3107}, @@ -1417,7 +1417,7 @@ static digr_T digraphdefault[] = { {'v', '4', 0x312a}, {'n', 'G', 0x312b}, {'g', 'n', 0x312c}, -# define DG_START_OTHER3 0x3220 +# define DG_START_OTHER3 0x3220 {'1', 'c', 0x3220}, {'2', 'c', 0x3221}, {'3', 'c', 0x3222}, @@ -1476,7 +1476,7 @@ get_digraph_for_char(int val_arg) digr_T *dp; static char_u r[3]; -#if defined(USE_UNICODE_DIGRAPHS) +# if defined(USE_UNICODE_DIGRAPHS) if (!enc_utf8) { char_u buf[6], *to; @@ -1497,7 +1497,7 @@ get_digraph_for_char(int val_arg) (void)convert_setup(&vc, NULL, NULL); } } -#endif +# endif for (use_defaults = 0; use_defaults <= 1; use_defaults++) { @@ -1546,9 +1546,9 @@ get_digraph( if (cmdline) { if (char2cells(c) == 1 -#if defined(FEAT_CRYPT) || defined(FEAT_EVAL) +# if defined(FEAT_CRYPT) || defined(FEAT_EVAL) && cmdline_star == 0 -#endif +# endif ) putcmdline(c, TRUE); } @@ -1609,7 +1609,7 @@ getexactdigraph(int char1, int char2, int meta_char) ++dp; } } -#ifdef USE_UNICODE_DIGRAPHS +# ifdef USE_UNICODE_DIGRAPHS if (retval != 0 && !enc_utf8) { char_u buf[6], *to; @@ -1633,7 +1633,7 @@ getexactdigraph(int char1, int char2, int meta_char) (void)convert_setup(&vc, NULL, NULL); } } -#endif +# endif // Ignore multi-byte characters when not in multi-byte mode. if (!has_mbyte && retval > 0xff) @@ -1755,7 +1755,7 @@ putdigraph(char_u *str) } } -#if defined(USE_UNICODE_DIGRAPHS) +# if defined(USE_UNICODE_DIGRAPHS) static void digraph_header(char *msg) { @@ -1764,7 +1764,7 @@ digraph_header(char *msg) msg_outtrans_attr((char_u *)msg, HL_ATTR(HLF_CM)); msg_putchar('\n'); } -#endif +# endif void listdigraphs(int use_headers) @@ -1778,7 +1778,7 @@ listdigraphs(int use_headers) dp = digraphdefault; while (dp->char1 != NUL && !got_int) { -#if defined(USE_UNICODE_DIGRAPHS) +# if defined(USE_UNICODE_DIGRAPHS) digr_T tmp; // May need to convert the result to 'encoding'. @@ -1788,12 +1788,12 @@ listdigraphs(int use_headers) if (tmp.result != 0 && tmp.result != tmp.char2 && (has_mbyte || tmp.result <= 255)) printdigraph(&tmp, use_headers ? &previous : NULL); -#else +# else if (getexactdigraph(dp->char1, dp->char2, FALSE) == dp->result && (has_mbyte || dp->result <= 255)) printdigraph(dp, use_headers ? &previous : NULL); -#endif +# endif ++dp; ui_breakcheck(); } @@ -1801,11 +1801,11 @@ listdigraphs(int use_headers) dp = (digr_T *)user_digraphs.ga_data; for (i = 0; i < user_digraphs.ga_len && !got_int; ++i) { -#if defined(USE_UNICODE_DIGRAPHS) +# if defined(USE_UNICODE_DIGRAPHS) if (previous >= 0 && use_headers) digraph_header(_("Custom")); previous = -1; -#endif +# endif printdigraph(dp, NULL); ui_breakcheck(); ++dp; @@ -1881,7 +1881,7 @@ digraph_getlist_common(int list_all, typval_T *rettv) dp = digraphdefault; while (dp->char1 != NUL && !got_int) { -#ifdef USE_UNICODE_DIGRAPHS +# ifdef USE_UNICODE_DIGRAPHS digr_T tmp; tmp.char1 = dp->char1; @@ -1890,11 +1890,11 @@ digraph_getlist_common(int list_all, typval_T *rettv) if (tmp.result != 0 && tmp.result != tmp.char2 && (has_mbyte || tmp.result <= 255)) digraph_getlist_appendpair(&tmp, rettv->vval.v_list); -#else +# else if (getexactdigraph(dp->char1, dp->char2, FALSE) == dp->result && (has_mbyte || dp->result <= 255)) digraph_getlist_appendpair(dp, rettv->vval.v_list); -#endif +# endif ++dp; } } @@ -1956,7 +1956,7 @@ printdigraph(digr_T *dp, result_T *previous) if (dp->result == 0) return; -#if defined(USE_UNICODE_DIGRAPHS) +# if defined(USE_UNICODE_DIGRAPHS) if (previous != NULL) { int i; @@ -1971,7 +1971,7 @@ printdigraph(digr_T *dp, result_T *previous) } *previous = dp->result; } -#endif +# endif if (msg_col > cmdline_width - list_width) msg_putchar('\n'); if (msg_col) @@ -2224,7 +2224,7 @@ typedef struct char_u *to; } kmap_T; -#define KMAP_MAXLEN 20 // maximum length of "from" or "to" +# define KMAP_MAXLEN 20 // maximum length of "from" or "to" static void keymap_unload(void); @@ -2288,7 +2288,7 @@ ex_loadkeymap(exarg_T *eap) char_u *p; char_u *s; kmap_T *kp; -#define KMAP_LLEN 200 // max length of "to" and "from" together +# define KMAP_LLEN 200 // max length of "to" and "from" together char_u buf[KMAP_LLEN + 11]; int i; char_u *save_cpo = p_cpo; diff --git a/src/dosinst.h b/src/dosinst.h index f1d3dc6eb5..82641f647a 100644 --- a/src/dosinst.h +++ b/src/dosinst.h @@ -66,12 +66,12 @@ char *searchpath(char *name); * Modern way of creating registry entries, also works on 64 bit windows when * compiled as a 32 bit program. */ -# ifndef KEY_WOW64_64KEY -# define KEY_WOW64_64KEY 0x0100 -# endif -# ifndef KEY_WOW64_32KEY -# define KEY_WOW64_32KEY 0x0200 -# endif +#ifndef KEY_WOW64_64KEY +# define KEY_WOW64_64KEY 0x0100 +#endif +#ifndef KEY_WOW64_32KEY +# define KEY_WOW64_32KEY 0x0200 +#endif #ifdef __MINGW32__ # define UNUSED __attribute__((unused)) diff --git a/src/drawline.c b/src/drawline.c index 59d725d2ad..ef776dc204 100644 --- a/src/drawline.c +++ b/src/drawline.c @@ -300,9 +300,9 @@ get_sign_display_info( } if (wlv->row == wlv->startrow -#ifdef FEAT_DIFF +# ifdef FEAT_DIFF + wlv->filler_lines && wlv->filler_todo <= 0 -#endif +# endif ) { text_sign = (wlv->sattr.sat_text != NULL) ? wlv->sattr.sat_typenr : 0; @@ -1356,9 +1356,9 @@ win_line( else { did_emsg = save_did_emsg; -#ifdef SYN_TIME_LIMIT +# ifdef SYN_TIME_LIMIT if (!wp->w_s->b_syn_slow) -#endif +# endif { has_syntax = TRUE; extra_check = TRUE; @@ -2724,9 +2724,9 @@ win_line( // If a double-width char doesn't fit display a '>' in the // last column. if (( -# ifdef FEAT_RIGHTLEFT +#ifdef FEAT_RIGHTLEFT wp->w_p_rl ? (wlv.col <= 0) : -# endif +#endif (wlv.col >= wp->w_width - 1)) && (*mb_char2cells)(mb_c) == 2) { @@ -2853,10 +2853,10 @@ win_line( // Illegal UTF-8 byte: display as . // Non-BMP character : display as ? or fullwidth ?. transchar_hex(wlv.extra, mb_c); -# ifdef FEAT_RIGHTLEFT +#ifdef FEAT_RIGHTLEFT if (wp->w_p_rl) // reverse rl_mirror(wlv.extra); -# endif +#endif wlv.p_extra = wlv.extra; c = *wlv.p_extra; mb_c = mb_ptr2char_adv(&wlv.p_extra); @@ -2951,9 +2951,9 @@ win_line( // last column; the character is displayed at the start of the // next line. if (( -# ifdef FEAT_RIGHTLEFT +#ifdef FEAT_RIGHTLEFT wp->w_p_rl ? (wlv.col <= 0) : -# endif +#endif (wlv.col >= wp->w_width - 1)) && (*mb_char2cells)(mb_c) == 2) { @@ -3417,9 +3417,9 @@ win_line( && wlv.tocol > wlv.vcol && VIsual_mode != Ctrl_V && ( -# ifdef FEAT_RIGHTLEFT +#ifdef FEAT_RIGHTLEFT wp->w_p_rl ? (wlv.col >= 0) : -# endif +#endif (wlv.col < wp->w_width)) && !(noinvcur && lnum == wp->w_cursor.lnum @@ -3572,13 +3572,13 @@ win_line( || (wp->w_p_list && wp->w_lcs_chars.eol > 0))) wlv.char_attr = wlv.line_attr; -#ifdef FEAT_SIGNS +# ifdef FEAT_SIGNS // At end of line: if Sign is present with line highlight, reset char_attr // but not when cursorline is active if (sign_present && wlv.sattr.sat_linehl > 0 && wlv.draw_state == WL_LINE && !(wp->w_p_cul && lnum == wp->w_cursor.lnum)) wlv.char_attr = wlv.sattr.sat_linehl; -#endif +# endif # ifdef FEAT_DIFF if (wlv.diff_hlf == HLF_TXD || wlv.diff_hlf == HLF_TXA) { diff --git a/src/drawscreen.c b/src/drawscreen.c index ba6901d08b..79c0483e18 100644 --- a/src/drawscreen.c +++ b/src/drawscreen.c @@ -911,13 +911,13 @@ text_to_screenline(win_T *wp, char_u *text, int col) if (*p < 0x80 && u8cc[0] == 0) { ScreenLinesUC[idx] = 0; -#ifdef FEAT_ARABIC +# ifdef FEAT_ARABIC prev_c = u8c; -#endif +# endif } else { -#ifdef FEAT_ARABIC +# ifdef FEAT_ARABIC if (p_arshape && !p_tbidi && ARABIC_CHAR(u8c)) { // Do Arabic shaping. @@ -948,7 +948,7 @@ text_to_screenline(win_T *wp, char_u *text, int col) } else prev_c = u8c; -#endif +# endif // Non-BMP character: display as ? or fullwidth ?. ScreenLinesUC[idx] = u8c; for (i = 0; i < Screen_mco; ++i) @@ -981,11 +981,11 @@ text_to_screenline(win_T *wp, char_u *text, int col) len = n; if (len > 0) { -#ifdef FEAT_RIGHTLEFT +# ifdef FEAT_RIGHTLEFT if (wp->w_p_rl) mch_memmove(current_ScreenLine, text, len); else -#endif +# endif mch_memmove(current_ScreenLine + col, text, len); col += len; } @@ -1125,8 +1125,8 @@ fold_line( ++col; } -#ifdef FEAT_RIGHTLEFT -# define RL_MEMSET(p, v, l) \ +# ifdef FEAT_RIGHTLEFT +# define RL_MEMSET(p, v, l) \ do { \ if (wp->w_p_rl) \ for (ri = 0; ri < (l); ++ri) \ @@ -1135,13 +1135,13 @@ fold_line( for (ri = 0; ri < (l); ++ri) \ ScreenAttrs[off + (p) + ri] = v; \ } while (0) -#else -# define RL_MEMSET(p, v, l) \ +# else +# define RL_MEMSET(p, v, l) \ do { \ for (ri = 0; ri < l; ++ri) \ ScreenAttrs[off + (p) + ri] = v; \ } while (0) -#endif +# endif // 2. Add the 'foldcolumn' // Reduce the width when there is not enough space. @@ -1162,11 +1162,11 @@ fold_line( ch = mb_ptr2char_adv(&p); else ch = *p++; -#ifdef FEAT_RIGHTLEFT +# ifdef FEAT_RIGHTLEFT if (wp->w_p_rl) idx = off + wp->w_width - i - 1 - col; else -#endif +# endif idx = off + col + i; if (enc_utf8) { @@ -1194,7 +1194,7 @@ fold_line( // text RL_MEMSET(col, HL_ATTR(HLF_FL), wp->w_width - col); -#ifdef FEAT_SIGNS +# ifdef FEAT_SIGNS // If signs are being displayed, add two spaces. if (signcolumn_on(wp)) { @@ -1203,18 +1203,18 @@ fold_line( { if (len > 2) len = 2; -# ifdef FEAT_RIGHTLEFT +# ifdef FEAT_RIGHTLEFT if (wp->w_p_rl) // the line number isn't reversed copy_text_attr(off + wp->w_width - len - col, (char_u *)" ", len, HL_ATTR(HLF_FL)); else -# endif +# endif copy_text_attr(off + col, (char_u *)" ", len, HL_ATTR(HLF_FL)); col += len; } } -#endif +# endif // 3. Add the 'number' or 'relativenumber' column if (wp->w_p_nu || wp->w_p_rnu) @@ -1246,13 +1246,13 @@ fold_line( } vim_snprintf((char *)buf, sizeof(buf), fmt, w, num); -#ifdef FEAT_RIGHTLEFT +# ifdef FEAT_RIGHTLEFT if (wp->w_p_rl) // the line number isn't reversed copy_text_attr(off + wp->w_width - len - col, buf, len, HL_ATTR(HLF_FL)); else -#endif +# endif copy_text_attr(off + col, buf, len, HL_ATTR(HLF_FL)); col += len; } @@ -1270,14 +1270,14 @@ fold_line( col = text_to_screenline(wp, text, col); // Fill the rest of the line with the fold filler -#ifdef FEAT_RIGHTLEFT +# ifdef FEAT_RIGHTLEFT if (wp->w_p_rl) col -= txtcol; -#endif +# endif while (col < wp->w_width -#ifdef FEAT_RIGHTLEFT +# ifdef FEAT_RIGHTLEFT - (wp->w_p_rl ? txtcol : 0) -#endif +# endif ) { int c = wp->w_fill_chars.fold; @@ -1354,7 +1354,7 @@ fold_line( } } -#ifdef FEAT_SYN_HL +# ifdef FEAT_SYN_HL // Show colorcolumn in the fold line, but let cursorcolumn override it. if (wp->w_p_cc_cols) { @@ -1389,7 +1389,7 @@ fold_line( ScreenAttrs[off + txtcol] = hl_combine_attr( ScreenAttrs[off + txtcol], HL_ATTR(HLF_CUC)); } -#endif +# endif screen_line(wp, row + W_WINROW(wp), wp->w_wincol, wp->w_width, wp->w_width, -1, 0); @@ -2148,11 +2148,11 @@ win_update(win_T *wp) else if (!scrolled_down) srow += wp->w_lines[idx].wl_size; ++idx; -# ifdef FEAT_FOLDING +#ifdef FEAT_FOLDING if (idx < wp->w_lines_valid && wp->w_lines[idx].wl_valid) lnum = wp->w_lines[idx].wl_lnum; else -# endif +#endif ++lnum; } srow += mid_start; @@ -2842,19 +2842,19 @@ update_prepare(void) { cursor_off(); updating_screen = TRUE; -#ifdef FEAT_GUI +# ifdef FEAT_GUI // Remove the cursor before starting to do anything, because scrolling may // make it difficult to redraw the text under it. if (gui.in_use) gui_undraw_cursor(); -#endif -#ifdef FEAT_SEARCH_EXTRA +# endif +# ifdef FEAT_SEARCH_EXTRA start_search_hl(); -#endif -#ifdef FEAT_PROP_POPUP +# endif +# ifdef FEAT_PROP_POPUP // Update popup_mask if needed. may_update_popup_mask(must_redraw); -#endif +# endif } /* @@ -2908,9 +2908,9 @@ update_debug_sign(buf_T *buf, linenr_T lnum) if (!doit || updating_screen || State == MODE_ASKMORE || State == MODE_HITRETURN || msg_scrolled -#ifdef FEAT_GUI +# ifdef FEAT_GUI || gui.starting -#endif +# endif || starting) return; @@ -2925,10 +2925,10 @@ update_debug_sign(buf_T *buf, linenr_T lnum) win_redr_status(wp, FALSE); } -#if defined(FEAT_TABPANEL) +# if defined(FEAT_TABPANEL) if (redraw_tabpanel) draw_tabpanel(); -#endif +# endif update_finish(); } @@ -2948,13 +2948,13 @@ updateWindow(win_T *wp) update_prepare(); -#ifdef FEAT_CLIPBOARD +# ifdef FEAT_CLIPBOARD // When Visual area changed, may have to update selection. if (clip_star.available && clip_isautosel_star()) clip_update_selection(&clip_star); if (clip_plus.available && clip_isautosel_plus()) clip_update_selection(&clip_plus); -#endif +# endif win_update(wp); @@ -2962,10 +2962,10 @@ updateWindow(win_T *wp) if (redraw_tabline) draw_tabline(); -#if defined(FEAT_TABPANEL) +# if defined(FEAT_TABPANEL) if (redraw_tabpanel) draw_tabpanel(); -#endif +# endif if (wp->w_redr_status || p_ru # ifdef FEAT_STL_OPT @@ -2974,10 +2974,10 @@ updateWindow(win_T *wp) ) win_redr_status(wp, FALSE); -#ifdef FEAT_PROP_POPUP +# ifdef FEAT_PROP_POPUP // Display popup windows on top of everything. update_popups(win_update); -#endif +# endif update_finish(); } @@ -3250,9 +3250,9 @@ redraw_all_later(int type) redraw_all_windows_later(int type) { redraw_all_later(type); -#ifdef FEAT_PROP_POPUP +# ifdef FEAT_PROP_POPUP popup_redraw_all(); // redraw all popup windows -#endif +# endif } #endif diff --git a/src/edit.c b/src/edit.c index 891d51cf95..2392361fbf 100644 --- a/src/edit.c +++ b/src/edit.c @@ -1060,11 +1060,11 @@ doESCkey: break; case Ctrl_U: // delete all inserted text in current line -# ifdef FEAT_COMPL_FUNC +#ifdef FEAT_COMPL_FUNC // CTRL-X CTRL-U completes with 'completefunc'. if (ctrl_x_mode_function()) goto docomplete; -# endif +#endif did_backspace = ins_bs(c, BACKSPACE_LINE, &inserted_space); auto_format(FALSE, TRUE); inserted_space = FALSE; @@ -1532,24 +1532,24 @@ ins_redraw(int ready) // not busy with something // Trigger CursorMoved if the cursor moved. Not when the popup menu is // visible, the command might delete it. if (ready && (has_cursormovedI() -# ifdef FEAT_PROP_POPUP +#ifdef FEAT_PROP_POPUP || popup_visible -# endif -# if defined(FEAT_CONCEAL) +#endif +#if defined(FEAT_CONCEAL) || curwin->w_p_cole > 0 -# endif +#endif ) && !EQUAL_POS(last_cursormoved, curwin->w_cursor) && !pum_visible()) { -# ifdef FEAT_SYN_HL +#ifdef FEAT_SYN_HL // Need to update the screen first, to make sure syntax // highlighting is correct after making a change (e.g., inserting // a "(". The autocommand may also require a redraw, so it's done // again below, unfortunately. if (syntax_present(curwin) && must_redraw) update_screen(0); -# endif +#endif if (has_cursormovedI()) { // Make sure curswant is correct, an autocommand may call @@ -1561,14 +1561,14 @@ ins_redraw(int ready) // not busy with something if (popup_visible) popup_check_cursor_pos(); #endif -# ifdef FEAT_CONCEAL +#ifdef FEAT_CONCEAL if (curwin->w_p_cole > 0) { conceal_old_cursor_line = last_cursormoved.lnum; conceal_new_cursor_line = curwin->w_cursor.lnum; conceal_update_lines = TRUE; } -# endif +#endif last_cursormoved = curwin->w_cursor; } @@ -3923,14 +3923,14 @@ ins_start_select(int c) case K_KPAGEUP: case K_PAGEDOWN: case K_KPAGEDOWN: -# ifdef MACOS_X +#ifdef MACOS_X case K_LEFT: case K_RIGHT: case K_UP: case K_DOWN: case K_END: case K_HOME: -# endif +#endif if (!(mod_mask & MOD_MASK_SHIFT)) break; // FALLTHROUGH @@ -5357,9 +5357,9 @@ ins_digraph(void) add_to_showcmd_c(Ctrl_K); } -#ifdef USE_ON_FLY_SCROLL +# ifdef USE_ON_FLY_SCROLL dont_scroll = TRUE; // disallow scrolling here -#endif +# endif // don't map the digraph chars. This also prevents the // mode message to be deleted when ESC is hit diff --git a/src/errors.h b/src/errors.h index 67e88dba79..e767613f32 100644 --- a/src/errors.h +++ b/src/errors.h @@ -547,10 +547,10 @@ EXTERN char e_cannot_read_from_str[] INIT(= N_("E230: Cannot read from \"%s\"")); EXTERN char e_guifontwide_invalid[] INIT(= N_("E231: 'guifontwide' invalid")); -#ifdef FEAT_BEVAL_GUI +# ifdef FEAT_BEVAL_GUI EXTERN char e_cannot_create_ballooneval_with_both_message_and_callback[] INIT(= "E232: Cannot create BalloonEval with both message and callback"); -#endif +# endif # if defined(FEAT_GUI_GTK) || defined(FEAT_GUI_X11) EXTERN char e_cannot_open_display[] INIT(= N_("E233: Cannot open display")); @@ -1618,10 +1618,10 @@ EXTERN char e_missing_colon_str[] INIT(= N_("E627: Missing colon: %s")); EXTERN char e_missing_bang_or_slash_in_str[] INIT(= N_("E628: Missing ! or / in: %s")); -#ifdef NBDEBUG +# ifdef NBDEBUG EXTERN char e_bad_return_from_nb_do_cmd[] INIT(= "E629: Bad return from nb_do_cmd"); -#endif +# endif #endif #ifdef FEAT_JOB_CHANNEL EXTERN char e_str_write_while_not_connected[] @@ -2167,10 +2167,10 @@ EXTERN char e_netbeans_is_not_supported_with_this_GUI[] INIT(= N_("E838: NetBeans is not supported with this GUI")); #endif // E839 unused -# ifdef FEAT_COMPL_FUNC +#ifdef FEAT_COMPL_FUNC EXTERN char e_complete_function_deleted_text[] INIT(= N_("E840: Completion function deleted text")); -# endif +#endif EXTERN char e_reserved_name_cannot_be_used_for_user_defined_command[] INIT(= N_("E841: Reserved name, cannot be used for user defined command")); EXTERN char e_no_line_number_to_use_for_slnum[] @@ -3308,22 +3308,22 @@ EXTERN char e_could_not_clear_timeout_str[] INIT(= N_("E1285: Could not clear timeout: %s")); EXTERN char e_could_not_set_timeout_str[] INIT(= N_("E1286: Could not set timeout: %s")); -#ifndef PROF_NSEC +# ifndef PROF_NSEC EXTERN char e_could_not_set_handler_for_timeout_str[] INIT(= N_("E1287: Could not set handler for timeout: %s")); EXTERN char e_could_not_reset_handler_for_timeout_str[] INIT(= N_("E1288: Could not reset handler for timeout: %s")); EXTERN char e_could_not_check_for_pending_sigalrm_str[] INIT(= N_("E1289: Could not check for pending SIGALRM: %s")); -#endif +# endif #endif #ifdef FEAT_EVAL EXTERN char e_substitute_nesting_too_deep[] INIT(= N_("E1290: substitute nesting too deep")); -# ifdef MSWIN +# ifdef MSWIN EXTERN char e_invalid_argument_nr[] INIT(= N_("E1291: Invalid argument: %ld")); -# endif +# endif #endif EXTERN char e_cmdline_window_already_open[] INIT(= N_("E1292: Command-line window is already open")); diff --git a/src/evalbuffer.c b/src/evalbuffer.c index eff20e620b..03d946a0f7 100644 --- a/src/evalbuffer.c +++ b/src/evalbuffer.c @@ -35,7 +35,7 @@ set_ref_in_buffers(int copyID) if (!abort) abort = abort || set_ref_in_callback(&bp->b_prompt_interrupt, copyID); # endif -#ifdef FEAT_COMPL_FUNC +# ifdef FEAT_COMPL_FUNC if (!abort) abort = abort || set_ref_in_callback(&bp->b_cfu_cb, copyID); if (!abort) @@ -45,7 +45,7 @@ set_ref_in_buffers(int copyID) if (!abort && bp->b_p_cpt_cb != NULL) abort = abort || set_ref_in_cpt_callbacks(bp->b_p_cpt_cb, bp->b_p_cpt_count, copyID); -#endif +# endif if (!abort) abort = abort || set_ref_in_callback(&bp->b_tfu_cb, copyID); if (!abort) @@ -673,7 +673,7 @@ get_buffer_info(buf_T *buf) dict_add_list(dict, "windows", windows); } -#ifdef FEAT_PROP_POPUP +# ifdef FEAT_PROP_POPUP // List of popup windows displaying this buffer windows = list_alloc(); if (windows != NULL) @@ -688,9 +688,9 @@ get_buffer_info(buf_T *buf) dict_add_list(dict, "popups", windows); } -#endif +# endif -#ifdef FEAT_SIGNS +# ifdef FEAT_SIGNS if (buf->b_signlist != NULL) { // List of signs placed in this buffer @@ -701,11 +701,11 @@ get_buffer_info(buf_T *buf) dict_add_list(dict, "signs", signs); } } -#endif +# endif -#ifdef FEAT_VIMINFO +# ifdef FEAT_VIMINFO dict_add_number(dict, "lastused", buf->b_last_used); -#endif +# endif return dict; } @@ -942,9 +942,9 @@ f_setline(typval_T *argvars, typval_T *rettv) switch_buffer(bufref_T *save_curbuf, buf_T *buf) { block_autocmds(); -#ifdef FEAT_FOLDING +# ifdef FEAT_FOLDING ++disable_fold_update; -#endif +# endif set_bufref(save_curbuf, curbuf); --curbuf->b_nwindows; curbuf = buf; @@ -959,9 +959,9 @@ switch_buffer(bufref_T *save_curbuf, buf_T *buf) restore_buffer(bufref_T *save_curbuf) { unblock_autocmds(); -#ifdef FEAT_FOLDING +# ifdef FEAT_FOLDING --disable_fold_update; -#endif +# endif // Check for valid buffer, just in case. if (bufref_valid(save_curbuf)) { diff --git a/src/evalfunc.c b/src/evalfunc.c index e67f727d25..5d074d44ef 100644 --- a/src/evalfunc.c +++ b/src/evalfunc.c @@ -6175,16 +6175,16 @@ getregionpos( { colnr_T sc1, ec1, sc2, ec2; - #ifdef FEAT_LINEBREAK +#ifdef FEAT_LINEBREAK int lbr_saved = reset_lbr(); - #endif +#endif getvvcol(curwin, p1, &sc1, NULL, &ec1); getvvcol(curwin, p2, &sc2, NULL, &ec2); - #ifdef FEAT_LINEBREAK +#ifdef FEAT_LINEBREAK restore_lbr(lbr_saved); - #endif +#endif oap->motion_type = MBLOCK; oap->inclusive = TRUE; @@ -10127,11 +10127,11 @@ init_srand(UINT32_T *x) #if defined(FEAT_RELTIME) proftime_T res; profile_start(&res); -# if defined(MSWIN) +# if defined(MSWIN) *x = (UINT32_T)res.LowPart; -# else +# else *x = (UINT32_T)res.tv_fsec; -# endif +# endif #else *x = vim_time(); #endif @@ -12316,11 +12316,11 @@ f_synIDattr(typval_T *argvars UNUSED, typval_T *rettv) } else { -#if defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS) +# if defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS) if (USE_24BIT) modec = 'g'; else -#endif +# endif if (t_colors > 1) modec = 'c'; else diff --git a/src/evalvars.c b/src/evalvars.c index 406417771a..7cdef3f5ca 100644 --- a/src/evalvars.c +++ b/src/evalvars.c @@ -418,7 +418,7 @@ eval_charconvert( return OK; } -# if defined(FEAT_POSTSCRIPT) +#if defined(FEAT_POSTSCRIPT) int eval_printexpr(char_u *fname, char_u *args) { @@ -446,9 +446,9 @@ eval_printexpr(char_u *fname, char_u *args) } return OK; } -# endif +#endif -# if defined(FEAT_DIFF) +#if defined(FEAT_DIFF) void eval_diff( char_u *origfile, @@ -504,7 +504,7 @@ eval_patch( set_vim_var_string(VV_FNAME_OUT, NULL, -1); current_sctx = saved_sctx; } -# endif +#endif #if defined(FEAT_SPELL) /* diff --git a/src/evalwindow.c b/src/evalwindow.c index 57620b61bb..1bd970e16a 100644 --- a/src/evalwindow.c +++ b/src/evalwindow.c @@ -104,7 +104,7 @@ win_id2wp_tp(int id, tabpage_T **tpp) *tpp = tp; return wp; } -#ifdef FEAT_PROP_POPUP +# ifdef FEAT_PROP_POPUP // popup windows are in separate lists FOR_ALL_TABPAGES(tp) FOR_ALL_POPUPWINS_IN_TAB(tp, wp) @@ -121,7 +121,7 @@ win_id2wp_tp(int id, tabpage_T **tpp) *tpp = curtab; // any tabpage would do return wp; } -#endif +# endif return NULL; } @@ -184,7 +184,7 @@ find_win_by_nr( } if (nr >= LOWEST_WIN_ID) { -#ifdef FEAT_PROP_POPUP +# ifdef FEAT_PROP_POPUP // check tab-local popup windows for (wp = (tp == NULL ? curtab : tp)->tp_first_popupwin; wp != NULL; wp = wp->w_next) @@ -194,7 +194,7 @@ find_win_by_nr( FOR_ALL_POPUPWINS(wp) if (wp->w_id == nr) return wp; -#endif +# endif return NULL; } return wp; @@ -420,23 +420,23 @@ get_win_info(win_T *wp, short tpnr, short winnr) dict_add_number(dict, "winrow", wp->w_winrow + 1); dict_add_number(dict, "topline", wp->w_topline); dict_add_number(dict, "botline", wp->w_botline - 1); -#ifdef FEAT_MENU +# ifdef FEAT_MENU dict_add_number(dict, "winbar", wp->w_winbar_height); -#endif +# endif dict_add_number(dict, "width", wp->w_width); dict_add_number(dict, "wincol", wp->w_wincol + 1); dict_add_number(dict, "textoff", win_col_off(wp)); dict_add_number(dict, "bufnr", wp->w_buffer->b_fnum); dict_add_number(dict, "leftcol", wp->w_leftcol); -#ifdef FEAT_TERMINAL +# ifdef FEAT_TERMINAL dict_add_number(dict, "terminal", bt_terminal(wp->w_buffer)); -#endif -#ifdef FEAT_QUICKFIX +# endif +# ifdef FEAT_QUICKFIX dict_add_number(dict, "quickfix", bt_quickfix(wp->w_buffer)); dict_add_number(dict, "loclist", (bt_quickfix(wp->w_buffer) && wp->w_llist_ref != NULL)); -#endif +# endif // Add a reference to window variables dict_add_dict(dict, "variables", wp->w_vars); @@ -556,7 +556,7 @@ f_getwininfo(typval_T *argvars, typval_T *rettv) return; } } -#ifdef FEAT_PROP_POPUP +# ifdef FEAT_PROP_POPUP if (wparg != NULL) { tabnr = 0; @@ -572,7 +572,7 @@ found: if (d != NULL) list_append_dict(rettv->vval.v_list, d); } -#endif +# endif } /* @@ -590,7 +590,7 @@ f_getwinpos(typval_T *argvars UNUSED, typval_T *rettv) if (in_vim9script() && check_for_opt_number_arg(argvars, 0) == FAIL) return; -#if defined(FEAT_GUI) \ +# if defined(FEAT_GUI) \ || (defined(HAVE_TGETENT) && defined(FEAT_TERMRESPONSE)) \ || defined(MSWIN) { @@ -601,7 +601,7 @@ f_getwinpos(typval_T *argvars UNUSED, typval_T *rettv) (void)ui_get_winpos(&x, &y, timeout); } -#endif +# endif list_append_number(rettv->vval.v_list, (varnumber_T)x); list_append_number(rettv->vval.v_list, (varnumber_T)y); } @@ -614,7 +614,7 @@ f_getwinpos(typval_T *argvars UNUSED, typval_T *rettv) f_getwinposx(typval_T *argvars UNUSED, typval_T *rettv) { rettv->vval.v_number = -1; -#if defined(FEAT_GUI) \ +# if defined(FEAT_GUI) \ || (defined(HAVE_TGETENT) && defined(FEAT_TERMRESPONSE)) \ || defined(MSWIN) @@ -624,7 +624,7 @@ f_getwinposx(typval_T *argvars UNUSED, typval_T *rettv) if (ui_get_winpos(&x, &y, 100) == OK) rettv->vval.v_number = x; } -#endif +# endif } /* @@ -634,7 +634,7 @@ f_getwinposx(typval_T *argvars UNUSED, typval_T *rettv) f_getwinposy(typval_T *argvars UNUSED, typval_T *rettv) { rettv->vval.v_number = -1; -#if defined(FEAT_GUI) \ +# if defined(FEAT_GUI) \ || (defined(HAVE_TGETENT) && defined(FEAT_TERMRESPONSE)) \ || defined(MSWIN) { @@ -643,7 +643,7 @@ f_getwinposy(typval_T *argvars UNUSED, typval_T *rettv) if (ui_get_winpos(&x, &y, 100) == OK) rettv->vval.v_number = y; } -#endif +# endif } /* @@ -729,10 +729,10 @@ f_win_execute(typval_T *argvars, typval_T *rettv) pos_T curpos = wp->w_cursor; char_u cwd[MAXPATHL]; int cwd_status = FAIL; -#ifdef FEAT_AUTOCHDIR +# ifdef FEAT_AUTOCHDIR char_u autocwd[MAXPATHL]; int apply_acd = FALSE; -#endif +# endif // Getting and setting directory can be slow on some systems, only do // this when the current or target window/tab have a local directory or @@ -743,13 +743,13 @@ f_win_execute(typval_T *argvars, typval_T *rettv) || (curtab != tp && (curtab->tp_localdir != NULL || tp->tp_localdir != NULL)) -#ifdef FEAT_AUTOCHDIR +# ifdef FEAT_AUTOCHDIR || p_acd -#endif +# endif )) cwd_status = mch_dirname(cwd, MAXPATHL); -#ifdef FEAT_AUTOCHDIR +# ifdef FEAT_AUTOCHDIR // If 'acd' is set, check we are using that directory. If yes, then // apply 'acd' afterwards, otherwise restore the current directory. if (cwd_status == OK && p_acd) @@ -758,7 +758,7 @@ f_win_execute(typval_T *argvars, typval_T *rettv) apply_acd = mch_dirname(autocwd, MAXPATHL) == OK && STRCMP(cwd, autocwd) == 0; } -#endif +# endif if (switch_win_noblock(&switchwin, wp, tp, TRUE) == OK) { @@ -766,11 +766,11 @@ f_win_execute(typval_T *argvars, typval_T *rettv) execute_common(argvars, rettv, 1); } restore_win_noblock(&switchwin, TRUE); -#ifdef FEAT_AUTOCHDIR +# ifdef FEAT_AUTOCHDIR if (apply_acd) do_autochdir(); else -#endif +# endif if (cwd_status == OK) mch_chdir((char *)cwd); @@ -836,13 +836,13 @@ f_win_gotoid(typval_T *argvars, typval_T *rettv) if (text_or_buf_locked()) return; -#if defined(FEAT_PROP_POPUP) && defined(FEAT_TERMINAL) +# if defined(FEAT_PROP_POPUP) && defined(FEAT_TERMINAL) if (popup_is_popup(curwin) && curbuf->b_term != NULL) { emsg(_(e_not_allowed_for_terminal_in_popup_window)); return; } -#endif +# endif FOR_ALL_TAB_WINDOWS(tp, wp) if (wp->w_id == id) { @@ -1049,21 +1049,21 @@ f_win_gettype(typval_T *argvars, typval_T *rettv) } if (is_aucmd_win(wp)) rettv->vval.v_string = vim_strsave((char_u *)"autocmd"); -#if defined(FEAT_QUICKFIX) +# if defined(FEAT_QUICKFIX) else if (wp->w_p_pvw) rettv->vval.v_string = vim_strsave((char_u *)"preview"); -#endif -#ifdef FEAT_PROP_POPUP +# endif +# ifdef FEAT_PROP_POPUP else if (WIN_IS_POPUP(wp)) rettv->vval.v_string = vim_strsave((char_u *)"popup"); -#endif +# endif else if (wp == cmdwin_win) rettv->vval.v_string = vim_strsave((char_u *)"command"); -#ifdef FEAT_QUICKFIX +# ifdef FEAT_QUICKFIX else if (bt_quickfix(wp->w_buffer)) rettv->vval.v_string = vim_strsave((char_u *) (wp->w_llist_ref != NULL ? "loclist" : "quickfix")); -#endif +# endif } @@ -1243,10 +1243,10 @@ f_winrestview(typval_T *argvars, typval_T *rettv UNUSED) if (dict_has_key(dict, "topline")) set_topline(curwin, (linenr_T)dict_get_number(dict, "topline")); -#ifdef FEAT_DIFF +# ifdef FEAT_DIFF if (dict_has_key(dict, "topfill")) curwin->w_topfill = (int)dict_get_number(dict, "topfill"); -#endif +# endif if (dict_has_key(dict, "leftcol")) curwin->w_leftcol = (colnr_T)dict_get_number(dict, "leftcol"); if (dict_has_key(dict, "skipcol")) @@ -1261,9 +1261,9 @@ f_winrestview(typval_T *argvars, typval_T *rettv UNUSED) curwin->w_topline = 1; if (curwin->w_topline > curbuf->b_ml.ml_line_count) curwin->w_topline = curbuf->b_ml.ml_line_count; -#ifdef FEAT_DIFF +# ifdef FEAT_DIFF check_topfill(curwin, TRUE); -#endif +# endif } /* @@ -1285,9 +1285,9 @@ f_winsaveview(typval_T *argvars UNUSED, typval_T *rettv) dict_add_number(dict, "curswant", (long)curwin->w_curswant); dict_add_number(dict, "topline", (long)curwin->w_topline); -#ifdef FEAT_DIFF +# ifdef FEAT_DIFF dict_add_number(dict, "topfill", (long)curwin->w_topfill); -#endif +# endif dict_add_number(dict, "leftcol", (long)curwin->w_leftcol); dict_add_number(dict, "skipcol", (long)curwin->w_skipcol); } diff --git a/src/ex_cmds.h b/src/ex_cmds.h index 4471e2adb8..a3d705d5f1 100644 --- a/src/ex_cmds.h +++ b/src/ex_cmds.h @@ -1944,9 +1944,9 @@ struct exarg char_u *nextcmd; // next command (NULL if none) char_u *cmd; // the name of the command (except for :make) char_u **cmdlinep; // pointer to pointer of allocated cmdline -#ifdef FEAT_EVAL +# ifdef FEAT_EVAL char_u *cmdline_tofree; // free later -#endif +# endif cmdidx_T cmdidx; // the index for the command long argt; // flags for the command int skip; // don't execute the command, only parse it @@ -1971,19 +1971,19 @@ struct exarg char *errmsg; // returned error message char_u *(*ea_getline)(int, void *, int, getline_opt_T); void *cookie; // argument for getline() -#ifdef FEAT_EVAL +# ifdef FEAT_EVAL cstack_T *cstack; // condition stack for ":if" etc. class_T *ea_class; // Name of class being defined. Used by :class // and :enum commands. -#endif +# endif }; -#define FORCE_BIN 1 // ":edit ++bin file" -#define FORCE_NOBIN 2 // ":edit ++nobin file" +# define FORCE_BIN 1 // ":edit ++bin file" +# define FORCE_NOBIN 2 // ":edit ++nobin file" // Values for "flags" -#define EXFLAG_LIST 0x01 // 'l': list -#define EXFLAG_NR 0x02 // '#': number -#define EXFLAG_PRINT 0x04 // 'p': print +# define EXFLAG_LIST 0x01 // 'l': list +# define EXFLAG_NR 0x02 // '#': number +# define EXFLAG_PRINT 0x04 // 'p': print #endif diff --git a/src/ex_cmds2.c b/src/ex_cmds2.c index 6e9749f5dd..7012c98962 100644 --- a/src/ex_cmds2.c +++ b/src/ex_cmds2.c @@ -128,7 +128,7 @@ check_changed(buf_T *buf, int flags) #if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG) -#if defined(FEAT_BROWSE) +# if defined(FEAT_BROWSE) /* * When wanting to write a file without a file name, ask the user for a name. */ @@ -149,7 +149,7 @@ browse_save_fname(buf_T *buf) buf->b_flags |= BF_NOTEDITED; vim_free(fname); } -#endif +# endif /* * Ask the user what to do when abandoning a changed buffer. @@ -179,10 +179,10 @@ dialog_changed( { int empty_bufname; -#ifdef FEAT_BROWSE +# ifdef FEAT_BROWSE // May get file name, when there is none browse_save_fname(buf); -#endif +# endif empty_bufname = buf->b_fname == NULL ? TRUE : FALSE; if (empty_bufname) buf_set_name(buf->b_fnum, (char_u *)"Untitled"); @@ -218,9 +218,9 @@ dialog_changed( { if (bufIsChanged(buf2) && (buf2->b_ffname != NULL -#ifdef FEAT_BROWSE +# ifdef FEAT_BROWSE || (cmdmod.cmod_flags & CMOD_BROWSE) -#endif +# endif ) && !bt_dontwrite(buf2) && !buf2->b_p_ro) @@ -228,10 +228,10 @@ dialog_changed( bufref_T bufref; set_bufref(&bufref, buf2); -#ifdef FEAT_BROWSE +# ifdef FEAT_BROWSE // May get file name, when there is none browse_save_fname(buf2); -#endif +# endif if (buf2->b_fname != NULL && check_overwrite(&ea, buf2, buf2->b_fname, buf2->b_ffname, FALSE) == OK) // didn't hit Cancel diff --git a/src/ex_docmd.c b/src/ex_docmd.c index ca9e519350..645168e9a8 100644 --- a/src/ex_docmd.c +++ b/src/ex_docmd.c @@ -863,11 +863,11 @@ do_cmdline( break; } } -#ifdef FEAT_PROFILE +# ifdef FEAT_PROFILE else if (do_profiling == PROF_YES && getline_equal(fgetline, cookie, getsourceline)) script_line_end(); -#endif +# endif // Check if a sourced file hit a ":finish" command. if (source_finished(fgetline, cookie)) @@ -1746,10 +1746,10 @@ comment_start(char_u *p, int starts_with_colon UNUSED) return *p == '"'; } -# define CURRENT_WIN_NR current_win_nr(curwin) -# define LAST_WIN_NR current_win_nr(NULL) -# define CURRENT_TAB_NR current_tab_nr(curtab) -# define LAST_TAB_NR current_tab_nr(NULL) +#define CURRENT_WIN_NR current_win_nr(curwin) +#define LAST_WIN_NR current_win_nr(NULL) +#define CURRENT_TAB_NR current_tab_nr(curtab) +#define LAST_TAB_NR current_tab_nr(NULL) /* * Execute one Ex command. @@ -6576,9 +6576,9 @@ tabpage_close(int forceit) close_others(TRUE, forceit); if (ONE_WINDOW) ex_win_close(forceit, curwin, NULL); -# ifdef FEAT_GUI +#ifdef FEAT_GUI need_mouse_correct = TRUE; -# endif +#endif } /* @@ -6619,9 +6619,9 @@ ex_only(exarg_T *eap) { if (window_layout_locked(CMD_only)) return; -# ifdef FEAT_GUI +#ifdef FEAT_GUI need_mouse_correct = TRUE; -# endif +#endif if (eap->addr_count > 0) { win_T *wp; @@ -6743,9 +6743,9 @@ ex_exit(exarg_T *eap) if (only_one_window()) // quit last window, exit Vim getout(0); not_exiting(); -# ifdef FEAT_GUI +#ifdef FEAT_GUI need_mouse_correct = TRUE; -# endif +#endif // Quit current window, may free the buffer. win_close(curwin, !buf_hide(curwin->w_buffer)); } @@ -7246,7 +7246,7 @@ ex_splitview(exarg_T *eap) goto theend; eap->arg = fname; } -# ifdef FEAT_BROWSE +#ifdef FEAT_BROWSE else if ((cmdmod.cmod_flags & CMOD_BROWSE) && eap->cmdidx != CMD_vnew && eap->cmdidx != CMD_new) @@ -7307,9 +7307,9 @@ ex_splitview(exarg_T *eap) do_exedit(eap, old_curwin); } -# ifdef FEAT_BROWSE +#ifdef FEAT_BROWSE cmdmod.cmod_flags = save_cmod_flags; -# endif +#endif theend: vim_free(fname); @@ -7475,9 +7475,9 @@ ex_resize(exarg_T *eap) ; } -# ifdef FEAT_GUI +#ifdef FEAT_GUI need_mouse_correct = TRUE; -# endif +#endif n = atol((char *)eap->arg); if (cmdmod.cmod_split & WSP_VERT) { @@ -8126,7 +8126,7 @@ changedir_func( #endif { // use NameBuff for home directory name -# ifdef VMS +#ifdef VMS char_u *p; p = mch_getenv((char_u *)"SYS$LOGIN"); @@ -8134,9 +8134,9 @@ changedir_func( NameBuff[0] = NUL; else vim_strncpy(NameBuff, p, MAXPATHL - 1); -# else +#else expand_env((char_u *)"$HOME", NameBuff, MAXPATHL); -# endif +#endif new_dir = NameBuff; } dir_differs = pdir == NULL @@ -8283,13 +8283,13 @@ do_sleep(long msec, int hide_cursor) { long done = 0; long wait_now; -# ifdef ELAPSED_FUNC +#ifdef ELAPSED_FUNC elapsed_T start_tv; // Remember at what time we started, so that we know how much longer we // should wait after waiting for a bit. ELAPSED_INIT(start_tv); -# endif +#endif if (hide_cursor) cursor_sleep(); @@ -8331,13 +8331,13 @@ do_sleep(long msec, int hide_cursor) parse_queued_messages(); #endif -# ifdef ELAPSED_FUNC +#ifdef ELAPSED_FUNC // actual time passed done = ELAPSED_FUNC(start_tv); -# else +#else // guestimate time passed (will actually be more) done += wait_now; -# endif +#endif } // If CTRL-C was typed to interrupt the sleep, drop the CTRL-C from the @@ -9449,7 +9449,7 @@ ex_checkpath(exarg_T *eap) (linenr_T)1, (linenr_T)MAXLNUM, eap->forceit, FALSE); } -#if defined(FEAT_QUICKFIX) +# if defined(FEAT_QUICKFIX) /* * ":psearch" */ @@ -9460,7 +9460,7 @@ ex_psearch(exarg_T *eap) ex_findpat(eap); g_do_tagpreview = 0; } -#endif +# endif static void ex_findpat(exarg_T *eap) @@ -10052,12 +10052,12 @@ eval_vars( #ifdef FEAT_CLIENTSERVER case SPEC_CLIENT: // Source of last submitted input -#ifdef MSWIN +# ifdef MSWIN sprintf((char *)strbuf, PRINTF_HEX_LONG_U, (long_u)clientWindow); result = strbuf; -#else -# ifdef FEAT_SOCKETSERVER +# else +# ifdef FEAT_SOCKETSERVER if (clientserver_method == CLIENTSERVER_METHOD_SOCKET) { if (client_socket == NULL) @@ -10065,16 +10065,16 @@ eval_vars( else result = client_socket; } -# endif -# ifdef FEAT_X11 +# endif +# ifdef FEAT_X11 if (clientserver_method == CLIENTSERVER_METHOD_X11) { sprintf((char *)strbuf, PRINTF_HEX_LONG_U, (long_u)clientWindow); result = strbuf; } +# endif # endif -#endif break; #endif } @@ -10408,9 +10408,9 @@ ex_folddo(exarg_T *eap) # ifdef FEAT_CLIPBOARD start_global_changes(); # endif -#ifdef FEAT_CLIPBOARD_PROVIDER +# ifdef FEAT_CLIPBOARD_PROVIDER inc_clip_provider(); -#endif +# endif // First set the marks for all lines closed/open. for (lnum = eap->line1; lnum <= eap->line2; ++lnum) @@ -10423,9 +10423,9 @@ ex_folddo(exarg_T *eap) # ifdef FEAT_CLIPBOARD end_global_changes(); # endif -#ifdef FEAT_CLIPBOARD_PROVIDER +# ifdef FEAT_CLIPBOARD_PROVIDER dec_clip_provider(); -#endif +# endif } #endif diff --git a/src/ex_getln.c b/src/ex_getln.c index 7cf8a10ae1..0ec7293199 100644 --- a/src/ex_getln.c +++ b/src/ex_getln.c @@ -433,9 +433,9 @@ may_do_incsearch_highlighting( int skiplen, patlen; int found; // do_search() result pos_T end_pos; -#ifdef FEAT_RELTIME +# ifdef FEAT_RELTIME searchit_arg_T sia; -#endif +# endif int next_char; int use_last_pat; int did_do_incsearch = is_state->did_incsearch; @@ -505,18 +505,18 @@ may_do_incsearch_highlighting( if (search_first_line != 0) search_flags += SEARCH_START; ccline.cmdbuff[skiplen + patlen] = NUL; -#ifdef FEAT_RELTIME +# ifdef FEAT_RELTIME CLEAR_FIELD(sia); // Set the time limit to half a second. sia.sa_tm = 500; -#endif +# endif found = do_search(NULL, firstc == ':' ? '/' : firstc, search_delim, ccline.cmdbuff + skiplen, patlen, count, search_flags, -#ifdef FEAT_RELTIME +# ifdef FEAT_RELTIME &sia -#else +# else NULL -#endif +# endif ); ccline.cmdbuff[skiplen + patlen] = next_char; --emsg_off; @@ -1340,13 +1340,13 @@ cmdline_left_right_mouse(int c, int *ignore_drag_release) *ignore_drag_release = TRUE; else *ignore_drag_release = FALSE; -# ifdef FEAT_GUI +#ifdef FEAT_GUI // When GUI is active, also move when 'mouse' is empty if (!gui.in_use) -# endif +#endif if (!mouse_has(MOUSE_COMMAND)) return; -# ifdef FEAT_CLIPBOARD +#ifdef FEAT_CLIPBOARD if (mouse_row < cmdline_row && (clip_star.available || clip_plus.available)) { int button, is_click, is_drag; @@ -1366,7 +1366,7 @@ cmdline_left_right_mouse(int c, int *ignore_drag_release) clip_modeless(button, is_click, is_drag); return; } -# endif +#endif set_cmdspos(); for (ccline.cmdpos = 0; ccline.cmdpos < ccline.cmdlen; @@ -2343,27 +2343,27 @@ getcmdline_int( goto cmdline_not_changed; // Ignore mouse case K_MIDDLEMOUSE: -# ifdef FEAT_GUI +#ifdef FEAT_GUI // When GUI is active, also paste when 'mouse' is empty if (!gui.in_use) -# endif +#endif if (!mouse_has(MOUSE_COMMAND)) goto cmdline_not_changed; // Ignore mouse -# ifdef FEAT_CLIPBOARD +#ifdef FEAT_CLIPBOARD if (clip_star.available) cmdline_paste('*', TRUE, TRUE); else -# endif +#endif cmdline_paste(0, TRUE, TRUE); redrawcmd(); goto cmdline_changed; -# ifdef FEAT_DND +#ifdef FEAT_DND case K_DROP: cmdline_paste('~', TRUE, FALSE); redrawcmd(); goto cmdline_changed; -# endif +#endif case K_LEFTDRAG: case K_LEFTRELEASE: @@ -3356,7 +3356,7 @@ cmdline_overstrike(void) return ccline.overstrike; } -# if defined(MCH_CURSOR_SHAPE) || defined(FEAT_GUI) || defined(FEAT_MOUSESHAPE) +#if defined(MCH_CURSOR_SHAPE) || defined(FEAT_GUI) || defined(FEAT_MOUSESHAPE) /* * Return TRUE if the cursor is at the end of the cmdline. */ @@ -4331,9 +4331,9 @@ get_cmdline_type(void) return NUL; if (p->cmdfirstc == NUL) return -# ifdef FEAT_EVAL +#ifdef FEAT_EVAL (p->input_fn) ? '@' : -# endif +#endif '-'; return p->cmdfirstc; } @@ -4707,9 +4707,9 @@ open_cmdwin(void) // Can't do this recursively. Can't do it when typing a password. if (text_or_buf_locked() || cmdwin_type != 0 -# if defined(FEAT_CRYPT) || defined(FEAT_EVAL) +#if defined(FEAT_CRYPT) || defined(FEAT_EVAL) || cmdline_star > 0 -# endif +#endif ) { beep_flush(); @@ -4785,10 +4785,10 @@ open_cmdwin(void) #ifdef FEAT_FOLDING curwin->w_p_fen = FALSE; #endif -# ifdef FEAT_RIGHTLEFT +#ifdef FEAT_RIGHTLEFT curwin->w_p_rl = cmdmsg_rl; cmdmsg_rl = FALSE; -# endif +#endif RESET_BINDING(curwin); // Don't allow switching to another buffer. @@ -4872,17 +4872,17 @@ open_cmdwin(void) RedrawingDisabled = save_RedrawingDisabled; -# ifdef FEAT_FOLDING +#ifdef FEAT_FOLDING save_KeyTyped = KeyTyped; -# endif +#endif // Trigger CmdwinLeave autocommands. trigger_cmd_autocmd(cmdwin_type, EVENT_CMDWINLEAVE); -# ifdef FEAT_FOLDING +#ifdef FEAT_FOLDING // Restore KeyTyped in case it is modified by autocommands KeyTyped = save_KeyTyped; -# endif +#endif cmdwin_type = 0; cmdwin_buf = NULL; @@ -4899,11 +4899,11 @@ open_cmdwin(void) } else { -# if defined(FEAT_EVAL) +#if defined(FEAT_EVAL) // autocmds may abort script processing if (aborting() && cmdwin_result != K_IGNORE) cmdwin_result = Ctrl_C; -# endif +#endif // Set the new command line from the cmdline buffer. dealloc_cmdbuff(); @@ -4965,10 +4965,10 @@ open_cmdwin(void) ccline.cmdpos = ccline.cmdlen; } -# ifdef FEAT_CONCEAL +#ifdef FEAT_CONCEAL // Avoid command-line window first character being concealed. curwin->w_p_cole = 0; -# endif +#endif // First go back to the original window. wp = curwin; set_bufref(&bufref, curbuf); @@ -5002,9 +5002,9 @@ open_cmdwin(void) ga_clear(&winsizes); restart_edit = save_restart_edit; -# ifdef FEAT_RIGHTLEFT +#ifdef FEAT_RIGHTLEFT cmdmsg_rl = save_cmdmsg_rl; -# endif +#endif State = save_State; may_trigger_modechanged(); @@ -5100,12 +5100,12 @@ get_user_input( prompt = tv_get_string_chk(&argvars[0]); -#ifdef NO_CONSOLE_INPUT +# ifdef NO_CONSOLE_INPUT // While starting up, there is no place to enter text. When running tests // with --not-a-term we assume feedkeys() will be used. if (no_console_input() && !is_not_a_term()) return; -#endif +# endif cmd_silent = FALSE; // Want to see the prompt. if (prompt != NULL) diff --git a/src/feature.h b/src/feature.h index 8f53488bd5..376e40994e 100644 --- a/src/feature.h +++ b/src/feature.h @@ -221,7 +221,7 @@ #endif #ifdef FEAT_ARABIC # ifndef FEAT_RIGHTLEFT -# define FEAT_RIGHTLEFT +# define FEAT_RIGHTLEFT # endif #endif @@ -956,7 +956,7 @@ * +socketserver Use UNIX domain sockets for clientserver communication */ #if defined(UNIX) && defined(WANT_SOCKETSERVER) -#define FEAT_SOCKETSERVER +# define FEAT_SOCKETSERVER #endif /* diff --git a/src/fileio.c b/src/fileio.c index 8156b80e18..feb538655d 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -585,12 +585,12 @@ readfile( else { filemess(curbuf, sfname, (char_u *)( -# ifdef EFBIG +#ifdef EFBIG (errno == EFBIG) ? _("[File too big]") : -# endif -# ifdef EOVERFLOW +#endif +#ifdef EOVERFLOW (errno == EOVERFLOW) ? _("[File too big]") : -# endif +#endif _("[Permission Denied]")), 0); curbuf->b_p_ro = TRUE; // must use "w!" now } @@ -1695,7 +1695,7 @@ retry: { found_bad = FALSE; -# ifdef CP_UTF8 // VC 4.1 doesn't define CP_UTF8 +# ifdef CP_UTF8 // VC 4.1 doesn't define CP_UTF8 if (codepage == CP_UTF8) { // Handle CP_UTF8 input ourselves to be able to handle @@ -1725,7 +1725,7 @@ retry: } } else -# endif +# endif { // We don't know how long the byte sequence is, try // from one to three bytes. @@ -2732,10 +2732,10 @@ failed: FALSE, NULL, eap); if (msg_scrolled == n) msg_scroll = m; -# ifdef FEAT_EVAL +#ifdef FEAT_EVAL if (aborting()) // autocmds may abort script processing goto theend; -# endif +#endif } if (!(recoverymode && error)) @@ -3323,11 +3323,11 @@ get_win_fio_flags(char_u *ptr) cp = encname2codepage(ptr); if (cp == 0) { -# ifdef CP_UTF8 // VC 4.1 doesn't define CP_UTF8 +# ifdef CP_UTF8 // VC 4.1 doesn't define CP_UTF8 if (STRCMP(ptr, "utf-8") == 0) cp = CP_UTF8; else -# endif +# endif return 0; } return FIO_PUT_CP(cp) | FIO_CODEPAGE; @@ -4456,9 +4456,9 @@ buf_check_timestamp( if (emsg_silent == 0 && !in_assert_fails) { out_flush(); - #ifdef FEAT_GUI +#ifdef FEAT_GUI if (!focus) - #endif +#endif // give the user some time to think about it ui_delay(1004L, TRUE); diff --git a/src/filepath.c b/src/filepath.c index 3fd85a0491..f3396d143c 100644 --- a/src/filepath.c +++ b/src/filepath.c @@ -838,9 +838,9 @@ f_chdir(typval_T *argvars, typval_T *rettv) { if (mch_dirname(cwd, MAXPATHL) != FAIL) { -#ifdef BACKSLASH_IN_FILENAME +# ifdef BACKSLASH_IN_FILENAME slash_adjust(cwd); -#endif +# endif rettv->vval.v_string = vim_strsave(cwd); } vim_free(cwd); @@ -1159,10 +1159,10 @@ f_getcwd(typval_T *argvars, typval_T *rettv) } } } -#ifdef BACKSLASH_IN_FILENAME +# ifdef BACKSLASH_IN_FILENAME if (rettv->vval.v_string != NULL) slash_adjust(rettv->vval.v_string); -#endif +# endif } /* @@ -2084,15 +2084,15 @@ f_readfile(typval_T *argvars, typval_T *rettv) f_resolve(typval_T *argvars, typval_T *rettv) { char_u *p; -#ifdef HAVE_READLINK +# ifdef HAVE_READLINK char_u *buf = NULL; -#endif +# endif if (in_vim9script() && check_for_string_arg(argvars, 0) == FAIL) return; p = tv_get_string(&argvars[0]); -#ifdef FEAT_SHORTCUT +# ifdef FEAT_SHORTCUT { char_u *v = NULL; @@ -2102,8 +2102,8 @@ f_resolve(typval_T *argvars, typval_T *rettv) else rettv->vval.v_string = vim_strsave(p); } -#else -# ifdef HAVE_READLINK +# else +# ifdef HAVE_READLINK { char_u *cpy; int len; @@ -2275,17 +2275,17 @@ f_resolve(typval_T *argvars, typval_T *rettv) rettv->vval.v_string = p; } -# else +# else rettv->vval.v_string = vim_strsave(p); +# endif # endif -#endif simplify_filename(rettv->vval.v_string); -#ifdef HAVE_READLINK +# ifdef HAVE_READLINK fail: vim_free(buf); -#endif +# endif rettv->v_type = VAR_STRING; } @@ -2322,9 +2322,9 @@ f_writefile(typval_T *argvars, typval_T *rettv) int binary = FALSE; int append = FALSE; int defer = FALSE; -#ifdef HAVE_FSYNC +# ifdef HAVE_FSYNC int do_fsync = p_fs; -#endif +# endif char_u *fname; FILE *fd; int ret = 0; @@ -2377,12 +2377,12 @@ f_writefile(typval_T *argvars, typval_T *rettv) append = TRUE; if (vim_strchr(arg2, 'D') != NULL) defer = TRUE; -#ifdef HAVE_FSYNC +# ifdef HAVE_FSYNC if (vim_strchr(arg2, 's') != NULL) do_fsync = TRUE; else if (vim_strchr(arg2, 'S') != NULL) do_fsync = FALSE; -#endif +# endif } fname = tv_get_string_chk(&argvars[1]); @@ -2431,12 +2431,12 @@ f_writefile(typval_T *argvars, typval_T *rettv) if (write_list(fd, list, binary) == FAIL) ret = -1; } -#ifdef HAVE_FSYNC +# ifdef HAVE_FSYNC if (ret == 0 && do_fsync) // Ignore the error, the user wouldn't know what to do about // it. May happen for a device. vim_ignored = vim_fsync(fileno(fd)); -#endif +# endif fclose(fd); } } @@ -3341,9 +3341,9 @@ expand_wildcards( ffname = FullName_save((*files)[i], FALSE); if (ffname == NULL) // out of memory break; -# ifdef VMS +#ifdef VMS vms_remove_version(ffname); -# endif +#endif if (match_file_list(p_wig, (*files)[i], ffname)) { // remove this matching file from the list @@ -3462,11 +3462,11 @@ expand_backtick( if (cmd == NULL) return -1; -#ifdef FEAT_EVAL +# ifdef FEAT_EVAL if (*cmd == '=') // `={expr}`: Expand expression buffer = eval_to_string(cmd + 1, TRUE, FALSE); else -#endif +# endif buffer = get_cmd_output(cmd, NULL, (flags & EW_SILENT) ? SHELL_SILENT : 0, NULL); vim_free(cmd); @@ -3966,7 +3966,7 @@ unix_expandpath( if ((flags & EW_ALLLINKS) ? mch_lstat((char *)buf, &sb) >= 0 : mch_getperm(buf) >= 0) { -#ifdef MACOS_CONVERT +# ifdef MACOS_CONVERT size_t precomp_len = STRLEN(buf)+1; char_u *precomp_buf = mac_precompose_path(buf, precomp_len, &precomp_len); @@ -3976,7 +3976,7 @@ unix_expandpath( mch_memmove(buf, precomp_buf, precomp_len); vim_free(precomp_buf); } -#endif +# endif addfile(gap, buf, flags); } } diff --git a/src/findfile.c b/src/findfile.c index 4fc9fe76c5..0c5d1cf252 100644 --- a/src/findfile.c +++ b/src/findfile.c @@ -1738,13 +1738,13 @@ find_file_in_path( file_to_find, search_ctx); } -# if defined(EXITFREE) +#if defined(EXITFREE) void free_findfile(void) { VIM_CLEAR_STRING(ff_expand_buffer); } -# endif +#endif /* * Find the directory name "ptr[len]" in the path. @@ -1789,13 +1789,13 @@ find_file_in_path_option( static int did_findfile_init = FALSE; char_u *file_name = NULL; int rel_to_curdir; -# ifdef AMIGA +#ifdef AMIGA struct Process *proc = (struct Process *)FindTask(0L); APTR save_winptr = proc->pr_WindowPtr; // Avoid a requester here for a volume that doesn't exist. proc->pr_WindowPtr = (APTR)-1L; -# endif +#endif static size_t file_to_findlen = 0; if (first == TRUE) @@ -1841,16 +1841,16 @@ find_file_in_path_option( if (vim_isAbsName(*file_to_find) // "..", "../path", "." and "./path": don't use the path_option || rel_to_curdir -# if defined(MSWIN) +#if defined(MSWIN) // handle "\tmp" as absolute path || vim_ispathsep((*file_to_find)[0]) // handle "c:name" as absolute path || ((*file_to_find)[0] != NUL && (*file_to_find)[1] == ':') -# endif -# ifdef AMIGA +#endif +#ifdef AMIGA // handle ":tmp" as absolute path || (*file_to_find)[0] == ':' -# endif +#endif ) { /* @@ -1999,9 +1999,9 @@ find_file_in_path_option( } theend: -# ifdef AMIGA +#ifdef AMIGA proc->pr_WindowPtr = save_winptr; -# endif +#endif return file_name; } @@ -2175,7 +2175,7 @@ file_name_in_line( return find_file_name_in_path(ptr, len, options, count, rel_fname); } -# if defined(FEAT_FIND_ID) && defined(FEAT_EVAL) +#if defined(FEAT_FIND_ID) && defined(FEAT_EVAL) static char_u * eval_includeexpr(char_u *ptr, int len) { @@ -2193,7 +2193,7 @@ eval_includeexpr(char_u *ptr, int len) current_sctx = save_sctx; return res; } -# endif +#endif /* * Return the name of the file ptr[len] in 'path'. @@ -2209,14 +2209,14 @@ find_file_name_in_path( { char_u *file_name; int c; -# if defined(FEAT_FIND_ID) && defined(FEAT_EVAL) +#if defined(FEAT_FIND_ID) && defined(FEAT_EVAL) char_u *tofree = NULL; -# endif +#endif if (len == 0) return NULL; -# if defined(FEAT_FIND_ID) && defined(FEAT_EVAL) +#if defined(FEAT_FIND_ID) && defined(FEAT_EVAL) if ((options & FNAME_INCL) && *curbuf->b_p_inex != NUL) { tofree = eval_includeexpr(ptr, len); @@ -2226,7 +2226,7 @@ find_file_name_in_path( len = (int)STRLEN(ptr); } } -# endif +#endif if (options & FNAME_EXP) { @@ -2236,7 +2236,7 @@ find_file_name_in_path( file_name = find_file_in_path(ptr, len, options & ~FNAME_MESS, TRUE, rel_fname, &file_to_find, &search_ctx); -# if defined(FEAT_FIND_ID) && defined(FEAT_EVAL) +#if defined(FEAT_FIND_ID) && defined(FEAT_EVAL) /* * If the file could not be found in a normal way, try applying * 'includeexpr' (unless done already). @@ -2253,7 +2253,7 @@ find_file_name_in_path( TRUE, rel_fname, &file_to_find, &search_ctx); } } -# endif +#endif if (file_name == NULL && (options & FNAME_MESS)) { c = ptr[len]; @@ -2277,9 +2277,9 @@ find_file_name_in_path( else file_name = vim_strnsave(ptr, len); -# if defined(FEAT_FIND_ID) && defined(FEAT_EVAL) +#if defined(FEAT_FIND_ID) && defined(FEAT_EVAL) vim_free(tofree); -# endif +#endif return file_name; } @@ -2325,11 +2325,11 @@ gettail_dir(char_u *fname) int vim_ispathlistsep(int c) { -# ifdef UNIX +#ifdef UNIX return (c == ':'); -# else +#else return (c == ';'); // might not be right for every system... -# endif +#endif } /* @@ -2460,12 +2460,12 @@ expand_path_option( if (ga_grow(gap, 1) == FAIL) break; -# if defined(MSWIN) +#if defined(MSWIN) // Avoid the path ending in a backslash, it fails when a comma is // appended. if (buf[buflen - 1] == '\\') buf[buflen - 1] = '/'; -# endif +#endif p = vim_strnsave(buf, buflen); if (p == NULL) @@ -2497,9 +2497,9 @@ get_path_cutoff(char_u *fname, garray_T *gap) int j = 0; while ((fname[j] == path_part[i][j] -# if defined(MSWIN) +#if defined(MSWIN) || (vim_ispathsep(fname[j]) && vim_ispathsep(path_part[i][j])) -# endif +#endif ) && fname[j] != NUL && path_part[i][j] != NUL) j++; if (j > maxlen) @@ -2638,13 +2638,13 @@ uniquefy_paths( */ short_name = shorten_fname(path, curdir); if (short_name != NULL && short_name > path + 1 -# if defined(MSWIN) +#if defined(MSWIN) // On windows, // shorten_fname("c:\a\a.txt", "c:\a\b") // returns "\a\a.txt", which is not really the short // name, hence: && !vim_ispathsep(*short_name) -# endif +#endif ) { vim_snprintf((char *)path, MAXPATHL, ".%s%s", PATHSEPSTR, short_name); diff --git a/src/float.c b/src/float.c index eabc465f63..f4253cf845 100644 --- a/src/float.c +++ b/src/float.c @@ -338,7 +338,7 @@ f_fmod(typval_T *argvars, typval_T *rettv) rettv->vval.v_float = 0.0; } -# if defined(HAVE_MATH_H) +#if defined(HAVE_MATH_H) /* * "isinf()" function */ @@ -364,7 +364,7 @@ f_isnan(typval_T *argvars, typval_T *rettv) rettv->vval.v_number = argvars[0].v_type == VAR_FLOAT && isnan(argvars[0].vval.v_float); } -# endif +#endif /* * "log()" function diff --git a/src/fold.c b/src/fold.c index 144d5b0b4b..c6eb08a369 100644 --- a/src/fold.c +++ b/src/fold.c @@ -36,11 +36,11 @@ typedef struct // folds too } fold_T; -#define FD_OPEN 0 // fold is open (nested ones can be closed) -#define FD_CLOSED 1 // fold is closed -#define FD_LEVEL 2 // depends on 'foldlevel' (nested folds too) +# define FD_OPEN 0 // fold is open (nested ones can be closed) +# define FD_CLOSED 1 // fold is closed +# define FD_LEVEL 2 // depends on 'foldlevel' (nested folds too) -#define MAX_LEVEL 20 // maximum fold depth +# define MAX_LEVEL 20 // maximum fold depth // static functions {{{2 static void newFoldLevelWin(win_T *wp); @@ -83,9 +83,9 @@ static linenr_T prev_lnum = 0; static int prev_lnum_lvl = -1; // Flags used for "done" argument of setManualFold. -#define DONE_NOTHING 0 -#define DONE_ACTION 1 // did close or open a fold -#define DONE_FOLD 2 // did find a fold +# define DONE_NOTHING 0 +# define DONE_ACTION 1 // did close or open a fold +# define DONE_FOLD 2 // did find a fold static int foldstartmarkerlen; static char_u *foldendmarker; @@ -242,7 +242,7 @@ hasFoldingWin( } // foldLevel() {{{2 -#ifdef FEAT_EVAL +# ifdef FEAT_EVAL /* * Return fold level at line number "lnum" in the current window. */ @@ -264,7 +264,7 @@ foldLevel(linenr_T lnum) return foldLevelWin(curwin, lnum); } -#endif +# endif // lineFolded() {{{2 /* @@ -466,7 +466,7 @@ newFoldLevel(void) { newFoldLevelWin(curwin); -#ifdef FEAT_DIFF +# ifdef FEAT_DIFF if (foldmethodIsDiff(curwin) && curwin->w_p_scb) { win_T *wp; @@ -483,7 +483,7 @@ newFoldLevel(void) } } } -#endif +# endif } static void @@ -822,11 +822,11 @@ foldUpdate(win_T *wp, linenr_T top, linenr_T bot) if (disable_fold_update > 0) return; -#ifdef FEAT_DIFF +# ifdef FEAT_DIFF if (need_diff_redraw) // will update later return; -#endif +# endif if (wp->w_folds.ga_len > 0) { @@ -851,9 +851,9 @@ foldUpdate(win_T *wp, linenr_T top, linenr_T bot) if (foldmethodIsIndent(wp) || foldmethodIsExpr(wp) || foldmethodIsMarker(wp) -#ifdef FEAT_DIFF +# ifdef FEAT_DIFF || foldmethodIsDiff(wp) -#endif +# endif || foldmethodIsSyntax(wp)) { int save_got_int = got_int; @@ -1259,7 +1259,7 @@ setManualFold( int recurse, // TRUE when closing/opening recursive int *donep) { -#ifdef FEAT_DIFF +# ifdef FEAT_DIFF if (foldmethodIsDiff(curwin) && curwin->w_p_scb) { win_T *wp; @@ -1279,7 +1279,7 @@ setManualFold( } } } -#endif +# endif return setManualFoldWin(curwin, lnum, opening, recurse, donep); } @@ -1917,7 +1917,7 @@ get_foldtext( char_u *buf) { char_u *text = NULL; -#ifdef FEAT_EVAL +# ifdef FEAT_EVAL // an error occurred when evaluating 'fdt' setting static int got_fdt_error = FALSE; int save_did_emsg = did_emsg; @@ -2012,7 +2012,7 @@ get_foldtext( } } if (text == NULL) -#endif +# endif { long count = (long)(lnume - lnum + 1); @@ -2026,7 +2026,7 @@ get_foldtext( } // foldtext_cleanup() {{{2 -#ifdef FEAT_EVAL +# ifdef FEAT_EVAL /* * Remove 'foldmarker' and 'commentstring' from "str" (in-place). */ @@ -2116,7 +2116,7 @@ foldtext_cleanup(char_u *str) } } } -#endif +# endif // Folding by indent, expr, marker and syntax. {{{1 // Define "fline_T", passed to get fold level for a line. {{{2 @@ -2146,9 +2146,9 @@ static void foldSplit(garray_T *gap, int i, linenr_T top, linenr_T bot); static void foldRemove(garray_T *gap, linenr_T top, linenr_T bot); static void foldMerge(fold_T *fp1, garray_T *gap, fold_T *fp2); static void foldlevelIndent(fline_T *flp); -#ifdef FEAT_DIFF +# ifdef FEAT_DIFF static void foldlevelDiff(fline_T *flp); -#endif +# endif static void foldlevelExpr(fline_T *flp); static void foldlevelMarker(fline_T *flp); static void foldlevelSyntax(fline_T *flp); @@ -2183,7 +2183,7 @@ foldUpdateIEMS(win_T *wp, linenr_T top, linenr_T bot) setSmallMaybe(&wp->w_folds); } -#ifdef FEAT_DIFF +# ifdef FEAT_DIFF // add the context for "diff" folding if (foldmethodIsDiff(wp)) { @@ -2193,7 +2193,7 @@ foldUpdateIEMS(win_T *wp, linenr_T top, linenr_T bot) top = 1; bot += diff_context; } -#endif +# endif // When deleting lines at the end of the buffer "top" can be past the end // of the buffer. @@ -2255,10 +2255,10 @@ foldUpdateIEMS(win_T *wp, linenr_T top, linenr_T bot) } else if (foldmethodIsSyntax(wp)) getlevel = foldlevelSyntax; -#ifdef FEAT_DIFF +# ifdef FEAT_DIFF else if (foldmethodIsDiff(wp)) getlevel = foldlevelDiff; -#endif +# endif else { getlevel = foldlevelIndent; @@ -3082,9 +3082,9 @@ truncate_fold(fold_T *fp, linenr_T end) fp->fd_len = end - fp->fd_top; } -#define fold_end(fp) ((fp)->fd_top + (fp)->fd_len - 1) -#define valid_fold(fp, gap) ((gap)->ga_len > 0 && (fp) < ((fold_T *)(gap)->ga_data + (gap)->ga_len)) -#define fold_index(fp, gap) ((size_t)((fp) - ((fold_T *)(gap)->ga_data))) +# define fold_end(fp) ((fp)->fd_top + (fp)->fd_len - 1) +# define valid_fold(fp, gap) ((gap)->ga_len > 0 && (fp) < ((fold_T *)(gap)->ga_data + (gap)->ga_len)) +# define fold_index(fp, gap) ((size_t)((fp) - ((fold_T *)(gap)->ga_data))) void foldMoveRange(garray_T *gap, linenr_T line1, linenr_T line2, linenr_T dest) @@ -3199,9 +3199,9 @@ foldMoveRange(garray_T *gap, linenr_T line1, linenr_T line2, linenr_T dest) foldReverseOrder(gap, (linenr_T)(move_start + dest_index - move_end), (linenr_T)(dest_index - 1)); } -#undef fold_end -#undef valid_fold -#undef fold_index +# undef fold_end +# undef valid_fold +# undef fold_index // foldMerge() {{{2 /* @@ -3280,7 +3280,7 @@ foldlevelIndent(fline_T *flp) } // foldlevelDiff() {{{2 -#ifdef FEAT_DIFF +# ifdef FEAT_DIFF /* * Low level function to get the foldlevel for the "diff" method. * Doesn't use any caching. @@ -3293,7 +3293,7 @@ foldlevelDiff(fline_T *flp) else flp->lvl = 0; } -#endif +# endif // foldlevelExpr() {{{2 /* @@ -3304,10 +3304,10 @@ foldlevelDiff(fline_T *flp) static void foldlevelExpr(fline_T *flp) { -#ifndef FEAT_EVAL +# ifndef FEAT_EVAL flp->start = FALSE; flp->lvl = 0; -#else +# else win_T *win; int n; int c; @@ -3396,7 +3396,7 @@ foldlevelExpr(fline_T *flp) curwin = win; curbuf = curwin->w_buffer; -#endif +# endif } // parseMarker() {{{2 @@ -3508,10 +3508,10 @@ foldlevelMarker(fline_T *flp) static void foldlevelSyntax(fline_T *flp) { -#ifndef FEAT_SYN_HL +# ifndef FEAT_SYN_HL flp->start = 0; flp->lvl = 0; -#else +# else linenr_T lnum = flp->lnum + flp->off; int n; @@ -3527,12 +3527,12 @@ foldlevelSyntax(fline_T *flp) flp->lvl = n; } } -#endif +# endif } // functions for storing the fold state in a View {{{1 // put_folds() {{{2 -#if defined(FEAT_SESSION) +# if defined(FEAT_SESSION) static int put_folds_recurse(FILE *fd, garray_T *gap, linenr_T off); static int put_foldopen_recurse(FILE *fd, win_T *wp, garray_T *gap, linenr_T off); static int put_fold_open_close(FILE *fd, fold_T *fp, linenr_T off); @@ -3660,7 +3660,7 @@ put_fold_open_close(FILE *fd, fold_T *fp, linenr_T off) return OK; } -#endif // FEAT_SESSION +# endif // FEAT_SESSION // }}}1 #endif // defined(FEAT_FOLDING) @@ -3695,7 +3695,7 @@ foldclosed_both( return; } } -#endif +# endif rettv->vval.v_number = -1; } diff --git a/src/getchar.c b/src/getchar.c index 9bfa2b7598..c7eb7dda40 100644 --- a/src/getchar.c +++ b/src/getchar.c @@ -85,9 +85,9 @@ static int KeyNoremap = 0; // remapping flags #ifdef FEAT_NORMAL // Add extra space to handle large OSC responses in bigger chunks (improve // performance) -#define TYPELEN_INIT (5 * (MAXMAPLEN + 3) + 2048) +# define TYPELEN_INIT (5 * (MAXMAPLEN + 3) + 2048) #else // Tiny version -#define TYPELEN_INIT (5 * (MAXMAPLEN + 3)) +# define TYPELEN_INIT (5 * (MAXMAPLEN + 3)) #endif static char_u typebuf_init[TYPELEN_INIT]; // initial typebuf.tb_buf static char_u noremapbuf_init[TYPELEN_INIT]; // initial typebuf.tb_noremap @@ -1575,9 +1575,9 @@ save_typeahead(tasave_T *tp) readbuf1.bh_first.b_next = NULL; tp->save_readbuf2 = readbuf2; readbuf2.bh_first.b_next = NULL; -# ifdef USE_INPUT_BUF +#ifdef USE_INPUT_BUF tp->save_inputbuf = get_input_buf(); -# endif +#endif } /* @@ -1601,9 +1601,9 @@ restore_typeahead(tasave_T *tp, int overwrite UNUSED) readbuf1 = tp->save_readbuf1; free_buff(&readbuf2); readbuf2 = tp->save_readbuf2; -# ifdef USE_INPUT_BUF +#ifdef USE_INPUT_BUF set_input_buf(tp->save_inputbuf, overwrite); -# endif +#endif } /* @@ -2441,12 +2441,12 @@ getchar_common(typval_T *argvars, typval_T *rettv, int allow_number) if (called_emsg != called_emsg_start) return; -#ifdef MESSAGE_QUEUE +# ifdef MESSAGE_QUEUE // vpeekc() used to check for messages, but that caused problems, invoking // a callback where it was not expected. Some plugins use getchar(1) in a // loop to await a message, therefore make sure we check for messages here. parse_queued_messages(); -#endif +# endif if (cursor_flag == 'h') cursor_sleep(); @@ -2538,11 +2538,11 @@ getchar_common(typval_T *argvars, typval_T *rettv, int allow_number) if (win == NULL) return; (void)mouse_comp_pos(win, &row, &col, &lnum, NULL); -#ifdef FEAT_PROP_POPUP +# ifdef FEAT_PROP_POPUP if (WIN_IS_POPUP(win)) winnr = 0; else -#endif +# endif for (wp = firstwin; wp != win && wp != NULL; wp = wp->w_next) ++winnr; @@ -2668,13 +2668,13 @@ parse_queued_messages(void) if (has_sound_callback_in_queue()) invoke_sound_callback(); # endif -#ifdef SIGUSR1 +# ifdef SIGUSR1 if (got_sigusr1) { apply_autocmds(EVENT_SIGUSR1, NULL, NULL, FALSE, curbuf); got_sigusr1 = FALSE; } -#endif +# endif break; } diff --git a/src/globals.h b/src/globals.h index 338c197dac..c534bfc659 100644 --- a/src/globals.h +++ b/src/globals.h @@ -405,161 +405,161 @@ EXTERN int garbage_collect_at_exit INIT(= FALSE); // t_unknown - used for when the type is really unknown, e.g. global variables. // Also for when a function may or may not return something. -#define t_unknown (static_types[0]) -#define t_const_unknown (static_types[1]) +# define t_unknown (static_types[0]) +# define t_const_unknown (static_types[1]) // t_any - used for when the type can be anything, but excludes "void". -#define t_any (static_types[2]) -#define t_const_any (static_types[3]) +# define t_any (static_types[2]) +# define t_const_any (static_types[3]) // t_void - used for a function not returning anything. -#define t_void (static_types[4]) -#define t_const_void (static_types[5]) +# define t_void (static_types[4]) +# define t_const_void (static_types[5]) -#define t_bool (static_types[6]) -#define t_const_bool (static_types[7]) +# define t_bool (static_types[6]) +# define t_const_bool (static_types[7]) -#define t_null (static_types[8]) -#define t_const_null (static_types[9]) +# define t_null (static_types[8]) +# define t_const_null (static_types[9]) -#define t_none (static_types[10]) -#define t_const_none (static_types[11]) +# define t_none (static_types[10]) +# define t_const_none (static_types[11]) -#define t_number (static_types[12]) -#define t_const_number (static_types[13]) +# define t_number (static_types[12]) +# define t_const_number (static_types[13]) // t_number_bool - number that can be used as a bool -#define t_number_bool (static_types[14]) -#define t_const_number_bool (static_types[15]) +# define t_number_bool (static_types[14]) +# define t_const_number_bool (static_types[15]) // t_number_float - number that can be used as a float -#define t_number_float (static_types[16]) -#define t_const_number_float (static_types[17]) +# define t_number_float (static_types[16]) +# define t_const_number_float (static_types[17]) -#define t_float (static_types[18]) -#define t_const_float (static_types[19]) +# define t_float (static_types[18]) +# define t_const_float (static_types[19]) -#define t_string (static_types[20]) -#define t_const_string (static_types[21]) +# define t_string (static_types[20]) +# define t_const_string (static_types[21]) -#define t_blob (static_types[22]) -#define t_const_blob (static_types[23]) +# define t_blob (static_types[22]) +# define t_const_blob (static_types[23]) -#define t_blob_null (static_types[24]) -#define t_const_blob_null (static_types[25]) +# define t_blob_null (static_types[24]) +# define t_const_blob_null (static_types[25]) -#define t_job (static_types[26]) -#define t_const_job (static_types[27]) +# define t_job (static_types[26]) +# define t_const_job (static_types[27]) -#define t_channel (static_types[28]) -#define t_const_channel (static_types[29]) +# define t_channel (static_types[28]) +# define t_const_channel (static_types[29]) // t_number_or_string - Special value used for @#. -#define t_number_or_string (static_types[30]) -#define t_const_number_or_string (static_types[31]) +# define t_number_or_string (static_types[30]) +# define t_const_number_or_string (static_types[31]) // t_func_unknown - function with any arguments and no or unknown return value -#define t_func_unknown (static_types[32]) -#define t_const_func_unknown (static_types[33]) +# define t_func_unknown (static_types[32]) +# define t_const_func_unknown (static_types[33]) // t_func_void - function with any arguments and no return value -#define t_func_void (static_types[34]) -#define t_const_func_void (static_types[35]) +# define t_func_void (static_types[34]) +# define t_const_func_void (static_types[35]) -#define t_func_any (static_types[36]) -#define t_const_func_any (static_types[37]) +# define t_func_any (static_types[36]) +# define t_const_func_any (static_types[37]) -#define t_func_number (static_types[38]) -#define t_const_func_number (static_types[39]) +# define t_func_number (static_types[38]) +# define t_const_func_number (static_types[39]) -#define t_func_string (static_types[40]) -#define t_const_func_string (static_types[41]) +# define t_func_string (static_types[40]) +# define t_const_func_string (static_types[41]) -#define t_func_bool (static_types[42]) -#define t_const_func_bool (static_types[43]) +# define t_func_bool (static_types[42]) +# define t_const_func_bool (static_types[43]) // t_func_0_void - function without arguments and nor return value -#define t_func_0_void (static_types[44]) -#define t_const_func_0_void (static_types[45]) +# define t_func_0_void (static_types[44]) +# define t_const_func_0_void (static_types[45]) -#define t_func_0_any (static_types[46]) -#define t_const_func_0_any (static_types[47]) +# define t_func_0_any (static_types[46]) +# define t_const_func_0_any (static_types[47]) -#define t_func_0_number (static_types[48]) -#define t_const_func_0_number (static_types[49]) +# define t_func_0_number (static_types[48]) +# define t_const_func_0_number (static_types[49]) -#define t_func_0_string (static_types[50]) -#define t_const_func_0_string (static_types[51]) +# define t_func_0_string (static_types[50]) +# define t_const_func_0_string (static_types[51]) -#define t_list_any (static_types[52]) -#define t_const_list_any (static_types[53]) +# define t_list_any (static_types[52]) +# define t_const_list_any (static_types[53]) -#define t_dict_any (static_types[54]) -#define t_const_dict_any (static_types[55]) +# define t_dict_any (static_types[54]) +# define t_const_dict_any (static_types[55]) -#define t_list_empty (static_types[56]) -#define t_const_list_empty (static_types[57]) +# define t_list_empty (static_types[56]) +# define t_const_list_empty (static_types[57]) -#define t_dict_empty (static_types[58]) -#define t_const_dict_empty (static_types[59]) +# define t_dict_empty (static_types[58]) +# define t_const_dict_empty (static_types[59]) -#define t_list_bool (static_types[60]) -#define t_const_list_bool (static_types[61]) +# define t_list_bool (static_types[60]) +# define t_const_list_bool (static_types[61]) -#define t_list_number (static_types[62]) -#define t_const_list_number (static_types[63]) +# define t_list_number (static_types[62]) +# define t_const_list_number (static_types[63]) -#define t_list_string (static_types[64]) -#define t_const_list_string (static_types[65]) +# define t_list_string (static_types[64]) +# define t_const_list_string (static_types[65]) -#define t_list_job (static_types[66]) -#define t_const_list_job (static_types[67]) +# define t_list_job (static_types[66]) +# define t_const_list_job (static_types[67]) -#define t_list_dict_any (static_types[68]) -#define t_const_list_dict_any (static_types[69]) +# define t_list_dict_any (static_types[68]) +# define t_const_list_dict_any (static_types[69]) -#define t_list_list_any (static_types[70]) -#define t_const_list_list_any (static_types[71]) +# define t_list_list_any (static_types[70]) +# define t_const_list_list_any (static_types[71]) -#define t_list_list_number (static_types[72]) -#define t_const_list_list_number (static_types[73]) +# define t_list_list_number (static_types[72]) +# define t_const_list_list_number (static_types[73]) -#define t_list_list_string (static_types[74]) -#define t_const_list_list_string (static_types[75]) +# define t_list_list_string (static_types[74]) +# define t_const_list_list_string (static_types[75]) -#define t_list_list_list_number (static_types[76]) -#define t_const_list_list_list_number (static_types[77]) +# define t_list_list_list_number (static_types[76]) +# define t_const_list_list_list_number (static_types[77]) -#define t_dict_bool (static_types[78]) -#define t_const_dict_bool (static_types[79]) +# define t_dict_bool (static_types[78]) +# define t_const_dict_bool (static_types[79]) -#define t_dict_number (static_types[80]) -#define t_const_dict_number (static_types[81]) +# define t_dict_number (static_types[80]) +# define t_const_dict_number (static_types[81]) -#define t_dict_string (static_types[82]) -#define t_const_dict_string (static_types[83]) +# define t_dict_string (static_types[82]) +# define t_const_dict_string (static_types[83]) -#define t_super (static_types[84]) -#define t_const_super (static_types[85]) +# define t_super (static_types[84]) +# define t_const_super (static_types[85]) -#define t_object_any (static_types[86]) -#define t_const_object_any (static_types[87]) +# define t_object_any (static_types[86]) +# define t_const_object_any (static_types[87]) -#define t_class (static_types[88]) -#define t_const_class (static_types[89]) +# define t_class (static_types[88]) +# define t_const_class (static_types[89]) -#define t_typealias (static_types[90]) -#define t_const_typealias (static_types[91]) +# define t_typealias (static_types[90]) +# define t_const_typealias (static_types[91]) -#define t_tuple_any (static_types[92]) -#define t_const_tuple_any (static_types[93]) +# define t_tuple_any (static_types[92]) +# define t_const_tuple_any (static_types[93]) -#define t_tuple_empty (static_types[94]) -#define t_const_tuple_empty (static_types[95]) +# define t_tuple_empty (static_types[94]) +# define t_const_tuple_empty (static_types[95]) EXTERN type_T static_types[96] -#ifdef DO_INIT +# ifdef DO_INIT = { // 0: t_unknown {VAR_UNKNOWN, 0, 0, TTFLAG_STATIC, NULL, NULL, NULL}, @@ -753,7 +753,7 @@ EXTERN type_T static_types[96] {VAR_TUPLE, 0, 0, TTFLAG_STATIC, NULL, NULL, NULL}, {VAR_TUPLE, 0, 0, TTFLAG_STATIC|TTFLAG_CONST, NULL, NULL, NULL}, } -#endif +# endif ; EXTERN int did_source_packages INIT(= FALSE); @@ -875,12 +875,12 @@ EXTERN int gui_prev_topfill INIT(= 0); # endif #endif -# ifdef FEAT_MOUSESHAPE +#ifdef FEAT_MOUSESHAPE EXTERN int drag_status_line INIT(= FALSE); // dragging the status line EXTERN int postponed_mouseshape INIT(= FALSE); // postponed updating the // mouse pointer shape EXTERN int drag_sep_line INIT(= FALSE); // dragging vert separator -# endif +#endif #ifdef FEAT_DIFF @@ -1351,14 +1351,14 @@ EXTERN int (*mb_ptr2char)(char_u *p) INIT(= latin_ptr2char); // terminated. EXTERN int (*mb_head_off)(char_u *base, char_u *p) INIT(= latin_head_off); -# if defined(USE_ICONV) && defined(DYNAMIC_ICONV) +#if defined(USE_ICONV) && defined(DYNAMIC_ICONV) // Pointers to functions and variables to be loaded at runtime EXTERN size_t (*iconv) (iconv_t cd, const char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft); EXTERN iconv_t (*iconv_open) (const char *tocode, const char *fromcode); EXTERN int (*iconv_close) (iconv_t cd); EXTERN int (*iconvctl) (iconv_t cd, int request, void *argument); EXTERN int* (*iconv_errno) (void); -# endif +#endif #ifdef FEAT_XIM @@ -1627,9 +1627,9 @@ EXTERN int aucmd_cmdline_changed_count INIT(= 0); EXTERN int did_cursorhold INIT(= TRUE); // set when CursorHold t'gerd EXTERN pos_T last_cursormoved // for CursorMoved event -# ifdef DO_INIT +#ifdef DO_INIT = {0, 0, 0} -# endif +#endif ; EXTERN int postponed_split INIT(= 0); // for CTRL-W CTRL-] command diff --git a/src/gui_beval.c b/src/gui_beval.c index 1fd19c7475..1d41089fec 100644 --- a/src/gui_beval.c +++ b/src/gui_beval.c @@ -15,24 +15,24 @@ // on Win32 only get_beval_info() is required #if !defined(FEAT_GUI_MSWIN) -#ifdef FEAT_GUI_GTK -# if GTK_CHECK_VERSION(3,0,0) -# include +# ifdef FEAT_GUI_GTK +# if GTK_CHECK_VERSION(3,0,0) +# include +# else +# include +# endif +# include # else -# include +# include +# include +# include +# include +# include +# include +# include # endif -# include -#else -# include -# include -# include -# include -# include -# include -# include -#endif - -#ifndef FEAT_GUI_GTK + +# ifndef FEAT_GUI_GTK extern Widget vimShell; /* @@ -41,9 +41,9 @@ extern Widget vimShell; * showing BalloonEval or NULL if none is showing. */ static BalloonEval *current_beval = NULL; -#endif +# endif -#ifdef FEAT_GUI_GTK +# ifdef FEAT_GUI_GTK static void addEventHandler(GtkWidget *, BalloonEval *); static void removeEventHandler(BalloonEval *); static gint target_event_cb(GtkWidget *, GdkEvent *, gpointer); @@ -51,18 +51,18 @@ static gint mainwin_event_cb(GtkWidget *, GdkEvent *, gpointer); static void pointer_event(BalloonEval *, int, int, unsigned); static void key_event(BalloonEval *, unsigned, int); static gboolean timeout_cb(gpointer); -# if GTK_CHECK_VERSION(3,0,0) +# if GTK_CHECK_VERSION(3,0,0) static gboolean balloon_draw_event_cb (GtkWidget *, cairo_t *, gpointer); -# else +# else static gint balloon_expose_event_cb (GtkWidget *, GdkEventExpose *, gpointer); -# endif -#else +# endif +# else static void addEventHandler(Widget, BalloonEval *); static void removeEventHandler(BalloonEval *); static void pointerEventEH(Widget, XtPointer, XEvent *, Boolean *); static void pointerEvent(BalloonEval *, XEvent *); static void timerRoutine(XtPointer, XtIntervalId *); -#endif +# endif static void cancelBalloon(BalloonEval *); static void requestBalloon(BalloonEval *); static void drawBalloon(BalloonEval *); @@ -84,11 +84,11 @@ gui_mch_create_beval_area( void (*mesgCB)(BalloonEval *, int), void *clientData) { -#ifndef FEAT_GUI_GTK +# ifndef FEAT_GUI_GTK char *display_name; // get from gui.dpy int screen_num; char *p; -#endif +# endif BalloonEval *beval; if (mesg != NULL && mesgCB != NULL) @@ -100,12 +100,12 @@ gui_mch_create_beval_area( beval = ALLOC_CLEAR_ONE(BalloonEval); if (beval != NULL) { -#ifdef FEAT_GUI_GTK +# ifdef FEAT_GUI_GTK beval->target = GTK_WIDGET(target); -#else +# else beval->target = (Widget)target; beval->appContext = XtWidgetToApplicationContext((Widget)target); -#endif +# endif beval->showState = ShS_NEUTRAL; vim_free(beval->msg); beval->msg = mesg == NULL ? NULL : vim_strsave(mesg); @@ -120,7 +120,7 @@ gui_mch_create_beval_area( addEventHandler(beval->target, beval); createBalloonEvalWindow(beval); -#ifndef FEAT_GUI_GTK +# ifndef FEAT_GUI_GTK /* * Now create and save the screen width and height. Used in drawing. */ @@ -132,13 +132,13 @@ gui_mch_create_beval_area( screen_num = 0; beval->screen_width = DisplayWidth(gui.dpy, screen_num); beval->screen_height = DisplayHeight(gui.dpy, screen_num); -#endif +# endif } return beval; } -#if defined(FEAT_BEVAL_TIP) +# if defined(FEAT_BEVAL_TIP) /* * Destroy a balloon-eval and free its associated memory. */ @@ -148,18 +148,18 @@ gui_mch_destroy_beval_area(BalloonEval *beval) cancelBalloon(beval); removeEventHandler(beval); // Children will automatically be destroyed -# ifdef FEAT_GUI_GTK +# ifdef FEAT_GUI_GTK gtk_widget_destroy(beval->balloonShell); -# else +# else XtDestroyWidget(beval->balloonShell); -# endif -# ifdef FEAT_VARTABS +# endif +# ifdef FEAT_VARTABS if (beval->vts) vim_free(beval->vts); -# endif +# endif vim_free(beval); } -#endif +# endif void gui_mch_enable_beval_area(BalloonEval *beval) @@ -175,7 +175,7 @@ gui_mch_disable_beval_area(BalloonEval *beval) removeEventHandler(beval); } -#if defined(FEAT_BEVAL_TIP) +# if defined(FEAT_BEVAL_TIP) /* * This function returns the BalloonEval * associated with the currently * displayed tooltip. Returns NULL if there is no tooltip currently showing. @@ -187,7 +187,7 @@ gui_mch_currently_showing_beval(void) { return current_beval; } -#endif +# endif #endif // !FEAT_GUI_MSWIN #if defined(FEAT_NETBEANS_INTG) || defined(FEAT_EVAL) @@ -210,7 +210,7 @@ gui_mch_post_balloon(BalloonEval *beval, char_u *mesg) #endif // FEAT_NETBEANS_INTG || FEAT_EVAL #if !defined(FEAT_GUI_MSWIN) -#if defined(FEAT_BEVAL_TIP) +# if defined(FEAT_BEVAL_TIP) /* * Hide the given balloon. */ @@ -220,9 +220,9 @@ gui_mch_unpost_balloon(BalloonEval *beval) VIM_CLEAR(beval->msg); undrawBalloon(beval); } -#endif +# endif -#ifdef FEAT_GUI_GTK +# ifdef FEAT_GUI_GTK static void addEventHandler(GtkWidget *target, BalloonEval *beval) { @@ -290,22 +290,22 @@ target_event_cb(GtkWidget *widget, GdkEvent *event, gpointer data) * GDK_POINTER_MOTION_HINT_MASK is set, thus we cannot obtain * the coordinates from the GdkEventMotion struct directly. */ -# if GTK_CHECK_VERSION(3,0,0) +# if GTK_CHECK_VERSION(3,0,0) { GdkWindow * const win = gtk_widget_get_window(widget); GdkDisplay * const dpy = gdk_window_get_display(win); -# if GTK_CHECK_VERSION(3,20,0) +# if GTK_CHECK_VERSION(3,20,0) GdkSeat * const seat = gdk_display_get_default_seat(dpy); GdkDevice * const dev = gdk_seat_get_pointer(seat); -# else +# else GdkDeviceManager * const mngr = gdk_display_get_device_manager(dpy); GdkDevice * const dev = gdk_device_manager_get_client_pointer(mngr); -# endif +# endif gdk_window_get_device_position(win, dev , &x, &y, &state); } -# else +# else gdk_window_get_pointer(widget->window, &x, &y, &state); -# endif +# endif pointer_event(beval, x, y, (unsigned int)state); } else @@ -456,7 +456,7 @@ timeout_cb(gpointer data) return FALSE; // don't call me again } -# if GTK_CHECK_VERSION(3,0,0) +# if GTK_CHECK_VERSION(3,0,0) static gboolean balloon_draw_event_cb(GtkWidget *widget, cairo_t *cr, @@ -486,7 +486,7 @@ balloon_draw_event_cb(GtkWidget *widget, return FALSE; } -# else +# else static gint balloon_expose_event_cb(GtkWidget *widget, GdkEventExpose *event, @@ -499,9 +499,9 @@ balloon_expose_event_cb(GtkWidget *widget, return FALSE; // continue emission } -# endif // !GTK_CHECK_VERSION(3,0,0) +# endif // !GTK_CHECK_VERSION(3,0,0) -#else // !FEAT_GUI_GTK +# else // !FEAT_GUI_GTK static void addEventHandler(Widget target, BalloonEval *beval) @@ -693,7 +693,7 @@ timerRoutine(XtPointer dx, XtIntervalId *id UNUSED) requestBalloon(beval); } -#endif // !FEAT_GUI_GTK +# endif // !FEAT_GUI_GTK static void requestBalloon(BalloonEval *beval) @@ -711,14 +711,14 @@ requestBalloon(BalloonEval *beval) drawBalloon(beval); } -#ifdef FEAT_GUI_GTK +# ifdef FEAT_GUI_GTK /* * Convert the string to UTF-8 if 'encoding' is not "utf-8". * Replace any non-printable characters and invalid bytes sequences with * "^X" or "" escapes, and apply SpecialKey highlighting to them. * TAB and NL are passed through unscathed. */ -# define IS_NONPRINTABLE(c) (((c) < 0x20 && (c) != TAB && (c) != NL) \ +# define IS_NONPRINTABLE(c) (((c) < 0x20 && (c) != TAB && (c) != NL) \ || (c) == DEL) static void set_printable_label_text(GtkLabel *label, char_u *text) @@ -777,30 +777,30 @@ set_printable_label_text(GtkLabel *label, char_u *text) attrentry_T *aep; PangoAttribute *attr; guicolor_T pixel; -#if GTK_CHECK_VERSION(3,0,0) +# if GTK_CHECK_VERSION(3,0,0) GdkRGBA color = { 0.0, 0.0, 0.0, 1.0 }; -# if PANGO_VERSION_CHECK(1,38,0) +# if PANGO_VERSION_CHECK(1,38,0) PangoAttribute *attr_alpha; -# endif -#else +# endif +# else GdkColor color = { 0, 0, 0, 0 }; -#endif +# endif // Look up the RGB values of the SpecialKey foreground color. aep = syn_gui_attr2entry(HL_ATTR(HLF_8)); pixel = (aep != NULL) ? aep->ae_u.gui.fg_color : INVALCOLOR; if (pixel != INVALCOLOR) -# if GTK_CHECK_VERSION(3,0,0) +# if GTK_CHECK_VERSION(3,0,0) { color.red = ((pixel & 0xff0000) >> 16) / 255.0; color.green = ((pixel & 0xff00) >> 8) / 255.0; color.blue = (pixel & 0xff) / 255.0; color.alpha = 1.0; } -# else +# else gdk_colormap_query_color(gtk_widget_get_colormap(gui.drawarea), (unsigned long)pixel, &color); -# endif +# endif pdest = buf; p = text; @@ -844,31 +844,31 @@ set_printable_label_text(GtkLabel *label, char_u *text) } if (pixel != INVALCOLOR) { -#if GTK_CHECK_VERSION(3,0,0) -# define DOUBLE2UINT16(val) ((guint16)((val) * 65535 + 0.5)) +# if GTK_CHECK_VERSION(3,0,0) +# define DOUBLE2UINT16(val) ((guint16)((val) * 65535 + 0.5)) attr = pango_attr_foreground_new( DOUBLE2UINT16(color.red), DOUBLE2UINT16(color.green), DOUBLE2UINT16(color.blue)); -# if PANGO_VERSION_CHECK(1,38,0) +# if PANGO_VERSION_CHECK(1,38,0) attr_alpha = pango_attr_foreground_alpha_new( DOUBLE2UINT16(color.alpha)); -# endif -# undef DOUBLE2UINT16 -#else +# endif +# undef DOUBLE2UINT16 +# else attr = pango_attr_foreground_new( color.red, color.green, color.blue); -#endif +# endif attr->start_index = pdest - buf; attr->end_index = pdest - buf + outlen; pango_attr_list_insert(attr_list, attr); -#if GTK_CHECK_VERSION(3,0,0) -# if PANGO_VERSION_CHECK(1,38,0) +# if GTK_CHECK_VERSION(3,0,0) +# if PANGO_VERSION_CHECK(1,38,0) attr_alpha->start_index = pdest - buf; attr_alpha->end_index = pdest - buf + outlen; pango_attr_list_insert(attr_list, attr_alpha); -# endif -#endif +# endif +# endif } pdest += outlen; p += charlen; @@ -892,7 +892,7 @@ set_printable_label_text(GtkLabel *label, char_u *text) gtk_label_set_attributes(label, attr_list); pango_attr_list_unref(attr_list); } -# undef IS_NONPRINTABLE +# undef IS_NONPRINTABLE /* * Draw a balloon. @@ -914,18 +914,18 @@ drawBalloon(BalloonEval *beval) int y_offset = EVAL_OFFSET_Y; PangoLayout *layout; -# if !GTK_CHECK_VERSION(3,22,2) +# if !GTK_CHECK_VERSION(3,22,2) GdkScreen *screen; screen = gtk_widget_get_screen(beval->target); gtk_window_set_screen(GTK_WINDOW(beval->balloonShell), screen); -# endif +# endif gui_gtk_get_screen_geom_of_win(beval->target, 0, 0, &screen_x, &screen_y, &screen_w, &screen_h); -# if !GTK_CHECK_VERSION(3,0,0) +# if !GTK_CHECK_VERSION(3,0,0) gtk_widget_ensure_style(beval->balloonShell); gtk_widget_ensure_style(beval->balloonLabel); -# endif +# endif set_printable_label_text(GTK_LABEL(beval->balloonLabel), beval->msg); /* @@ -934,11 +934,11 @@ drawBalloon(BalloonEval *beval) * builtin maximum value of about 65 Latin characters. */ layout = gtk_label_get_layout(GTK_LABEL(beval->balloonLabel)); -# ifdef PANGO_WRAP_WORD_CHAR +# ifdef PANGO_WRAP_WORD_CHAR pango_layout_set_wrap(layout, PANGO_WRAP_WORD_CHAR); -# else +# else pango_layout_set_wrap(layout, PANGO_WRAP_WORD); -# endif +# endif pango_layout_set_width(layout, // try to come up with some reasonable width PANGO_SCALE * CLAMP(gui.num_cols * gui.char_width, @@ -946,11 +946,11 @@ drawBalloon(BalloonEval *beval) MAX(20, screen_w - 20))); // Calculate the balloon's width and height. -# if GTK_CHECK_VERSION(3,0,0) +# if GTK_CHECK_VERSION(3,0,0) gtk_widget_get_preferred_size(beval->balloonShell, &requisition, NULL); -# else +# else gtk_widget_size_request(beval->balloonShell, &requisition); -# endif +# endif // Compute position of the balloon area gdk_window_get_origin(gtk_widget_get_window(beval->target), &x, &y); @@ -970,11 +970,11 @@ drawBalloon(BalloonEval *beval) MAX(0, screen_y + screen_h - requisition.height)); // Show the balloon -# if GTK_CHECK_VERSION(3,0,0) +# if GTK_CHECK_VERSION(3,0,0) gtk_window_move(GTK_WINDOW(beval->balloonShell), x, y); -# else +# else gtk_widget_set_uposition(beval->balloonShell, x, y); -# endif +# endif gtk_widget_show(beval->balloonShell); beval->showState = ShS_SHOWING; @@ -1018,37 +1018,37 @@ createBalloonEvalWindow(BalloonEval *beval) gtk_widget_set_name(beval->balloonShell, "gtk-tooltips"); gtk_container_set_border_width(GTK_CONTAINER(beval->balloonShell), 4); -# if GTK_CHECK_VERSION(3,0,0) +# if GTK_CHECK_VERSION(3,0,0) g_signal_connect(G_OBJECT(beval->balloonShell), "draw", G_CALLBACK(balloon_draw_event_cb), NULL); -# else +# else gtk_signal_connect((GtkObject*)(beval->balloonShell), "expose_event", GTK_SIGNAL_FUNC(balloon_expose_event_cb), NULL); -# endif +# endif beval->balloonLabel = gtk_label_new(NULL); gtk_label_set_line_wrap(GTK_LABEL(beval->balloonLabel), FALSE); gtk_label_set_justify(GTK_LABEL(beval->balloonLabel), GTK_JUSTIFY_LEFT); -# if GTK_CHECK_VERSION(3,16,0) +# if GTK_CHECK_VERSION(3,16,0) gtk_label_set_xalign(GTK_LABEL(beval->balloonLabel), 0.5); gtk_label_set_yalign(GTK_LABEL(beval->balloonLabel), 0.5); -# elif GTK_CHECK_VERSION(3,14,0) +# elif GTK_CHECK_VERSION(3,14,0) GValue align_val = G_VALUE_INIT; g_value_init(&align_val, G_TYPE_FLOAT); g_value_set_float(&align_val, 0.5); g_object_set_property(G_OBJECT(beval->balloonLabel), "xalign", &align_val); g_object_set_property(G_OBJECT(beval->balloonLabel), "yalign", &align_val); g_value_unset(&align_val); -# else +# else gtk_misc_set_alignment(GTK_MISC(beval->balloonLabel), 0.5f, 0.5f); -# endif +# endif gtk_widget_set_name(beval->balloonLabel, "vim-balloon-label"); gtk_widget_show(beval->balloonLabel); gtk_container_add(GTK_CONTAINER(beval->balloonShell), beval->balloonLabel); } -#else // !FEAT_GUI_GTK +# else // !FEAT_GUI_GTK /* * Draw a balloon. @@ -1174,7 +1174,7 @@ createBalloonEvalWindow(BalloonEval *beval) xmLabelWidgetClass, beval->balloonShell, args, n); } -#endif // !FEAT_GUI_GTK +# endif // !FEAT_GUI_GTK #endif // !FEAT_GUI_MSWIN #endif // FEAT_BEVAL_GUI diff --git a/src/gui_gtk.c b/src/gui_gtk.c index 305e761a5c..77f96179e1 100644 --- a/src/gui_gtk.c +++ b/src/gui_gtk.c @@ -1863,12 +1863,12 @@ gui_mch_show_popupmenu(vimmenu_T *menu) gtk_menu_popup_at_pointer(GTK_MENU(menu->submenu_id), (GdkEvent *)&trigger); } -#else +# else gtk_menu_popup(GTK_MENU(menu->submenu_id), NULL, NULL, (GtkMenuPositionFunc)NULL, NULL, 3U, gui.event_time); -#endif +# endif } // Ugly global variable to pass "mouse_pos" flag from gui_make_popup() to @@ -2132,7 +2132,7 @@ find_replace_dialog_create(char_u *arg, int do_replace) int wword = FALSE; int mcase = !p_ic; char_u *conv_buffer = NULL; -# define CONV(message) convert_localized_message(&conv_buffer, (message)) +#define CONV(message) convert_localized_message(&conv_buffer, (message)) frdp = (do_replace) ? (&repl_widgets) : (&find_widgets); diff --git a/src/gui_gtk_f.h b/src/gui_gtk_f.h index 073db6ac73..2103f9df4f 100644 --- a/src/gui_gtk_f.h +++ b/src/gui_gtk_f.h @@ -10,10 +10,10 @@ #define __GTK_FORM_H__ #ifdef USE_GTK3 -#include +# include #else -#include -#include +# include +# include #endif @@ -23,15 +23,15 @@ extern "C" { #define GTK_TYPE_FORM (gui_gtk_form_get_type ()) #ifdef USE_GTK3 -#define GTK_FORM(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GTK_TYPE_FORM, GtkForm)) -#define GTK_FORM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GTK_TYPE_FORM, GtkFormClass)) -#define GTK_IS_FORM(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GTK_TYPE_FORM)) -#define GTK_IS_FORM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GTK_TYPE_FORM)) +# define GTK_FORM(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GTK_TYPE_FORM, GtkForm)) +# define GTK_FORM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GTK_TYPE_FORM, GtkFormClass)) +# define GTK_IS_FORM(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GTK_TYPE_FORM)) +# define GTK_IS_FORM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GTK_TYPE_FORM)) #else -#define GTK_FORM(obj) (GTK_CHECK_CAST ((obj), GTK_TYPE_FORM, GtkForm)) -#define GTK_FORM_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GTK_TYPE_FORM, GtkFormClass)) -#define GTK_IS_FORM(obj) (GTK_CHECK_TYPE ((obj), GTK_TYPE_FORM)) -#define GTK_IS_FORM_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GTK_TYPE_FORM)) +# define GTK_FORM(obj) (GTK_CHECK_CAST ((obj), GTK_TYPE_FORM, GtkForm)) +# define GTK_FORM_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GTK_TYPE_FORM, GtkFormClass)) +# define GTK_IS_FORM(obj) (GTK_CHECK_TYPE ((obj), GTK_TYPE_FORM)) +# define GTK_IS_FORM_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GTK_TYPE_FORM)) #endif diff --git a/src/gui_gtk_x11.c b/src/gui_gtk_x11.c index ec845a36e6..015a2c7f65 100644 --- a/src/gui_gtk_x11.c +++ b/src/gui_gtk_x11.c @@ -27,7 +27,7 @@ #include "vim.h" #ifdef USE_GRESOURCE -#include "auto/gui_gtk_gresources.h" +# include "auto/gui_gtk_gresources.h" #endif #ifdef FEAT_GUI_GNOME @@ -145,7 +145,7 @@ static const GtkTargetEntry dnd_targets[] = * "Monospace" is a standard font alias that should be present * on all proper Pango/fontconfig installations. */ -# define DEFAULT_FONT "Monospace 12" +#define DEFAULT_FONT "Monospace 12" #if defined(FEAT_GUI_GNOME) && defined(FEAT_SESSION) # define USE_GNOME_SESSION @@ -706,12 +706,12 @@ gui_mch_prepare(int *argc, char **argv) gui_mch_free_all(void) { vim_free(gui_argv); -#if defined(USE_GNOME_SESSION) +# if defined(USE_GNOME_SESSION) vim_free(abs_restart_command); -#endif -#ifdef TRACK_RESIZE_HISTORY +# endif +# ifdef TRACK_RESIZE_HISTORY free_all_resize_hist(); -#endif +# endif } #endif @@ -2036,11 +2036,11 @@ scroll_event(GtkWidget *widget, int_u vim_modifiers; #if GTK_CHECK_VERSION(3,4,0) static double acc_x, acc_y; -#if !GTK_CHECK_VERSION(3,22,0) +# if !GTK_CHECK_VERSION(3,22,0) static guint32 last_smooth_event_time; -#endif -#define DT_X11 1 -#define DT_WAYLAND 2 +# endif +# define DT_X11 1 +# define DT_WAYLAND 2 static int display_type; if (!display_type) display_type = gui_mch_get_display() ? DT_X11 : DT_WAYLAND; @@ -2071,30 +2071,30 @@ scroll_event(GtkWidget *widget, // this event tells us to stop, without an actual moving return FALSE; } -#if GTK_CHECK_VERSION(3,22,0) +# if GTK_CHECK_VERSION(3,22,0) if (gdk_device_get_axes(event->device) & GDK_AXIS_FLAG_WHEEL) // this is from a wheel (as oppose to a touchpad / trackpoint) -#else +# else if (event->time - last_smooth_event_time > 50) // reset our accumulations after 50ms of silence -#endif +# endif acc_x = acc_y = 0; acc_x += event->delta_x; acc_y += event->delta_y; -#if !GTK_CHECK_VERSION(3,22,0) +# if !GTK_CHECK_VERSION(3,22,0) last_smooth_event_time = event->time; -#endif +# endif break; #endif default: // This shouldn't happen return FALSE; } -# ifdef FEAT_XIM +#ifdef FEAT_XIM // cancel any preediting if (im_is_preediting()) xim_reset(); -# endif +#endif vim_modifiers = modifiers_gdk2mouse(event->state); @@ -2132,8 +2132,8 @@ scroll_event(GtkWidget *widget, // for X11 we deal with unsmooth events, and so ignore the smooth ones ; else -#undef DT_X11 -#undef DT_WAYLAND +# undef DT_X11 +# undef DT_WAYLAND #endif gui_send_mouse_event(button, (int)event->x, (int)event->y, FALSE, vim_modifiers); @@ -3179,9 +3179,9 @@ update_window_manager_hints(int force_width, int force_height) // otherwise the hints don't work. width = gui_get_base_width(); height = gui_get_base_height(); -# ifdef FEAT_MENU +#ifdef FEAT_MENU height += tabline_height() * gui.char_height; -# endif +#endif width += get_menu_tool_width(); height += get_menu_tool_height(); @@ -4846,16 +4846,16 @@ gui_mch_set_shellsize(int width, int height, else update_window_manager_hints(width, height); -# if !GTK_CHECK_VERSION(3,0,0) -# if 0 +#if !GTK_CHECK_VERSION(3,0,0) +# if 0 if (!resize_idle_installed) { g_idle_add_full(GDK_PRIORITY_EVENTS + 10, &force_shell_resize_idle, NULL, NULL); resize_idle_installed = TRUE; } -# endif -# endif // !GTK_CHECK_VERSION(3,0,0) +# endif +#endif // !GTK_CHECK_VERSION(3,0,0) /* * Wait until all events are processed to prevent a crash because the * real size of the drawing area doesn't reflect Vim's internal ideas. diff --git a/src/gui_motif.c b/src/gui_motif.c index 6ddcbfabdf..9f4a5856d0 100644 --- a/src/gui_motif.c +++ b/src/gui_motif.c @@ -725,10 +725,10 @@ gui_motif_fontset2fontlist(XFontSet *fontset) */ static void gui_motif_add_actext(vimmenu_T *menu); -#if (XmVersion >= 1002) +# if (XmVersion >= 1002) static void toggle_tearoff(Widget wid); static void gui_mch_recurse_tearoffs(vimmenu_T *menu); -#endif +# endif static void submenu_change(vimmenu_T *mp, int colors); static void do_set_mnemonics(int enable); @@ -740,7 +740,7 @@ gui_mch_enable_menu(int flag) if (flag) { XtManageChild(menuBar); -#ifdef FEAT_TOOLBAR +# ifdef FEAT_TOOLBAR if (XtIsManaged(XtParent(toolBar))) { // toolBar is attached to top form @@ -748,7 +748,7 @@ gui_mch_enable_menu(int flag) XmNtopAttachment, XmATTACH_WIDGET, XmNtopWidget, menuBar, NULL); -#ifdef FEAT_GUI_TABLINE +# ifdef FEAT_GUI_TABLINE if (showing_tabline) { XtVaSetValues(tabLine, @@ -761,16 +761,16 @@ gui_mch_enable_menu(int flag) NULL); } else -#endif +# endif XtVaSetValues(textAreaForm, XmNtopAttachment, XmATTACH_WIDGET, XmNtopWidget, XtParent(toolBar), NULL); } else -#endif +# endif { -#ifdef FEAT_GUI_TABLINE +# ifdef FEAT_GUI_TABLINE if (showing_tabline) { XtVaSetValues(tabLine, @@ -783,7 +783,7 @@ gui_mch_enable_menu(int flag) NULL); } else -#endif +# endif XtVaSetValues(textAreaForm, XmNtopAttachment, XmATTACH_WIDGET, XmNtopWidget, menuBar, @@ -793,13 +793,13 @@ gui_mch_enable_menu(int flag) else { XtUnmanageChild(menuBar); -#ifdef FEAT_TOOLBAR +# ifdef FEAT_TOOLBAR if (XtIsManaged(XtParent(toolBar))) { XtVaSetValues(XtParent(toolBar), XmNtopAttachment, XmATTACH_FORM, NULL); -#ifdef FEAT_GUI_TABLINE +# ifdef FEAT_GUI_TABLINE if (showing_tabline) { XtVaSetValues(tabLine, @@ -812,16 +812,16 @@ gui_mch_enable_menu(int flag) NULL); } else -#endif +# endif XtVaSetValues(textAreaForm, XmNtopAttachment, XmATTACH_WIDGET, XmNtopWidget, XtParent(toolBar), NULL); } else -#endif +# endif { -#ifdef FEAT_GUI_TABLINE +# ifdef FEAT_GUI_TABLINE if (showing_tabline) { XtVaSetValues(tabLine, @@ -833,7 +833,7 @@ gui_mch_enable_menu(int flag) NULL); } else -#endif +# endif XtVaSetValues(textAreaForm, XmNtopAttachment, XmATTACH_FORM, NULL); @@ -876,7 +876,7 @@ gui_mch_add_menu(vimmenu_T *menu, int idx) Widget shell; vimmenu_T *parent = menu->parent; -#ifdef MOTIF_POPUP +# ifdef MOTIF_POPUP if (menu_is_popup(menu->name)) { Arg arg[2]; @@ -884,9 +884,9 @@ gui_mch_add_menu(vimmenu_T *menu, int idx) // Only create the popup menu when it's actually used, otherwise there // is a delay when using the right mouse button. -# if (XmVersion <= 1002) +# if (XmVersion <= 1002) if (mouse_model_popup()) -# endif +# endif { if (gui.menu_bg_pixel != INVALCOLOR) { @@ -902,7 +902,7 @@ gui_mch_add_menu(vimmenu_T *menu, int idx) } return; } -#endif +# endif if (!menu_is_menubar(menu->name) || (parent != NULL && parent->submenu_id == (Widget)0)) @@ -916,11 +916,11 @@ gui_mch_add_menu(vimmenu_T *menu, int idx) (parent == NULL) ? menuBar : parent->submenu_id, XmNlabelString, label, XmNmnemonic, p_wak[0] == 'n' ? NUL : menu->mnemonic, -#if (XmVersion >= 1002) +# if (XmVersion >= 1002) // submenu: count the tearoff item (needed for LessTif) XmNpositionIndex, idx + (parent != NULL && tearoff_val == (int)XmTEAR_OFF_ENABLED ? 1 : 0), -#endif +# endif NULL); XmStringFree(label); @@ -955,10 +955,10 @@ gui_mch_add_menu(vimmenu_T *menu, int idx) if (menu->submenu_id == (Widget)0) // failed return; -#if (XmVersion >= 1002) +# if (XmVersion >= 1002) // Set the colors for the tear off widget toggle_tearoff(menu->submenu_id); -#endif +# endif XtVaSetValues(menu->id, XmNsubMenuId, menu->submenu_id, @@ -993,17 +993,17 @@ gui_motif_add_actext(vimmenu_T *menu) void gui_mch_toggle_tearoffs(int enable) { -#if (XmVersion >= 1002) +# if (XmVersion >= 1002) if (enable) tearoff_val = (int)XmTEAR_OFF_ENABLED; else tearoff_val = (int)XmTEAR_OFF_DISABLED; toggle_tearoff(menuBar); gui_mch_recurse_tearoffs(root_menu); -#endif +# endif } -#if (XmVersion >= 1002) +# if (XmVersion >= 1002) /* * Set the tearoff for one menu widget on or off, and set the color of the * tearoff widget. @@ -1033,7 +1033,7 @@ gui_mch_recurse_tearoffs(vimmenu_T *menu) menu = menu->next; } } -#endif +# endif int gui_mch_text_area_extra_height(void) @@ -1120,12 +1120,12 @@ gui_mch_compute_menu_height( XtVaSetValues(menuBar, XmNheight, gui.menu_height, NULL); } -#ifdef FEAT_TOOLBAR +# ifdef FEAT_TOOLBAR /* * Icons used by the toolbar code. */ -#include "gui_x11_pm.h" +# include "gui_x11_pm.h" static char **get_toolbar_pixmap(vimmenu_T *menu, char **fname); @@ -1221,7 +1221,7 @@ add_pixmap_args(vimmenu_T *menu, Arg *args, int n) } return n; } -#endif // FEAT_TOOLBAR +# endif // FEAT_TOOLBAR void gui_mch_add_menu_item(vimmenu_T *menu, int idx) @@ -1301,9 +1301,9 @@ gui_mch_add_menu_item(vimmenu_T *menu, int idx) if (xms != NULL) XmStringFree(xms); -# ifdef FEAT_BEVAL_GUI +# ifdef FEAT_BEVAL_GUI gui_mch_menu_set_tip(menu); -# endif +# endif menu->parent = parent; menu->submenu_id = NULL; @@ -1327,11 +1327,11 @@ gui_mch_add_menu_item(vimmenu_T *menu, int idx) { menu->id = XtVaCreateWidget("subMenu", xmSeparatorGadgetClass, parent->submenu_id, -#if (XmVersion >= 1002) +# if (XmVersion >= 1002) // count the tearoff item (needed for LessTif) XmNpositionIndex, idx + (tearoff_val == (int)XmTEAR_OFF_ENABLED ? 1 : 0), -#endif +# endif NULL); gui_motif_menu_colors(menu->id); return; @@ -1344,11 +1344,11 @@ gui_mch_add_menu_item(vimmenu_T *menu, int idx) xmPushButtonWidgetClass, parent->submenu_id, XmNlabelString, label, XmNmnemonic, menu->mnemonic, -#if (XmVersion >= 1002) +# if (XmVersion >= 1002) // count the tearoff item (needed for LessTif) XmNpositionIndex, idx + (tearoff_val == (int)XmTEAR_OFF_ENABLED ? 1 : 0), -#endif +# endif NULL); gui_motif_menu_colors(menu->id); gui_motif_menu_fontlist(menu->id); @@ -1363,7 +1363,7 @@ gui_mch_add_menu_item(vimmenu_T *menu, int idx) } } -#if (XmVersion <= 1002) +# if (XmVersion <= 1002) /* * This function will destroy/create the popup menus dynamically, * according to the value of 'mousemodel'. @@ -1410,7 +1410,7 @@ gui_motif_update_mousemodel(vimmenu_T *menu) ++idx; } } -#endif +# endif void gui_mch_new_menu_colors(void) @@ -1418,10 +1418,10 @@ gui_mch_new_menu_colors(void) if (menuBar == (Widget)0) return; gui_motif_menu_colors(menuBar); -#ifdef FEAT_TOOLBAR +# ifdef FEAT_TOOLBAR gui_motif_menu_colors(toolBarFrame); gui_motif_menu_colors(toolBar); -#endif +# endif submenu_change(root_menu, TRUE); } @@ -1441,20 +1441,20 @@ gui_mch_new_menu_font(void) XtVaGetValues(vimShell, XtNwidth, &w, XtNheight, &h, NULL); gui_resize_shell(w, h -#ifdef FEAT_XIM +# ifdef FEAT_XIM - xim_get_status_area_height() -#endif +# endif ); } gui_set_shellsize(FALSE, TRUE, RESIZE_VERT); ui_new_shellsize(); } -#if defined(FEAT_BEVAL_GUI) +# if defined(FEAT_BEVAL_GUI) void gui_mch_new_tooltip_font(void) { -# ifdef FEAT_TOOLBAR +# ifdef FEAT_TOOLBAR vimmenu_T *menu; if (toolBar == (Widget)0) @@ -1463,13 +1463,13 @@ gui_mch_new_tooltip_font(void) menu = gui_find_menu((char_u *)"ToolBar"); if (menu != NULL) submenu_change(menu, FALSE); -# endif +# endif } void gui_mch_new_tooltip_colors(void) { -# ifdef FEAT_TOOLBAR +# ifdef FEAT_TOOLBAR vimmenu_T *toolbar; if (toolBar == (Widget)0) @@ -1478,9 +1478,9 @@ gui_mch_new_tooltip_colors(void) toolbar = gui_find_menu((char_u *)"ToolBar"); if (toolbar != NULL) submenu_change(toolbar, TRUE); -# endif +# endif } -#endif +# endif static void submenu_change( @@ -1496,7 +1496,7 @@ submenu_change( if (colors) { gui_motif_menu_colors(mp->id); -#ifdef FEAT_TOOLBAR +# ifdef FEAT_TOOLBAR // For a toolbar item: Free the pixmap and allocate a new one, // so that the background color is right. if (mp->xpm != NULL) @@ -1507,7 +1507,7 @@ submenu_change( n = add_pixmap_args(mp, args, n); XtSetValues(mp->id, args, n); } -# ifdef FEAT_BEVAL_GUI +# ifdef FEAT_BEVAL_GUI // If we have a tooltip, then we need to change its font if (mp->tip != NULL) { @@ -1519,13 +1519,13 @@ submenu_change( args[1].value = gui.tooltip_fg_pixel; XtSetValues(mp->tip->balloonLabel, &args[0], XtNumber(args)); } +# endif # endif -#endif } else { gui_motif_menu_fontlist(mp->id); -#ifdef FEAT_BEVAL_GUI +# ifdef FEAT_BEVAL_GUI // If we have a tooltip, then we need to change its font if (mp->tip != NULL) { @@ -1536,13 +1536,13 @@ submenu_change( &gui.tooltip_fontset); XtSetValues(mp->tip->balloonLabel, &args[0], XtNumber(args)); } -#endif +# endif } } if (mp->children != NULL) { -#if (XmVersion >= 1002) +# if (XmVersion >= 1002) // Set the colors/font for the tear off widget if (mp->submenu_id != (Widget)0) { @@ -1552,7 +1552,7 @@ submenu_change( gui_motif_menu_fontlist(mp->submenu_id); toggle_tearoff(mp->submenu_id); } -#endif +# endif // Set the colors for the children submenu_change(mp->children, colors); } @@ -1580,7 +1580,7 @@ gui_mch_destroy_menu(vimmenu_T *menu) Widget parent; parent = XtParent(menu->id); -#if defined(FEAT_TOOLBAR) && defined(FEAT_BEVAL_GUI) +# if defined(FEAT_TOOLBAR) && defined(FEAT_BEVAL_GUI) if (parent == toolBar && menu->tip != NULL) { // We try to destroy this before the actual menu, because there are @@ -1594,12 +1594,12 @@ gui_mch_destroy_menu(vimmenu_T *menu) gui_mch_destroy_beval_area(menu->tip); menu->tip = NULL; } -#endif +# endif XtDestroyWidget(menu->id); menu->id = (Widget)0; if (parent == menuBar) gui_mch_compute_menu_height((Widget)0); -#ifdef FEAT_TOOLBAR +# ifdef FEAT_TOOLBAR else if (parent == toolBar) { Cardinal num_children; @@ -1611,16 +1611,16 @@ gui_mch_destroy_menu(vimmenu_T *menu) else gui.toolbar_height = gui_mch_compute_toolbar_height(); } -#endif +# endif } void gui_mch_show_popupmenu(vimmenu_T *menu UNUSED) { -#ifdef MOTIF_POPUP +# ifdef MOTIF_POPUP XmMenuPosition(menu->submenu_id, gui_x11_get_last_mouse_event()); XtManageChild(menu->submenu_id); -#endif +# endif } #endif // FEAT_MENU @@ -2055,7 +2055,7 @@ set_fontlist(Widget id) { XmFontList fl; -#ifdef FONTSET_ALWAYS +# ifdef FONTSET_ALWAYS if (gui.fontset != NOFONTSET) { fl = gui_motif_fontset2fontlist((XFontSet *)&gui.fontset); @@ -2074,7 +2074,7 @@ set_fontlist(Widget id) XmFontListFree(fl); } } -#else +# else if (gui.norm_font != NOFONT) { fl = gui_motif_create_fontlist((XFontStruct *)gui.norm_font); @@ -2093,7 +2093,7 @@ set_fontlist(Widget id) XmFontListFree(fl); } } -#endif +# endif } #endif @@ -2103,8 +2103,8 @@ set_fontlist(Widget id) * file selector related stuff */ -#include -#include +# include +# include typedef struct dialog_callback_arg { @@ -2392,7 +2392,7 @@ butproc( dialogStatus = (int)(long)client_data + 1; } -#ifdef HAVE_XPM +# ifdef HAVE_XPM static Widget create_pixmap_label( @@ -2455,7 +2455,7 @@ create_pixmap_label( return label; } -#endif +# endif int gui_mch_dialog( @@ -2482,10 +2482,10 @@ gui_mch_dialog( Widget separator = NULL; int n; Arg args[6]; -#ifdef HAVE_XPM +# ifdef HAVE_XPM char **icon_data = NULL; Widget dialogpixmap = NULL; -#endif +# endif if (title == NULL) title = (char_u *)_("Vim dialog"); @@ -2689,7 +2689,7 @@ gui_mch_dialog( NULL); XtManageChild(form); -#ifdef HAVE_XPM +# ifdef HAVE_XPM // Add a pixmap, left of the message. switch (type) { @@ -2723,7 +2723,7 @@ gui_mch_dialog( dialogpixmap = create_pixmap_label(form, "dialogPixmap", icon_data, args, n); XtManageChild(dialogpixmap); -#endif +# endif // Create the dialog message. // Since LessTif is apparently having problems with the creation of @@ -2742,12 +2742,12 @@ gui_mch_dialog( XmNalignment, XmALIGNMENT_BEGINNING, XmNtopAttachment, XmATTACH_FORM, XmNtopOffset, 8, -#ifdef HAVE_XPM +# ifdef HAVE_XPM XmNleftAttachment, XmATTACH_WIDGET, XmNleftWidget, dialogpixmap, -#else +# else XmNleftAttachment, XmATTACH_FORM, -#endif +# endif XmNleftOffset, 8, XmNrightAttachment, XmATTACH_FORM, XmNrightOffset, 8, @@ -2904,7 +2904,7 @@ gui_mch_show_toolbar(int showit) } gui.toolbar_height = gui_mch_compute_toolbar_height(); XtManageChild(XtParent(toolBar)); -#ifdef FEAT_GUI_TABLINE +# ifdef FEAT_GUI_TABLINE if (showing_tabline) { XtVaSetValues(tabLine, @@ -2917,7 +2917,7 @@ gui_mch_show_toolbar(int showit) NULL); } else -#endif +# endif XtVaSetValues(textAreaForm, XmNtopAttachment, XmATTACH_WIDGET, XmNtopWidget, XtParent(toolBar), @@ -2937,7 +2937,7 @@ gui_mch_show_toolbar(int showit) gui.toolbar_height = 0; if (XtIsManaged(menuBar)) { -#ifdef FEAT_GUI_TABLINE +# ifdef FEAT_GUI_TABLINE if (showing_tabline) { XtVaSetValues(tabLine, @@ -2950,7 +2950,7 @@ gui_mch_show_toolbar(int showit) NULL); } else -#endif +# endif XtVaSetValues(textAreaForm, XmNtopAttachment, XmATTACH_WIDGET, XmNtopWidget, menuBar, @@ -2958,7 +2958,7 @@ gui_mch_show_toolbar(int showit) } else { -#ifdef FEAT_GUI_TABLINE +# ifdef FEAT_GUI_TABLINE if (showing_tabline) { XtVaSetValues(tabLine, @@ -2970,7 +2970,7 @@ gui_mch_show_toolbar(int showit) NULL); } else -#endif +# endif XtVaSetValues(textAreaForm, XmNtopAttachment, XmATTACH_FORM, NULL); @@ -3031,11 +3031,11 @@ gui_mch_compute_toolbar_height(void) height = whgt; } } -#ifdef LESSTIF_VERSION +# ifdef LESSTIF_VERSION // Hack: When starting up we get wrong dimensions. if (height < 10) height = 24; -#endif +# endif return (int)(height + (borders << 1)); } @@ -3077,20 +3077,20 @@ gui_mch_show_tabline(int showit) XtUnmanageChild(XtNameToWidget(tabLine, "MinorTabScrollerNext")); XtUnmanageChild(XtNameToWidget(tabLine, "MinorTabScrollerPrevious")); -#ifdef FEAT_MENU -# ifdef FEAT_TOOLBAR +# ifdef FEAT_MENU +# ifdef FEAT_TOOLBAR if (XtIsManaged(XtParent(toolBar))) XtVaSetValues(tabLine, XmNtopAttachment, XmATTACH_WIDGET, XmNtopWidget, XtParent(toolBar), NULL); else -# endif +# endif if (XtIsManaged(menuBar)) XtVaSetValues(tabLine, XmNtopAttachment, XmATTACH_WIDGET, XmNtopWidget, menuBar, NULL); else -#endif +# endif XtVaSetValues(tabLine, XmNtopAttachment, XmATTACH_FORM, NULL); XtVaSetValues(textAreaForm, @@ -3101,20 +3101,20 @@ gui_mch_show_tabline(int showit) else { XtUnmanageChild(tabLine); -#ifdef FEAT_MENU -# ifdef FEAT_TOOLBAR +# ifdef FEAT_MENU +# ifdef FEAT_TOOLBAR if (XtIsManaged(XtParent(toolBar))) XtVaSetValues(textAreaForm, XmNtopAttachment, XmATTACH_WIDGET, XmNtopWidget, XtParent(toolBar), NULL); else -# endif +# endif if (XtIsManaged(menuBar)) XtVaSetValues(textAreaForm, XmNtopAttachment, XmATTACH_WIDGET, XmNtopWidget, menuBar, NULL); else -#endif +# endif XtVaSetValues(textAreaForm, XmNtopAttachment, XmATTACH_FORM, NULL); } @@ -3284,7 +3284,7 @@ gui_motif_scroll_colors(Widget id) gui_motif_menu_fontlist(Widget id UNUSED) { #ifdef FEAT_MENU -#ifdef FONTSET_ALWAYS +# ifdef FONTSET_ALWAYS if (gui.menu_fontset != NOFONTSET) { XmFontList fl; @@ -3305,7 +3305,7 @@ gui_motif_menu_fontlist(Widget id UNUSED) XmFontListFree(fl); } } -#else +# else if (gui.menu_font != NOFONT) { XmFontList fl; @@ -3326,7 +3326,7 @@ gui_motif_menu_fontlist(Widget id UNUSED) XmFontListFree(fl); } } -#endif +# endif #endif } diff --git a/src/gui_photon.c b/src/gui_photon.c index edaff0c9c2..8cc31d59ad 100644 --- a/src/gui_photon.c +++ b/src/gui_photon.c @@ -1563,7 +1563,7 @@ gui_mch_dialog( } } } -#ifndef FEAT_GUI_TEXTDIALOG +# ifndef FEAT_GUI_TEXTDIALOG dialog_result = PtAlert( gui.vimWindow, NULL, title, @@ -1571,7 +1571,7 @@ gui_mch_dialog( message, NULL, button_count, (const char **) button_array, NULL, default_button, 0, Pt_MODAL); -#else +# else // Writing the dialog ourselves lets us add extra features, like // trapping the escape key and returning 0 to vim { @@ -1636,7 +1636,7 @@ gui_mch_dialog( PtDestroyWidget(dialog); gui_ph_dialog_text = NULL; } -#endif +# endif } vim_free(button_array); @@ -1981,11 +1981,11 @@ gui_mch_new_colors(void) g = PgGreenValue(gui_ph_mouse_color) ^ 255; b = PgBlueValue(gui_ph_mouse_color) ^ 255; -#ifndef FEAT_MOUSESHAPE +# ifndef FEAT_MOUSESHAPE gui_ph_mouse_color = PgRGB(r, g, b); PtSetResource(gui.vimTextArea, Pt_ARG_CURSOR_COLOR, gui_ph_mouse_color, 0); -#endif +# endif } #endif @@ -2353,7 +2353,7 @@ gui_mch_haskey(char_u *name) // Menu #ifdef FEAT_TOOLBAR -#include "toolbar.phi" +# include "toolbar.phi" static PhImage_t *gui_ph_toolbar_images[] = { &tb_new_phi, @@ -2579,7 +2579,7 @@ gui_mch_add_menu_item(vimmenu_T *menu, int index) n = 0; PtSetArg(&args[ n++ ], Pt_ARG_POINTER, menu, 0); -#ifdef FEAT_TOOLBAR +# ifdef FEAT_TOOLBAR if (menu_is_toolbar(parent->name)) { if (menu_is_separator(menu->name)) @@ -2630,7 +2630,7 @@ gui_mch_add_menu_item(vimmenu_T *menu, int index) PtRealizeWidget(menu->id); } else -#endif +# endif if (menu_is_separator(menu->name)) { menu->id = PtCreateWidget(PtSeparator, parent->submenu_id, n, args); @@ -2655,14 +2655,14 @@ gui_mch_add_menu_item(vimmenu_T *menu, int index) PtAddCallback(menu->id, Pt_CB_ACTIVATE, gui_ph_handle_menu, menu); -#ifdef USE_PANEL_GROUP +# ifdef USE_PANEL_GROUP if (gui_ph_is_buffer_item(menu, parent) == TRUE) { PtAddCallback(menu->id, Pt_CB_DESTROYED, gui_ph_handle_buffer_remove, menu); gui_ph_pg_add_buffer(menu->dname); } -#endif +# endif } gui_ph_position_menu(menu->id, menu->priority); diff --git a/src/gui_x11.c b/src/gui_x11.c index 675ebd1a20..a61d47a077 100644 --- a/src/gui_x11.c +++ b/src/gui_x11.c @@ -380,10 +380,10 @@ static XtResource vim_resources[] = # ifdef FONTSET_ALWAYS XtNmenuFontSet, XtCMenuFontSet, -#else +# else XtNmenuFont, XtCMenuFont, -#endif +# endif XtRString, sizeof(char *), XtOffsetOf(gui_T, rsrc_menu_font_name), @@ -1162,9 +1162,9 @@ gui_mch_prepare(int *argc, char **argv) # define CARDINAL (Cardinal *) #else # if XtSpecificationRelease == 4 -# define CARDINAL (Cardinal *) +# define CARDINAL (Cardinal *) # else -# define CARDINAL (int *) +# define CARDINAL (int *) # endif #endif @@ -1184,7 +1184,7 @@ gui_mch_init_check(void) cmdline_options, XtNumber(cmdline_options), CARDINAL &gui_argc, gui_argv); -# if defined(LC_NUMERIC) +#if defined(LC_NUMERIC) { // The call to XtOpenDisplay() may have set the locale from the // environment. Set LC_NUMERIC to "C" to make sure that strtod() uses a @@ -1194,7 +1194,7 @@ gui_mch_init_check(void) if (p == NULL || strcmp(p, "C") != 0) setlocale(LC_NUMERIC, "C"); } -# endif +#endif if (app_context == NULL || gui.dpy == NULL) { gui.dying = TRUE; @@ -1574,7 +1574,7 @@ gui_init_menu_font(void) { XrmValue from, to; -#ifdef FONTSET_ALWAYS +# ifdef FONTSET_ALWAYS from.addr = (char *)gui.rsrc_menu_font_name; from.size = strlen(from.addr); to.addr = (XtPointer)&gui.menu_fontset; @@ -1584,7 +1584,7 @@ gui_init_menu_font(void) { // Failed. What to do? } -#else +# else from.addr = (char *)gui.rsrc_menu_font_name; from.size = strlen(from.addr); to.addr = (XtPointer)&gui.menu_font; @@ -1594,7 +1594,7 @@ gui_init_menu_font(void) { // Failed. What to do? } -#endif +# endif } #endif @@ -2101,7 +2101,7 @@ fontset_height( return extents->max_logical_extent.height; } -#if 0 +# if 0 // NOT USED YET static int fontset_descent(XFontSet fs) @@ -2111,7 +2111,7 @@ fontset_descent(XFontSet fs) extents = XExtentsOfFontSet (fs); return extents->max_logical_extent.height + extents->max_logical_extent.y; } -#endif +# endif static int fontset_ascent(XFontSet fs) @@ -2808,9 +2808,9 @@ gui_mch_menu_grey(vimmenu_T *menu, int grey) gui_mch_menu_hidden(menu, False); if (grey -#ifdef FEAT_GUI_MOTIF +# ifdef FEAT_GUI_MOTIF || !menu->sensitive -#endif +# endif ) XtSetSensitive(menu->id, False); else diff --git a/src/gui_xim.c b/src/gui_xim.c index 4aa2a85436..8e9b750a41 100644 --- a/src/gui_xim.c +++ b/src/gui_xim.c @@ -289,18 +289,18 @@ im_preedit_window_set_position(void) im_preedit_window_open(void) { char *preedit_string; -#if !GTK_CHECK_VERSION(3,16,0) +# if !GTK_CHECK_VERSION(3,16,0) char buf[8]; -#endif +# endif PangoAttrList *attr_list; PangoLayout *layout; -#if GTK_CHECK_VERSION(3,0,0) -# if !GTK_CHECK_VERSION(3,16,0) +# if GTK_CHECK_VERSION(3,0,0) +# if !GTK_CHECK_VERSION(3,16,0) GdkRGBA color; -# endif -#else +# endif +# else GdkColor color; -#endif +# endif gint w, h; if (preedit_window == NULL) @@ -313,7 +313,7 @@ im_preedit_window_open(void) gtk_container_add(GTK_CONTAINER(preedit_window), preedit_label); } -#if GTK_CHECK_VERSION(3,16,0) +# if GTK_CHECK_VERSION(3,16,0) { GtkStyleContext * const context = gtk_widget_get_style_context(preedit_label); @@ -363,7 +363,7 @@ im_preedit_window_open(void) g_free(fontsize_propval); g_object_unref(provider); } -#elif GTK_CHECK_VERSION(3,0,0) +# elif GTK_CHECK_VERSION(3,0,0) gtk_widget_override_font(preedit_label, gui.norm_font); vim_snprintf(buf, sizeof(buf), "#%06X", gui.norm_pixel); @@ -374,7 +374,7 @@ im_preedit_window_open(void) gdk_rgba_parse(&color, buf); gtk_widget_override_background_color(preedit_label, GTK_STATE_FLAG_NORMAL, &color); -#else +# else gtk_widget_modify_font(preedit_label, gui.norm_font); vim_snprintf(buf, sizeof(buf), "#%06X", (unsigned)gui.norm_pixel); @@ -384,7 +384,7 @@ im_preedit_window_open(void) vim_snprintf(buf, sizeof(buf), "#%06X", (unsigned)gui.back_pixel); gdk_color_parse(buf, &color); gtk_widget_modify_bg(preedit_window, GTK_STATE_NORMAL, &color); -#endif +# endif gtk_im_context_get_preedit_string(xic, &preedit_string, &attr_list, NULL); @@ -436,9 +436,9 @@ im_delete_preedit(void) } if (State & MODE_NORMAL -#ifdef FEAT_TERMINAL +# ifdef FEAT_TERMINAL && !term_use_loop() -#endif +# endif ) { im_preedit_cursor = 0; @@ -507,9 +507,9 @@ im_commit_cb(GtkIMContext *context UNUSED, int commit_with_preedit = TRUE; char_u *im_str; -#ifdef XIM_DEBUG +# ifdef XIM_DEBUG xim_log("im_commit_cb(): %s\n", str); -#endif +# endif if (p_imst == IM_ON_THE_SPOT) { @@ -593,9 +593,9 @@ im_commit_cb(GtkIMContext *context UNUSED, static void im_preedit_start_cb(GtkIMContext *context UNUSED, gpointer data UNUSED) { -#ifdef XIM_DEBUG +# ifdef XIM_DEBUG xim_log("im_preedit_start_cb()\n"); -#endif +# endif im_is_active = TRUE; preedit_is_active = TRUE; @@ -609,9 +609,9 @@ im_preedit_start_cb(GtkIMContext *context UNUSED, gpointer data UNUSED) static void im_preedit_end_cb(GtkIMContext *context UNUSED, gpointer data UNUSED) { -#ifdef XIM_DEBUG +# ifdef XIM_DEBUG xim_log("im_preedit_end_cb()\n"); -#endif +# endif im_delete_preedit(); // Indicate that preediting has finished @@ -619,12 +619,12 @@ im_preedit_end_cb(GtkIMContext *context UNUSED, gpointer data UNUSED) preedit_start_col = MAXCOL; xim_has_preediting = FALSE; -#if 0 +# if 0 // Removal of this line suggested by Takuhiro Nishioka. Fixes that IM was // switched off unintentionally. We now use preedit_is_active (added by // SungHyun Nam). im_is_active = FALSE; -#endif +# endif preedit_is_active = FALSE; gui_update_cursor(TRUE, FALSE); im_show_info(); @@ -686,9 +686,9 @@ im_preedit_changed_cb(GtkIMContext *context, gpointer data UNUSED) &preedit_string, NULL, NULL); -#ifdef XIM_DEBUG +# ifdef XIM_DEBUG xim_log("im_preedit_changed_cb(): %s\n", preedit_string); -#endif +# endif g_return_if_fail(preedit_string != NULL); // just in case @@ -869,9 +869,9 @@ im_get_feedback_attr(int col) void xim_init(void) { -#ifdef XIM_DEBUG +# ifdef XIM_DEBUG xim_log("xim_init()\n"); -#endif +# endif g_return_if_fail(gui.drawarea != NULL); g_return_if_fail(gtk_widget_get_window(gui.drawarea) != NULL); @@ -894,9 +894,9 @@ xim_init(void) void im_shutdown(void) { -#ifdef XIM_DEBUG +# ifdef XIM_DEBUG xim_log("im_shutdown()\n"); -#endif +# endif if (xic != NULL) { @@ -1012,11 +1012,11 @@ im_synthesize_keypress(unsigned int keyval, unsigned int state) void xim_reset(void) { -# ifdef FEAT_EVAL +# ifdef FEAT_EVAL if (USE_IMACTIVATEFUNC) call_imactivatefunc(im_is_active); else -# endif +# endif if (xic != NULL) { gtk_im_context_reset(xic); @@ -1054,9 +1054,9 @@ xim_reset(void) int xim_queue_key_press_event(GdkEventKey *event, int down) { -#ifdef FEAT_GUI_GTK +# ifdef FEAT_GUI_GTK if (event->state & GDK_SUPER_MASK) return FALSE; -#endif +# endif if (down) { // Workaround GTK2 XIM 'feature' that always converts keypad keys to @@ -1357,7 +1357,7 @@ xim_set_preedit(void) static int xim_real_init(Window x11_window, Display *x11_display); -# ifdef USE_X11R6_XIM +# ifdef USE_X11R6_XIM static void xim_instantiate_cb( Display *display, @@ -1367,9 +1367,9 @@ xim_instantiate_cb( Window x11_window; Display *x11_display; -# ifdef XIM_DEBUG +# ifdef XIM_DEBUG xim_log("xim_instantiate_cb()\n"); -# endif +# endif gui_get_x11_windis(&x11_window, &x11_display); if (display != x11_display) @@ -1391,9 +1391,9 @@ xim_destroy_cb( Window x11_window; Display *x11_display; -# ifdef XIM_DEBUG +# ifdef XIM_DEBUG xim_log("xim_destroy_cb()\n"); - #endif +# endif gui_get_x11_windis(&x11_window, &x11_display); xic = NULL; @@ -1404,7 +1404,7 @@ xim_destroy_cb( XRegisterIMInstantiateCallback(x11_display, NULL, NULL, NULL, xim_instantiate_cb, NULL); } -# endif +# endif void xim_init(void) @@ -1412,9 +1412,9 @@ xim_init(void) Window x11_window; Display *x11_display; -# ifdef XIM_DEBUG +# ifdef XIM_DEBUG xim_log("xim_init()\n"); -# endif +# endif gui_get_x11_windis(&x11_window, &x11_display); @@ -1425,10 +1425,10 @@ xim_init(void) gui_set_shellsize(FALSE, FALSE, RESIZE_BOTH); -# ifdef USE_X11R6_XIM +# ifdef USE_X11R6_XIM XRegisterIMInstantiateCallback(x11_display, NULL, NULL, NULL, xim_instantiate_cb, NULL); -# endif +# endif } static int @@ -1440,7 +1440,7 @@ xim_real_init(Window x11_window, Display *x11_display) *ns, *end, tmp[1024]; -# define IMLEN_MAX 40 +# define IMLEN_MAX 40 char buf[IMLEN_MAX + 7]; XIM xim = NULL; XIMStyles *xim_styles; @@ -1505,7 +1505,7 @@ xim_real_init(Window x11_window, Display *x11_display) return FALSE; } -# ifdef USE_X11R6_XIM +# ifdef USE_X11R6_XIM { XIMCallback destroy_cb; @@ -1514,7 +1514,7 @@ xim_real_init(Window x11_window, Display *x11_display) if (XSetIMValues(xim, XNDestroyCallback, &destroy_cb, NULL)) emsg(_(e_warning_could_not_set_destroy_callback_to_im)); } -# endif +# endif if (XGetIMValues(xim, XNQueryInputStyle, &xim_styles, NULL) || !xim_styles) { @@ -1590,7 +1590,7 @@ xim_real_init(Window x11_window, Display *x11_display) // A crash was reported when trying to pass gui.norm_font as XNFontSet, // thus that has been removed. Hopefully the default works... -# ifdef FEAT_XFONTSET +# ifdef FEAT_XFONTSET if (gui.fontset != NOFONTSET) { preedit_list = XVaCreateNestedList(0, @@ -1606,7 +1606,7 @@ xim_real_init(Window x11_window, Display *x11_display) NULL); } else -# endif +# endif { preedit_list = XVaCreateNestedList(0, XNSpotLocation, &over_spot, @@ -1708,10 +1708,10 @@ xim_set_status_area(void) status_area.y = gui.char_height * Rows + gui.border_offset; if (gui.which_scrollbars[SBAR_BOTTOM]) status_area.y += gui.scrollbar_height; -#ifdef FEAT_MENU +# ifdef FEAT_MENU if (gui.menu_is_active) status_area.y += gui.menu_height; -#endif +# endif status_area.height = gui.char_height; status_list = XVaCreateNestedList(0, XNArea, &status_area, NULL); } @@ -1721,10 +1721,10 @@ xim_set_status_area(void) status_area.y = gui.char_height * Rows + gui.border_offset; if (gui.which_scrollbars[SBAR_BOTTOM]) status_area.y += gui.scrollbar_height; -#ifdef FEAT_MENU +# ifdef FEAT_MENU if (gui.menu_is_active) status_area.y += gui.menu_height; -#endif +# endif status_area.width = 0; status_area.height = gui.char_height; } @@ -1736,10 +1736,10 @@ xim_set_status_area(void) pre_area.width = gui.char_width * Columns - pre_area.x; if (gui.which_scrollbars[SBAR_BOTTOM]) pre_area.y += gui.scrollbar_height; -#ifdef FEAT_MENU +# ifdef FEAT_MENU if (gui.menu_is_active) pre_area.y += gui.menu_height; -#endif +# endif pre_area.height = gui.char_height; preedit_list = XVaCreateNestedList(0, XNArea, &pre_area, NULL); } diff --git a/src/hardcopy.c b/src/hardcopy.c index 3d4fdda543..99a991dc2d 100644 --- a/src/hardcopy.c +++ b/src/hardcopy.c @@ -559,7 +559,7 @@ ex_hardcopy(exarg_T *eap) CLEAR_FIELD(settings); settings.has_color = TRUE; -# ifdef FEAT_POSTSCRIPT +#ifdef FEAT_POSTSCRIPT if (*eap->arg == '>') { char *errormsg = NULL; @@ -575,7 +575,7 @@ ex_hardcopy(exarg_T *eap) } else if (*eap->arg != NUL) settings.arguments = eap->arg; -# endif +#endif /* * Initialise for printing. Ask the user for settings, unless forceit is @@ -939,7 +939,7 @@ hardcopy_line( return col; } -# if defined(FEAT_POSTSCRIPT) +#if defined(FEAT_POSTSCRIPT) /* * PS printer stuff. @@ -970,9 +970,9 @@ hardcopy_line( * http://www.adobe.com */ -#define PRT_PS_DEFAULT_DPI (72) // Default user space resolution -#define PRT_PS_DEFAULT_FONTSIZE (10) -#define PRT_PS_DEFAULT_BUFFER_SIZE (80) +# define PRT_PS_DEFAULT_DPI (72) // Default user space resolution +# define PRT_PS_DEFAULT_FONTSIZE (10) +# define PRT_PS_DEFAULT_BUFFER_SIZE (80) struct prt_mediasize_S { @@ -981,7 +981,7 @@ struct prt_mediasize_S float height; }; -#define PRT_MEDIASIZE_LEN ARRAY_LENGTH(prt_mediasize) +# define PRT_MEDIASIZE_LEN ARRAY_LENGTH(prt_mediasize) static struct prt_mediasize_S prt_mediasize[] = { @@ -1012,10 +1012,10 @@ struct prt_ps_font_S char *(ps_fontname[4]); }; -#define PRT_PS_FONT_ROMAN (0) -#define PRT_PS_FONT_BOLD (1) -#define PRT_PS_FONT_OBLIQUE (2) -#define PRT_PS_FONT_BOLDOBLIQUE (3) +# define PRT_PS_FONT_ROMAN (0) +# define PRT_PS_FONT_BOLD (1) +# define PRT_PS_FONT_OBLIQUE (2) +# define PRT_PS_FONT_BOLDOBLIQUE (3) // Standard font metrics for Courier family static struct prt_ps_font_S prt_ps_courier_font = @@ -1055,14 +1055,14 @@ struct prt_ps_charset_S }; -#define CS_JIS_C_1978 (0x01) -#define CS_JIS_X_1983 (0x02) -#define CS_JIS_X_1990 (0x04) -#define CS_NEC (0x08) -#define CS_MSWINDOWS (0x10) -#define CS_CP932 (0x20) -#define CS_KANJITALK6 (0x40) -#define CS_KANJITALK7 (0x80) +# define CS_JIS_C_1978 (0x01) +# define CS_JIS_X_1983 (0x02) +# define CS_JIS_X_1990 (0x04) +# define CS_NEC (0x08) +# define CS_MSWINDOWS (0x10) +# define CS_CP932 (0x20) +# define CS_KANJITALK6 (0x40) +# define CS_KANJITALK7 (0x80) // Japanese encodings and charsets static struct prt_ps_encoding_S j_encodings[] = @@ -1088,13 +1088,13 @@ static struct prt_ps_charset_S j_charsets[] = {"KANJITALK7", "90pv", CS_KANJITALK7} }; -#define CS_GB_2312_80 (0x01) -#define CS_GBT_12345_90 (0x02) -#define CS_GBK2K (0x04) -#define CS_SC_MAC (0x08) -#define CS_GBT_90_MAC (0x10) -#define CS_GBK (0x20) -#define CS_SC_ISO10646 (0x40) +# define CS_GB_2312_80 (0x01) +# define CS_GBT_12345_90 (0x02) +# define CS_GBK2K (0x04) +# define CS_SC_MAC (0x08) +# define CS_GBT_90_MAC (0x10) +# define CS_GBK (0x20) +# define CS_SC_ISO10646 (0x40) // Simplified Chinese encodings and charsets static struct prt_ps_encoding_S sc_encodings[] = @@ -1118,19 +1118,19 @@ static struct prt_ps_charset_S sc_charsets[] = {"ISO10646", "UniGB", CS_SC_ISO10646} }; -#define CS_CNS_PLANE_1 (0x01) -#define CS_CNS_PLANE_2 (0x02) -#define CS_CNS_PLANE_1_2 (0x04) -#define CS_B5 (0x08) -#define CS_ETEN (0x10) -#define CS_HK_GCCS (0x20) -#define CS_HK_SCS (0x40) -#define CS_HK_SCS_ETEN (0x80) -#define CS_MTHKL (0x100) -#define CS_MTHKS (0x200) -#define CS_DLHKL (0x400) -#define CS_DLHKS (0x800) -#define CS_TC_ISO10646 (0x1000) +# define CS_CNS_PLANE_1 (0x01) +# define CS_CNS_PLANE_2 (0x02) +# define CS_CNS_PLANE_1_2 (0x04) +# define CS_B5 (0x08) +# define CS_ETEN (0x10) +# define CS_HK_GCCS (0x20) +# define CS_HK_SCS (0x40) +# define CS_HK_SCS_ETEN (0x80) +# define CS_MTHKL (0x100) +# define CS_MTHKS (0x200) +# define CS_DLHKL (0x400) +# define CS_DLHKS (0x800) +# define CS_TC_ISO10646 (0x1000) // Traditional Chinese encodings and charsets static struct prt_ps_encoding_S tc_encodings[] = @@ -1164,10 +1164,10 @@ static struct prt_ps_charset_S tc_charsets[] = {"ISO10646", "UniCNS", CS_TC_ISO10646} }; -#define CS_KR_X_1992 (0x01) -#define CS_KR_MAC (0x02) -#define CS_KR_X_1992_MS (0x04) -#define CS_KR_ISO10646 (0x08) +# define CS_KR_X_1992 (0x01) +# define CS_KR_MAC (0x02) +# define CS_KR_X_1992_MS (0x04) +# define CS_KR_ISO10646 (0x08) // Korean encodings and charsets static struct prt_ps_encoding_S k_encodings[] = @@ -1249,9 +1249,9 @@ struct prt_ps_resource_S }; // Types of PS resource file currently used -#define PRT_RESOURCE_TYPE_PROCSET (0) -#define PRT_RESOURCE_TYPE_ENCODING (1) -#define PRT_RESOURCE_TYPE_CMAP (2) +# define PRT_RESOURCE_TYPE_PROCSET (0) +# define PRT_RESOURCE_TYPE_ENCODING (1) +# define PRT_RESOURCE_TYPE_CMAP (2) // The PS prolog file version number has to match - if the prolog file is // updated, increment the number in the file and here. Version checking was @@ -1262,8 +1262,8 @@ struct prt_ps_resource_S // VIM Prolog CIDProlog // 6.2 1.3 // 7.0 1.4 1.0 -#define PRT_PROLOG_VERSION ((char_u *)"1.4") -#define PRT_CID_PROLOG_VERSION ((char_u *)"1.0") +# define PRT_PROLOG_VERSION ((char_u *)"1.4") +# define PRT_CID_PROLOG_VERSION ((char_u *)"1.0") // String versions of PS resource types - indexed by constants above so don't // re-order! @@ -1275,23 +1275,23 @@ static char *prt_resource_types[] = }; // Strings to look for in a PS resource file -#define PRT_RESOURCE_HEADER "%!PS-Adobe-" -#define PRT_RESOURCE_RESOURCE "Resource-" -#define PRT_RESOURCE_PROCSET "ProcSet" -#define PRT_RESOURCE_ENCODING "Encoding" -#define PRT_RESOURCE_CMAP "CMap" +# define PRT_RESOURCE_HEADER "%!PS-Adobe-" +# define PRT_RESOURCE_RESOURCE "Resource-" +# define PRT_RESOURCE_PROCSET "ProcSet" +# define PRT_RESOURCE_ENCODING "Encoding" +# define PRT_RESOURCE_CMAP "CMap" // Data for table based DSC comment recognition, easy to extend if VIM needs to // read more comments. -#define PRT_DSC_MISC_TYPE (-1) -#define PRT_DSC_TITLE_TYPE (1) -#define PRT_DSC_VERSION_TYPE (2) -#define PRT_DSC_ENDCOMMENTS_TYPE (3) +# define PRT_DSC_MISC_TYPE (-1) +# define PRT_DSC_TITLE_TYPE (1) +# define PRT_DSC_VERSION_TYPE (2) +# define PRT_DSC_ENDCOMMENTS_TYPE (3) -#define PRT_DSC_TITLE "%%Title:" -#define PRT_DSC_VERSION "%%Version:" -#define PRT_DSC_ENDCOMMENTS "%%EndComments:" +# define PRT_DSC_TITLE "%%Title:" +# define PRT_DSC_VERSION "%%Version:" +# define PRT_DSC_ENDCOMMENTS "%%EndComments:" struct prt_dsc_comment_S { @@ -1308,7 +1308,7 @@ struct prt_dsc_line_S }; -#define SIZEOF_CSTR(s) (sizeof(s) - 1) +# define SIZEOF_CSTR(s) (sizeof(s) - 1) static struct prt_dsc_comment_S prt_dsc_table[] = { {PRT_DSC_TITLE, SIZEOF_CSTR(PRT_DSC_TITLE), PRT_DSC_TITLE_TYPE}, @@ -1571,7 +1571,7 @@ prt_def_var(char *name, double value, int prec) } // Convert size from font space to user space at current font scale -#define PRT_PS_FONT_TO_USER(scale, size) ((size) * ((scale)/1000.0)) +# define PRT_PS_FONT_TO_USER(scale, size) ((size) * ((scale)/1000.0)) static void prt_flush_buffer(void) @@ -1684,12 +1684,12 @@ prt_find_resource(char *name, struct prt_ps_resource_S *resource) } // PS CR and LF characters have platform independent values -#define PSLF (0x0a) -#define PSCR (0x0d) +# define PSLF (0x0a) +# define PSCR (0x0d) // Static buffer to read initial comments in a resource file, some can have a // couple of KB of comments! -#define PRT_FILE_BUFFER_LEN (2048) +# define PRT_FILE_BUFFER_LEN (2048) struct prt_resfile_buffer_S { char_u buffer[PRT_FILE_BUFFER_LEN]; @@ -1990,7 +1990,7 @@ prt_dsc_text(char *comment, char *text) prt_write_file(prt_line_buffer); } -#define prt_dsc_atend(c) prt_dsc_text((c), "atend") +# define prt_dsc_atend(c) prt_dsc_text((c), "atend") static void prt_dsc_ints(char *comment, int count, int *ints) @@ -2340,7 +2340,7 @@ mch_print_init( struct prt_ps_encoding_S *p_mbenc_first; struct prt_ps_charset_S *p_mbchar = NULL; -#if 0 +# if 0 /* * TODO: * If "forceit" is false: pop up a dialog to select: @@ -2356,7 +2356,7 @@ mch_print_init( */ if (forceit) s_pd.Flags |= PD_RETURNDEFAULT; -#endif +# endif /* * Set up font and encoding. @@ -2923,11 +2923,11 @@ mch_print_begin(prt_settings_T *psettings) prt_dsc_resources(NULL, "encoding", buffer); } prt_dsc_requirements(prt_duplex, prt_tumble, prt_collate, -#ifdef FEAT_SYN_HL +# ifdef FEAT_SYN_HL psettings->do_syntax -#else +# else 0 -#endif +# endif , prt_num_copies); prt_dsc_noarg("EndComments"); @@ -3453,5 +3453,5 @@ mch_print_set_fg(long_u fgcol) prt_need_fgcol = TRUE; } -# endif //FEAT_POSTSCRIPT +#endif //FEAT_POSTSCRIPT #endif //FEAT_PRINTER diff --git a/src/highlight.c b/src/highlight.c index f8d3688366..9afe69c4dd 100644 --- a/src/highlight.c +++ b/src/highlight.c @@ -159,9 +159,9 @@ typedef struct #endif #ifdef FEAT_GUI GuiFont sg_font; // GUI font handle -#ifdef FEAT_XFONTSET +# ifdef FEAT_XFONTSET GuiFontset sg_fontset; // GUI fontset handle -#endif +# endif char_u *sg_font_name; // GUI font or fontset name int sg_gui_attr; // Screen attr for GUI mode #endif @@ -2396,18 +2396,18 @@ hl_do_font( // fontset. Same for the Menu group. if (do_normal) gui_init_font(arg, TRUE); -# if defined(FEAT_GUI_MOTIF) && defined(FEAT_MENU) +# if defined(FEAT_GUI_MOTIF) && defined(FEAT_MENU) if (do_menu) { -# ifdef FONTSET_ALWAYS +# ifdef FONTSET_ALWAYS gui.menu_fontset = HL_TABLE()[idx].sg_fontset; -# else +# else // YIKES! This is a bug waiting to crash the program gui.menu_font = HL_TABLE()[idx].sg_fontset; -# endif +# endif gui_mch_new_menu_font(); } -# ifdef FEAT_BEVAL_GUI +# ifdef FEAT_BEVAL_GUI if (do_tooltip) { // The Athena widget set could not handle switching between @@ -2418,8 +2418,8 @@ hl_do_font( gui.tooltip_fontset = (XFontSet)HL_TABLE()[idx].sg_fontset; gui_mch_new_tooltip_font(); } -# endif # endif +# endif } else # endif @@ -2433,15 +2433,15 @@ hl_do_font( { if (do_normal) gui_init_font(arg, FALSE); -#ifndef FONTSET_ALWAYS -# if defined(FEAT_GUI_MOTIF) && defined(FEAT_MENU) +# ifndef FONTSET_ALWAYS +# if defined(FEAT_GUI_MOTIF) && defined(FEAT_MENU) if (do_menu) { gui.menu_font = HL_TABLE()[idx].sg_font; gui_mch_new_menu_font(); } +# endif # endif -#endif } } } @@ -2461,33 +2461,33 @@ color_name2handle(char_u *name) if (STRICMP(name, "fg") == 0 || STRICMP(name, "foreground") == 0) { -#if defined(FEAT_TERMGUICOLORS) && defined(FEAT_GUI) +# if defined(FEAT_TERMGUICOLORS) && defined(FEAT_GUI) if (gui.in_use) -#endif -#ifdef FEAT_GUI +# endif +# ifdef FEAT_GUI return gui.norm_pixel; -#endif -#ifdef FEAT_TERMGUICOLORS +# endif +# ifdef FEAT_TERMGUICOLORS if (cterm_normal_fg_gui_color != INVALCOLOR) return cterm_normal_fg_gui_color; // Guess that the foreground is black or white. return GUI_GET_COLOR((char_u *)(*p_bg == 'l' ? "black" : "white")); -#endif +# endif } if (STRICMP(name, "bg") == 0 || STRICMP(name, "background") == 0) { -#if defined(FEAT_TERMGUICOLORS) && defined(FEAT_GUI) +# if defined(FEAT_TERMGUICOLORS) && defined(FEAT_GUI) if (gui.in_use) -#endif -#ifdef FEAT_GUI +# endif +# ifdef FEAT_GUI return gui.back_pixel; -#endif -#ifdef FEAT_TERMGUICOLORS +# endif +# ifdef FEAT_TERMGUICOLORS if (cterm_normal_bg_gui_color != INVALCOLOR) return cterm_normal_bg_gui_color; // Guess that the background is white or black. return GUI_GET_COLOR((char_u *)(*p_bg == 'l' ? "white" : "black")); -#endif +# endif } return GUI_GET_COLOR(name); @@ -2544,7 +2544,7 @@ decode_hex_color(char_u *hex) return gui_adjust_rgb(color); } -#ifdef FEAT_EVAL +# ifdef FEAT_EVAL // Returns the color currently mapped to the given name or INVALCOLOR if no // such name exists in the color table. The convention is to use lowercase for // all keys in the v:colornames dictionary. The value can be either a string in @@ -2590,7 +2590,7 @@ colorname2rgb(char_u *name) return INVALCOLOR; } -#endif +# endif guicolor_T gui_get_color_cmn(char_u *name) @@ -2647,7 +2647,7 @@ gui_get_color_cmn(char_u *name) if (entry != NULL) return gui_adjust_rgb((guicolor_T)entry->key); -#if defined(FEAT_EVAL) +# if defined(FEAT_EVAL) /* * Not a traditional color. Load additional color aliases and then consult the alias table. */ @@ -2660,9 +2660,9 @@ gui_get_color_cmn(char_u *name) } return color; -#else +# else return INVALCOLOR; -#endif +# endif } guicolor_T @@ -2692,7 +2692,7 @@ static garray_T cterm_attr_table = {0, 0, 0, 0, NULL}; #ifdef FEAT_GUI static garray_T gui_attr_table = {0, 0, 0, 0, NULL}; -#define GUI_ATTR_ENTRY(idx) ((attrentry_T *)gui_attr_table.ga_data)[idx] +# define GUI_ATTR_ENTRY(idx) ((attrentry_T *)gui_attr_table.ga_data)[idx] #endif /* @@ -2726,9 +2726,9 @@ get_attr_entry(garray_T *table, attrentry_T *aep) && aep->ae_u.gui.sp_color == taep->ae_u.gui.sp_color && aep->ae_u.gui.font == taep->ae_u.gui.font -# ifdef FEAT_XFONTSET +# ifdef FEAT_XFONTSET && aep->ae_u.gui.fontset == taep->ae_u.gui.fontset -# endif +# endif )) || #endif @@ -2844,11 +2844,11 @@ get_cterm_attr_idx(int attr, int fg, int bg) attrentry_T at_en; CLEAR_FIELD(at_en); -#ifdef FEAT_TERMGUICOLORS +# ifdef FEAT_TERMGUICOLORS at_en.ae_u.cterm.fg_rgb = INVALCOLOR; at_en.ae_u.cterm.bg_rgb = INVALCOLOR; at_en.ae_u.cterm.ul_rgb = INVALCOLOR; -#endif +# endif at_en.ae_attr = attr; at_en.ae_u.cterm.fg_color = fg; at_en.ae_u.cterm.bg_color = bg; @@ -3287,11 +3287,11 @@ highlight_has_attr( if (id <= 0 || id > highlight_ga.ga_len) return NULL; -#if defined(FEAT_GUI) || defined(FEAT_EVAL) +# if defined(FEAT_GUI) || defined(FEAT_EVAL) if (modec == 'g') attr = HL_TABLE()[id - 1].sg_gui; else -#endif +# endif { if (modec == 'c') attr = HL_TABLE()[id - 1].sg_cterm; @@ -3536,11 +3536,11 @@ set_hl_attr( // highlighting attributes, need to allocate an attr number. if (sgp->sg_cterm_fg == 0 && sgp->sg_cterm_bg == 0 && sgp->sg_cterm_ul == 0 && sgp->sg_cterm_font == 0 -# ifdef FEAT_TERMGUICOLORS +#ifdef FEAT_TERMGUICOLORS && sgp->sg_gui_fg == INVALCOLOR && sgp->sg_gui_bg == INVALCOLOR && sgp->sg_gui_sp == INVALCOLOR -# endif +#endif ) sgp->sg_cterm_attr = sgp->sg_cterm; else @@ -3550,7 +3550,7 @@ set_hl_attr( at_en.ae_u.cterm.bg_color = sgp->sg_cterm_bg; at_en.ae_u.cterm.ul_color = sgp->sg_cterm_ul; at_en.ae_u.cterm.font = sgp->sg_cterm_font; -# ifdef FEAT_TERMGUICOLORS +#ifdef FEAT_TERMGUICOLORS at_en.ae_u.cterm.fg_rgb = GUI_MCH_GET_RGB2(sgp->sg_gui_fg); at_en.ae_u.cterm.bg_rgb = GUI_MCH_GET_RGB2(sgp->sg_gui_bg); // Only use the underline/undercurl color when used, it may clear the @@ -3568,7 +3568,7 @@ set_hl_attr( at_en.ae_u.cterm.fg_rgb = CTERMCOLOR; at_en.ae_u.cterm.bg_rgb = CTERMCOLOR; } -# endif +#endif sgp->sg_cterm_attr = get_attr_entry(&cterm_attr_table, &at_en); } } @@ -3941,9 +3941,9 @@ combine_stl_hlt( CLEAR_POINTER(&hlt[hlcnt + i]); hlt[hlcnt + i].sg_term = highlight_attr[hlf]; hlt[hlcnt + i].sg_cterm = highlight_attr[hlf]; -# if defined(FEAT_GUI) || defined(FEAT_EVAL) +# if defined(FEAT_GUI) || defined(FEAT_EVAL) hlt[hlcnt + i].sg_gui = highlight_attr[hlf]; -# endif +# endif } else mch_memmove(&hlt[hlcnt + i], @@ -3965,11 +3965,11 @@ combine_stl_hlt( hlt[hlcnt + i].sg_cterm_bg = hlt[id - 1].sg_cterm_bg; if (hlt[id - 1].sg_cterm_font != hlt[id_S - 1].sg_cterm_font) hlt[hlcnt + i].sg_cterm_font = hlt[id - 1].sg_cterm_font; -# if defined(FEAT_GUI) || defined(FEAT_EVAL) +# if defined(FEAT_GUI) || defined(FEAT_EVAL) hlt[hlcnt + i].sg_gui ^= hlt[id - 1].sg_gui ^ hlt[id_S - 1].sg_gui; -# endif -# ifdef FEAT_GUI +# endif +# ifdef FEAT_GUI if (hlt[id - 1].sg_gui_fg != hlt[id_S - 1].sg_gui_fg) hlt[hlcnt + i].sg_gui_fg = hlt[id - 1].sg_gui_fg; if (hlt[id - 1].sg_gui_bg != hlt[id_S - 1].sg_gui_bg) @@ -3978,11 +3978,11 @@ combine_stl_hlt( hlt[hlcnt + i].sg_gui_sp = hlt[id - 1].sg_gui_sp; if (hlt[id - 1].sg_font != hlt[id_S - 1].sg_font) hlt[hlcnt + i].sg_font = hlt[id - 1].sg_font; -# ifdef FEAT_XFONTSET +# ifdef FEAT_XFONTSET if (hlt[id - 1].sg_fontset != hlt[id_S - 1].sg_fontset) hlt[hlcnt + i].sg_fontset = hlt[id - 1].sg_fontset; -# endif # endif +# endif highlight_ga.ga_len = hlcnt + i + 1; set_hl_attr(hlcnt + i); // At long last we can apply table[i] = syn_id2attr(hlcnt + i + 1); @@ -4982,7 +4982,7 @@ hldict_attr_to_str( // Temporary buffer used to store the command string produced by hlset(). // IObuff cannot be used for this as the error messages produced by hlset() // internally use IObuff. -#define HLSETBUFSZ 512 +# define HLSETBUFSZ 512 static char_u hlsetBuf[HLSETBUFSZ + 1]; /* diff --git a/src/if_cscope.c b/src/if_cscope.c index 7d246b58b5..4e65da99a4 100644 --- a/src/if_cscope.c +++ b/src/if_cscope.c @@ -13,24 +13,24 @@ #if defined(FEAT_CSCOPE) -#include -#include -#if defined(UNIX) -# include -#endif - -#if defined (MSWIN) -# ifndef WIN32_LEAN_AND_MEAN -# define WIN32_LEAN_AND_MEAN +# include +# include +# if defined(UNIX) +# include # endif -# include -#endif -#define CSCOPE_SUCCESS 0 -#define CSCOPE_FAILURE -1 +# if defined (MSWIN) +# ifndef WIN32_LEAN_AND_MEAN +# define WIN32_LEAN_AND_MEAN +# endif +# include +# endif -#define CSCOPE_DBFILE "cscope.out" -#define CSCOPE_PROMPT ">> " +# define CSCOPE_SUCCESS 0 +# define CSCOPE_FAILURE -1 + +# define CSCOPE_DBFILE "cscope.out" +# define CSCOPE_PROMPT ">> " /* * See ":help cscope-find" for the possible queries. @@ -48,19 +48,19 @@ typedef struct csi { char * fname; // cscope db name char * ppath; // path to prepend (the -P option) char * flags; // additional cscope flags/options (e.g, -p2) -#if defined(UNIX) +# if defined(UNIX) pid_t pid; // PID of the connected cscope process. dev_t st_dev; // ID of dev containing cscope db ino_t st_ino; // inode number of cscope db -#else -# if defined(MSWIN) +# else +# if defined(MSWIN) DWORD pid; // PID of the connected cscope process. HANDLE hProc; // cscope process handle DWORD nVolume; // Volume serial number, instead of st_dev DWORD nIndexHigh; // st_ino has no meaning in the Windows DWORD nIndexLow; +# endif # endif -#endif FILE * fr_fp; // from cscope: FILE. FILE * to_fp; // to cscope: FILE. @@ -81,9 +81,9 @@ static int cs_check_for_connections(void); static int cs_check_for_tags(void); static int cs_cnt_connections(void); static int cs_create_connection(int i); -#ifdef FEAT_QUICKFIX +# ifdef FEAT_QUICKFIX static void cs_file_results(FILE *, int *); -#endif +# endif static void cs_fill_results(char *, int , int *, char ***, char ***, int *); static int cs_find(exarg_T *eap); @@ -365,9 +365,9 @@ ex_cstag(exarg_T *eap) if (!ret) { (void)emsg(_(e_cstag_tag_not_founc)); -#if defined(FEAT_QUICKFIX) +# if defined(FEAT_QUICKFIX) g_do_tagpreview = 0; -#endif +# endif } } @@ -439,7 +439,7 @@ cs_print_tags(void) * * Note: All string comparisons are case sensitive! */ -#if defined(FEAT_EVAL) +# if defined(FEAT_EVAL) static int cs_connection(int num, char_u *dbpath, char_u *ppath) { @@ -488,7 +488,7 @@ cs_connection(int num, char_u *dbpath, char_u *ppath) return FALSE; } -#endif +# endif /* @@ -588,9 +588,9 @@ staterr: goto add_err; while (fname[strlen(fname)-1] == '/' -#ifdef MSWIN +# ifdef MSWIN || fname[strlen(fname)-1] == '\\' -#endif +# endif ) { fname[strlen(fname)-1] = '\0'; @@ -691,7 +691,7 @@ cs_reading_emsg( semsg(_(e_error_reading_cscope_connection_nr), idx); } -#define CSREAD_BUFSIZE 2048 +# define CSREAD_BUFSIZE 2048 /* * Count the number of matches for a given cscope connection. */ @@ -822,14 +822,14 @@ cs_create_cmd(char *csoption, char *pattern) static int cs_create_connection(int i) { -#ifdef UNIX +# ifdef UNIX int to_cs[2], from_cs[2]; -#endif +# endif int cmdlen; int len; char *prog, *cmd, *ppath = NULL; size_t proglen; -#ifdef MSWIN +# ifdef MSWIN int fd; SECURITY_ATTRIBUTES sa; PROCESS_INFORMATION pi; @@ -838,9 +838,9 @@ cs_create_connection(int i) HANDLE stdin_rd, stdout_rd; HANDLE stdout_wr, stdin_wr; BOOL created; -#endif +# endif -#if defined(UNIX) +# if defined(UNIX) /* * Cscope reads from to_cs[0] and writes to from_cs[1]; vi reads from * from_cs[0] and writes to to_cs[1]. @@ -881,7 +881,7 @@ err_closing: // close unused (void)close(to_cs[1]); (void)close(from_cs[0]); -#else +# else // MSWIN // Create pipes to communicate with cscope sa.nLength = sizeof(SECURITY_ATTRIBUTES); @@ -905,16 +905,16 @@ err_closing: } return CSCOPE_FAILURE; } -#endif +# endif // expand the cscope exec for env var's if ((prog = alloc(MAXPATHL + 1)) == NULL) { -#ifdef UNIX +# ifdef UNIX exit(EXIT_FAILURE); -#else +# else // MSWIN goto err_closing; -#endif +# endif } proglen = expand_env(p_csprg, (char_u *)prog, MAXPATHL); @@ -926,12 +926,12 @@ err_closing: if ((ppath = alloc(MAXPATHL + 1)) == NULL) { vim_free(prog); -#ifdef UNIX +# ifdef UNIX exit(EXIT_FAILURE); -#else +# else // MSWIN goto err_closing; -#endif +# endif } cmdlen += (int)expand_env((char_u *)csinfo[i].ppath, (char_u *)ppath, MAXPATHL); } @@ -943,21 +943,21 @@ err_closing: { vim_free(prog); vim_free(ppath); -#ifdef UNIX +# ifdef UNIX exit(EXIT_FAILURE); -#else +# else // MSWIN goto err_closing; -#endif +# endif } // run the cscope command -#ifdef UNIX +# ifdef UNIX vim_snprintf(cmd, cmdlen, "/bin/sh -c \"exec %s -dl -f %s", prog, csinfo[i].fname); -#else +# else vim_snprintf(cmd, cmdlen, "%s -dl -f %s", prog, csinfo[i].fname); -#endif +# endif if (csinfo[i].ppath != NULL) { len = (int)STRLEN(cmd); @@ -977,16 +977,16 @@ err_closing: # endif vim_free(ppath); -#if defined(UNIX) -# if defined(HAVE_SETSID) || defined(HAVE_SETPGID) +# if defined(UNIX) +# if defined(HAVE_SETSID) || defined(HAVE_SETPGID) // Change our process group to avoid cscope receiving SIGWINCH. -# if defined(HAVE_SETSID) +# if defined(HAVE_SETSID) (void)setsid(); -# else +# else if (setpgid(0, 0) == -1) PERROR(_("cs_create_connection setpgid failed")); +# endif # endif -# endif if (build_argv_from_string((char_u *)cmd, &argv, &argc) == FAIL) exit(EXIT_FAILURE); @@ -1011,7 +1011,7 @@ err_closing: (void)close(to_cs[0]); (void)close(from_cs[1]); } -#else +# else // MSWIN // Create a new process to run cscope and use pipes to talk with it GetStartupInfo(&si); @@ -1050,7 +1050,7 @@ err_closing: CloseHandle(stdin_rd); CloseHandle(stdout_wr); -#endif // !UNIX +# endif // !UNIX return CSCOPE_SUCCESS; } @@ -1116,7 +1116,7 @@ cs_find_common( char *cmd; int *nummatches; int totmatches; -#ifdef FEAT_QUICKFIX +# ifdef FEAT_QUICKFIX char cmdletter; char *qfpos; @@ -1170,13 +1170,13 @@ cs_find_common( && apply_autocmds(EVENT_QUICKFIXCMDPRE, (char_u *)"cscope", curbuf->b_fname, TRUE, curbuf)) { -# ifdef FEAT_EVAL +# ifdef FEAT_EVAL if (aborting()) return FALSE; -# endif +# endif } } -#endif +# endif // create the actual command to send to cscope cmd = cs_create_cmd(opt, pat); @@ -1223,7 +1223,7 @@ cs_find_common( return FALSE; } -#ifdef FEAT_QUICKFIX +# ifdef FEAT_QUICKFIX if (qfpos != NULL && *qfpos != '0' && totmatches > 0) { // fill error list @@ -1277,7 +1277,7 @@ cs_find_common( return TRUE; } else -#endif // FEAT_QUICKFIX +# endif // FEAT_QUICKFIX { char **matches = NULL, **contexts = NULL; int matched = 0; @@ -1343,20 +1343,20 @@ clear_csinfo(int i) csinfo[i].fname = NULL; csinfo[i].ppath = NULL; csinfo[i].flags = NULL; -#if defined(UNIX) +# if defined(UNIX) csinfo[i].st_dev = (dev_t)0; csinfo[i].st_ino = (ino_t)0; -#else +# else csinfo[i].nVolume = 0; csinfo[i].nIndexHigh = 0; csinfo[i].nIndexLow = 0; -#endif +# endif csinfo[i].pid = 0; csinfo[i].fr_fp = NULL; csinfo[i].to_fp = NULL; -#if defined(MSWIN) +# if defined(MSWIN) csinfo[i].hProc = NULL; -#endif +# endif } /* @@ -1371,7 +1371,7 @@ cs_insert_filelist( { int i; int j; -#ifndef UNIX +# ifndef UNIX BY_HANDLE_FILE_INFORMATION bhfi; switch (win32_fileinfo((char_u *)fname, &bhfi)) @@ -1396,15 +1396,15 @@ cs_insert_filelist( (void)emsg(_(e_cannot_get_cscope_database_information)); return -1; } -#endif +# endif i = -1; // can be set to the index of an empty item in csinfo for (j = 0; j < csinfo_size; j++) { if (csinfo[j].fname != NULL -#if defined(UNIX) +# if defined(UNIX) && csinfo[j].st_dev == sb->st_dev && csinfo[j].st_ino == sb->st_ino -#else +# else // compare pathnames first && ((fullpathcmp((char_u *)csinfo[j].fname, (char_u *)fname, FALSE, TRUE) & FPC_SAME) @@ -1412,7 +1412,7 @@ cs_insert_filelist( || (csinfo[j].nVolume == bhfi.dwVolumeSerialNumber && csinfo[j].nIndexHigh == bhfi.nFileIndexHigh && csinfo[j].nIndexLow == bhfi.nFileIndexLow)) -#endif +# endif ) { if (p_csverbose) @@ -1484,15 +1484,15 @@ cs_insert_filelist( else csinfo[i].flags = NULL; -#if defined(UNIX) +# if defined(UNIX) csinfo[i].st_dev = sb->st_dev; csinfo[i].st_ino = sb->st_ino; -#else +# else csinfo[i].nVolume = bhfi.dwVolumeSerialNumber; csinfo[i].nIndexLow = bhfi.nFileIndexLow; csinfo[i].nIndexHigh = bhfi.nFileIndexHigh; -#endif +# endif return i; } @@ -1794,7 +1794,7 @@ cs_parse_results( return name; } -#ifdef FEAT_QUICKFIX +# ifdef FEAT_QUICKFIX /* * Write cscope find results to file. */ @@ -1849,7 +1849,7 @@ cs_file_results(FILE *f, int *nummatches_a) } // for all cscope connections vim_free(buf); } -#endif +# endif /* * Get parsed cscope output and calls cs_make_vim_style_matches to convert @@ -1951,17 +1951,17 @@ cs_pathcomponents(char *path) { s--; if (*s == '/' -#ifdef MSWIN +# ifdef MSWIN || *s == '\\' -#endif +# endif ) break; } } if ((s > path && *s == '/') -#ifdef MSWIN +# ifdef MSWIN || (s > path && *s == '\\') -#endif +# endif ) ++s; return s; @@ -2197,7 +2197,7 @@ cs_read_prompt(int i) return CSCOPE_SUCCESS; } -#if defined(UNIX) && defined(SIGALRM) +# if defined(UNIX) && defined(SIGALRM) /* * Used to catch and ignore SIGALRM below. */ @@ -2206,7 +2206,7 @@ sig_handler SIGDEFARG(sigarg) { // do nothing } -#endif +# endif /* * Does the actual free'ing for the cs ptr with an optional flag of whether @@ -2223,23 +2223,23 @@ cs_release_csp(int i, int freefnpp) (void)fputs("q\n", csinfo[i].to_fp); (void)fflush(csinfo[i].to_fp); } -#if defined(UNIX) +# if defined(UNIX) { int waitpid_errno; int pstat; pid_t pid; -# if defined(HAVE_SIGACTION) +# if defined(HAVE_SIGACTION) struct sigaction sa, old; // Use sigaction() to limit the waiting time to two seconds. sigemptyset(&sa.sa_mask); sa.sa_handler = sig_handler; -# ifdef SA_NODEFER +# ifdef SA_NODEFER sa.sa_flags = SA_NODEFER; -# else +# else sa.sa_flags = 0; -# endif +# endif sigaction(SIGALRM, &sa, &old); alarm(2); // 2 sec timeout @@ -2250,7 +2250,7 @@ cs_release_csp(int i, int freefnpp) // cancel pending alarm if still there and restore signal alarm(0); sigaction(SIGALRM, &old, NULL); -# else +# else int waited; // Can't use sigaction(), loop for two seconds. First yield the CPU @@ -2264,7 +2264,7 @@ cs_release_csp(int i, int freefnpp) break; // break unless the process is still running mch_delay(50L, 0); // sleep 50 ms } -# endif +# endif /* * If the cscope process is still running: kill it. * Safety check: If the PID would be zero here, the entire X session @@ -2272,7 +2272,7 @@ cs_release_csp(int i, int freefnpp) */ if (pid < 0 && csinfo[i].pid > 1) { -# ifdef ECHILD +# ifdef ECHILD int alive = TRUE; if (waitpid_errno == ECHILD) @@ -2301,14 +2301,14 @@ cs_release_csp(int i, int freefnpp) } } if (alive) -# endif +# endif { kill(csinfo[i].pid, SIGKILL); (void)waitpid(csinfo[i].pid, &pstat, 0); } } } -#else // !UNIX +# else // !UNIX if (csinfo[i].hProc != NULL) { // Give cscope a chance to exit normally @@ -2316,7 +2316,7 @@ cs_release_csp(int i, int freefnpp) TerminateProcess(csinfo[i].hProc, 0); CloseHandle(csinfo[i].hProc); } -#endif +# endif if (csinfo[i].fr_fp != NULL) (void)fclose(csinfo[i].fr_fp); @@ -2441,9 +2441,9 @@ cs_resolve_file(int i, char *name) if (csinfo[i].ppath != NULL && (strncmp(name, csinfo[i].ppath, strlen(csinfo[i].ppath)) != 0) && (name[0] != '/') -#ifdef MSWIN +# ifdef MSWIN && name[0] != '\\' && name[1] != ':' -#endif +# endif ) { if ((fullname = alloc(len)) != NULL) diff --git a/src/if_lua.c b/src/if_lua.c index 04524aa339..3642561617 100644 --- a/src/if_lua.c +++ b/src/if_lua.c @@ -17,25 +17,25 @@ #include #if __STDC_VERSION__ >= 199901L -# define LUAV_INLINE inline +# define LUAV_INLINE inline #else -# define LUAV_INLINE +# define LUAV_INLINE #endif // Only do the following when the feature is enabled. Needed for "make // depend". #if defined(FEAT_LUA) -#define LUAVIM_CHUNKNAME "vim chunk" -#define LUAVIM_NAME "vim" -#define LUAVIM_EVALNAME "luaeval" -#define LUAVIM_EVALHEADER "local _A=select(1,...) return " +# define LUAVIM_CHUNKNAME "vim chunk" +# define LUAVIM_NAME "vim" +# define LUAVIM_EVALNAME "luaeval" +# define LUAVIM_EVALHEADER "local _A=select(1,...) return " -#ifdef LUA_RELEASE -# define LUAVIM_VERSION LUA_RELEASE -#else -# define LUAVIM_VERSION LUA_VERSION -#endif +# ifdef LUA_RELEASE +# define LUAVIM_VERSION LUA_RELEASE +# else +# define LUAVIM_VERSION LUA_VERSION +# endif typedef buf_T *luaV_Buffer; typedef win_T *luaV_Window; @@ -73,14 +73,14 @@ static const char LUA___CALL[] = "__call"; static const char LUAVIM_UDATA_CACHE[] = "luaV_udata_cache"; -#define luaV_getfield(L, s) \ +# define luaV_getfield(L, s) \ lua_pushlightuserdata((L), (void *)(s)); \ lua_rawget((L), LUA_REGISTRYINDEX) -#define luaV_checksandbox(L) \ +# define luaV_checksandbox(L) \ if (sandbox) luaL_error((L), "not allowed in sandbox") -#define luaV_msg(L) luaV_msgfunc((L), (msgfunc_T) msg) -#define luaV_emsg(L) luaV_msgfunc((L), (msgfunc_T) emsg) -#define luaV_checktypval(L, a, v, msg) \ +# define luaV_msg(L) luaV_msgfunc((L), (msgfunc_T) msg) +# define luaV_emsg(L) luaV_msgfunc((L), (msgfunc_T) emsg) +# define luaV_checktypval(L, a, v, msg) \ do { \ if (luaV_totypval(L, a, v) == FAIL) \ luaL_error(L, msg ": cannot convert value"); \ @@ -93,148 +93,148 @@ static luaV_Funcref *luaV_pushfuncref(lua_State *L, char_u *name); static int luaV_call_lua_func(int argcount, typval_T *argvars, typval_T *rettv, void *state); static void luaV_call_lua_func_free(void *state); -#if LUA_VERSION_NUM <= 501 -#define luaV_register(L, l) luaL_register(L, NULL, l) -#define luaL_typeerror luaL_typerror -#else -#define luaV_register(L, l) luaL_setfuncs(L, l, 0) -#endif - -#ifdef DYNAMIC_LUA - -#ifdef MSWIN -# define load_dll vimLoadLib -# define symbol_from_dll GetProcAddress -# define close_dll FreeLibrary -# define load_dll_error GetWin32Error -#else -# include -# define HANDLE void* -# define load_dll(n) dlopen((n), RTLD_LAZY|RTLD_GLOBAL) -# define symbol_from_dll dlsym -# define close_dll dlclose -# define load_dll_error dlerror -#endif +# if LUA_VERSION_NUM <= 501 +# define luaV_register(L, l) luaL_register(L, NULL, l) +# define luaL_typeerror luaL_typerror +# else +# define luaV_register(L, l) luaL_setfuncs(L, l, 0) +# endif + +# ifdef DYNAMIC_LUA + +# ifdef MSWIN +# define load_dll vimLoadLib +# define symbol_from_dll GetProcAddress +# define close_dll FreeLibrary +# define load_dll_error GetWin32Error +# else +# include +# define HANDLE void* +# define load_dll(n) dlopen((n), RTLD_LAZY|RTLD_GLOBAL) +# define symbol_from_dll dlsym +# define close_dll dlclose +# define load_dll_error dlerror +# endif // lauxlib -#if LUA_VERSION_NUM <= 501 -#define luaL_register dll_luaL_register -#define luaL_prepbuffer dll_luaL_prepbuffer -#define luaL_openlib dll_luaL_openlib -#define luaL_typerror dll_luaL_typerror -#define luaL_loadfile dll_luaL_loadfile -#define luaL_loadbuffer dll_luaL_loadbuffer -#else -#define luaL_prepbuffsize dll_luaL_prepbuffsize -#define luaL_setfuncs dll_luaL_setfuncs -#define luaL_loadfilex dll_luaL_loadfilex -#define luaL_loadbufferx dll_luaL_loadbufferx -#define luaL_argerror dll_luaL_argerror -#endif -#if LUA_VERSION_NUM >= 504 -#define luaL_typeerror dll_luaL_typeerror -#endif -#define luaL_checkany dll_luaL_checkany -#define luaL_checklstring dll_luaL_checklstring -#define luaL_checkinteger dll_luaL_checkinteger -#define luaL_optinteger dll_luaL_optinteger -#define luaL_checktype dll_luaL_checktype -#define luaL_error dll_luaL_error -#define luaL_newstate dll_luaL_newstate -#define luaL_buffinit dll_luaL_buffinit -#define luaL_addlstring dll_luaL_addlstring -#define luaL_pushresult dll_luaL_pushresult -#define luaL_loadstring dll_luaL_loadstring -#define luaL_ref dll_luaL_ref -#define luaL_unref dll_luaL_unref +# if LUA_VERSION_NUM <= 501 +# define luaL_register dll_luaL_register +# define luaL_prepbuffer dll_luaL_prepbuffer +# define luaL_openlib dll_luaL_openlib +# define luaL_typerror dll_luaL_typerror +# define luaL_loadfile dll_luaL_loadfile +# define luaL_loadbuffer dll_luaL_loadbuffer +# else +# define luaL_prepbuffsize dll_luaL_prepbuffsize +# define luaL_setfuncs dll_luaL_setfuncs +# define luaL_loadfilex dll_luaL_loadfilex +# define luaL_loadbufferx dll_luaL_loadbufferx +# define luaL_argerror dll_luaL_argerror +# endif +# if LUA_VERSION_NUM >= 504 +# define luaL_typeerror dll_luaL_typeerror +# endif +# define luaL_checkany dll_luaL_checkany +# define luaL_checklstring dll_luaL_checklstring +# define luaL_checkinteger dll_luaL_checkinteger +# define luaL_optinteger dll_luaL_optinteger +# define luaL_checktype dll_luaL_checktype +# define luaL_error dll_luaL_error +# define luaL_newstate dll_luaL_newstate +# define luaL_buffinit dll_luaL_buffinit +# define luaL_addlstring dll_luaL_addlstring +# define luaL_pushresult dll_luaL_pushresult +# define luaL_loadstring dll_luaL_loadstring +# define luaL_ref dll_luaL_ref +# define luaL_unref dll_luaL_unref // lua -#if LUA_VERSION_NUM <= 501 -#define lua_tonumber dll_lua_tonumber -#define lua_tointeger dll_lua_tointeger -#define lua_call dll_lua_call -#define lua_pcall dll_lua_pcall -#else -#define lua_tonumberx dll_lua_tonumberx -#define lua_tointegerx dll_lua_tointegerx -#define lua_callk dll_lua_callk -#define lua_pcallk dll_lua_pcallk -#define lua_getglobal dll_lua_getglobal -#define lua_setglobal dll_lua_setglobal -#endif -#if LUA_VERSION_NUM <= 502 -#define lua_replace dll_lua_replace -#define lua_remove dll_lua_remove -#endif -#if LUA_VERSION_NUM >= 503 -#define lua_rotate dll_lua_rotate -#define lua_copy dll_lua_copy -#endif -#define lua_typename dll_lua_typename -#define lua_close dll_lua_close -#define lua_gettop dll_lua_gettop -#define lua_settop dll_lua_settop -#define lua_pushvalue dll_lua_pushvalue -#define lua_isnumber dll_lua_isnumber -#define lua_isstring dll_lua_isstring -#define lua_type dll_lua_type -#define lua_rawequal dll_lua_rawequal -#define lua_toboolean dll_lua_toboolean -#define lua_tolstring dll_lua_tolstring -#define lua_touserdata dll_lua_touserdata -#define lua_pushnil dll_lua_pushnil -#define lua_pushnumber dll_lua_pushnumber -#define lua_pushinteger dll_lua_pushinteger -#define lua_pushlstring dll_lua_pushlstring -#define lua_pushstring dll_lua_pushstring -#define lua_pushfstring dll_lua_pushfstring -#define lua_pushcclosure dll_lua_pushcclosure -#define lua_pushboolean dll_lua_pushboolean -#define lua_pushlightuserdata dll_lua_pushlightuserdata -#define lua_getfield dll_lua_getfield -#define lua_rawget dll_lua_rawget -#define lua_rawgeti dll_lua_rawgeti -#define lua_createtable dll_lua_createtable -#define lua_settable dll_lua_settable -#if LUA_VERSION_NUM >= 504 - #define lua_newuserdatauv dll_lua_newuserdatauv -#else - #define lua_newuserdata dll_lua_newuserdata -#endif -#define lua_getmetatable dll_lua_getmetatable -#define lua_setfield dll_lua_setfield -#define lua_rawset dll_lua_rawset -#define lua_rawseti dll_lua_rawseti -#define lua_setmetatable dll_lua_setmetatable -#define lua_next dll_lua_next +# if LUA_VERSION_NUM <= 501 +# define lua_tonumber dll_lua_tonumber +# define lua_tointeger dll_lua_tointeger +# define lua_call dll_lua_call +# define lua_pcall dll_lua_pcall +# else +# define lua_tonumberx dll_lua_tonumberx +# define lua_tointegerx dll_lua_tointegerx +# define lua_callk dll_lua_callk +# define lua_pcallk dll_lua_pcallk +# define lua_getglobal dll_lua_getglobal +# define lua_setglobal dll_lua_setglobal +# endif +# if LUA_VERSION_NUM <= 502 +# define lua_replace dll_lua_replace +# define lua_remove dll_lua_remove +# endif +# if LUA_VERSION_NUM >= 503 +# define lua_rotate dll_lua_rotate +# define lua_copy dll_lua_copy +# endif +# define lua_typename dll_lua_typename +# define lua_close dll_lua_close +# define lua_gettop dll_lua_gettop +# define lua_settop dll_lua_settop +# define lua_pushvalue dll_lua_pushvalue +# define lua_isnumber dll_lua_isnumber +# define lua_isstring dll_lua_isstring +# define lua_type dll_lua_type +# define lua_rawequal dll_lua_rawequal +# define lua_toboolean dll_lua_toboolean +# define lua_tolstring dll_lua_tolstring +# define lua_touserdata dll_lua_touserdata +# define lua_pushnil dll_lua_pushnil +# define lua_pushnumber dll_lua_pushnumber +# define lua_pushinteger dll_lua_pushinteger +# define lua_pushlstring dll_lua_pushlstring +# define lua_pushstring dll_lua_pushstring +# define lua_pushfstring dll_lua_pushfstring +# define lua_pushcclosure dll_lua_pushcclosure +# define lua_pushboolean dll_lua_pushboolean +# define lua_pushlightuserdata dll_lua_pushlightuserdata +# define lua_getfield dll_lua_getfield +# define lua_rawget dll_lua_rawget +# define lua_rawgeti dll_lua_rawgeti +# define lua_createtable dll_lua_createtable +# define lua_settable dll_lua_settable +# if LUA_VERSION_NUM >= 504 +# define lua_newuserdatauv dll_lua_newuserdatauv +# else +# define lua_newuserdata dll_lua_newuserdata +# endif +# define lua_getmetatable dll_lua_getmetatable +# define lua_setfield dll_lua_setfield +# define lua_rawset dll_lua_rawset +# define lua_rawseti dll_lua_rawseti +# define lua_setmetatable dll_lua_setmetatable +# define lua_next dll_lua_next // libs -#define luaopen_base dll_luaopen_base -#define luaopen_table dll_luaopen_table -#define luaopen_string dll_luaopen_string -#define luaopen_math dll_luaopen_math -#define luaopen_io dll_luaopen_io -#define luaopen_os dll_luaopen_os -#define luaopen_package dll_luaopen_package -#define luaopen_debug dll_luaopen_debug -#define luaL_openlibs dll_luaL_openlibs +# define luaopen_base dll_luaopen_base +# define luaopen_table dll_luaopen_table +# define luaopen_string dll_luaopen_string +# define luaopen_math dll_luaopen_math +# define luaopen_io dll_luaopen_io +# define luaopen_os dll_luaopen_os +# define luaopen_package dll_luaopen_package +# define luaopen_debug dll_luaopen_debug +# define luaL_openlibs dll_luaL_openlibs // lauxlib -#if LUA_VERSION_NUM <= 501 +# if LUA_VERSION_NUM <= 501 void (*dll_luaL_register) (lua_State *L, const char *libname, const luaL_Reg *l); char *(*dll_luaL_prepbuffer) (luaL_Buffer *B); void (*dll_luaL_openlib) (lua_State *L, const char *libname, const luaL_Reg *l, int nup); int (*dll_luaL_typerror) (lua_State *L, int narg, const char *tname); int (*dll_luaL_loadfile) (lua_State *L, const char *filename); int (*dll_luaL_loadbuffer) (lua_State *L, const char *buff, size_t sz, const char *name); -#else +# else char *(*dll_luaL_prepbuffsize) (luaL_Buffer *B, size_t sz); void (*dll_luaL_setfuncs) (lua_State *L, const luaL_Reg *l, int nup); int (*dll_luaL_loadfilex) (lua_State *L, const char *filename, const char *mode); int (*dll_luaL_loadbufferx) (lua_State *L, const char *buff, size_t sz, const char *name, const char *mode); int (*dll_luaL_argerror) (lua_State *L, int numarg, const char *extramsg); -#endif -#if LUA_VERSION_NUM >= 504 +# endif +# if LUA_VERSION_NUM >= 504 int (*dll_luaL_typeerror) (lua_State *L, int narg, const char *tname); -#endif +# endif void (*dll_luaL_checkany) (lua_State *L, int narg); const char *(*dll_luaL_checklstring) (lua_State *L, int numArg, size_t *l); lua_Integer (*dll_luaL_checkinteger) (lua_State *L, int numArg); @@ -247,18 +247,18 @@ void (*dll_luaL_addlstring) (luaL_Buffer *B, const char *s, size_t l); void (*dll_luaL_pushresult) (luaL_Buffer *B); int (*dll_luaL_loadstring) (lua_State *L, const char *s); int (*dll_luaL_ref) (lua_State *L, int idx); -#if LUA_VERSION_NUM <= 502 +# if LUA_VERSION_NUM <= 502 void (*dll_luaL_unref) (lua_State *L, int idx, int n); -#else +# else void (*dll_luaL_unref) (lua_State *L, int idx, lua_Integer n); -#endif +# endif // lua -#if LUA_VERSION_NUM <= 501 +# if LUA_VERSION_NUM <= 501 lua_Number (*dll_lua_tonumber) (lua_State *L, int idx); lua_Integer (*dll_lua_tointeger) (lua_State *L, int idx); void (*dll_lua_call) (lua_State *L, int nargs, int nresults); int (*dll_lua_pcall) (lua_State *L, int nargs, int nresults, int errfunc); -#else +# else lua_Number (*dll_lua_tonumberx) (lua_State *L, int idx, int *isnum); lua_Integer (*dll_lua_tointegerx) (lua_State *L, int idx, int *isnum); void (*dll_lua_callk) (lua_State *L, int nargs, int nresults, int ctx, @@ -267,15 +267,15 @@ int (*dll_lua_pcallk) (lua_State *L, int nargs, int nresults, int errfunc, int ctx, lua_CFunction k); void (*dll_lua_getglobal) (lua_State *L, const char *var); void (*dll_lua_setglobal) (lua_State *L, const char *var); -#endif -#if LUA_VERSION_NUM <= 502 +# endif +# if LUA_VERSION_NUM <= 502 void (*dll_lua_replace) (lua_State *L, int idx); void (*dll_lua_remove) (lua_State *L, int idx); -#endif -#if LUA_VERSION_NUM >= 503 +# endif +# if LUA_VERSION_NUM >= 503 void (*dll_lua_rotate) (lua_State *L, int idx, int n); void (*dll_lua_copy) (lua_State *L, int fromidx, int toidx); -#endif +# endif const char *(*dll_lua_typename) (lua_State *L, int tp); void (*dll_lua_close) (lua_State *L); int (*dll_lua_gettop) (lua_State *L); @@ -298,28 +298,28 @@ void (*dll_lua_pushcclosure) (lua_State *L, lua_CFunction fn, int n); void (*dll_lua_pushboolean) (lua_State *L, int b); void (*dll_lua_pushlightuserdata) (lua_State *L, void *p); void (*dll_lua_getfield) (lua_State *L, int idx, const char *k); -#if LUA_VERSION_NUM <= 502 +# if LUA_VERSION_NUM <= 502 void (*dll_lua_rawget) (lua_State *L, int idx); void (*dll_lua_rawgeti) (lua_State *L, int idx, int n); -#else +# else int (*dll_lua_rawget) (lua_State *L, int idx); int (*dll_lua_rawgeti) (lua_State *L, int idx, lua_Integer n); -#endif +# endif void (*dll_lua_createtable) (lua_State *L, int narr, int nrec); void (*dll_lua_settable) (lua_State *L, int idx); -#if LUA_VERSION_NUM >= 504 +# if LUA_VERSION_NUM >= 504 void *(*dll_lua_newuserdatauv) (lua_State *L, size_t sz, int nuvalue); -#else +# else void *(*dll_lua_newuserdata) (lua_State *L, size_t sz); -#endif +# endif int (*dll_lua_getmetatable) (lua_State *L, int objindex); void (*dll_lua_setfield) (lua_State *L, int idx, const char *k); void (*dll_lua_rawset) (lua_State *L, int idx); -#if LUA_VERSION_NUM <= 502 +# if LUA_VERSION_NUM <= 502 void (*dll_lua_rawseti) (lua_State *L, int idx, int n); -#else +# else void (*dll_lua_rawseti) (lua_State *L, int idx, lua_Integer n); -#endif +# endif int (*dll_lua_setmetatable) (lua_State *L, int objindex); int (*dll_lua_next) (lua_State *L, int idx); // libs @@ -341,23 +341,23 @@ typedef struct { static const luaV_Reg luaV_dll[] = { // lauxlib -#if LUA_VERSION_NUM <= 501 +# if LUA_VERSION_NUM <= 501 {"luaL_register", (luaV_function) &dll_luaL_register}, {"luaL_prepbuffer", (luaV_function) &dll_luaL_prepbuffer}, {"luaL_openlib", (luaV_function) &dll_luaL_openlib}, {"luaL_typerror", (luaV_function) &dll_luaL_typerror}, {"luaL_loadfile", (luaV_function) &dll_luaL_loadfile}, {"luaL_loadbuffer", (luaV_function) &dll_luaL_loadbuffer}, -#else +# else {"luaL_prepbuffsize", (luaV_function) &dll_luaL_prepbuffsize}, {"luaL_setfuncs", (luaV_function) &dll_luaL_setfuncs}, {"luaL_loadfilex", (luaV_function) &dll_luaL_loadfilex}, {"luaL_loadbufferx", (luaV_function) &dll_luaL_loadbufferx}, {"luaL_argerror", (luaV_function) &dll_luaL_argerror}, -#endif -#if LUA_VERSION_NUM >= 504 +# endif +# if LUA_VERSION_NUM >= 504 {"luaL_typeerror", (luaV_function) &dll_luaL_typeerror}, -#endif +# endif {"luaL_checkany", (luaV_function) &dll_luaL_checkany}, {"luaL_checklstring", (luaV_function) &dll_luaL_checklstring}, {"luaL_checkinteger", (luaV_function) &dll_luaL_checkinteger}, @@ -372,27 +372,27 @@ static const luaV_Reg luaV_dll[] = { {"luaL_ref", (luaV_function) &dll_luaL_ref}, {"luaL_unref", (luaV_function) &dll_luaL_unref}, // lua -#if LUA_VERSION_NUM <= 501 +# if LUA_VERSION_NUM <= 501 {"lua_tonumber", (luaV_function) &dll_lua_tonumber}, {"lua_tointeger", (luaV_function) &dll_lua_tointeger}, {"lua_call", (luaV_function) &dll_lua_call}, {"lua_pcall", (luaV_function) &dll_lua_pcall}, -#else +# else {"lua_tonumberx", (luaV_function) &dll_lua_tonumberx}, {"lua_tointegerx", (luaV_function) &dll_lua_tointegerx}, {"lua_callk", (luaV_function) &dll_lua_callk}, {"lua_pcallk", (luaV_function) &dll_lua_pcallk}, {"lua_getglobal", (luaV_function) &dll_lua_getglobal}, {"lua_setglobal", (luaV_function) &dll_lua_setglobal}, -#endif -#if LUA_VERSION_NUM <= 502 +# endif +# if LUA_VERSION_NUM <= 502 {"lua_replace", (luaV_function) &dll_lua_replace}, {"lua_remove", (luaV_function) &dll_lua_remove}, -#endif -#if LUA_VERSION_NUM >= 503 +# endif +# if LUA_VERSION_NUM >= 503 {"lua_rotate", (luaV_function) &dll_lua_rotate}, {"lua_copy", (luaV_function) &dll_lua_copy}, -#endif +# endif {"lua_typename", (luaV_function) &dll_lua_typename}, {"lua_close", (luaV_function) &dll_lua_close}, {"lua_gettop", (luaV_function) &dll_lua_gettop}, @@ -419,11 +419,11 @@ static const luaV_Reg luaV_dll[] = { {"lua_rawgeti", (luaV_function) &dll_lua_rawgeti}, {"lua_createtable", (luaV_function) &dll_lua_createtable}, {"lua_settable", (luaV_function) &dll_lua_settable}, -#if LUA_VERSION_NUM >= 504 +# if LUA_VERSION_NUM >= 504 {"lua_newuserdatauv", (luaV_function) &dll_lua_newuserdatauv}, -#else +# else {"lua_newuserdata", (luaV_function) &dll_lua_newuserdata}, -#endif +# endif {"lua_getmetatable", (luaV_function) &dll_lua_getmetatable}, {"lua_setfield", (luaV_function) &dll_lua_setfield}, {"lua_rawset", (luaV_function) &dll_lua_rawset}, @@ -470,17 +470,17 @@ lua_link_init(char *libname, int verbose) } return OK; } -#endif // DYNAMIC_LUA +# endif // DYNAMIC_LUA -#if defined(DYNAMIC_LUA) +# if defined(DYNAMIC_LUA) int lua_enabled(int verbose) { return lua_link_init((char *)p_luadll, verbose) == OK; } -#endif +# endif -#if LUA_VERSION_NUM > 501 && LUA_VERSION_NUM < 504 +# if LUA_VERSION_NUM > 501 && LUA_VERSION_NUM < 504 static int luaL_typeerror(lua_State *L, int narg, const char *tname) { @@ -488,7 +488,7 @@ luaL_typeerror(lua_State *L, int narg, const char *tname) tname, luaL_typename(L, narg)); return luaL_argerror(L, narg, msg); } -#endif +# endif static LUAV_INLINE void luaV_getudata(lua_State *L, void *v) @@ -553,9 +553,9 @@ luaV_checkcache(lua_State *L, void *p) return p; } -#define luaV_unbox(L,luatyp,ud) (*((luatyp *) lua_touserdata((L),(ud)))) +# define luaV_unbox(L,luatyp,ud) (*((luatyp *) lua_touserdata((L),(ud)))) -#define luaV_checkvalid(L,luatyp,ud) \ +# define luaV_checkvalid(L,luatyp,ud) \ luaV_checkcache((L), (void *) luaV_unbox((L),luatyp,(ud))) static void * @@ -832,7 +832,7 @@ luaV_msgfunc(lua_State *L, msgfunc_T mf) lua_pop(L, 2); // original and modified strings } -#define luaV_newtype(typ,tname,luatyp,luatname) \ +# define luaV_newtype(typ,tname,luatyp,luatname) \ static luatyp * \ luaV_new##tname(lua_State *L, typ *obj) \ { \ @@ -844,7 +844,7 @@ luaV_msgfunc(lua_State *L, msgfunc_T mf) return o; \ } -#define luaV_pushtype(typ,tname,luatyp) \ +# define luaV_pushtype(typ,tname,luatyp) \ static luatyp * \ luaV_push##tname(lua_State *L, typ *obj) \ { \ @@ -865,7 +865,7 @@ luaV_msgfunc(lua_State *L, msgfunc_T mf) return o; \ } -#define luaV_type_tostring(tname,luatname) \ +# define luaV_type_tostring(tname,luatname) \ static int \ luaV_##tname##_tostring(lua_State *L) \ { \ @@ -1077,7 +1077,7 @@ luaV_dict_len(lua_State *L) static int luaV_dict_iter(lua_State *L UNUSED) { -#ifdef FEAT_EVAL +# ifdef FEAT_EVAL hashitem_T *hi = (hashitem_T *) lua_touserdata(L, lua_upvalueindex(1)); int n = lua_tointeger(L, lua_upvalueindex(2)); dictitem_T *di; @@ -1091,9 +1091,9 @@ luaV_dict_iter(lua_State *L UNUSED) lua_pushinteger(L, n - 1); lua_replace(L, lua_upvalueindex(2)); return 2; -#else +# else return 0; -#endif +# endif } static int @@ -1469,9 +1469,9 @@ luaV_buffer_newindex(lua_State *L) { buf_T *b = (buf_T *) luaV_checkvalid(L, luaV_Buffer, 1); linenr_T n = (linenr_T) luaL_checkinteger(L, 2); -#ifdef HAVE_SANDBOX +# ifdef HAVE_SANDBOX luaV_checksandbox(L); -#endif +# endif if (n < 1 || n > b->b_ml.ml_line_count) luaL_error(L, "invalid line number"); if (lua_isnil(L, 3)) // delete line @@ -1543,9 +1543,9 @@ luaV_buffer_insert(lua_State *L) linenr_T n = (linenr_T) luaL_optinteger(L, 3, last); buf_T *buf; luaL_checktype(L, 2, LUA_TSTRING); -#ifdef HAVE_SANDBOX +# ifdef HAVE_SANDBOX luaV_checksandbox(L); -#endif +# endif // fix insertion line if (n < 0) n = 0; if (n > last) n = last; @@ -1661,9 +1661,9 @@ luaV_window_newindex(lua_State *L) int v = luaL_checkinteger(L, 3); if (strncmp(s, "line", 4) == 0) { -#ifdef HAVE_SANDBOX +# ifdef HAVE_SANDBOX luaV_checksandbox(L); -#endif +# endif if (v < 1 || v > w->w_buffer->b_ml.ml_line_count) luaL_error(L, "line out of range"); w->w_cursor.lnum = v; @@ -1671,9 +1671,9 @@ luaV_window_newindex(lua_State *L) } else if (strncmp(s, "col", 3) == 0) { -#ifdef HAVE_SANDBOX +# ifdef HAVE_SANDBOX luaV_checksandbox(L); -#endif +# endif w->w_cursor.col = v - 1; w->w_set_curswant = TRUE; update_screen(UPD_VALID); @@ -1681,9 +1681,9 @@ luaV_window_newindex(lua_State *L) else if (strncmp(s, "width", 5) == 0) { win_T *win = curwin; -#ifdef FEAT_GUI +# ifdef FEAT_GUI need_mouse_correct = TRUE; -#endif +# endif curwin = w; win_setwidth(v); curwin = win; @@ -1691,9 +1691,9 @@ luaV_window_newindex(lua_State *L) else if (strncmp(s, "height", 6) == 0) { win_T *win = curwin; -#ifdef FEAT_GUI +# ifdef FEAT_GUI need_mouse_correct = TRUE; -#endif +# endif curwin = w; win_setheight(v); curwin = win; @@ -2161,9 +2161,9 @@ luaV_window(lua_State *L) luaV_open(lua_State *L) { char_u *s = NULL; -#ifdef HAVE_SANDBOX +# ifdef HAVE_SANDBOX luaV_checksandbox(L); -#endif +# endif if (lua_isstring(L, 1)) s = (char_u *) lua_tostring(L, 1); luaV_pushbuffer(L, buflist_new(s, NULL, 1L, BLN_LISTED)); return 1; @@ -2401,7 +2401,7 @@ luaV_pushversion(lua_State *L) return 0; } -#define LUA_VIM_FN_CODE \ +# define LUA_VIM_FN_CODE \ "vim.fn = setmetatable({}, {\n"\ " __index = function (t, key)\n"\ " local function _fn(...)\n"\ @@ -2412,7 +2412,7 @@ luaV_pushversion(lua_State *L) " end\n"\ " })" -#define LUA_VIM_UPDATE_PACKAGE_PATHS \ +# define LUA_VIM_UPDATE_PACKAGE_PATHS \ "local last_vim_paths = {}\n"\ "vim._update_package_paths = function ()\n"\ " local cur_vim_paths = {}\n"\ @@ -2477,7 +2477,7 @@ luaV_pushversion(lua_State *L) " last_vim_paths = cur_vim_paths\n"\ "end" -#define LUA_VIM_SETUP_VARIABLE_DICTS \ +# define LUA_VIM_SETUP_VARIABLE_DICTS \ "do\n"\ " local function make_dict_accessor(scope)\n"\ " local mt = {}\n"\ @@ -2605,13 +2605,13 @@ lua_init(void) if (lua_isopen()) return OK; -#ifdef DYNAMIC_LUA +# ifdef DYNAMIC_LUA if (!lua_enabled(TRUE)) { emsg(_("Lua library cannot be loaded.")); return FAIL; } -#endif +# endif L = luaV_newstate(); return OK; @@ -2700,9 +2700,9 @@ ex_luado(exarg_T *eap) if (lua_isstring(L, -1)) // update line? { -#ifdef HAVE_SANDBOX +# ifdef HAVE_SANDBOX luaV_checksandbox(L); -#endif +# endif ml_replace(l, luaV_toline(L, -1), TRUE); changed_bytes(l, 0); lua_pop(L, 1); // result from luaV_toline @@ -2727,7 +2727,7 @@ ex_luafile(exarg_T *eap) } } -#define luaV_freetype(typ,tname) \ +# define luaV_freetype(typ,tname) \ void \ lua_##tname##_free(typ *o) \ { \ diff --git a/src/if_mzsch.c b/src/if_mzsch.c index 634ab00b70..a6043e1d82 100644 --- a/src/if_mzsch.c +++ b/src/if_mzsch.c @@ -235,11 +235,11 @@ static Scheme_Object *(*dll_scheme_make_path)(const char *chars); # endif static void (*dll_scheme_close_input_port)(Scheme_Object *port); static void (*dll_scheme_count_lines)(Scheme_Object *port); -#if MZSCHEME_VERSION_MAJOR < 360 +# if MZSCHEME_VERSION_MAJOR < 360 static Scheme_Object *(*dll_scheme_current_continuation_marks)(void); -#else +# else static Scheme_Object *(*dll_scheme_current_continuation_marks)(Scheme_Object *prompt_tag); -#endif +# endif static void (*dll_scheme_display)(Scheme_Object *obj, Scheme_Object *port); static char *(*dll_scheme_display_to_string)(Scheme_Object *obj, OUTPUT_LEN_TYPE *len); static int (*dll_scheme_eq)(Scheme_Object *obj1, Scheme_Object *obj2); @@ -361,144 +361,144 @@ static void (*dll_scheme_register_embedded_load)(intptr_t len, const char *s); static void (*dll_scheme_set_config_path)(Scheme_Object *p); # endif -#if defined(DYNAMIC_MZSCHEME) +# if defined(DYNAMIC_MZSCHEME) // arrays are imported directly -# define scheme_eof dll_scheme_eof -# define scheme_false dll_scheme_false -# define scheme_void dll_scheme_void -# define scheme_null dll_scheme_null -# define scheme_true dll_scheme_true +# define scheme_eof dll_scheme_eof +# define scheme_false dll_scheme_false +# define scheme_void dll_scheme_void +# define scheme_null dll_scheme_null +# define scheme_true dll_scheme_true // pointers are GetProcAddress'ed as pointers to pointer -#if !defined(USE_THREAD_LOCAL) && !defined(LINK_EXTENSIONS_BY_TABLE) -# define scheme_current_thread (*dll_scheme_current_thread_ptr) -# endif -# define scheme_console_printf (*dll_scheme_console_printf_ptr) -# define scheme_console_output (*dll_scheme_console_output_ptr) -# define scheme_notify_multithread (*dll_scheme_notify_multithread_ptr) +# if !defined(USE_THREAD_LOCAL) && !defined(LINK_EXTENSIONS_BY_TABLE) +# define scheme_current_thread (*dll_scheme_current_thread_ptr) +# endif +# define scheme_console_printf (*dll_scheme_console_printf_ptr) +# define scheme_console_output (*dll_scheme_console_output_ptr) +# define scheme_notify_multithread (*dll_scheme_notify_multithread_ptr) // and functions in a usual way -# define GC_malloc dll_GC_malloc -# define GC_malloc_atomic dll_GC_malloc_atomic - -# define scheme_add_global dll_scheme_add_global -# define scheme_add_global_symbol dll_scheme_add_global_symbol -# define scheme_apply dll_scheme_apply -# define scheme_basic_env dll_scheme_basic_env -# define scheme_builtin_value dll_scheme_builtin_value -# if MZSCHEME_VERSION_MAJOR >= 299 -# define scheme_byte_string_to_char_string dll_scheme_byte_string_to_char_string -# define scheme_make_path dll_scheme_make_path -# endif -# define scheme_check_threads dll_scheme_check_threads -# define scheme_close_input_port dll_scheme_close_input_port -# define scheme_count_lines dll_scheme_count_lines -# define scheme_current_continuation_marks \ +# define GC_malloc dll_GC_malloc +# define GC_malloc_atomic dll_GC_malloc_atomic + +# define scheme_add_global dll_scheme_add_global +# define scheme_add_global_symbol dll_scheme_add_global_symbol +# define scheme_apply dll_scheme_apply +# define scheme_basic_env dll_scheme_basic_env +# define scheme_builtin_value dll_scheme_builtin_value +# if MZSCHEME_VERSION_MAJOR >= 299 +# define scheme_byte_string_to_char_string dll_scheme_byte_string_to_char_string +# define scheme_make_path dll_scheme_make_path +# endif +# define scheme_check_threads dll_scheme_check_threads +# define scheme_close_input_port dll_scheme_close_input_port +# define scheme_count_lines dll_scheme_count_lines +# define scheme_current_continuation_marks \ dll_scheme_current_continuation_marks -# define scheme_display dll_scheme_display -# define scheme_display_to_string dll_scheme_display_to_string -# define scheme_do_eval dll_scheme_do_eval -# define scheme_dont_gc_ptr dll_scheme_dont_gc_ptr -# define scheme_eq dll_scheme_eq -# define scheme_eval dll_scheme_eval -# define scheme_eval_string dll_scheme_eval_string -# define scheme_eval_string_all dll_scheme_eval_string_all -# define scheme_finish_primitive_module dll_scheme_finish_primitive_module -# if MZSCHEME_VERSION_MAJOR < 299 -# define scheme_format dll_scheme_format -# else -# define scheme_format_utf8 dll_scheme_format_utf8 -# endif -# define scheme_gc_ptr_ok dll_scheme_gc_ptr_ok -# if MZSCHEME_VERSION_MAJOR < 299 -# define scheme_get_sized_byte_string_output dll_scheme_get_sized_string_output -# else -# define scheme_get_sized_byte_string_output \ +# define scheme_display dll_scheme_display +# define scheme_display_to_string dll_scheme_display_to_string +# define scheme_do_eval dll_scheme_do_eval +# define scheme_dont_gc_ptr dll_scheme_dont_gc_ptr +# define scheme_eq dll_scheme_eq +# define scheme_eval dll_scheme_eval +# define scheme_eval_string dll_scheme_eval_string +# define scheme_eval_string_all dll_scheme_eval_string_all +# define scheme_finish_primitive_module dll_scheme_finish_primitive_module +# if MZSCHEME_VERSION_MAJOR < 299 +# define scheme_format dll_scheme_format +# else +# define scheme_format_utf8 dll_scheme_format_utf8 +# endif +# define scheme_gc_ptr_ok dll_scheme_gc_ptr_ok +# if MZSCHEME_VERSION_MAJOR < 299 +# define scheme_get_sized_byte_string_output dll_scheme_get_sized_string_output +# else +# define scheme_get_sized_byte_string_output \ dll_scheme_get_sized_byte_string_output -# define scheme_get_param dll_scheme_get_param -# endif -# define scheme_intern_symbol dll_scheme_intern_symbol -# define scheme_lookup_global dll_scheme_lookup_global -# define scheme_make_closed_prim_w_arity dll_scheme_make_closed_prim_w_arity -# define scheme_make_integer_value dll_scheme_make_integer_value -# define scheme_make_pair dll_scheme_make_pair -# define scheme_make_prim_w_arity dll_scheme_make_prim_w_arity -# if MZSCHEME_VERSION_MAJOR < 299 -# define scheme_make_byte_string dll_scheme_make_string -# define scheme_make_byte_string_output_port dll_scheme_make_string_output_port -# else -# define scheme_make_byte_string dll_scheme_make_byte_string -# define scheme_make_byte_string_output_port \ +# define scheme_get_param dll_scheme_get_param +# endif +# define scheme_intern_symbol dll_scheme_intern_symbol +# define scheme_lookup_global dll_scheme_lookup_global +# define scheme_make_closed_prim_w_arity dll_scheme_make_closed_prim_w_arity +# define scheme_make_integer_value dll_scheme_make_integer_value +# define scheme_make_pair dll_scheme_make_pair +# define scheme_make_prim_w_arity dll_scheme_make_prim_w_arity +# if MZSCHEME_VERSION_MAJOR < 299 +# define scheme_make_byte_string dll_scheme_make_string +# define scheme_make_byte_string_output_port dll_scheme_make_string_output_port +# else +# define scheme_make_byte_string dll_scheme_make_byte_string +# define scheme_make_byte_string_output_port \ dll_scheme_make_byte_string_output_port -# endif -# define scheme_make_struct_instance dll_scheme_make_struct_instance -# define scheme_make_struct_names dll_scheme_make_struct_names -# define scheme_make_struct_type dll_scheme_make_struct_type -# define scheme_make_struct_values dll_scheme_make_struct_values -# define scheme_make_type dll_scheme_make_type -# define scheme_make_vector dll_scheme_make_vector -# define scheme_malloc_fail_ok dll_scheme_malloc_fail_ok -# define scheme_open_input_file dll_scheme_open_input_file -# define scheme_primitive_module dll_scheme_primitive_module -# define scheme_proper_list_length dll_scheme_proper_list_length -# define scheme_raise dll_scheme_raise -# define scheme_read dll_scheme_read -# define scheme_register_static dll_scheme_register_static -# define scheme_set_stack_base dll_scheme_set_stack_base -# define scheme_signal_error dll_scheme_signal_error -# define scheme_wrong_type dll_scheme_wrong_type -# if MZSCHEME_VERSION_MAJOR >= 299 -# define scheme_set_param dll_scheme_set_param -# define scheme_current_config dll_scheme_current_config -# define scheme_char_string_to_byte_string \ +# endif +# define scheme_make_struct_instance dll_scheme_make_struct_instance +# define scheme_make_struct_names dll_scheme_make_struct_names +# define scheme_make_struct_type dll_scheme_make_struct_type +# define scheme_make_struct_values dll_scheme_make_struct_values +# define scheme_make_type dll_scheme_make_type +# define scheme_make_vector dll_scheme_make_vector +# define scheme_malloc_fail_ok dll_scheme_malloc_fail_ok +# define scheme_open_input_file dll_scheme_open_input_file +# define scheme_primitive_module dll_scheme_primitive_module +# define scheme_proper_list_length dll_scheme_proper_list_length +# define scheme_raise dll_scheme_raise +# define scheme_read dll_scheme_read +# define scheme_register_static dll_scheme_register_static +# define scheme_set_stack_base dll_scheme_set_stack_base +# define scheme_signal_error dll_scheme_signal_error +# define scheme_wrong_type dll_scheme_wrong_type +# if MZSCHEME_VERSION_MAJOR >= 299 +# define scheme_set_param dll_scheme_set_param +# define scheme_current_config dll_scheme_current_config +# define scheme_char_string_to_byte_string \ dll_scheme_char_string_to_byte_string -# define scheme_char_string_to_path \ +# define scheme_char_string_to_path \ dll_scheme_char_string_to_path -# define scheme_set_collects_path dll_scheme_set_collects_path -# endif -# define scheme_make_hash_table dll_scheme_make_hash_table -# define scheme_hash_set dll_scheme_hash_set -# define scheme_hash_get dll_scheme_hash_get -# define scheme_make_double dll_scheme_make_double -# define scheme_make_sized_byte_string dll_scheme_make_sized_byte_string -# define scheme_namespace_require dll_scheme_namespace_require -# define scheme_dynamic_wind dll_scheme_dynamic_wind -# ifdef MZ_PRECISE_GC -# define GC_malloc_one_tagged dll_GC_malloc_one_tagged -# define GC_register_traversers dll_GC_register_traversers -# endif -# if MZSCHEME_VERSION_MAJOR >= 400 -# ifdef TRAMPOLINED_MZVIM_STARTUP -# define scheme_main_setup dll_scheme_main_setup -# if defined(IMPLEMENT_THREAD_LOCAL_VIA_WIN_TLS) || MZSCHEME_VERSION_MAJOR >= 603 -# define scheme_register_tls_space dll_scheme_register_tls_space +# define scheme_set_collects_path dll_scheme_set_collects_path +# endif +# define scheme_make_hash_table dll_scheme_make_hash_table +# define scheme_hash_set dll_scheme_hash_set +# define scheme_hash_get dll_scheme_hash_get +# define scheme_make_double dll_scheme_make_double +# define scheme_make_sized_byte_string dll_scheme_make_sized_byte_string +# define scheme_namespace_require dll_scheme_namespace_require +# define scheme_dynamic_wind dll_scheme_dynamic_wind +# ifdef MZ_PRECISE_GC +# define GC_malloc_one_tagged dll_GC_malloc_one_tagged +# define GC_register_traversers dll_GC_register_traversers +# endif +# if MZSCHEME_VERSION_MAJOR >= 400 +# ifdef TRAMPOLINED_MZVIM_STARTUP +# define scheme_main_setup dll_scheme_main_setup +# if defined(IMPLEMENT_THREAD_LOCAL_VIA_WIN_TLS) || MZSCHEME_VERSION_MAJOR >= 603 +# define scheme_register_tls_space dll_scheme_register_tls_space +# endif # endif +# define scheme_init_collection_paths dll_scheme_init_collection_paths +# define scheme_malloc_immobile_box dll_scheme_malloc_immobile_box +# define scheme_free_immobile_box dll_scheme_free_immobile_box +# endif +# if MZSCHEME_VERSION_MAJOR >= 600 +# define scheme_embedded_load dll_scheme_embedded_load +# define scheme_register_embedded_load dll_scheme_register_embedded_load +# define scheme_set_config_path dll_scheme_set_config_path # endif -# define scheme_init_collection_paths dll_scheme_init_collection_paths -# define scheme_malloc_immobile_box dll_scheme_malloc_immobile_box -# define scheme_free_immobile_box dll_scheme_free_immobile_box -# endif -# if MZSCHEME_VERSION_MAJOR >= 600 -# define scheme_embedded_load dll_scheme_embedded_load -# define scheme_register_embedded_load dll_scheme_register_embedded_load -# define scheme_set_config_path dll_scheme_set_config_path -# endif -# ifndef PROTO -# if MZSCHEME_VERSION_MAJOR >= 500 -# if defined(IMPLEMENT_THREAD_LOCAL_VIA_WIN_TLS) || defined(IMPLEMENT_THREAD_LOCAL_EXTERNALLY_VIA_PROC) +# ifndef PROTO +# if MZSCHEME_VERSION_MAJOR >= 500 +# if defined(IMPLEMENT_THREAD_LOCAL_VIA_WIN_TLS) || defined(IMPLEMENT_THREAD_LOCAL_EXTERNALLY_VIA_PROC) // define as function for macro in schthread.h Thread_Local_Variables * scheme_external_get_thread_local_variables(void) { return dll_scheme_external_get_thread_local_variables(); } +# endif # endif # endif -# endif -#endif +# endif typedef struct { @@ -517,9 +517,9 @@ static Thunk_Info mzsch_imports[] = { {"scheme_void", (void **)&dll_scheme_void}, {"scheme_null", (void **)&dll_scheme_null}, {"scheme_true", (void **)&dll_scheme_true}, -#if !defined(USE_THREAD_LOCAL) && !defined(LINK_EXTENSIONS_BY_TABLE) +# if !defined(USE_THREAD_LOCAL) && !defined(LINK_EXTENSIONS_BY_TABLE) {"scheme_current_thread", (void **)&dll_scheme_current_thread_ptr}, -#endif +# endif {"scheme_console_printf", (void **)&dll_scheme_console_printf_ptr}, {"scheme_console_output", (void **)&dll_scheme_console_output_ptr}, {"scheme_notify_multithread", @@ -553,7 +553,7 @@ static Thunk_Info mzsch_imports[] = { # else {"scheme_format_utf8", (void **)&dll_scheme_format_utf8}, {"scheme_get_param", (void **)&dll_scheme_get_param}, -#endif +# endif {"scheme_gc_ptr_ok", (void **)&dll_scheme_gc_ptr_ok}, # if MZSCHEME_VERSION_MAJOR < 299 {"scheme_get_sized_string_output", @@ -561,7 +561,7 @@ static Thunk_Info mzsch_imports[] = { # else {"scheme_get_sized_byte_string_output", (void **)&dll_scheme_get_sized_byte_string_output}, -#endif +# endif {"scheme_intern_symbol", (void **)&dll_scheme_intern_symbol}, {"scheme_lookup_global", (void **)&dll_scheme_lookup_global}, {"scheme_make_closed_prim_w_arity", @@ -911,9 +911,9 @@ mzscheme_end(void) { // We can not unload the DLL. Racket's thread might be still alive. #if 0 -#ifdef DYNAMIC_MZSCHEME +# ifdef DYNAMIC_MZSCHEME dynamic_mzscheme_end(); -#endif +# endif #endif } @@ -1046,7 +1046,7 @@ startup_mzscheme(void) #endif // setup 'current-library-collection-paths' parameter -# if MZSCHEME_VERSION_MAJOR >= 299 +#if MZSCHEME_VERSION_MAJOR >= 299 { Scheme_Object *coll_path = NULL; int mustfree = FALSE; @@ -1064,13 +1064,13 @@ startup_mzscheme(void) if (mustfree) vim_free(s); } -# ifdef MZSCHEME_COLLECTS +# ifdef MZSCHEME_COLLECTS if (coll_path == NULL) { coll_path = scheme_make_path(MZSCHEME_COLLECTS); MZ_GC_CHECK(); } -# endif +# endif if (coll_path != NULL) { scheme_set_collects_path(coll_path); @@ -1078,8 +1078,8 @@ startup_mzscheme(void) } MZ_GC_UNREG(); } -# else -# ifdef MZSCHEME_COLLECTS +#else +# ifdef MZSCHEME_COLLECTS { Scheme_Object *coll_string = NULL; Scheme_Object *coll_pair = NULL; @@ -1103,7 +1103,7 @@ startup_mzscheme(void) # endif #endif -# if MZSCHEME_VERSION_MAJOR >= 600 +#if MZSCHEME_VERSION_MAJOR >= 600 { Scheme_Object *config_path = NULL; int mustfree = FALSE; @@ -1121,13 +1121,13 @@ startup_mzscheme(void) if (mustfree) vim_free(s); } -#ifdef MZSCHEME_CONFIGDIR +# ifdef MZSCHEME_CONFIGDIR if (config_path == NULL) { config_path = scheme_make_path(MZSCHEME_CONFIGDIR); MZ_GC_CHECK(); } -#endif +# endif if (config_path != NULL) { scheme_set_config_path(config_path); @@ -1135,7 +1135,7 @@ startup_mzscheme(void) } MZ_GC_UNREG(); } -# endif +#endif #if MZSCHEME_VERSION_MAJOR >= 400 scheme_init_collection_paths(environment, scheme_null); @@ -1174,7 +1174,7 @@ startup_mzscheme(void) MZ_GC_VAR_IN_REG(0, make_security_guard); MZ_GC_REG(); -#if MZSCHEME_VERSION_MAJOR < 400 +# if MZSCHEME_VERSION_MAJOR < 400 { Scheme_Object *make_security_guard_symbol = NULL; MZ_GC_DECL_REG(1); @@ -1186,10 +1186,10 @@ startup_mzscheme(void) make_security_guard_symbol, environment); MZ_GC_UNREG(); } -#else +# else make_security_guard = scheme_builtin_value("make-security-guard"); MZ_GC_CHECK(); -#endif +# endif // setup sandbox guards if (make_security_guard != NULL) @@ -2070,9 +2070,9 @@ set_window_width(void *data, int argc, Scheme_Object **argv) win = get_window_arg(prim->name, 1, argc, argv); width = SCHEME_INT_VAL(GUARANTEE_INTEGER(prim->name, 0)); -# ifdef FEAT_GUI +#ifdef FEAT_GUI need_mouse_correct = TRUE; -# endif +#endif savewin = curwin; curwin = win->win; @@ -3261,7 +3261,7 @@ mzscheme_to_vim_impl(Scheme_Object *obj, typval_T *tv, int depth, tv->vval.v_string = vim_strsave(BYTE_STRING_VALUE(tmp)); MZ_GC_UNREG(); } -#endif +# endif else if (SCHEME_VECTORP(obj) || SCHEME_NULLP(obj) || SCHEME_PAIRP(obj) || SCHEME_MUTABLE_PAIRP(obj)) { diff --git a/src/if_py_both.h b/src/if_py_both.h index e0020519b0..ed37fb0251 100644 --- a/src/if_py_both.h +++ b/src/if_py_both.h @@ -282,8 +282,8 @@ static int Vim_PyRun_SimpleString(const char *str) Py_DECREF(output); return 0; } -#define PyRun_String Vim_PyRun_String -#define PyRun_SimpleString Vim_PyRun_SimpleString +# define PyRun_String Vim_PyRun_String +# define PyRun_SimpleString Vim_PyRun_SimpleString #else // !defined(USE_LIMITED_API) diff --git a/src/if_ruby.c b/src/if_ruby.c index 913936174a..60ca11188a 100644 --- a/src/if_ruby.c +++ b/src/if_ruby.c @@ -76,7 +76,7 @@ # if RUBY_VERSION >= 20 // USE_TYPEDDATA is not defined yet. We just check for 2.0. # define rb_check_typeddata rb_check_typeddata_stub -#endif +# endif # if RUBY_VERSION == 21 // Ruby 2.1 adds new GC called RGenGC and RARRAY_PTR uses diff --git a/src/if_xcmdsrv.c b/src/if_xcmdsrv.c index 2c12672a82..da64aa0e54 100644 --- a/src/if_xcmdsrv.c +++ b/src/if_xcmdsrv.c @@ -157,7 +157,7 @@ static PendingCommand *pendingCommands = NULL; * this module: */ -#define MAX_PROP_WORDS 100000 +# define MAX_PROP_WORDS 100000 struct ServerReply { @@ -255,7 +255,7 @@ DoRegisterName(Display *dpy, char_u *name) { Window w; XErrorHandler old_handler; -#define MAX_NAME_LENGTH 100 +# define MAX_NAME_LENGTH 100 char_u propInfo[MAX_NAME_LENGTH + 20]; if (commProperty == None) @@ -311,9 +311,9 @@ DoRegisterName(Display *dpy, char_u *name) if (!got_x_error) { -#ifdef FEAT_EVAL +# ifdef FEAT_EVAL set_vim_var_string(VV_SEND_SERVER, name, -1); -#endif +# endif serverName = vim_strsave(name); need_maketitle = TRUE; return 0; @@ -321,7 +321,7 @@ DoRegisterName(Display *dpy, char_u *name) return -2; } -#if defined(FEAT_GUI) +# if defined(FEAT_GUI) /* * Clean out new ID from registry and set it as comm win. * Change any registered window ID. @@ -356,7 +356,7 @@ serverChangeRegisteredWindow( } XUngrabServer(dpy); } -#endif +# endif /* * Send to an instance of Vim via the X display. @@ -392,9 +392,9 @@ serverSendToVim( if (commProperty == None && dpy != NULL && SendInit(dpy) < 0) return -1; -#if defined(FEAT_EVAL) +# if defined(FEAT_EVAL) ch_log(NULL, "serverSendToVim(%s, %s)", name, cmd); -#endif +# endif // Execute locally if no display or target is ourselves if (dpy == NULL || (serverName != NULL && STRICMP(name, serverName) == 0)) @@ -497,10 +497,10 @@ serverSendToVim( } } -#if defined(FEAT_EVAL) +# if defined(FEAT_EVAL) ch_log(NULL, "serverSendToVim() result: %s", pending.result == NULL ? "NULL" : (char *)pending.result); -#endif +# endif if (result != NULL) *result = pending.result; else @@ -561,19 +561,19 @@ ServerWait( time_t now; XEvent event; -#define UI_MSEC_DELAY 53 -#define SEND_MSEC_POLL 500 -#ifdef HAVE_SELECT +# define UI_MSEC_DELAY 53 +# define SEND_MSEC_POLL 500 +# ifdef HAVE_SELECT fd_set fds; FD_ZERO(&fds); FD_SET(ConnectionNumber(dpy), &fds); -#else +# else struct pollfd fds; fds.fd = ConnectionNumber(dpy); fds.events = POLLIN; -#endif +# endif time(&start); while (TRUE) @@ -590,14 +590,14 @@ ServerWait( if (seconds >= 0 && (now - start) >= seconds) break; -#ifdef FEAT_TIMERS +# ifdef FEAT_TIMERS check_due_timer(); -#endif +# endif // Just look out for the answer without calling back into Vim if (localLoop) { -#ifdef HAVE_SELECT +# ifdef HAVE_SELECT struct timeval tv; // Set the time every call, select() may change it to the remaining @@ -606,10 +606,10 @@ ServerWait( tv.tv_usec = SEND_MSEC_POLL * 1000; if (select(FD_SETSIZE, &fds, NULL, NULL, &tv) < 0) break; -#else +# else if (poll(&fds, 1, SEND_MSEC_POLL) < 0) break; -#endif +# endif } else { @@ -1228,9 +1228,9 @@ server_parse_message( int code; char_u *tofree; -#if defined(FEAT_EVAL) +# if defined(FEAT_EVAL) ch_log(NULL, "server_parse_message() numItems: %ld", numItems); -#endif +# endif /* * Several commands and results could arrive in the property at @@ -1272,9 +1272,9 @@ server_parse_message( enc = NULL; while ((long_u)(p - propInfo) < numItems && *p == '-') { -#if defined(FEAT_EVAL) +# if defined(FEAT_EVAL) ch_log(NULL, "server_parse_message() item: %c, %s", p[-2], p); -#endif +# endif switch (p[1]) { case 'r': diff --git a/src/indent.c b/src/indent.c index 48fe9d1907..e31da232aa 100644 --- a/src/indent.c +++ b/src/indent.c @@ -1216,9 +1216,9 @@ may_do_si(void) { return curbuf->b_p_si && !curbuf->b_p_cin -# ifdef FEAT_EVAL +#ifdef FEAT_EVAL && *curbuf->b_p_inde == NUL -# endif +#endif && !p_paste; } diff --git a/src/insexpand.c b/src/insexpand.c index 907d36aee3..d6b600ca57 100644 --- a/src/insexpand.c +++ b/src/insexpand.c @@ -18,29 +18,29 @@ * Note: If you change CTRL-X submode, you must also maintain ctrl_x_msgs[] and * ctrl_x_mode_names[] below. */ -# define CTRL_X_WANT_IDENT 0x100 - -# define CTRL_X_NORMAL 0 // CTRL-N CTRL-P completion, default -# define CTRL_X_NOT_DEFINED_YET 1 -# define CTRL_X_SCROLL 2 -# define CTRL_X_WHOLE_LINE 3 -# define CTRL_X_FILES 4 -# define CTRL_X_TAGS (5 + CTRL_X_WANT_IDENT) -# define CTRL_X_PATH_PATTERNS (6 + CTRL_X_WANT_IDENT) -# define CTRL_X_PATH_DEFINES (7 + CTRL_X_WANT_IDENT) -# define CTRL_X_FINISHED 8 -# define CTRL_X_DICTIONARY (9 + CTRL_X_WANT_IDENT) -# define CTRL_X_THESAURUS (10 + CTRL_X_WANT_IDENT) -# define CTRL_X_CMDLINE 11 -# define CTRL_X_FUNCTION 12 -# define CTRL_X_OMNI 13 -# define CTRL_X_SPELL 14 -# define CTRL_X_LOCAL_MSG 15 // only used in "ctrl_x_msgs" -# define CTRL_X_EVAL 16 // for builtin function complete() -# define CTRL_X_CMDLINE_CTRL_X 17 // CTRL-X typed in CTRL_X_CMDLINE -# define CTRL_X_REGISTER 18 // complete words from registers - -# define CTRL_X_MSG(i) ctrl_x_msgs[(i) & ~CTRL_X_WANT_IDENT] +#define CTRL_X_WANT_IDENT 0x100 + +#define CTRL_X_NORMAL 0 // CTRL-N CTRL-P completion, default +#define CTRL_X_NOT_DEFINED_YET 1 +#define CTRL_X_SCROLL 2 +#define CTRL_X_WHOLE_LINE 3 +#define CTRL_X_FILES 4 +#define CTRL_X_TAGS (5 + CTRL_X_WANT_IDENT) +#define CTRL_X_PATH_PATTERNS (6 + CTRL_X_WANT_IDENT) +#define CTRL_X_PATH_DEFINES (7 + CTRL_X_WANT_IDENT) +#define CTRL_X_FINISHED 8 +#define CTRL_X_DICTIONARY (9 + CTRL_X_WANT_IDENT) +#define CTRL_X_THESAURUS (10 + CTRL_X_WANT_IDENT) +#define CTRL_X_CMDLINE 11 +#define CTRL_X_FUNCTION 12 +#define CTRL_X_OMNI 13 +#define CTRL_X_SPELL 14 +#define CTRL_X_LOCAL_MSG 15 // only used in "ctrl_x_msgs" +#define CTRL_X_EVAL 16 // for builtin function complete() +#define CTRL_X_CMDLINE_CTRL_X 17 // CTRL-X typed in CTRL_X_CMDLINE +#define CTRL_X_REGISTER 18 // complete words from registers + +#define CTRL_X_MSG(i) ctrl_x_msgs[(i) & ~CTRL_X_WANT_IDENT] // Message for CTRL-X mode, index is ctrl_x_mode. static char *ctrl_x_msgs[] = @@ -116,12 +116,12 @@ struct compl_S }; // values for cp_flags -# define CP_ORIGINAL_TEXT 1 // the original text when the expansion begun -# define CP_FREE_FNAME 2 // cp_fname is allocated -# define CP_CONT_S_IPOS 4 // use CONT_S_IPOS for compl_cont_status -# define CP_EQUAL 8 // ins_compl_equal() always returns TRUE -# define CP_ICASE 16 // ins_compl_equal() ignores case -# define CP_FAST 32 // use fast_breakcheck instead of ui_breakcheck +#define CP_ORIGINAL_TEXT 1 // the original text when the expansion begun +#define CP_FREE_FNAME 2 // cp_fname is allocated +#define CP_CONT_S_IPOS 4 // use CONT_S_IPOS for compl_cont_status +#define CP_EQUAL 8 // ins_compl_equal() always returns TRUE +#define CP_ICASE 16 // ins_compl_equal() ignores case +#define CP_FAST 32 // use fast_breakcheck instead of ui_breakcheck /* * All the current matches are stored in a list. @@ -223,15 +223,15 @@ static int compl_hi_on_autocompl_longest = FALSE; // apply "PreInsert" high // List of flags for method of completion. static int compl_cont_status = 0; -# define CONT_ADDING 1 // "normal" or "adding" expansion -# define CONT_INTRPT (2 + 4) // a ^X interrupted the current expansion +#define CONT_ADDING 1 // "normal" or "adding" expansion +#define CONT_INTRPT (2 + 4) // a ^X interrupted the current expansion // it's set only iff N_ADDS is set -# define CONT_N_ADDS 4 // next ^X<> will add-new or expand-current -# define CONT_S_IPOS 8 // next ^X<> will set initial_pos? +#define CONT_N_ADDS 4 // next ^X<> will add-new or expand-current +#define CONT_S_IPOS 8 // next ^X<> will set initial_pos? // if so, word-wise-expansion will set SOL -# define CONT_SOL 16 // pattern includes start of line, just for +#define CONT_SOL 16 // pattern includes start of line, just for // word-wise expansion, not set for ^X^L -# define CONT_LOCAL 32 // for ctrl_x_mode 0, ^X^P/^X^N do a local +#define CONT_LOCAL 32 // for ctrl_x_mode 0, ^X^P/^X^N do a local // expansion, (eg use complete=.) static int compl_opt_refresh_always = FALSE; @@ -273,13 +273,13 @@ static int get_compl_len(void); static void ins_compl_restart(void); static void ins_compl_set_original_text(char_u *str, size_t len); static void ins_compl_fixRedoBufForLeader(char_u *ptr_arg); -# if defined(FEAT_COMPL_FUNC) || defined(FEAT_EVAL) +#if defined(FEAT_COMPL_FUNC) || defined(FEAT_EVAL) static void ins_compl_add_list(list_T *list); static void ins_compl_add_dict(dict_T *dict); static int get_userdefined_compl_info(colnr_T curs_col, callback_T *cb, int *startcol); static void get_cpt_func_completion_matches(callback_T *cb); static callback_T *get_callback_if_cpt_func(char_u *p, int idx); -# endif +#endif static int setup_cpt_sources(void); static int is_cpt_func_refresh_always(void); static void cpt_sources_clear(void); @@ -1953,18 +1953,18 @@ ins_compl_dictionaries( // backticks (for security, the 'dict' option may have been set in // a modeline). copy_option_part(&dict, buf, LSIZE, ","); -# ifdef FEAT_SPELL +#ifdef FEAT_SPELL if (!thesaurus && STRCMP(buf, "spell") == 0) count = -1; else -# endif +#endif if (vim_strchr(buf, '`') != NULL || expand_wildcards(1, &buf, &count, &files, EW_FILE|EW_SILENT) != OK) count = 0; } -# ifdef FEAT_SPELL +#ifdef FEAT_SPELL if (count == -1) { // Complete from active spelling. Skip "\<" in the pattern, we @@ -1976,7 +1976,7 @@ ins_compl_dictionaries( spell_dump_compl(ptr, regmatch.rm_ic, &dir, 0); } else -# endif +#endif if (count > 0) // avoid warning for using "files" uninit { ins_compl_files(count, files, thesaurus, flags, ®match, buf, @@ -3432,12 +3432,12 @@ copy_cpt_callbacks(callback_T **dest, int *dest_cnt, callback_T *src, int cnt) void set_buflocal_cpt_callbacks(buf_T *buf UNUSED) { -#ifdef FEAT_EVAL +# ifdef FEAT_EVAL if (buf == NULL || cpt_cb_count == 0) return; (void)copy_cpt_callbacks(&buf->b_p_cpt_cb, &buf->b_p_cpt_count, cpt_cb, cpt_cb_count); -#endif +# endif } /* @@ -4030,14 +4030,14 @@ get_complete_info(list_T *what_list, dict_T *retdict) { int ret = OK; listitem_T *item; -#define CI_WHAT_MODE 0x01 -#define CI_WHAT_PUM_VISIBLE 0x02 -#define CI_WHAT_ITEMS 0x04 -#define CI_WHAT_SELECTED 0x08 -#define CI_WHAT_COMPLETED 0x10 -#define CI_WHAT_MATCHES 0x20 -#define CI_WHAT_PREINSERTED_TEXT 0x40 -#define CI_WHAT_ALL 0xff +# define CI_WHAT_MODE 0x01 +# define CI_WHAT_PUM_VISIBLE 0x02 +# define CI_WHAT_ITEMS 0x04 +# define CI_WHAT_SELECTED 0x08 +# define CI_WHAT_COMPLETED 0x10 +# define CI_WHAT_MATCHES 0x20 +# define CI_WHAT_PREINSERTED_TEXT 0x40 +# define CI_WHAT_ALL 0xff int what_flag; if (what_list == NULL) diff --git a/src/iscygpty.h b/src/iscygpty.h index b053007eea..01db588aa3 100644 --- a/src/iscygpty.h +++ b/src/iscygpty.h @@ -34,8 +34,8 @@ int is_cygpty(int fd); int is_cygpty_used(void); #else -#define is_cygpty(fd) 0 -#define is_cygpty_used() 0 +# define is_cygpty(fd) 0 +# define is_cygpty_used() 0 #endif #endif // _ISCYGPTY_H diff --git a/src/job.c b/src/job.c index 37df1e89b1..cfa9578354 100644 --- a/src/job.c +++ b/src/job.c @@ -2019,18 +2019,18 @@ job_to_string_buf(typval_T *varp, char_u *buf) status = job->jv_status == JOB_FAILED ? "fail" : job->jv_status >= JOB_ENDED ? "dead" : "run"; -# ifdef UNIX +#ifdef UNIX vim_snprintf((char *)buf, NUMBUFLEN, "process %ld %s", (long)job->jv_pid, status); -# elif defined(MSWIN) +#elif defined(MSWIN) vim_snprintf((char *)buf, NUMBUFLEN, "process %ld %s", (long)job->jv_proc_info.dwProcessId, status); -# else +#else // fall-back vim_snprintf((char *)buf, NUMBUFLEN, "process ? %s", status); -# endif +#endif return buf; } diff --git a/src/macros.h b/src/macros.h index 56d0a31426..3e2c1c568b 100644 --- a/src/macros.h +++ b/src/macros.h @@ -82,8 +82,8 @@ * toupper() and tolower() implementations only work for ASCII. */ #ifdef MSWIN -# define TOUPPER_LOC(c) toupper_tab[(c) & 255] -# define TOLOWER_LOC(c) tolower_tab[(c) & 255] +# define TOUPPER_LOC(c) toupper_tab[(c) & 255] +# define TOLOWER_LOC(c) tolower_tab[(c) & 255] #else # ifdef BROKEN_TOUPPER # define TOUPPER_LOC(c) (SAFE_islower(c) ? SAFE_toupper(c) : (c)) @@ -169,7 +169,7 @@ # define mch_stat(n, p) stat(vms_fixfilename(n), (p)) #else # if !defined(MSWIN) && !defined(PROTO) -# define mch_access(n, p) access((n), (p)) +# define mch_access(n, p) access((n), (p)) # endif // Use 64-bit fstat function on MS-Windows. @@ -436,9 +436,9 @@ #define ARRAY_LENGTH(a) (sizeof(a) / sizeof((a)[0])) #ifdef FEAT_MENU -#define FOR_ALL_MENUS(m) \ +# define FOR_ALL_MENUS(m) \ for ((m) = root_menu; (m) != NULL; (m) = (m)->next) -#define FOR_ALL_CHILD_MENUS(p, c) \ +# define FOR_ALL_CHILD_MENUS(p, c) \ for ((c) = (p)->children; (c) != NULL; (c) = (c)->next) #endif @@ -476,7 +476,7 @@ for ((sign) = (buf)->b_signlist; (sign) != NULL; (sign) = (sign)->se_next) #ifdef FEAT_SPELL -#define FOR_ALL_SPELL_LANGS(slang) \ +# define FOR_ALL_SPELL_LANGS(slang) \ for ((slang) = first_lang; (slang) != NULL; (slang) = (slang)->sl_next) #endif diff --git a/src/main.c b/src/main.c index e42aafaa9d..bf68879ed0 100644 --- a/src/main.c +++ b/src/main.c @@ -76,30 +76,30 @@ static char *(main_errors[]) = // Various parameters passed between main() and other functions. static mparm_T params; -#ifdef _IOLBF +# ifdef _IOLBF static void *s_vbuf = NULL; // buffer for setvbuf() -#endif +# endif -#ifndef NO_VIM_MAIN // skip this for unittests +# ifndef NO_VIM_MAIN // skip this for unittests static char_u *start_dir = NULL; // current working dir on startup static int has_dash_c_arg = FALSE; -# ifdef VIMDLL +# ifdef VIMDLL __declspec(dllexport) -# endif +# endif int -# ifdef MSWIN +# ifdef MSWIN VimMain -# else +# else main -# endif +# endif (int argc, char **argv) { -#if defined(STARTUPTIME) || defined(CLEAN_RUNTIMEPATH) +# if defined(STARTUPTIME) || defined(CLEAN_RUNTIMEPATH) int i; -#endif +# endif /* * Do any system-specific initialisations. These can NOT use IObuff or @@ -107,13 +107,13 @@ main */ mch_early_init(); -#ifdef MSWIN +# ifdef MSWIN /* * MinGW expands command line arguments, which confuses our code to * convert when 'encoding' changes. Get the unexpanded arguments. */ argc = get_cmd_argsW(&argv); -#endif +# endif // Many variables are in "params" so that we can pass them to invoked // functions without a lot of arguments. "argc" and "argv" are also @@ -122,53 +122,53 @@ main params.argc = argc; params.argv = argv; params.want_full_screen = TRUE; -#ifdef FEAT_EVAL +# ifdef FEAT_EVAL params.use_debug_break_level = -1; -#endif +# endif params.window_count = -1; autocmd_init(); -#ifdef FEAT_RUBY +# ifdef FEAT_RUBY { int ruby_stack_start; vim_ruby_init((void *)&ruby_stack_start); } -#endif +# endif -#ifdef FEAT_TCL +# ifdef FEAT_TCL vim_tcl_init(params.argv[0]); -#endif +# endif -#ifdef MEM_PROFILE +# ifdef MEM_PROFILE atexit(vim_mem_profile_dump); -#endif +# endif /* * Various initialisations #1 shared with tests. */ common_init_1(); -#if defined(STARTUPTIME) || defined(FEAT_JOB_CHANNEL) +# if defined(STARTUPTIME) || defined(FEAT_JOB_CHANNEL) // Need to find "--startuptime" and "--log" before actually parsing // arguments. for (i = 1; i < argc - 1; ++i) { -# ifdef STARTUPTIME +# ifdef STARTUPTIME if (STRICMP(argv[i], "--startuptime") == 0 && time_fd == NULL) { time_fd = mch_fopen(argv[i + 1], "a"); TIME_MSG("--- VIM STARTING ---"); } -# endif -# ifdef FEAT_EVAL +# endif +# ifdef FEAT_EVAL if (STRICMP(argv[i], "--log") == 0) ch_logfile((char_u *)(argv[i + 1]), (char_u *)"ao"); -# endif +# endif } -#endif +# endif -#ifdef CLEAN_RUNTIMEPATH +# ifdef CLEAN_RUNTIMEPATH // Need to find "--clean" before actually parsing arguments. for (i = 1; i < argc; ++i) if (STRICMP(argv[i], "--clean") == 0) @@ -176,8 +176,8 @@ main params.clean = TRUE; break; } -#endif -#ifdef MSWIN +# endif +# ifdef MSWIN // Need to find "-register" and "-unregister" before loading any libraries. for (i = 1; i < argc; ++i) if ((STRICMP(argv[i] + 1, "register") == 0 @@ -187,27 +187,27 @@ main found_register_arg = TRUE; break; } -#endif +# endif /* * Various initialisations #2 shared with tests. */ common_init_2(¶ms); -#ifdef VIMDLL +# ifdef VIMDLL // Check if the current executable file is for the GUI subsystem. gui.starting = mch_is_gui_executable(); -#elif defined(FEAT_GUI_MSWIN) +# elif defined(FEAT_GUI_MSWIN) gui.starting = TRUE; -#endif +# endif -#ifdef FEAT_CLIENTSERVER +# ifdef FEAT_CLIENTSERVER /* * Do the client-server stuff, unless "--servername ''" was used. * This may exit Vim if the command was sent to the server. */ exec_on_server(¶ms); -#endif +# endif /* * Figure out the way to work from the command name argv[0]. @@ -227,10 +227,10 @@ main * there is no terminal version, and on Windows we can't fork one off with * :gui. */ -#ifdef ALWAYS_USE_GUI +# ifdef ALWAYS_USE_GUI gui.starting = TRUE; -#else -# if defined(FEAT_GUI_X11) || defined(FEAT_GUI_GTK) +# else +# if defined(FEAT_GUI_X11) || defined(FEAT_GUI_GTK) /* * Check if the GUI can be started. Reset gui.starting if not. * Don't know about other systems, stay on the safe side and don't check. @@ -247,12 +247,12 @@ main mch_exit(1); } } -# endif -#endif +# endif +# endif if (GARGCOUNT > 0) { -#ifdef EXPAND_FILENAMES +# ifdef EXPAND_FILENAMES /* * Expand wildcards in file names. */ @@ -270,19 +270,19 @@ main if (start_dir != NULL) mch_chdir((char *)start_dir); } -#endif +# endif params.fname = alist_name(&GARGLIST[0]); } -#ifdef MSWIN +# ifdef MSWIN { // Remember the number of entries in the argument list. If it changes // we don't react on setting 'encoding'. set_alist_count(); } -#endif +# endif -#ifdef MSWIN +# ifdef MSWIN if (GARGCOUNT == 1 && params.full_path) { /* @@ -296,13 +296,13 @@ main if (start_dir != NULL) mch_dirname(start_dir, MAXPATHL); } -#endif +# endif TIME_MSG("expanding arguments"); -#ifdef FEAT_DIFF +# ifdef FEAT_DIFF if (params.diff_mode && params.window_count == -1) params.window_count = 0; // open up to 3 windows -#endif +# endif // Don't redraw until much later. ++RedrawingDisabled; @@ -318,15 +318,15 @@ main * For GTK we can't be sure, but when started from the desktop it doesn't * make sense to try using a terminal. */ -#if defined(ALWAYS_USE_GUI) || defined(FEAT_GUI_X11) || defined(FEAT_GUI_GTK) \ +# if defined(ALWAYS_USE_GUI) || defined(FEAT_GUI_X11) || defined(FEAT_GUI_GTK) \ || defined(VIMDLL) if (gui.starting -# ifdef FEAT_GUI_GTK +# ifdef FEAT_GUI_GTK && !isatty(2) -# endif +# endif ) params.want_full_screen = FALSE; -#endif +# endif /* * mch_init() sets up the terminal (window) for use. This must be @@ -336,7 +336,7 @@ main mch_init(); TIME_MSG("shell init"); -#ifdef USE_XSMP +# ifdef USE_XSMP /* * For want of anywhere else to do it, try to connect to xsmp here. * Fitting it in after gui_mch_init, but before gui_init (via termcapinit). @@ -354,14 +354,14 @@ main TIME_MSG("xsmp init"); } } -#endif +# endif /* * Print a warning if stdout is not a terminal. */ check_tty(¶ms); -#ifdef _IOLBF +# ifdef _IOLBF if (silent_mode) { // Ensure output works usefully without a tty: buffer lines instead of @@ -370,7 +370,7 @@ main if (s_vbuf != NULL) setvbuf(stdout, s_vbuf, _IOLBF, BUFSIZ); } -#endif +# endif // This message comes before term inits, but after setting "silent_mode" // when the input is not a tty. Omit the message with --not-a-term. @@ -390,12 +390,12 @@ main */ ui_get_shellsize(); // inits Rows and Columns win_init_size(); -#ifdef FEAT_DIFF +# ifdef FEAT_DIFF // Set the 'diff' option now, so that it can be checked for in a .vimrc // file. There is no buffer yet though. if (params.diff_mode) diff_win_options(firstwin, FALSE); -#endif +# endif cmdline_row = Rows - p_ch; cmdline_col_off = 0; @@ -414,14 +414,14 @@ main init_highlight(TRUE, FALSE); // set the default highlight groups TIME_MSG("init highlight"); -#if defined(FEAT_TERMRESPONSE) +# if defined(FEAT_TERMRESPONSE) init_term_props(TRUE); -#endif +# endif -#ifdef FEAT_EVAL +# ifdef FEAT_EVAL // Set the break level after the terminal is initialized. debug_break_level = params.use_debug_break_level; -#endif +# endif // Reset 'loadplugins' for "-u NONE" before "--cmd" arguments. // Allows for setting 'loadplugins' there. @@ -436,11 +436,11 @@ main // Source startup scripts. source_startup_scripts(¶ms); -#ifdef FEAT_EVAL +# ifdef FEAT_EVAL set_vim_var_nr(VV_VIM_DID_INIT, 1L); -#endif +# endif -#ifdef FEAT_MZSCHEME +# ifdef FEAT_MZSCHEME /* * Newer version of MzScheme (Racket) require earlier (trampolined) * initialisation via scheme_main_setup. @@ -449,11 +449,11 @@ main * Do source startup scripts, so that 'mzschemedll' can be set. */ return mzscheme_main(); -#else +# else return vim_main2(); -#endif +# endif } -#endif // NO_VIM_MAIN +# endif // NO_VIM_MAIN #endif // PROTO #if defined(FEAT_X11) && defined(FEAT_XCLIPBOARD) && defined(FEAT_CLIPBOARD) @@ -495,7 +495,7 @@ x_restore_state(void) vim_main2(void) { #ifndef NO_VIM_MAIN -#ifdef FEAT_EVAL +# ifdef FEAT_EVAL /* * Read all the plugin files. * Only when compiled with +eval, since most plugins need it. @@ -504,11 +504,11 @@ vim_main2(void) { char_u *rtp_copy = NULL; char_u *plugin_pattern = (char_u *) -# if defined(VMS) || defined(AMIGA) // VMS and Amiga don't handle the "**". +# if defined(VMS) || defined(AMIGA) // VMS and Amiga don't handle the "**". "plugin/*.vim" -# else +# else "plugin/**/*.vim" -# endif +# endif ; // First add all package directories to 'runtimepath', so that their @@ -536,9 +536,9 @@ vim_main2(void) source_runtime(plugin_pattern, DIP_ALL | DIP_AFTER); TIME_MSG("loading after plugins"); } -#endif +# endif -#ifdef FEAT_DIFF +# ifdef FEAT_DIFF // Decide about window layout for diff mode after reading vimrc. if (params.diff_mode && params.window_layout == 0) { @@ -547,7 +547,7 @@ vim_main2(void) else params.window_layout = WIN_VER; // use vertical split } -#endif +# endif /* * Recovery mode without a file name: List swap files. @@ -574,15 +574,15 @@ vim_main2(void) if (params.no_swap_file) p_uc = 0; -#ifdef FEAT_GUI +# ifdef FEAT_GUI if (gui.starting) { -# if defined(UNIX) || defined(VMS) +# if defined(UNIX) || defined(VMS) // When something caused a message from a vimrc script, need to output // an extra newline before the shell prompt. if (did_emsg || msg_didout) putchar('\n'); -# endif +# endif gui_start(NULL); // will set full_screen to TRUE TIME_MSG("starting GUI"); @@ -593,9 +593,9 @@ vim_main2(void) mch_exit(1); firstwin->w_prev_height = firstwin->w_height; // may have changed } -#endif +# endif -#ifdef FEAT_VIMINFO +# ifdef FEAT_VIMINFO /* * Read in registers, history etc, but not marks, from the viminfo file. * This is where v:oldfiles gets filled. @@ -605,14 +605,14 @@ vim_main2(void) read_viminfo(NULL, VIF_WANT_INFO | VIF_GET_OLDFILES); TIME_MSG("reading viminfo"); } -#endif -#ifdef FEAT_EVAL +# endif +# ifdef FEAT_EVAL // 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()); -#endif +# endif -#ifdef FEAT_QUICKFIX +# ifdef FEAT_QUICKFIX /* * "-q errorfile": Load the error file now. * If the error file can't be read, exit before doing anything else. @@ -633,7 +633,7 @@ vim_main2(void) } TIME_MSG("reading errorfile"); } -#endif +# endif /* * Start putting things on the screen. @@ -645,7 +645,7 @@ vim_main2(void) if (!exmode_active) msg_scroll = FALSE; -#ifdef FEAT_GUI +# ifdef FEAT_GUI /* * This seems to be required to make callbacks to be called now, instead * of after things have been put on the screen, which then may be deleted @@ -658,36 +658,36 @@ vim_main2(void) gui_wait_for_chars(50L, typebuf.tb_change_cnt); TIME_MSG("GUI delay"); } -#endif +# endif -#if defined(FEAT_GUI_PHOTON) && defined(FEAT_CLIPBOARD) +# if defined(FEAT_GUI_PHOTON) && defined(FEAT_CLIPBOARD) qnx_clip_init(); -#endif +# endif -#if defined(MACOS_X) && defined(FEAT_CLIPBOARD) +# if defined(MACOS_X) && defined(FEAT_CLIPBOARD) clip_init(TRUE); -#endif +# endif -#ifdef FEAT_XCLIPBOARD +# ifdef FEAT_XCLIPBOARD // Start using the X clipboard, unless the GUI was started. -# ifdef FEAT_GUI +# ifdef FEAT_GUI if (!gui.in_use) -# endif +# endif { setup_term_clip(); TIME_MSG("setup x11 clipboard"); } -#endif +# endif -#ifdef FEAT_CLIENTSERVER +# ifdef FEAT_CLIENTSERVER // Prepare for being a Vim server. prepare_server(¶ms); -#endif +# endif -#ifdef FEAT_WAYLAND -# ifdef FEAT_GUI +# ifdef FEAT_WAYLAND +# ifdef FEAT_GUI if (!gui.in_use) -# endif +# endif { sprintf(wayland_vim_special_mime, "application/x-vim-instance-%ld", mch_get_pid()); @@ -696,17 +696,17 @@ vim_main2(void) { TIME_MSG("connected to Wayland display"); -# ifdef FEAT_WAYLAND_CLIPBOARD +# ifdef FEAT_WAYLAND_CLIPBOARD if (clip_init_wayland() == OK) TIME_MSG("setup Wayland clipboard"); -# endif +# endif } } -#endif +# endif -#ifdef HAVE_CLIPMETHOD +# ifdef HAVE_CLIPMETHOD choose_clipmethod(); -#endif +# endif /* * If "-" argument given: Read file from stdin. @@ -718,12 +718,12 @@ vim_main2(void) if (params.edit_type == EDIT_STDIN && !recoverymode) read_stdin(); -#if defined(UNIX) || defined(VMS) +# if defined(UNIX) || defined(VMS) // 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 && params.edit_type != EDIT_STDIN) newline_on_exit = TRUE; -#endif +# endif /* * When done something that is not allowed or given an error message call @@ -750,17 +750,17 @@ vim_main2(void) scroll_region_reset(); // In case Rows changed scroll_start(); // may scroll the screen to the right position -#if defined(UNIX) || defined(VMS) || defined(MACOS_X) +# if defined(UNIX) || defined(VMS) || defined(MACOS_X) term_push_title(SAVE_RESTORE_BOTH); -#endif +# endif /* * Don't clear the screen when starting in Ex mode, unless using the GUI. */ if (exmode_active -#ifdef FEAT_GUI +# ifdef FEAT_GUI && !gui.in_use -#endif +# endif ) set_must_redraw(UPD_CLEAR); else @@ -769,14 +769,14 @@ vim_main2(void) TIME_MSG("clearing screen"); } -#ifdef FEAT_CRYPT +# ifdef FEAT_CRYPT if (params.ask_for_key) { crypt_check_current_method(); (void)crypt_get_key(TRUE, TRUE); TIME_MSG("getting crypt key"); } -#endif +# endif no_wait_return = TRUE; @@ -787,10 +787,10 @@ vim_main2(void) create_windows(¶ms); TIME_MSG("opening buffers"); -#ifdef FEAT_EVAL +# ifdef FEAT_EVAL // clear v:swapcommand set_vim_var_string(VV_SWAPCOMMAND, NULL, -1); -#endif +# endif // Ex starts at last line of the file if (exmode_active) @@ -800,7 +800,7 @@ vim_main2(void) TIME_MSG("BufEnter autocommands"); setpcmark(); -#ifdef FEAT_QUICKFIX +# ifdef FEAT_QUICKFIX /* * When started with "-q errorfile" jump to first error now. */ @@ -809,7 +809,7 @@ vim_main2(void) qf_jump(NULL, 0, 0, FALSE); TIME_MSG("jump to first error"); } -#endif +# endif /* * If opened more than one window, start editing files in the other @@ -818,7 +818,7 @@ vim_main2(void) edit_buffers(¶ms, start_dir); vim_free(start_dir); -#ifdef FEAT_DIFF +# ifdef FEAT_DIFF if (params.diff_mode) { win_T *wp; @@ -827,7 +827,7 @@ vim_main2(void) FOR_ALL_WINDOWS(wp) diff_win_options(wp, TRUE); } -#endif +# endif /* * Shorten any of the filenames, but only when absolute. @@ -851,7 +851,7 @@ vim_main2(void) getout(1); } -#if defined(FEAT_X11) && defined(FEAT_XCLIPBOARD) +# if defined(FEAT_X11) && defined(FEAT_XCLIPBOARD) // Temporarily set x_jump_env to here in case there is an X11 IO error, // because x_jump_env is only actually set in main_loop(), before // exe_commands(). May not be the best solution since commands passed via @@ -863,24 +863,24 @@ vim_main2(void) if (jump_result == 0) { -#endif +# endif // Execute any "+", "-c" and "-S" arguments. if (params.n_commands > 0) exe_commands(¶ms); -#if defined(FEAT_X11) && defined(FEAT_XCLIPBOARD) +# if defined(FEAT_X11) && defined(FEAT_XCLIPBOARD) } else // Restore state and continue just like what main_loop() does. x_restore_state(); -#endif +# endif // Must come before the may_req_ calls. starting = 0; -#if defined(FEAT_TERMRESPONSE) +# if defined(FEAT_TERMRESPONSE) // Must be done before redrawing, puts a few characters on the screen. check_terminal_behavior(); -#endif +# endif RedrawingDisabled = 0; redraw_all_later(UPD_NOT_VALID); @@ -889,33 +889,33 @@ vim_main2(void) // 'autochdir' has been postponed DO_AUTOCHDIR; -#ifdef FEAT_TERMRESPONSE +# ifdef FEAT_TERMRESPONSE // 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_bg_color(); -#endif +# endif // start in insert mode if (p_im) need_start_insertmode = TRUE; -#ifdef FEAT_EVAL +# ifdef FEAT_EVAL set_vim_var_nr(VV_VIM_DID_ENTER, 1L); -#endif +# endif apply_autocmds(EVENT_VIMENTER, NULL, NULL, FALSE, curbuf); TIME_MSG("VimEnter autocommands"); -#if defined(FEAT_EVAL) && defined(FEAT_CLIPBOARD) +# if defined(FEAT_EVAL) && defined(FEAT_CLIPBOARD) // Adjust default register name for "unnamed" in 'clipboard'. Can only be // done after the clipboard is available and all initial commands that may // modify the 'clipboard' setting have run; i.e. just before entering the // main loop. reset_reg_var(); -#endif +# endif -#if defined(FEAT_DIFF) +# if defined(FEAT_DIFF) // 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) @@ -924,16 +924,16 @@ vim_main2(void) check_scrollbind((linenr_T)0, 0L); TIME_MSG("diff scrollbinding"); } -#endif +# endif -#if defined(MSWIN) && (!defined(FEAT_GUI_MSWIN) || defined(VIMDLL)) -# ifdef VIMDLL +# if defined(MSWIN) && (!defined(FEAT_GUI_MSWIN) || defined(VIMDLL)) +# ifdef VIMDLL if (!gui.in_use) -# endif +# endif mch_set_winsize_now(); // Allow winsize changes from now on -#endif +# endif -#if defined(FEAT_GUI) +# if defined(FEAT_GUI) // When tab pages were created, may need to update the tab pages line and // scrollbars. This is skipped while creating them. if (gui.in_use && first_tabpage->tp_next != NULL) @@ -943,30 +943,30 @@ vim_main2(void) gui_update_scrollbars(TRUE); } need_mouse_correct = TRUE; -#endif +# endif // 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) stuffcharReadbuff(K_NOP); -#ifdef FEAT_NETBEANS_INTG +# ifdef FEAT_NETBEANS_INTG if (netbeansArg != NULL && strncmp("-nb", netbeansArg, 3) == 0) { -# ifdef FEAT_GUI -# if !defined(FEAT_GUI_X11) && !defined(FEAT_GUI_GTK) \ +# ifdef FEAT_GUI +# if !defined(FEAT_GUI_X11) && !defined(FEAT_GUI_GTK) \ && !defined(FEAT_GUI_MSWIN) if (gui.in_use) { mch_errmsg(_("netbeans is not supported with this GUI\n")); mch_exit(2); } +# endif # endif -# endif // Tell the client that it can start sending commands. netbeans_open(netbeansArg + 3, TRUE); } -#endif +# endif // Redraw at least once, also when 'lazyredraw' is set, to make sure the // window title gets updated. @@ -2008,10 +2008,10 @@ parse_command_name(mparm_T *parmp) initstr = gettail((char_u *)parmp->argv[0]); -#ifdef FEAT_EVAL +# ifdef FEAT_EVAL set_vim_var_string(VV_PROGNAME, initstr, -1); set_progpath((char_u *)parmp->argv[0]); -#endif +# endif if (TOLOWER_ASC(initstr[0]) == 'r') { @@ -2024,9 +2024,9 @@ parse_command_name(mparm_T *parmp) && (TOLOWER_ASC(initstr[1]) == 'v' || TOLOWER_ASC(initstr[1]) == 'g')) { -#ifdef FEAT_GUI +# ifdef FEAT_GUI gui.starting = TRUE; -#endif +# endif parmp->evim_mode = TRUE; ++initstr; } @@ -2035,17 +2035,17 @@ parse_command_name(mparm_T *parmp) if (TOLOWER_ASC(initstr[0]) == 'g') { main_start_gui(); -#ifdef FEAT_GUI +# ifdef FEAT_GUI ++initstr; -#endif -#ifdef GUI_MAY_SPAWN +# endif +# ifdef GUI_MAY_SPAWN gui.dospawn = FALSE; // No need to spawn a new process. -#endif +# endif } -#ifdef GUI_MAY_SPAWN +# ifdef GUI_MAY_SPAWN else gui.dospawn = TRUE; // Not "gvim". Need to spawn gvim.exe. -#endif +# endif if (STRNICMP(initstr, "view", 4) == 0) @@ -2061,13 +2061,13 @@ parse_command_name(mparm_T *parmp) // Catch "[r][g]vimdiff" and "[r][g]viewdiff". if (STRICMP(initstr, "diff") == 0) { -#ifdef FEAT_DIFF +# ifdef FEAT_DIFF parmp->diff_mode = TRUE; -#else +# else mch_errmsg(_("This Vim was not compiled with the diff feature.")); mch_errmsg("\n"); mch_exit(2); -#endif +# endif } // Checking for "ex" here may catch some weird names, such as "vimex" or @@ -2123,7 +2123,7 @@ command_line_scan(mparm_T *parmp) { want_argument = FALSE; c = argv[0][argv_idx++]; -#if defined( VMS) +# if defined( VMS) /* 2025-05-13 SMS * On sufficiently recent non-VAX systems, case preservation * of the command line is possible/routine. And quotation @@ -2150,7 +2150,7 @@ command_line_scan(mparm_T *parmp) * the following (additional?) downcasing (which spoils the * preserve-case results): */ -#endif /* defined( VMS) */ +# endif /* defined( VMS) */ switch (c) { case NUL: // "vim -" read from stdin @@ -2186,9 +2186,9 @@ command_line_scan(mparm_T *parmp) { Columns = 80; // need to init Columns info_message = TRUE; // use mch_msg(), not mch_errmsg() -#if defined(FEAT_GUI) && !defined(ALWAYS_USE_GUI) && !defined(VIMDLL) +# if defined(FEAT_GUI) && !defined(ALWAYS_USE_GUI) && !defined(VIMDLL) gui.starting = FALSE; // not starting GUI, will exit -#endif +# endif list_version(); msg_putchar('\n'); msg_didout = FALSE; @@ -2197,24 +2197,24 @@ command_line_scan(mparm_T *parmp) else if (STRNICMP(argv[0] + argv_idx, "clean", 5) == 0) { parmp->use_vimrc = (char_u *)"DEFAULTS"; -#ifdef FEAT_GUI +# ifdef FEAT_GUI use_gvimrc = (char_u *)"NONE"; -#endif +# endif parmp->clean = TRUE; set_option_value_give_err((char_u *)"vif", 0L, (char_u *)"NONE", 0); } else if (STRNICMP(argv[0] + argv_idx, "literal", 7) == 0) { -#ifdef EXPAND_FILENAMES +# ifdef EXPAND_FILENAMES parmp->literal = TRUE; -#endif +# endif } else if (STRNICMP(argv[0] + argv_idx, "nofork", 6) == 0) { -#ifdef FEAT_GUI +# ifdef FEAT_GUI gui.dofork = FALSE; // don't fork() when starting GUI -#endif +# endif } else if (STRNICMP(argv[0] + argv_idx, "noplugin", 8) == 0) p_lpl = FALSE; @@ -2243,14 +2243,14 @@ command_line_scan(mparm_T *parmp) want_argument = TRUE; argv_idx += 3; } -#ifdef FEAT_CLIENTSERVER +# ifdef FEAT_CLIENTSERVER else if (STRNICMP(argv[0] + argv_idx, "serverlist", 10) == 0) ; // already processed -- no arg else if (STRNICMP(argv[0] + argv_idx, "servername", 10) == 0 || STRNICMP(argv[0] + argv_idx, "serversend", 10) == 0 -# if defined(FEAT_X11) && defined(FEAT_SOCKETSERVER) +# if defined(FEAT_X11) && defined(FEAT_SOCKETSERVER) || STRNICMP(argv[0] + argv_idx, "clientserver", 12) == 0 -# endif +# endif ) { // already processed -- snatch the following arg @@ -2260,13 +2260,13 @@ command_line_scan(mparm_T *parmp) ++argv; } } -#endif -#if defined(FEAT_GUI_GTK) || defined(FEAT_GUI_MSWIN) -# ifdef FEAT_GUI_GTK +# endif +# if defined(FEAT_GUI_GTK) || defined(FEAT_GUI_MSWIN) +# ifdef FEAT_GUI_GTK else if (STRNICMP(argv[0] + argv_idx, "socketid", 8) == 0) -# else +# else else if (STRNICMP(argv[0] + argv_idx, "windowid", 8) == 0) -# endif +# endif { // already processed -- snatch the following arg if (argc > 1) @@ -2275,13 +2275,13 @@ command_line_scan(mparm_T *parmp) ++argv; } } -#endif -#ifdef FEAT_GUI_GTK +# endif +# ifdef FEAT_GUI_GTK else if (STRNICMP(argv[0] + argv_idx, "echo-wid", 8) == 0) { // already processed, skip } -#endif +# endif else { if (argv[0][argv_idx]) @@ -2293,12 +2293,12 @@ command_line_scan(mparm_T *parmp) break; case 'A': // "-A" start in Arabic mode -#ifdef FEAT_ARABIC +# ifdef FEAT_ARABIC set_option_value_give_err((char_u *)"arabic", 1L, NULL, 0); -#else +# else mch_errmsg(_(e_arabic_cannot_be_used_not_enabled_at_compile_time)); mch_exit(2); -#endif +# endif break; case 'b': // "-b" binary mode @@ -2324,9 +2324,9 @@ command_line_scan(mparm_T *parmp) case 'f': // "-f" GUI: run in foreground. Amiga: open // window directly, not with newcli -#ifdef FEAT_GUI +# ifdef FEAT_GUI gui.dofork = FALSE; // don't fork() when starting GUI -#endif +# endif break; case 'g': // "-g" start GUI @@ -2340,21 +2340,21 @@ command_line_scan(mparm_T *parmp) case '?': // "-?" give help message (for MS-Windows) case 'h': // "-h" give help message -#ifdef FEAT_GUI_GNOME +# ifdef FEAT_GUI_GNOME // Tell usage() to exit for "gvim". gui.starting = FALSE; -#endif +# endif usage(); break; case 'H': // "-H" start in Hebrew mode: rl + hkmap set -#ifdef FEAT_RIGHTLEFT +# ifdef FEAT_RIGHTLEFT p_hkmap = TRUE; set_option_value_give_err((char_u *)"rl", 1L, NULL, 0); -#else +# else mch_errmsg(_(e_hebrew_cannot_be_used_not_enabled_at_compile_time)); mch_exit(2); -#endif +# endif break; case 'l': // "-l" lisp mode, 'lisp' and 'showmatch' on @@ -2371,9 +2371,9 @@ command_line_scan(mparm_T *parmp) break; case 'y': // "-y" easy mode -#ifdef FEAT_GUI +# ifdef FEAT_GUI gui.starting = TRUE; // start GUI a bit later -#endif +# endif parmp->evim_mode = TRUE; break; @@ -2382,7 +2382,7 @@ command_line_scan(mparm_T *parmp) break; case 'n': // "-n" no swap file -#ifdef FEAT_NETBEANS_INTG +# ifdef FEAT_NETBEANS_INTG // checking for "-nb", netbeans parameters if (argv[0][argv_idx] == 'b') { @@ -2390,12 +2390,12 @@ command_line_scan(mparm_T *parmp) argv_idx = -1; // skip to next argument } else -#endif +# endif parmp->no_swap_file = TRUE; break; case 'p': // "-p[N]" open N tab pages -#ifdef TARGET_API_MAC_OSX +# ifdef TARGET_API_MAC_OSX // For some reason on MacOS X, an argument like: // -psn_0_10223617 is passed in when invoke from Finder // or with the 'open' command @@ -2405,7 +2405,7 @@ command_line_scan(mparm_T *parmp) main_start_gui(); break; } -#endif +# endif // default is 0: open window for each file parmp->window_count = get_number_arg((char_u *)argv[0], &argv_idx, 0); @@ -2426,7 +2426,7 @@ command_line_scan(mparm_T *parmp) parmp->window_layout = WIN_VER; break; -#ifdef FEAT_QUICKFIX +# ifdef FEAT_QUICKFIX case 'q': // "-q" QuickFix mode if (parmp->edit_type != EDIT_NONE) mainerr(ME_TOO_MANY_ARGS, (char_u *)argv[0]); @@ -2439,7 +2439,7 @@ command_line_scan(mparm_T *parmp) else if (argc > 1) // "-q {errorfile}" want_argument = TRUE; break; -#endif +# endif case 'R': // "-R" readonly mode readonlymode = TRUE; @@ -2472,22 +2472,22 @@ command_line_scan(mparm_T *parmp) want_argument = TRUE; break; -#ifdef FEAT_EVAL +# ifdef FEAT_EVAL case 'D': // "-D" Debugging parmp->use_debug_break_level = 9999; break; -#endif -#ifdef FEAT_DIFF +# endif +# ifdef FEAT_DIFF case 'd': // "-d" 'diff' -# ifdef AMIGA +# ifdef AMIGA // check for "-dev {device}" if (argv[0][argv_idx] == 'e' && argv[0][argv_idx + 1] == 'v') want_argument = TRUE; else -# endif +# endif parmp->diff_mode = TRUE; break; -#endif +# endif case 'V': // "-V{N}" Verbose level // default is 10: a little bit verbose p_verbose = get_number_arg((char_u *)argv[0], &argv_idx, 10); @@ -2501,9 +2501,9 @@ command_line_scan(mparm_T *parmp) case 'v': // "-v" Vi-mode (as if called "vi") exmode_active = 0; -#if defined(FEAT_GUI) && !defined(VIMDLL) +# if defined(FEAT_GUI) && !defined(VIMDLL) gui.starting = FALSE; // don't start GUI -#endif +# endif break; case 'w': // "-w{number}" set window height @@ -2517,21 +2517,21 @@ command_line_scan(mparm_T *parmp) want_argument = TRUE; break; -#ifdef FEAT_CRYPT +# ifdef FEAT_CRYPT case 'x': // "-x" encrypted reading/writing of files parmp->ask_for_key = TRUE; break; -#endif +# endif case 'X': // "-X" don't connect to X server -#if (defined(UNIX) || defined(VMS)) && defined(FEAT_X11) +# if (defined(UNIX) || defined(VMS)) && defined(FEAT_X11) x_no_connect = TRUE; -#endif +# endif break; case 'Y': // "-Y" don't connect to Wayland compositor -#if defined(FEAT_WAYLAND) +# if defined(FEAT_WAYLAND) wayland_no_connect = TRUE; -#endif +# endif break; case 'Z': // "-Z" restricted mode @@ -2552,16 +2552,16 @@ command_line_scan(mparm_T *parmp) // FALLTHROUGH case 'S': // "-S {file}" execute Vim script case 'i': // "-i {viminfo}" use for viminfo -#ifndef FEAT_DIFF +# ifndef FEAT_DIFF case 'd': // "-d {device}" device (for Amiga) -#endif +# endif case 'T': // "-T {terminal}" terminal name case 'u': // "-u {vimrc}" vim inits file case 'U': // "-U {gvimrc}" gvim inits file case 'W': // "-W {scriptout}" overwrite -#ifdef FEAT_GUI_MSWIN +# ifdef FEAT_GUI_MSWIN case 'P': // "-P {parent title}" MDI parent -#endif +# endif want_argument = TRUE; break; @@ -2635,9 +2635,9 @@ command_line_scan(mparm_T *parmp) if (argv[-1][2] == 'g') { // without GUI ignore the argument -#ifdef FEAT_GUI +# ifdef FEAT_GUI parmp->gui_dialog_file = (char_u *)argv[0]; -#endif +# endif } // "--startuptime " already handled @@ -2647,11 +2647,11 @@ command_line_scan(mparm_T *parmp) // case 'd': -d {device} is handled in mch_check_win() for the // Amiga -#ifdef FEAT_QUICKFIX +# ifdef FEAT_QUICKFIX case 'q': // "-q {errorfile}" QuickFix mode parmp->use_ef = (char_u *)argv[0]; break; -#endif +# endif case 'i': // "-i {viminfo}" use for viminfo set_option_value_give_err((char_u *)"vif", @@ -2690,11 +2690,11 @@ scripterror: * HAVE_TERMLIB is supported it overrides the environment * variable TERM. */ -#ifdef FEAT_GUI +# ifdef FEAT_GUI if (term_is_gui((char_u *)argv[0])) gui.starting = TRUE; // start GUI a bit later else -#endif +# endif parmp->term = (char_u *)argv[0]; break; @@ -2703,9 +2703,9 @@ scripterror: break; case 'U': // "-U {gvimrc}" gvim inits file -#ifdef FEAT_GUI +# ifdef FEAT_GUI use_gvimrc = (char_u *)argv[0]; -#endif +# endif break; case 'w': // "-w {nr}" 'window' value @@ -2733,11 +2733,11 @@ scripterror: } break; -#ifdef FEAT_GUI_MSWIN +# ifdef FEAT_GUI_MSWIN case 'P': // "-P {parent title}" MDI parent gui_mch_set_parent(argv[0]); break; -#endif +# endif } } } @@ -2754,18 +2754,18 @@ scripterror: mainerr(ME_TOO_MANY_ARGS, (char_u *)argv[0]); parmp->edit_type = EDIT_FILE; -#ifdef MSWIN +# ifdef MSWIN // Remember if the argument was a full path before changing // slashes to backslashes. if (argv[0][0] != NUL && argv[0][1] == ':' && argv[0][2] == '\\') parmp->full_path = TRUE; -#endif +# endif // Add the file to the global argument list. if (ga_grow(&global_alist.al_ga, 1) == FAIL || (p = vim_strsave((char_u *)argv[0])) == NULL) mch_exit(2); -#ifdef FEAT_DIFF +# ifdef FEAT_DIFF if (parmp->diff_mode && mch_isdir(p) && GARGCOUNT > 0 && !mch_isdir(alist_name(&GARGLIST[0]))) { @@ -2778,8 +2778,8 @@ scripterror: p = r; } } -#endif -#ifdef __CYGWIN__ +# endif +# ifdef __CYGWIN__ /* * If vim is invoked by non-Cygwin tools, convert away any * DOS paths, so things like .swp files are created correctly. @@ -2790,44 +2790,44 @@ scripterror: { char posix_path[MAXPATHL]; -# if CYGWIN_VERSION_DLL_MAJOR >= 1007 +# if CYGWIN_VERSION_DLL_MAJOR >= 1007 cygwin_conv_path(CCP_WIN_A_TO_POSIX, p, posix_path, MAXPATHL); -# else +# else cygwin_conv_to_posix_path(p, posix_path); -# endif +# endif vim_free(p); p = vim_strsave((char_u *)posix_path); if (p == NULL) mch_exit(2); } -#endif +# endif -#ifdef USE_FNAME_CASE +# ifdef USE_FNAME_CASE // Make the case of the file name match the actual file. fname_case(p, 0); -#endif +# endif alist_add(&global_alist, p, -#ifdef EXPAND_FILENAMES +# ifdef EXPAND_FILENAMES parmp->literal ? 2 : 0 // add buffer nr after exp. -#else +# else 2 // add buffer number now and use curbuf -#endif +# endif ); -#ifdef MSWIN +# ifdef MSWIN { // Remember this argument has been added to the argument list. // Needed when 'encoding' is changed. used_file_arg(argv[0], parmp->literal, parmp->full_path, -# ifdef FEAT_DIFF +# ifdef FEAT_DIFF parmp->diff_mode -# else +# else FALSE -# endif +# endif ); } -#endif +# endif } /* @@ -2843,7 +2843,7 @@ scripterror: } } -#ifdef FEAT_EVAL +# ifdef FEAT_EVAL // If there is a "+123" or "-c" command, set v:swapcommand to the first // one. if (parmp->n_commands > 0) @@ -2856,7 +2856,7 @@ scripterror: vim_free(p); } } -#endif +# endif } /* @@ -2875,13 +2875,13 @@ check_tty(mparm_T *parmp) silent_mode = TRUE; } else if (parmp->want_full_screen && (!stdout_isatty || !input_isatty) -#ifdef FEAT_GUI +# ifdef FEAT_GUI // don't want the delay when started from the desktop && !gui.starting -#endif +# endif && !parmp->not_a_term) { -#ifdef NBDEBUG +# ifdef NBDEBUG /* * This shouldn't be necessary. But if I run netbeans with the log * output coming to the console and XOpenDisplay fails, I get vim @@ -2894,15 +2894,15 @@ check_tty(mparm_T *parmp) mch_errmsg(_("Vim: Error: Failure to start gvim from NetBeans\n")); exit(1); } -#endif -#if defined(MSWIN) && (!defined(FEAT_GUI_MSWIN) || defined(VIMDLL)) +# endif +# if defined(MSWIN) && (!defined(FEAT_GUI_MSWIN) || defined(VIMDLL)) if ( -# ifdef VIMDLL +# ifdef VIMDLL !gui.starting && -# endif +# endif is_cygpty_used()) { -# if defined(HAVE_BIND_TEXTDOMAIN_CODESET) \ +# if defined(HAVE_BIND_TEXTDOMAIN_CODESET) \ && defined(FEAT_GETTEXT) char *s, *tofree = NULL; @@ -2916,11 +2916,11 @@ check_tty(mparm_T *parmp) s = "utf-8"; // Use "utf-8" by default. (void)bind_textdomain_codeset(VIMPACKAGE, s); vim_free(tofree); -# endif +# endif mch_errmsg(_("Vim: Error: This version of Vim does not run in a Cygwin terminal\n")); exit(1); } -#endif +# endif if (!stdout_isatty) mch_errmsg(_("Vim: Warning: Output is not to a terminal\n")); if (!input_isatty) @@ -2958,13 +2958,13 @@ read_stdin(void) check_swap_exists_action(); -#if !(defined(AMIGA) || defined(MACOS_X)) +# if !(defined(AMIGA) || defined(MACOS_X)) // Dup stdin from stderr to read commands from, so that shell commands // work. // TODO: why is this needed, even though readfile() has done this? close(0); vim_ignored = dup(2); -#endif +# endif } /* @@ -3053,11 +3053,11 @@ create_windows(mparm_T *parmp UNUSED) curbuf = curwin->w_buffer; if (curbuf->b_ml.ml_mfp == NULL) { -#ifdef FEAT_FOLDING +# ifdef FEAT_FOLDING // Set 'foldlevel' to 'foldlevelstart' if it's not negative. if (p_fdls >= 0) curwin->w_p_fdl = p_fdls; -#endif +# endif // When getting the ATTENTION prompt here, use a dialog swap_exists_action = SEA_DIALOG; @@ -3220,7 +3220,7 @@ edit_buffers( // make the first window the current window win = firstwin; -#if defined(FEAT_QUICKFIX) +# if defined(FEAT_QUICKFIX) // Avoid making a preview window the current window. while (win->w_p_pvw) { @@ -3231,7 +3231,7 @@ edit_buffers( break; } } -#endif +# endif win_enter(win, FALSE); --autocmd_no_leave; @@ -3289,10 +3289,10 @@ exe_commands(mparm_T *parmp) curwin->w_cursor.lnum = 0; estack_push(ETYPE_ARGS, (char_u *)"command line", 0); ESTACK_CHECK_SETUP; -#ifdef FEAT_EVAL +# ifdef FEAT_EVAL current_sctx.sc_sid = SID_CARG; current_sctx.sc_seq = 0; -#endif +# endif for (i = 0; i < parmp->n_commands; ++i) { do_cmdline_cmd(parmp->commands[i]); @@ -3301,20 +3301,20 @@ exe_commands(mparm_T *parmp) } ESTACK_CHECK_NOW; estack_pop(); -#ifdef FEAT_EVAL +# ifdef FEAT_EVAL current_sctx.sc_sid = 0; -#endif +# endif if (curwin->w_cursor.lnum == 0) curwin->w_cursor.lnum = 1; if (!exmode_active) msg_scroll = FALSE; -#ifdef FEAT_QUICKFIX +# ifdef FEAT_QUICKFIX // When started with "-q errorfile" jump to first error again. if (parmp->edit_type == EDIT_QF) qf_jump(NULL, 0, 0, FALSE); -#endif +# endif TIME_MSG("executing command arguments"); } @@ -3351,10 +3351,10 @@ source_startup_scripts(mparm_T *parmp) else if (STRCMP(parmp->use_vimrc, "NONE") == 0 || STRCMP(parmp->use_vimrc, "NORC") == 0) { -#ifdef FEAT_GUI +# ifdef FEAT_GUI if (use_gvimrc == NULL) // don't load gvimrc either use_gvimrc = parmp->use_vimrc; -#endif +# endif } else { @@ -3364,24 +3364,24 @@ source_startup_scripts(mparm_T *parmp) } else if (!silent_mode) { -#ifdef AMIGA +# ifdef AMIGA struct Process *proc = (struct Process *)FindTask(0L); APTR save_winptr = proc->pr_WindowPtr; // Avoid a requester here for a volume that doesn't exist. proc->pr_WindowPtr = (APTR)-1L; -#endif +# endif /* * Get system wide defaults, if the file name is defined. */ -#ifdef SYS_VIMRC_FILE +# ifdef SYS_VIMRC_FILE (void)do_source((char_u *)SYS_VIMRC_FILE, FALSE, DOSO_NONE, NULL); -#endif -#ifdef MACOS_X +# endif +# ifdef MACOS_X (void)do_source((char_u *)"$VIMRUNTIME/macmap.vim", FALSE, DOSO_NONE, NULL); -#endif +# endif /* * Try to read initialization commands from the following places: @@ -3397,29 +3397,29 @@ source_startup_scripts(mparm_T *parmp) { if (do_source((char_u *)USR_VIMRC_FILE, TRUE, DOSO_VIMRC, NULL) == FAIL -#ifdef USR_VIMRC_FILE2 +# ifdef USR_VIMRC_FILE2 && do_source((char_u *)USR_VIMRC_FILE2, TRUE, DOSO_VIMRC, NULL) == FAIL -#endif -#ifdef XDG_VIMRC_FILE +# endif +# ifdef XDG_VIMRC_FILE && do_source((char_u *)XDG_VIMRC_FILE, TRUE, DOSO_VIMRC, NULL) == FAIL -#endif -#ifdef USR_VIMRC_FILE3 +# endif +# ifdef USR_VIMRC_FILE3 && do_source((char_u *)USR_VIMRC_FILE3, TRUE, DOSO_VIMRC, NULL) == FAIL -#endif -#ifdef USR_VIMRC_FILE4 +# endif +# ifdef USR_VIMRC_FILE4 && do_source((char_u *)USR_VIMRC_FILE4, TRUE, DOSO_VIMRC, NULL) == FAIL -#endif +# endif && process_env((char_u *)"EXINIT", FALSE) == FAIL && do_source((char_u *)USR_EXRC_FILE, FALSE, DOSO_NONE, NULL) == FAIL -#ifdef USR_EXRC_FILE2 +# ifdef USR_EXRC_FILE2 && do_source((char_u *)USR_EXRC_FILE2, FALSE, DOSO_NONE, NULL) == FAIL -#endif +# endif && !has_dash_c_arg) { // When no .vimrc file was found: source defaults.vim. @@ -3440,45 +3440,45 @@ source_startup_scripts(mparm_T *parmp) */ if (p_exrc) { -#if defined(UNIX) || defined(VMS) +# if defined(UNIX) || defined(VMS) // If ".vimrc" file is not owned by user, set 'secure' mode. if (!file_owned(VIMRC_FILE)) -#endif +# endif secure = p_secure; i = FAIL; if (fullpathcmp((char_u *)USR_VIMRC_FILE, (char_u *)VIMRC_FILE, FALSE, TRUE) != FPC_SAME -#ifdef USR_VIMRC_FILE2 +# ifdef USR_VIMRC_FILE2 && fullpathcmp((char_u *)USR_VIMRC_FILE2, (char_u *)VIMRC_FILE, FALSE, TRUE) != FPC_SAME -#endif -#ifdef USR_VIMRC_FILE3 +# endif +# ifdef USR_VIMRC_FILE3 && fullpathcmp((char_u *)USR_VIMRC_FILE3, (char_u *)VIMRC_FILE, FALSE, TRUE) != FPC_SAME -#endif -#ifdef SYS_VIMRC_FILE +# endif +# ifdef SYS_VIMRC_FILE && fullpathcmp((char_u *)SYS_VIMRC_FILE, (char_u *)VIMRC_FILE, FALSE, TRUE) != FPC_SAME -#endif +# endif ) i = do_source((char_u *)VIMRC_FILE, TRUE, DOSO_VIMRC, NULL); if (i == FAIL) { -#if defined(UNIX) || defined(VMS) +# if defined(UNIX) || defined(VMS) // if ".exrc" is not owned by user set 'secure' mode if (!file_owned(EXRC_FILE)) secure = p_secure; else secure = 0; -#endif +# endif if ( fullpathcmp((char_u *)USR_EXRC_FILE, (char_u *)EXRC_FILE, FALSE, TRUE) != FPC_SAME -#ifdef USR_EXRC_FILE2 +# ifdef USR_EXRC_FILE2 && fullpathcmp((char_u *)USR_EXRC_FILE2, (char_u *)EXRC_FILE, FALSE, TRUE) != FPC_SAME -#endif +# endif ) (void)do_source((char_u *)EXRC_FILE, FALSE, DOSO_NONE, NULL); @@ -3487,9 +3487,9 @@ source_startup_scripts(mparm_T *parmp) if (secure == 2) need_wait_return = TRUE; secure = 0; -#ifdef AMIGA +# ifdef AMIGA proc->pr_WindowPtr = save_winptr; -#endif +# endif } TIME_MSG("sourcing vimrc file(s)"); } @@ -3500,13 +3500,13 @@ source_startup_scripts(mparm_T *parmp) static void main_start_gui(void) { -#ifdef FEAT_GUI +# ifdef FEAT_GUI gui.starting = TRUE; // start GUI a bit later -#else +# else mch_errmsg(_(e_gui_cannot_be_used_not_enabled_at_compile_time)); mch_errmsg("\n"); mch_exit(2); -#endif +# endif } #endif // NO_VIM_MAIN @@ -3636,14 +3636,14 @@ usage(void) N_("[file ..] edit specified file(s)"), N_("- read text from stdin"), N_("-t tag edit file where tag is defined"), -#ifdef FEAT_QUICKFIX +# ifdef FEAT_QUICKFIX N_("-q [errorfile] edit file with first error") -#endif +# endif }; -#if defined(UNIX) || defined(VMS) +# if defined(UNIX) || defined(VMS) reset_signals(); // kill us with CTRL-C here, if you like -#endif +# endif init_longVersion(); mch_msg(longVersion); @@ -3656,31 +3656,31 @@ usage(void) break; mch_msg(_("\n or:")); } -#if defined( VMS) +# if defined( VMS) mch_msg(_("\nWhere command is down-cased, prepend / (like: -/R) to treat flag as upper-case.")); mch_msg(_("\nOr, where supported, SET PROC/PARSE=EXT, or else quote upper-case material.")); -#endif /* defined( VMS) */ +# endif /* defined( VMS) */ mch_msg(_("\n\nArguments:\n")); main_msg(_("--\t\t\tOnly file names after this")); -#ifdef EXPAND_FILENAMES +# ifdef EXPAND_FILENAMES main_msg(_("--literal\t\tDon't expand wildcards")); -#endif -#ifdef FEAT_OLE +# endif +# ifdef FEAT_OLE main_msg(_("-register\t\tRegister this gvim for OLE")); main_msg(_("-unregister\t\tUnregister gvim for OLE")); -#endif -#ifdef FEAT_GUI +# endif +# ifdef FEAT_GUI main_msg(_("-g\t\t\tRun using GUI (like \"gvim\")")); main_msg(_("-f or --nofork\tForeground: Don't fork when starting GUI")); -#endif +# endif main_msg(_("-v\t\t\tVi mode (like \"vi\")")); main_msg(_("-e\t\t\tEx mode (like \"ex\")")); main_msg(_("-E\t\t\tImproved Ex mode")); main_msg(_("-s\t\t\tSilent (batch) mode (only for \"ex\")")); -#ifdef FEAT_DIFF +# ifdef FEAT_DIFF main_msg(_("-d\t\t\tDiff mode (like \"vimdiff\")")); -#endif +# endif main_msg(_("-y\t\t\tEasy mode (like \"evim\", modeless)")); main_msg(_("-R\t\t\tReadonly mode (like \"view\")")); main_msg(_("-Z\t\t\tRestricted mode (like \"rvim\")")); @@ -3691,33 +3691,33 @@ usage(void) main_msg(_("-C\t\t\tCompatible with Vi: 'compatible'")); main_msg(_("-N\t\t\tNot fully Vi compatible: 'nocompatible'")); main_msg(_("-V[N][fname]\t\tBe verbose [level N] [log messages to fname]")); -#ifdef FEAT_EVAL +# ifdef FEAT_EVAL main_msg(_("-D\t\t\tDebugging mode")); -#endif +# endif main_msg(_("-n\t\t\tNo swap file, use memory only")); main_msg(_("-r\t\t\tList swap files and exit")); main_msg(_("-r (with file name)\tRecover crashed session")); main_msg(_("-L\t\t\tSame as -r")); -#ifdef AMIGA +# ifdef AMIGA main_msg(_("-f\t\t\tDon't use newcli to open window")); main_msg(_("-dev \t\tUse for I/O")); -#endif -#ifdef FEAT_ARABIC +# endif +# ifdef FEAT_ARABIC main_msg(_("-A\t\t\tStart in Arabic mode")); -#endif -#ifdef FEAT_RIGHTLEFT +# endif +# ifdef FEAT_RIGHTLEFT main_msg(_("-H\t\t\tStart in Hebrew mode")); -#endif +# endif main_msg(_("-T \tSet terminal type to ")); main_msg(_("--not-a-term\t\tSkip warning for input/output not being a terminal")); -#ifdef FEAT_GUI +# ifdef FEAT_GUI main_msg(_("--gui-dialog-file {fname} For testing: write dialog text")); -#endif +# endif main_msg(_("--ttyfail\t\tExit if input or output is not a terminal")); main_msg(_("-u \t\tUse instead of any .vimrc")); -#ifdef FEAT_GUI +# ifdef FEAT_GUI main_msg(_("-U \t\tUse instead of any .gvimrc")); -#endif +# endif main_msg(_("--noplugin\t\tDon't load plugin scripts")); main_msg(_("-p[N]\t\tOpen N tab pages (default: one for each file)")); main_msg(_("-o[N]\t\tOpen N windows (default: one for each file)")); @@ -3730,22 +3730,22 @@ usage(void) main_msg(_("-s \tRead Normal mode commands from file ")); main_msg(_("-w \tAppend all typed commands to file ")); main_msg(_("-W \tWrite all typed commands to file ")); -#ifdef FEAT_CRYPT +# ifdef FEAT_CRYPT main_msg(_("-x\t\t\tEdit encrypted files")); -#endif -#if (defined(UNIX) || defined(VMS)) && defined(FEAT_X11) -# if defined(FEAT_GUI_X11) && !defined(FEAT_GUI_GTK) - main_msg(_("-display \tConnect Vim to this particular X-server")); # endif +# if (defined(UNIX) || defined(VMS)) && defined(FEAT_X11) +# if defined(FEAT_GUI_X11) && !defined(FEAT_GUI_GTK) + main_msg(_("-display \tConnect Vim to this particular X-server")); +# endif main_msg(_("-X\t\t\tDo not connect to X server")); -#endif -#if defined(FEAT_WAYLAND) +# endif +# if defined(FEAT_WAYLAND) main_msg(_("-Y\t\t\tDo not connect to Wayland compositor")); -#endif -#ifdef FEAT_CLIENTSERVER -# if defined(FEAT_X11) && defined(FEAT_SOCKETSERVER) - main_msg(_("--clientserver Backend for clientserver communication")); # endif +# ifdef FEAT_CLIENTSERVER +# if defined(FEAT_X11) && defined(FEAT_SOCKETSERVER) + main_msg(_("--clientserver Backend for clientserver communication")); +# endif main_msg(_("--remote \tEdit in a Vim server if possible")); main_msg(_("--remote-silent Same, don't complain if there is no server")); main_msg(_("--remote-wait As --remote but wait for files to have been edited")); @@ -3755,24 +3755,24 @@ usage(void) main_msg(_("--remote-expr \tEvaluate in a Vim server and print result")); main_msg(_("--serverlist\t\tList available Vim server names and exit")); main_msg(_("--servername \tSend to/become the Vim server ")); -#endif -#ifdef STARTUPTIME +# endif +# ifdef STARTUPTIME main_msg(_("--startuptime \tWrite startup timing messages to ")); -#endif -#ifdef FEAT_JOB_CHANNEL +# endif +# ifdef FEAT_JOB_CHANNEL main_msg(_("--log \t\tStart logging to early")); -#endif -#ifdef FEAT_VIMINFO +# endif +# ifdef FEAT_VIMINFO main_msg(_("-i \t\tUse instead of .viminfo")); -#endif +# endif main_msg(_("--clean\t\t'nocompatible', Vim defaults, no plugins, no viminfo")); main_msg(_("-h or --help\tPrint Help (this message) and exit")); main_msg(_("--version\t\tPrint version information and exit")); -#ifdef FEAT_GUI_X11 -# ifdef FEAT_GUI_MOTIF +# ifdef FEAT_GUI_X11 +# ifdef FEAT_GUI_MOTIF mch_msg(_("\nArguments recognised by gvim (Motif version):\n")); -# endif +# endif main_msg(_("-display \tRun Vim on ")); main_msg(_("-iconic\t\tStart Vim iconified")); main_msg(_("-background \tUse for the background (also: -bg)")); @@ -3786,8 +3786,8 @@ usage(void) main_msg(_("-reverse\t\tUse reverse video (also: -rv)")); main_msg(_("+reverse\t\tDon't use reverse video (also: +rv)")); main_msg(_("-xrm \tSet the specified resource")); -#endif // FEAT_GUI_X11 -#ifdef FEAT_GUI_GTK +# endif // FEAT_GUI_X11 +# ifdef FEAT_GUI_GTK mch_msg(_("\nArguments recognised by gvim (GTK+ version):\n")); main_msg(_("-background \tUse for the background (also: -bg)")); main_msg(_("-foreground \tUse for normal text (also: -fg)")); @@ -3799,18 +3799,18 @@ usage(void) main_msg(_("--role \tSet a unique role to identify the main window")); main_msg(_("--socketid \tOpen Vim inside another GTK widget")); main_msg(_("--echo-wid\t\tMake gvim echo the Window ID on stdout")); -#endif -#ifdef FEAT_GUI_MSWIN -# ifdef VIMDLL - if (gui.starting) # endif +# ifdef FEAT_GUI_MSWIN +# ifdef VIMDLL + if (gui.starting) +# endif { main_msg(_("-P \tOpen Vim inside parent application")); main_msg(_("--windowid \tOpen Vim inside another win32 widget")); } -#endif +# endif -#ifdef FEAT_GUI_GNOME +# ifdef FEAT_GUI_GNOME // Gnome gives extra messages for --help if we continue, but not for -h. if (gui.starting) { @@ -3818,7 +3818,7 @@ usage(void) gui.dofork = FALSE; } else -#endif +# endif mch_exit(0); } diff --git a/src/match.c b/src/match.c index a0cae5df71..ff7e8d9f3d 100644 --- a/src/match.c +++ b/src/match.c @@ -866,11 +866,11 @@ get_prevcol_hl_flag(win_T *wp, match_T *search_hl, long curcol) int prevcol_hl_flag = FALSE; matchitem_T *cur; // points to the match list -#if defined(FEAT_PROP_POPUP) +# if defined(FEAT_PROP_POPUP) // don't do this in a popup window if (popup_is_popup(wp)) return FALSE; -#endif +# endif // we're not really at that column when skipping some text if ((long)(wp->w_p_wrap ? wp->w_skipcol : wp->w_leftcol) > prevcol) @@ -965,7 +965,7 @@ matchadd_dict_arg(typval_T *tv, char_u **conceal_char, win_T **win) return OK; } -#endif +# endif /* * "clearmatches()" function @@ -973,7 +973,7 @@ matchadd_dict_arg(typval_T *tv, char_u **conceal_char, win_T **win) void f_clearmatches(typval_T *argvars UNUSED, typval_T *rettv UNUSED) { -#ifdef FEAT_SEARCH_EXTRA +# ifdef FEAT_SEARCH_EXTRA win_T *win; if (in_vim9script() && check_for_opt_number_arg(argvars, 0) == FAIL) @@ -982,7 +982,7 @@ f_clearmatches(typval_T *argvars UNUSED, typval_T *rettv UNUSED) win = get_optional_window(argvars, 0); if (win != NULL) clear_matches(win); -#endif +# endif } /* @@ -1063,7 +1063,7 @@ f_getmatches(typval_T *argvars UNUSED, typval_T *rettv UNUSED) void f_setmatches(typval_T *argvars UNUSED, typval_T *rettv UNUSED) { -#ifdef FEAT_SEARCH_EXTRA +# ifdef FEAT_SEARCH_EXTRA list_T *l; listitem_T *li; dict_T *d; @@ -1172,7 +1172,7 @@ f_setmatches(typval_T *argvars UNUSED, typval_T *rettv UNUSED) } rettv->vval.v_number = 0; } -#endif +# endif } /* diff --git a/src/mbyte.c b/src/mbyte.c index 38d0fe5a84..41571f4767 100644 --- a/src/mbyte.c +++ b/src/mbyte.c @@ -866,7 +866,7 @@ dbcs_class(unsigned lead, unsigned trail) unsigned char tb = trail; // convert process code to JIS -# if defined(MSWIN) || defined(WIN32UNIX) || defined(MACOS_X) +#if defined(MSWIN) || defined(WIN32UNIX) || defined(MACOS_X) // process code is SJIS if (lb <= 0x9f) lb = (lb - 0x81) * 2 + 0x21; @@ -881,7 +881,7 @@ dbcs_class(unsigned lead, unsigned trail) tb -= 0x7e; lb += 1; } -# else +#else /* * XXX: Code page identification can not use with all * system! So, some other encoding information @@ -894,7 +894,7 @@ dbcs_class(unsigned lead, unsigned trail) // assume process code is JAPANESE-EUC lb &= 0x7f; tb &= 0x7f; -# endif +#endif // exceptions switch (lb << 8 | tb) { @@ -4481,9 +4481,9 @@ mb_unescape(char_u **pp) n += 2; } else if ((str[n] == K_SPECIAL -# ifdef FEAT_GUI +#ifdef FEAT_GUI || str[n] == CSI -# endif +#endif ) && str[n + 1] == KS_EXTRA && str[n + 2] == (int)KE_CSI) @@ -4492,9 +4492,9 @@ mb_unescape(char_u **pp) n += 2; } else if (str[n] == K_SPECIAL -# ifdef FEAT_GUI +#ifdef FEAT_GUI || str[n] == CSI -# endif +#endif ) break; // a special key can't be a multibyte char else @@ -4764,7 +4764,7 @@ enc_locale(void) #endif } -# if defined(MSWIN) || defined(FEAT_CYGWIN_WIN32_CLIPBOARD) +#if defined(MSWIN) || defined(FEAT_CYGWIN_WIN32_CLIPBOARD) /* * Convert an encoding name to an MS-Windows codepage. * Returns zero if no codepage can be figured out. @@ -4791,9 +4791,9 @@ encname2codepage(char_u *name) return cp; return 0; } -# endif +#endif -# if defined(USE_ICONV) +#if defined(USE_ICONV) /* * Call iconv_open() with a check if iconv() works properly (there are broken @@ -4805,7 +4805,7 @@ encname2codepage(char_u *name) my_iconv_open(char_u *to, char_u *from) { iconv_t fd; -#define ICONV_TESTLEN 400 +# define ICONV_TESTLEN 400 char_u tobuf[ICONV_TESTLEN]; char *p; size_t tolen; @@ -4814,11 +4814,11 @@ my_iconv_open(char_u *to, char_u *from) if (iconv_ok == FALSE) return (void *)-1; // detected a broken iconv() previously -#ifdef DYNAMIC_ICONV +# ifdef DYNAMIC_ICONV // Check if the iconv.dll can be found. if (!iconv_enabled(TRUE)) return (void *)-1; -#endif +# endif fd = iconv_open((char *)enc_skip(to), (char *)enc_skip(from)); @@ -4951,26 +4951,26 @@ iconv_string( return result; } -# if defined(DYNAMIC_ICONV) +# if defined(DYNAMIC_ICONV) /* * Dynamically load the "iconv.dll" on Win32. */ -# ifndef DYNAMIC_ICONV // must be generating prototypes -# define HINSTANCE int -# endif +# ifndef DYNAMIC_ICONV // must be generating prototypes +# define HINSTANCE int +# endif static HINSTANCE hIconvDLL = 0; static HINSTANCE hMsvcrtDLL = 0; -# ifndef DYNAMIC_ICONV_DLL -# define DYNAMIC_ICONV_DLL "iconv.dll" -# define DYNAMIC_ICONV_DLL_ALT1 "libiconv.dll" -# define DYNAMIC_ICONV_DLL_ALT2 "libiconv2.dll" -# define DYNAMIC_ICONV_DLL_ALT3 "libiconv-2.dll" -# endif -# ifndef DYNAMIC_MSVCRT_DLL -# define DYNAMIC_MSVCRT_DLL "msvcrt.dll" -# endif +# ifndef DYNAMIC_ICONV_DLL +# define DYNAMIC_ICONV_DLL "iconv.dll" +# define DYNAMIC_ICONV_DLL_ALT1 "libiconv.dll" +# define DYNAMIC_ICONV_DLL_ALT2 "libiconv2.dll" +# define DYNAMIC_ICONV_DLL_ALT3 "libiconv-2.dll" +# endif +# ifndef DYNAMIC_MSVCRT_DLL +# define DYNAMIC_MSVCRT_DLL "msvcrt.dll" +# endif /* * Try opening the iconv.dll and return TRUE if iconv() can be used. @@ -4983,20 +4983,20 @@ iconv_enabled(int verbose) // The iconv DLL file goes under different names, try them all. // Do the "2" version first, it's newer. -#ifdef DYNAMIC_ICONV_DLL_ALT2 +# ifdef DYNAMIC_ICONV_DLL_ALT2 if (hIconvDLL == 0) hIconvDLL = vimLoadLib(DYNAMIC_ICONV_DLL_ALT2); -#endif -#ifdef DYNAMIC_ICONV_DLL_ALT3 +# endif +# ifdef DYNAMIC_ICONV_DLL_ALT3 if (hIconvDLL == 0) hIconvDLL = vimLoadLib(DYNAMIC_ICONV_DLL_ALT3); -#endif +# endif if (hIconvDLL == 0) hIconvDLL = vimLoadLib(DYNAMIC_ICONV_DLL); -#ifdef DYNAMIC_ICONV_DLL_ALT1 +# ifdef DYNAMIC_ICONV_DLL_ALT1 if (hIconvDLL == 0) hIconvDLL = vimLoadLib(DYNAMIC_ICONV_DLL_ALT1); -#endif +# endif if (hIconvDLL != 0) hMsvcrtDLL = vimLoadLib(DYNAMIC_MSVCRT_DLL); @@ -5059,8 +5059,8 @@ iconv_end(void) hIconvDLL = 0; hMsvcrtDLL = 0; } -# endif // DYNAMIC_ICONV -# endif // USE_ICONV +# endif // DYNAMIC_ICONV +#endif // USE_ICONV #if defined(FEAT_EVAL) /* @@ -5463,7 +5463,7 @@ string_convert_ext( *lenp = (int)(d - retval); break; -# ifdef MACOS_CONVERT +#ifdef MACOS_CONVERT case CONV_MAC_LATIN1: retval = mac_string_convert(ptr, len, lenp, vcp->vc_fail, 'm', 'l', unconvlenp); @@ -5483,14 +5483,14 @@ string_convert_ext( retval = mac_string_convert(ptr, len, lenp, vcp->vc_fail, 'u', 'm', unconvlenp); break; -# endif +#endif -# ifdef USE_ICONV +#ifdef USE_ICONV case CONV_ICONV: // conversion with output_conv.vc_fd retval = iconv_string(vcp, ptr, len, unconvlenp, lenp); break; -# endif -# ifdef MSWIN +#endif +#ifdef MSWIN case CONV_CODEPAGE: // codepage -> codepage { int retlen; @@ -5549,7 +5549,7 @@ string_convert_ext( vim_free(tmp); break; } -# endif +#endif } return retval; diff --git a/src/memline.c b/src/memline.c index eeca73469f..427b64924a 100644 --- a/src/memline.c +++ b/src/memline.c @@ -516,10 +516,10 @@ ml_set_crypt_key( return; // no memfile yet, nothing to do old_method = crypt_method_nr_from_name(old_cm); -#ifdef FEAT_CRYPT +# ifdef FEAT_CRYPT if (crypt_may_close_swapfile(buf, buf->b_p_key, crypt_get_method_nr(buf))) return; -#endif +# endif // First make sure the swapfile is in a consistent state, using the old // key and method. @@ -1136,7 +1136,7 @@ add_b0_fenc( static int swapfile_process_running(ZERO_BL *b0p, char_u *swap_fname UNUSED) { -#if defined(HAVE_SYSINFO) && defined(HAVE_SYSINFO_UPTIME) +# if defined(HAVE_SYSINFO) && defined(HAVE_SYSINFO_UPTIME) stat_T st; struct sysinfo sinfo; @@ -2404,11 +2404,11 @@ recov_file_names(char_u **names, char_u *path, int prepend_dot) */ char_u *p; int i; -# ifndef MSWIN +#ifndef MSWIN int shortname = curbuf->b_shortname; curbuf->b_shortname = FALSE; -# endif +#endif num_names = 0; @@ -2449,16 +2449,16 @@ recov_file_names(char_u **names, char_u *path, int prepend_dot) else ++num_names; -# ifndef MSWIN +#ifndef MSWIN /* * Also try with 'shortname' set, in case the file is on a DOS filesystem. */ curbuf->b_shortname = TRUE; -#ifdef VMS +# ifdef VMS names[num_names] = modname(path, (char_u *)"_sw%", FALSE); -#else +# else names[num_names] = modname(path, (char_u *)".sw?", FALSE); -#endif +# endif if (names[num_names] == NULL) goto end; @@ -2473,12 +2473,12 @@ recov_file_names(char_u **names, char_u *path, int prepend_dot) vim_free(names[num_names]); else ++num_names; -# endif +#endif end: -# ifndef MSWIN +#ifndef MSWIN curbuf->b_shortname = shortname; -# endif +#endif return num_names; } @@ -5678,8 +5678,8 @@ ml_crypt_prepare(memfile_T *mfp, off_T offset, int reading) #if defined(FEAT_BYTEOFF) -#define MLCS_MAXL 800 // max no of lines in chunk -#define MLCS_MINL 400 // should be half of MLCS_MAXL +# define MLCS_MAXL 800 // max no of lines in chunk +# define MLCS_MINL 400 // should be half of MLCS_MAXL /* * Keep information for finding byte offset of a line, updtype may be one of: @@ -5822,7 +5822,7 @@ ml_updatechunk( end_idx = count - 1; linecnt += rest; } -#ifdef FEAT_PROP_POPUP +# ifdef FEAT_PROP_POPUP if (buf->b_has_textprop) { int i; @@ -5835,7 +5835,7 @@ ml_updatechunk( + (dp->db_index[i] & DB_INDEX_MASK)) + 1; } else -#endif +# endif { if (idx == 0) // first line in block, text at the end text_end = dp->db_txt_end; @@ -5995,9 +5995,9 @@ ml_find_line_or_offset(buf_T *buf, linenr_T lnum, long *offp) while ((lnum != 0 && curline < lnum) || (offset != 0 && size < offset)) { -#ifdef FEAT_PROP_POPUP +# ifdef FEAT_PROP_POPUP size_t textprop_total = 0; -#endif +# endif if (curline > buf->b_ml.ml_line_count || (hp = ml_find_line(buf, curline, ML_FIND)) == NULL) @@ -6023,7 +6023,7 @@ ml_find_line_or_offset(buf_T *buf, linenr_T lnum, long *offp) extra = 0; for (;;) { -#ifdef FEAT_PROP_POPUP +# ifdef FEAT_PROP_POPUP size_t textprop_size = 0; if (buf->b_has_textprop) @@ -6036,20 +6036,20 @@ ml_find_line_or_offset(buf_T *buf, linenr_T lnum, long *offp) : ((dp->db_index[idx - 1]) & DB_INDEX_MASK)); textprop_size = (l2 - l1) - (STRLEN(l1) + 1); } -#endif +# endif if (!(offset >= size + text_end - (int)((dp->db_index[idx]) & DB_INDEX_MASK) -#ifdef FEAT_PROP_POPUP +# ifdef FEAT_PROP_POPUP - (long)(textprop_total + textprop_size) -#endif +# endif + ffdos)) break; if (ffdos) size++; -#ifdef FEAT_PROP_POPUP +# ifdef FEAT_PROP_POPUP textprop_total += textprop_size; -#endif +# endif if (idx == count - 1) { extra = 1; @@ -6058,7 +6058,7 @@ ml_find_line_or_offset(buf_T *buf, linenr_T lnum, long *offp) idx++; } } -#ifdef FEAT_PROP_POPUP +# ifdef FEAT_PROP_POPUP if (buf->b_has_textprop && lnum != 0) { int i; @@ -6073,11 +6073,11 @@ ml_find_line_or_offset(buf_T *buf, linenr_T lnum, long *offp) } } else -#endif +# endif len = text_end - ((dp->db_index[idx]) & DB_INDEX_MASK) -#ifdef FEAT_PROP_POPUP +# ifdef FEAT_PROP_POPUP - (long)textprop_total -#endif +# endif ; size += len; if (offset != 0 && size >= offset) @@ -6089,9 +6089,9 @@ ml_find_line_or_offset(buf_T *buf, linenr_T lnum, long *offp) else *offp = offset - size + len - (text_end - ((dp->db_index[idx - 1]) & DB_INDEX_MASK)) -#ifdef FEAT_PROP_POPUP +# ifdef FEAT_PROP_POPUP + (long)textprop_total -#endif +# endif ; curline += idx - start_idx + extra; if (curline > buf->b_ml.ml_line_count) diff --git a/src/menu.c b/src/menu.c index 8b9b3af746..3c0dfca677 100644 --- a/src/menu.c +++ b/src/menu.c @@ -1787,10 +1787,10 @@ get_menu_index(vimmenu_T *menu, int state) idx = MENU_INDEX_INSERT; else if (state & MODE_CMDLINE) idx = MENU_INDEX_CMDLINE; -#ifdef FEAT_TERMINAL +# ifdef FEAT_TERMINAL else if (term_use_loop()) idx = MENU_INDEX_TERMINAL; -#endif +# endif else if (VIsual_active) { if (VIsual_select) @@ -1948,10 +1948,10 @@ menu_is_tearoff(char_u *name UNUSED) static int get_menu_mode(void) { -#ifdef FEAT_TERMINAL +# ifdef FEAT_TERMINAL if (term_use_loop()) return MENU_INDEX_TERMINAL; -#endif +# endif if (VIsual_active) { if (VIsual_select) @@ -2020,12 +2020,12 @@ show_popupmenu(void) gui_mch_show_popupmenu(menu); } # endif -# if defined(FEAT_GUI) && defined(FEAT_TERM_POPUP_MENU) +# if defined(FEAT_GUI) && defined(FEAT_TERM_POPUP_MENU) else -# endif -# if defined(FEAT_TERM_POPUP_MENU) +# endif +# if defined(FEAT_TERM_POPUP_MENU) pum_show_popupmenu(menu); -# endif +# endif } #endif @@ -2102,9 +2102,9 @@ gui_update_menus_recurse(vimmenu_T *menu, int mode) // Never hide a toplevel menu, it may make the menubar resize or // disappear. Same problem for ToolBar items. if (vim_strchr(p_go, GO_GREY) != NULL || menu->parent == NULL -# ifdef FEAT_TOOLBAR +# ifdef FEAT_TOOLBAR || menu_is_toolbar(menu->parent->name) -# endif +# endif ) gui_mch_menu_grey(menu, grey); else @@ -2271,11 +2271,11 @@ gui_add_tearoff(char_u *tearpath, int *pri_tab, int pri_idx) t = pri_tab[pri_idx + 1]; pri_tab[pri_idx + 1] = 1; -#ifdef FEAT_TOOLBAR +# ifdef FEAT_TOOLBAR menuarg.iconfile = NULL; menuarg.iconidx = -1; menuarg.icon_builtin = FALSE; -#endif +# endif menuarg.noremap[0] = REMAP_NONE; menuarg.silent[0] = TRUE; diff --git a/src/message.c b/src/message.c index e4f23c68a5..e2058f8d4d 100644 --- a/src/message.c +++ b/src/message.c @@ -2725,9 +2725,9 @@ msg_puts_display( // doesn't fit, draw a single character here. Otherwise collect // characters and draw them all at once later. if ( -# ifdef FEAT_RIGHTLEFT +#ifdef FEAT_RIGHTLEFT cmdmsg_rl || -# endif +#endif (cw > 1 && msg_col + t_col >= wrap_col)) { if (l > 1) @@ -3531,14 +3531,14 @@ do_more_prompt(int typed_char) #if defined(USE_MCH_ERRMSG) -#ifdef mch_errmsg -# undef mch_errmsg -#endif -#ifdef mch_msg -# undef mch_msg -#endif +# ifdef mch_errmsg +# undef mch_errmsg +# endif +# ifdef mch_msg +# undef mch_msg +# endif -#if defined(MSWIN) && (!defined(FEAT_GUI_MSWIN) || defined(VIMDLL)) +# if defined(MSWIN) && (!defined(FEAT_GUI_MSWIN) || defined(VIMDLL)) static void mch_errmsg_c(char *str) { @@ -3563,7 +3563,7 @@ mch_errmsg_c(char *str) fprintf(stderr, "%s", str); } } -#endif +# endif /* * Give an error message. To be used when the screen hasn't been initialized @@ -3573,46 +3573,46 @@ mch_errmsg_c(char *str) void mch_errmsg(char *str) { -#if !defined(MSWIN) || defined(FEAT_GUI_MSWIN) +# if !defined(MSWIN) || defined(FEAT_GUI_MSWIN) int len; -#endif +# endif -#if (defined(UNIX) || defined(FEAT_GUI)) && !defined(ALWAYS_USE_GUI) && !defined(VIMDLL) +# if (defined(UNIX) || defined(FEAT_GUI)) && !defined(ALWAYS_USE_GUI) && !defined(VIMDLL) // On Unix use stderr if it's a tty. // When not going to start the GUI also use stderr. // On Mac, when started from Finder, stderr is the console. if ( -# ifdef UNIX -# ifdef MACOS_X +# ifdef UNIX +# ifdef MACOS_X (isatty(2) && strcmp("/dev/console", ttyname(2)) != 0) -# else +# else isatty(2) -# endif -# ifdef FEAT_GUI +# endif +# ifdef FEAT_GUI || +# endif # endif -# endif -# ifdef FEAT_GUI +# ifdef FEAT_GUI !(gui.in_use || gui.starting) -# endif +# endif ) { fprintf(stderr, "%s", str); return; } -#endif +# endif -#if defined(MSWIN) && (!defined(FEAT_GUI_MSWIN) || defined(VIMDLL)) -# ifdef VIMDLL +# if defined(MSWIN) && (!defined(FEAT_GUI_MSWIN) || defined(VIMDLL)) +# ifdef VIMDLL if (!(gui.in_use || gui.starting)) -# endif +# endif { mch_errmsg_c(str); return; } -#endif +# endif -#if !defined(MSWIN) || defined(FEAT_GUI_MSWIN) +# if !defined(MSWIN) || defined(FEAT_GUI_MSWIN) // avoid a delay for a message that isn't there emsg_on_display = FALSE; @@ -3626,7 +3626,7 @@ mch_errmsg(char *str) { mch_memmove((char_u *)error_ga.ga_data + error_ga.ga_len, (char_u *)str, len); -# ifdef UNIX +# ifdef UNIX // remove CR characters, they are displayed { char_u *p; @@ -3640,14 +3640,14 @@ mch_errmsg(char *str) *p = ' '; } } -# endif +# endif --len; // don't count the NUL at the end error_ga.ga_len += len; } -#endif +# endif } -#if defined(MSWIN) && (!defined(FEAT_GUI_MSWIN) || defined(VIMDLL)) +# if defined(MSWIN) && (!defined(FEAT_GUI_MSWIN) || defined(VIMDLL)) static void mch_msg_c(char *str) { @@ -3672,7 +3672,7 @@ mch_msg_c(char *str) printf("%s", str); } } -#endif +# endif /* * Give a message. To be used when the screen hasn't been initialized yet. @@ -3682,44 +3682,44 @@ mch_msg_c(char *str) void mch_msg(char *str) { -#if (defined(UNIX) || defined(FEAT_GUI)) && !defined(ALWAYS_USE_GUI) && !defined(VIMDLL) +# if (defined(UNIX) || defined(FEAT_GUI)) && !defined(ALWAYS_USE_GUI) && !defined(VIMDLL) // On Unix use stdout if we have a tty. This allows "vim -h | more" and // uses mch_errmsg() when started from the desktop. // When not going to start the GUI also use stdout. // On Mac, when started from Finder, stderr is the console. if ( -# ifdef UNIX -# ifdef MACOS_X +# ifdef UNIX +# ifdef MACOS_X (isatty(2) && strcmp("/dev/console", ttyname(2)) != 0) -# else +# else isatty(2) -# endif -# ifdef FEAT_GUI +# endif +# ifdef FEAT_GUI || +# endif # endif -# endif -# ifdef FEAT_GUI +# ifdef FEAT_GUI !(gui.in_use || gui.starting) -# endif +# endif ) { printf("%s", str); return; } -#endif +# endif -#if defined(MSWIN) && (!defined(FEAT_GUI_MSWIN) || defined(VIMDLL)) -# ifdef VIMDLL +# if defined(MSWIN) && (!defined(FEAT_GUI_MSWIN) || defined(VIMDLL)) +# ifdef VIMDLL if (!(gui.in_use || gui.starting)) -# endif +# endif { mch_msg_c(str); return; } -#endif -#if !defined(MSWIN) || defined(FEAT_GUI_MSWIN) +# endif +# if !defined(MSWIN) || defined(FEAT_GUI_MSWIN) mch_errmsg(str); -#endif +# endif } #endif // USE_MCH_ERRMSG @@ -4258,13 +4258,13 @@ do_dialog( int i; tmode_T save_tmode; -#ifndef NO_CONSOLE +# ifndef NO_CONSOLE // Don't output anything in silent mode ("ex -s") if (silent_mode) return dfltbutton; // return default option -#endif +# endif -#ifdef FEAT_GUI_DIALOG +# ifdef FEAT_GUI_DIALOG // When GUI is running and 'c' not in 'guioptions', use the GUI dialog if (gui.in_use && vim_strchr(p_go, GO_CONDIALOG) == NULL) { @@ -4286,7 +4286,7 @@ do_dialog( return c; } -#endif +# endif oldState = State; State = MODE_CONFIRM; @@ -4418,14 +4418,14 @@ msg_show_console_dialog( int dfltbutton) { int len = 0; -#define HOTK_LEN (has_mbyte ? MB_MAXBYTES : 1) +# define HOTK_LEN (has_mbyte ? MB_MAXBYTES : 1) int lenhotkey = HOTK_LEN; // count first button char_u *hotk = NULL; char_u *msgp = NULL; char_u *hotkp = NULL; char_u *r; int copy; -#define HAS_HOTKEY_LEN 30 +# define HAS_HOTKEY_LEN 30 char_u has_hotkey[HAS_HOTKEY_LEN]; int first_hotkey = FALSE; // first char of button is hotkey int idx; diff --git a/src/misc1.c b/src/misc1.c index 3ef007c357..917e9d3067 100644 --- a/src/misc1.c +++ b/src/misc1.c @@ -694,14 +694,14 @@ get_mode(char_u *buf) buf[i++] = 'x'; buf[i++] = '!'; } -#ifdef FEAT_TERMINAL +# ifdef FEAT_TERMINAL else if (term_use_loop()) { if (State & MODE_CMDLINE) buf[i++] = 'c'; buf[i++] = 't'; } -#endif +# endif else if (State == MODE_HITRETURN || State == MODE_ASKMORE || State == MODE_SETWSIZE || State == MODE_CONFIRM) @@ -771,10 +771,10 @@ get_mode(char_u *buf) buf[i++] = 'i'; buf[i++] = restart_edit; } -#ifdef FEAT_TERMINAL +# ifdef FEAT_TERMINAL else if (term_in_normal_mode()) buf[i++] = 't'; -#endif +# endif } buf[i] = NUL; @@ -1532,7 +1532,7 @@ expand_env_esc( if (src[1] == '{') # else if (*src == '%') -#endif +# endif ++tail; #endif *var = NUL; @@ -2170,7 +2170,7 @@ init_users(void) lazy_init_done = TRUE; ga_init2(&ga_users, sizeof(char_u *), 20); -# if defined(HAVE_GETPWENT) && defined(HAVE_PWD_H) +#if defined(HAVE_GETPWENT) && defined(HAVE_PWD_H) { struct passwd* pw; @@ -2179,7 +2179,7 @@ init_users(void) add_user((char_u *)pw->pw_name, TRUE); endpwent(); } -# elif defined(MSWIN) +#elif defined(MSWIN) { DWORD nusers = 0, ntotal = 0, i; PUSER_INFO_0 uinfo; @@ -2193,8 +2193,8 @@ init_users(void) NetApiBufferFree(uinfo); } } -# endif -# if defined(HAVE_GETPWNAM) +#endif +#if defined(HAVE_GETPWNAM) { char_u *user_env = mch_getenv((char_u *)"USER"); @@ -2225,7 +2225,7 @@ init_users(void) } } } -# endif +#endif } /* @@ -2373,7 +2373,7 @@ fast_breakcheck(void) } } -# if defined(FEAT_SPELL) +#if defined(FEAT_SPELL) /* * Like line_breakcheck() but check 100 times less often. */ @@ -2391,12 +2391,12 @@ veryfast_breakcheck(void) #if defined(VIM_BACKTICK) || defined(FEAT_EVAL) \ || (defined(HAVE_LOCALE_H) || defined(X_LOCALE)) -#ifndef SEEK_SET -# define SEEK_SET 0 -#endif -#ifndef SEEK_END -# define SEEK_END 2 -#endif +# ifndef SEEK_SET +# define SEEK_SET 0 +# endif +# ifndef SEEK_END +# define SEEK_END 2 +# endif /* * Get the stdout of an external command. @@ -2472,9 +2472,9 @@ get_cmd_output( mch_remove(tempname); if (buffer == NULL) goto done; -#ifdef VMS +# ifdef VMS len = i; // VMS doesn't give us what we asked for... -#endif +# endif if (i != len) { semsg(_(e_cant_read_file_str), tempname); @@ -2654,7 +2654,7 @@ get_cmd_output_as_rettv( else { res = get_cmd_output(tv_get_string(&argvars[0]), infile, flags, NULL); -#ifdef USE_CRNL +# ifdef USE_CRNL // translate into if (res != NULL) { @@ -2669,7 +2669,7 @@ get_cmd_output_as_rettv( } *d = NUL; } -#endif +# endif rettv->vval.v_string = res; res = NULL; } diff --git a/src/misc2.c b/src/misc2.c index fcbf0dd1cd..2056700e4f 100644 --- a/src/misc2.c +++ b/src/misc2.c @@ -210,10 +210,10 @@ coladvance2( if (col > wcol || (!virtual_active() && one_more == 0)) { idx -= 1; -# ifdef FEAT_LINEBREAK +#ifdef FEAT_LINEBREAK // Don't count the chars from 'showbreak'. csize -= head; -# endif +#endif col -= csize; } @@ -2148,7 +2148,7 @@ cursorentry_T shape_table[SHAPE_IDX_COUNT] = * Table with names for mouse shapes. Keep in sync with all the tables for * mch_set_mouse_shape()!. */ -#define STRING_INIT(s) \ +# define STRING_INIT(s) \ {(char_u *)(s), STRLEN_LITERAL(s)} static string_T mshape_names[] = { @@ -2170,7 +2170,7 @@ static string_T mshape_names[] = STRING_INIT("up-arrow"), {NULL, 0} }; -#undef STRING_INIT +# undef STRING_INIT # define MSHAPE_NAMES_COUNT (ARRAY_LENGTH(mshape_names) - 1) # endif @@ -2204,11 +2204,11 @@ parse_shape_opt(int what) /* * Repeat for all comma separated parts. */ -#ifdef FEAT_MOUSESHAPE +# ifdef FEAT_MOUSESHAPE if (what == SHAPE_MOUSE) modep = p_mouseshape; else -#endif +# endif modep = p_guicursor; while (*modep != NUL) { @@ -2255,14 +2255,14 @@ parse_shape_opt(int what) idx = all_idx--; else if (round == 2) { -#ifdef FEAT_MOUSESHAPE +# ifdef FEAT_MOUSESHAPE if (what == SHAPE_MOUSE) { // Set the default, for the missing parts shape_table[idx].mshape = 0; } else -#endif +# endif { // Set the defaults, for the missing parts shape_table[idx].shape = SHAPE_BLOCK; @@ -2275,7 +2275,7 @@ parse_shape_opt(int what) // Parse the part after the colon for (p = colonp + 1; *p && *p != ','; ) { -#ifdef FEAT_MOUSESHAPE +# ifdef FEAT_MOUSESHAPE if (what == SHAPE_MOUSE) { for (i = 0; ; ++i) @@ -2301,7 +2301,7 @@ parse_shape_opt(int what) } } else // if (what == SHAPE_MOUSE) -#endif +# endif { /* * First handle the ones with a number argument. @@ -2395,13 +2395,13 @@ parse_shape_opt(int what) // If the 's' flag is not given, use the 'v' cursor for 's' if (!found_ve) { -#ifdef FEAT_MOUSESHAPE +# ifdef FEAT_MOUSESHAPE if (what == SHAPE_MOUSE) { shape_table[SHAPE_IDX_VE].mshape = shape_table[SHAPE_IDX_V].mshape; } else -#endif +# endif { shape_table[SHAPE_IDX_VE].shape = shape_table[SHAPE_IDX_V].shape; shape_table[SHAPE_IDX_VE].percentage = @@ -2429,22 +2429,22 @@ parse_shape_opt(int what) int get_shape_idx(int mouse) { -#ifdef FEAT_MOUSESHAPE +# ifdef FEAT_MOUSESHAPE if (mouse && (State == MODE_HITRETURN || State == MODE_ASKMORE)) { -# ifdef FEAT_GUI +# ifdef FEAT_GUI int x, y; gui_mch_getmouse(&x, &y); if (Y_2_ROW(y) == Rows - 1) return SHAPE_IDX_MOREL; -# endif +# endif return SHAPE_IDX_MORE; } if (mouse && drag_status_line) return SHAPE_IDX_SDRAG; if (mouse && drag_sep_line) return SHAPE_IDX_VDRAG; -#endif +# endif if (!mouse && State == MODE_SHOWMATCH) return SHAPE_IDX_SM; if (State & VREPLACE_FLAG) @@ -2472,7 +2472,7 @@ get_shape_idx(int mouse) } return SHAPE_IDX_N; } -#endif +# endif # if defined(FEAT_MOUSESHAPE) static int current_mouse_shape = 0; @@ -2673,7 +2673,7 @@ qsort( #if !defined(HAVE_SETENV) && !defined(HAVE_PUTENV) && !defined(PROTO) -#define EXTRASIZE 5 // increment to add to env. size +# define EXTRASIZE 5 // increment to add to env. size static int envsize = -1; // current size of environment extern char **environ; // the global which is your env. @@ -2820,18 +2820,18 @@ vimpty_getenv(const char_u *string) filewritable(char_u *fname) { int retval = 0; -#if defined(UNIX) || defined(VMS) +# if defined(UNIX) || defined(VMS) int perm = 0; -#endif +# endif -#if defined(UNIX) || defined(VMS) +# if defined(UNIX) || defined(VMS) perm = mch_getperm(fname); -#endif +# endif if ( # ifdef MSWIN mch_writable(fname) && # else -# if defined(UNIX) || defined(VMS) +# if defined(UNIX) || defined(VMS) (perm & 0222) && # endif # endif diff --git a/src/mouse.c b/src/mouse.c index 84b8808dfd..e043e1b4fc 100644 --- a/src/mouse.c +++ b/src/mouse.c @@ -1428,15 +1428,15 @@ get_pseudo_mouse_code( return (int)KE_IGNORE; // not recognized, ignore it } -# define HMT_NORMAL 1 -# define HMT_NETTERM 2 -# define HMT_DEC 4 -# define HMT_JSBTERM 8 -# define HMT_PTERM 16 -# define HMT_URXVT 32 -# define HMT_GPM 64 -# define HMT_SGR 128 -# define HMT_SGR_REL 256 +#define HMT_NORMAL 1 +#define HMT_NETTERM 2 +#define HMT_DEC 4 +#define HMT_JSBTERM 8 +#define HMT_PTERM 16 +#define HMT_URXVT 32 +#define HMT_GPM 64 +#define HMT_SGR 128 +#define HMT_SGR_REL 256 static int has_mouse_termcode = 0; void diff --git a/src/move.c b/src/move.c index 6f25c5d66b..808b57252d 100644 --- a/src/move.c +++ b/src/move.c @@ -1465,31 +1465,31 @@ textpos2screenpos( colnr_T col; int width; linenr_T lnum = pos->lnum; -#ifdef FEAT_FOLDING +# ifdef FEAT_FOLDING int is_folded; is_folded = hasFoldingWin(wp, lnum, &lnum, NULL, TRUE, NULL); -#endif +# endif row = plines_m_win(wp, wp->w_topline, lnum - 1, INT_MAX); // "row" should be the screen line where line "lnum" begins, which can // be negative if "lnum" is "w_topline" and "w_skipcol" is non-zero. row -= adjust_plines_for_skipcol(wp); -#ifdef FEAT_DIFF +# ifdef FEAT_DIFF // Add filler lines above this buffer line. row += lnum == wp->w_topline ? wp->w_topfill : diff_check_fill(wp, lnum); -#endif +# endif colnr_T off = win_col_off(wp); -#ifdef FEAT_FOLDING +# ifdef FEAT_FOLDING if (is_folded) { row += W_WINROW(wp) + 1; coloff = wp->w_wincol + 1 + off; } else -#endif +# endif { getvcol(wp, pos, &scol, &ccol, &ecol); @@ -1925,12 +1925,12 @@ scrollup( int do_sms = curwin->w_p_wrap && curwin->w_p_sms; if (do_sms -# ifdef FEAT_FOLDING +#ifdef FEAT_FOLDING || (byfold && hasAnyFolding(curwin)) -# endif -# ifdef FEAT_DIFF +#endif +#ifdef FEAT_DIFF || (curwin->w_p_diff && !curwin->w_p_wrap) -# endif +#endif ) { int width1 = curwin->w_width - curwin_col_off(); @@ -1947,19 +1947,19 @@ scrollup( // folding: count each sequence of folded lines as one logical line. for (int todo = line_count; todo > 0; --todo) { -# ifdef FEAT_DIFF +#ifdef FEAT_DIFF if (curwin->w_topfill > 0) --curwin->w_topfill; else -# endif +#endif { linenr_T lnum = curwin->w_topline; -# ifdef FEAT_FOLDING +#ifdef FEAT_FOLDING if (byfold) // for a closed fold: go to the last line in the fold (void)hasFolding(lnum, NULL, &lnum); -# endif +#endif if (lnum == curwin->w_topline && do_sms) { // 'smoothscroll': increase "w_skipcol" until it goes over @@ -1989,9 +1989,9 @@ scrollup( // approximate w_botline curwin->w_botline += lnum - curwin->w_topline; curwin->w_topline = lnum; -# ifdef FEAT_DIFF +#ifdef FEAT_DIFF curwin->w_topfill = diff_check_fill(curwin, lnum); -# endif +#endif curwin->w_skipcol = 0; if (todo > 1 && do_sms) size = linetabsize_eol(curwin, curwin->w_topline); @@ -3376,12 +3376,12 @@ do_check_cursorbind(void) // skip original window and windows with 'nocursorbind' if (curwin != old_curwin && curwin->w_p_crb) { -# ifdef FEAT_DIFF +#ifdef FEAT_DIFF if (curwin->w_p_diff) curwin->w_cursor.lnum = diff_get_corresponding_line(old_curbuf, line); else -# endif +#endif curwin->w_cursor.lnum = line; curwin->w_cursor.col = col; curwin->w_cursor.coladd = coladd; diff --git a/src/netbeans.c b/src/netbeans.c index 46e6042bc7..0f17c1b00a 100644 --- a/src/netbeans.c +++ b/src/netbeans.c @@ -211,9 +211,9 @@ netbeans_connect(char *params, int doabort) if (nb_channel != NULL) { // success -# ifdef FEAT_BEVAL_GUI +#ifdef FEAT_BEVAL_GUI bevalServers |= BEVAL_NETBEANS; -# endif +#endif // success, login vim_snprintf(buf, sizeof(buf), "AUTH %s\n", password); @@ -3046,33 +3046,33 @@ netbeans_draw_multisign_indicator(int row) int i; int y; int x; -#if GTK_CHECK_VERSION(3,0,0) +# if GTK_CHECK_VERSION(3,0,0) cairo_t *cr = NULL; -#else +# else GdkDrawable *drawable = gui.drawarea->window; -#endif +# endif if (!NETBEANS_OPEN) return; -#if GTK_CHECK_VERSION(3,0,0) +# if GTK_CHECK_VERSION(3,0,0) cr = cairo_create(gui.surface); cairo_set_source_rgba(cr, gui.fgcolor->red, gui.fgcolor->green, gui.fgcolor->blue, gui.fgcolor->alpha); -#endif +# endif x = 0; y = row * gui.char_height + 2; for (i = 0; i < gui.char_height - 3; i++) -#if GTK_CHECK_VERSION(3,0,0) +# if GTK_CHECK_VERSION(3,0,0) cairo_rectangle(cr, x+2, y++, 1, 1); -#else +# else gdk_draw_point(drawable, gui.text_gc, x+2, y++); -#endif +# endif -#if GTK_CHECK_VERSION(3,0,0) +# if GTK_CHECK_VERSION(3,0,0) cairo_rectangle(cr, x+0, y, 1, 1); cairo_rectangle(cr, x+2, y, 1, 1); cairo_rectangle(cr, x+4, y++, 1, 1); @@ -3080,7 +3080,7 @@ netbeans_draw_multisign_indicator(int row) cairo_rectangle(cr, x+2, y, 1, 1); cairo_rectangle(cr, x+3, y++, 1, 1); cairo_rectangle(cr, x+2, y, 1, 1); -#else +# else gdk_draw_point(drawable, gui.text_gc, x+0, y); gdk_draw_point(drawable, gui.text_gc, x+2, y); gdk_draw_point(drawable, gui.text_gc, x+4, y++); @@ -3088,11 +3088,11 @@ netbeans_draw_multisign_indicator(int row) gdk_draw_point(drawable, gui.text_gc, x+2, y); gdk_draw_point(drawable, gui.text_gc, x+3, y++); gdk_draw_point(drawable, gui.text_gc, x+2, y); -#endif +# endif -#if GTK_CHECK_VERSION(3,0,0) +# if GTK_CHECK_VERSION(3,0,0) cairo_destroy(cr); -#endif +# endif } #endif // FEAT_GUI_GTK diff --git a/src/normal.c b/src/normal.c index 3f32293360..1534ab3c56 100644 --- a/src/normal.c +++ b/src/normal.c @@ -1634,28 +1634,28 @@ clear_showcmd(void) top = curwin->w_cursor.lnum; bot = VIsual.lnum; } -# ifdef FEAT_FOLDING +#ifdef FEAT_FOLDING // Include closed folds as a whole. (void)hasFolding(top, &top, NULL); (void)hasFolding(bot, NULL, &bot); -# endif +#endif lines = bot - top + 1; if (VIsual_mode == Ctrl_V) { -# ifdef FEAT_LINEBREAK +#ifdef FEAT_LINEBREAK char_u *saved_sbr = p_sbr; char_u *saved_w_sbr = curwin->w_p_sbr; // Make 'sbr' empty for a moment to get the correct size. p_sbr = empty_option; curwin->w_p_sbr = empty_option; -# endif +#endif getvcols(curwin, &curwin->w_cursor, &VIsual, &leftcol, &rightcol); -# ifdef FEAT_LINEBREAK +#ifdef FEAT_LINEBREAK p_sbr = saved_sbr; curwin->w_p_sbr = saved_w_sbr; -# endif +#endif sprintf((char *)showcmd_buf, "%ldx%ld", lines, (long)(rightcol - leftcol + 1)); } @@ -5425,13 +5425,13 @@ nv_pcmark(cmdarg_T *cap) } else clearopbeep(cap->oap); -# ifdef FEAT_FOLDING +#ifdef FEAT_FOLDING if (cap->oap->op_type == OP_NOP && (pos == (pos_T *)-1 || lnum != curwin->w_cursor.lnum) && (fdo_flags & FDO_MARK) && old_KeyTyped) foldOpenCursor(); -# endif +#endif } /* @@ -5703,9 +5703,9 @@ nv_gv_cmd(cmdarg_T *cap) i = VIsual_mode; VIsual_mode = curbuf->b_visual.vi_mode; curbuf->b_visual.vi_mode = i; -# ifdef FEAT_EVAL +#ifdef FEAT_EVAL curbuf->b_visual_mode_eval = i; -# endif +#endif i = curwin->w_curswant; curwin->w_curswant = curbuf->b_visual.vi_curswant; curbuf->b_visual.vi_curswant = i; diff --git a/src/nv_cmds.h b/src/nv_cmds.h index aa68b686b5..99925f2c50 100644 --- a/src/nv_cmds.h +++ b/src/nv_cmds.h @@ -28,33 +28,33 @@ # define NVCMD(a, b, c, d) \ {a, b, c, d} -#ifdef FEAT_GUI -#define NV_VER_SCROLLBAR nv_ver_scrollbar -#define NV_HOR_SCROLLBAR nv_hor_scrollbar -#else -#define NV_VER_SCROLLBAR nv_error -#define NV_HOR_SCROLLBAR nv_error -#endif +# ifdef FEAT_GUI +# define NV_VER_SCROLLBAR nv_ver_scrollbar +# define NV_HOR_SCROLLBAR nv_hor_scrollbar +# else +# define NV_VER_SCROLLBAR nv_error +# define NV_HOR_SCROLLBAR nv_error +# endif -#ifdef FEAT_GUI_TABLINE -#define NV_TABLINE nv_tabline -#define NV_TABMENU nv_tabmenu -#else -#define NV_TABLINE nv_error -#define NV_TABMENU nv_error -#endif +# ifdef FEAT_GUI_TABLINE +# define NV_TABLINE nv_tabline +# define NV_TABMENU nv_tabmenu +# else +# define NV_TABLINE nv_error +# define NV_TABMENU nv_error +# endif -#ifdef FEAT_NETBEANS_INTG -#define NV_NBCMD nv_nbcmd -#else -#define NV_NBCMD nv_error -#endif +# ifdef FEAT_NETBEANS_INTG +# define NV_NBCMD nv_nbcmd +# else +# define NV_NBCMD nv_error +# endif -#ifdef FEAT_DND -#define NV_DROP nv_drop -#else -#define NV_DROP nv_error -#endif +# ifdef FEAT_DND +# define NV_DROP nv_drop +# else +# define NV_DROP nv_error +# endif /* * Function to be called for a Normal or Visual mode command. @@ -63,17 +63,17 @@ typedef void (*nv_func_T)(cmdarg_T *cap); // Values for cmd_flags. -#define NV_NCH 0x01 // may need to get a second char -#define NV_NCH_NOP (0x02|NV_NCH) // get second char when no operator pending -#define NV_NCH_ALW (0x04|NV_NCH) // always get a second char -#define NV_LANG 0x08 // second char needs language adjustment +# define NV_NCH 0x01 // may need to get a second char +# define NV_NCH_NOP (0x02|NV_NCH) // get second char when no operator pending +# define NV_NCH_ALW (0x04|NV_NCH) // always get a second char +# define NV_LANG 0x08 // second char needs language adjustment -#define NV_SS 0x10 // may start selection -#define NV_SSS 0x20 // may start selection with shift modifier -#define NV_STS 0x40 // may stop selection without shift modif. -#define NV_RL 0x80 // 'rightleft' modifies command -#define NV_KEEPREG 0x100 // don't clear regname -#define NV_NCW 0x200 // not allowed in command-line window +# define NV_SS 0x10 // may start selection +# define NV_SSS 0x20 // may start selection with shift modifier +# define NV_STS 0x40 // may stop selection without shift modif. +# define NV_RL 0x80 // 'rightleft' modifies command +# define NV_KEEPREG 0x100 // don't clear regname +# define NV_NCW 0x200 // not allowed in command-line window /* * Generally speaking, every Normal mode command should either clear any diff --git a/src/option.c b/src/option.c index 1ec7efbf83..e4a94e1c6e 100644 --- a/src/option.c +++ b/src/option.c @@ -73,12 +73,12 @@ static void compatible_set(void); static char *(p_bin_dep_opts[]) = {"textwidth", "wrapmargin", "modeline", "expandtab", NULL}; static char *(p_paste_dep_opts[]) = {"autoindent", "expandtab", "ruler", "showmatch", "smarttab", "softtabstop", "textwidth", "wrapmargin", -#ifdef FEAT_RIGHTLEFT +# ifdef FEAT_RIGHTLEFT "hkmap", "revins", -#endif -#ifdef FEAT_VARTABS +# endif +# ifdef FEAT_VARTABS "varsofttabstop", -#endif +# endif NULL}; static void didset_options_sctx(int opt_flags, char **buf); #endif @@ -439,13 +439,13 @@ set_init_xdg_rtp(void) options[opt_idx].def_val[VI_DEFAULT] = xdg_rtp; p_pp = xdg_rtp; -#if defined(XDG_VDIR) && defined(FEAT_SESSION) +# if defined(XDG_VDIR) && defined(FEAT_SESSION) if ((opt_idx = findoption((char_u *)"viewdir")) < 0) goto theend; options[opt_idx].def_val[VI_DEFAULT] = (char_u *)XDG_VDIR; p_vdir = (char_u *)XDG_VDIR; -#endif +# endif theend: vim_free(vimrc1); @@ -542,16 +542,16 @@ set_init_default_encoding(void) char_u *p; int opt_idx; -# if defined(MSWIN) || defined(__MVS__) +#if defined(MSWIN) || defined(__MVS__) // MS-Windows has builtin support for conversion to and from Unicode, using // "utf-8" for 'encoding' should work best for most users. // z/OS built should default to UTF-8 mode as setlocale does not respect utf-8 environment variable locales p = vim_strnsave((char_u *)ENC_DFLT, STRLEN_LITERAL(ENC_DFLT)); -# else +#else // enc_locale() will try to find the encoding of the current locale. // This works best for properly configured systems, old and new. p = enc_locale(); -# endif +#endif if (p == NULL) return; @@ -862,10 +862,10 @@ set_options_default( if (!(options[i].flags & P_NODEFAULT) && (opt_flags == 0 || (options[i].var != (char_u *)&p_enc -# if defined(FEAT_CRYPT) +#if defined(FEAT_CRYPT) && options[i].var != (char_u *)&p_cm && options[i].var != (char_u *)&p_key -# endif +#endif ))) set_option_default(i, opt_flags, p_cp); @@ -1149,20 +1149,20 @@ set_init_3(void) || fnamecmp(p, "powershell.exe") == 0 ) { -# if defined(FEAT_QUICKFIX) +# if defined(FEAT_QUICKFIX) if (do_sp) { p_sp = (char_u *)"2>&1 | Out-File -Encoding default"; options[idx_sp].def_val[VI_DEFAULT] = p_sp; } -# endif +# endif if (do_srr) { p_srr = (char_u *)"2>&1 | Out-File -Encoding default"; options[idx_srr].def_val[VI_DEFAULT] = p_srr; } } -#endif +# endif else // Always use POSIX shell style redirection if we reach this if ( fnamecmp(p, "sh") == 0 @@ -3106,33 +3106,33 @@ insecure_flag(win_T *wp, int opt_idx, int opt_flags) switch ((int)options[opt_idx].indir) { case PV_WRAP: return &wp->w_p_wrap_flags; -#ifdef FEAT_STL_OPT +# ifdef FEAT_STL_OPT case PV_STL: return &wp->w_p_stl_flags; -#endif -#ifdef FEAT_EVAL -# ifdef FEAT_FOLDING +# endif +# ifdef FEAT_EVAL +# ifdef FEAT_FOLDING case PV_FDE: return &wp->w_p_fde_flags; case PV_FDT: return &wp->w_p_fdt_flags; -# endif -# ifdef FEAT_BEVAL +# endif +# ifdef FEAT_BEVAL case PV_BEXPR: return &wp->w_buffer->b_p_bexpr_flags; -# endif +# endif case PV_INDE: return &wp->w_buffer->b_p_inde_flags; case PV_FEX: return &wp->w_buffer->b_p_fex_flags; -# ifdef FEAT_FIND_ID +# ifdef FEAT_FIND_ID case PV_INEX: return &wp->w_buffer->b_p_inex_flags; +# endif # endif -#endif } else // For global value of window-local options, use flags in w_allbuf_opt. switch ((int)options[opt_idx].indir) { case PV_WRAP: return &wp->w_allbuf_opt.wo_wrap_flags; -#if defined(FEAT_EVAL) && defined(FEAT_FOLDING) +# if defined(FEAT_EVAL) && defined(FEAT_FOLDING) case PV_FDE: return &wp->w_allbuf_opt.wo_fde_flags; case PV_FDT: return &wp->w_allbuf_opt.wo_fdt_flags; -#endif +# endif } // Nothing special, return global flags field. @@ -3337,9 +3337,9 @@ did_set_arabic(optset_T *args UNUSED) msg_source(HL_ATTR(HLF_W)); msg_attr(_(w_arabic), HL_ATTR(HLF_W)); -#ifdef FEAT_EVAL +# ifdef FEAT_EVAL set_vim_var_string(VV_WARNINGMSG, (char_u *)_(w_arabic), -1); -#endif +# endif } // set 'delcombine' @@ -3844,7 +3844,7 @@ did_set_modifiable(optset_T *args UNUSED) { // when 'modifiable' is changed, redraw the window title -# ifdef FEAT_TERMINAL +#ifdef FEAT_TERMINAL // Cannot set 'modifiable' when in Terminal mode. if (curbuf->b_p_ma && (term_in_normal_mode() || (bt_terminal(curbuf) && curbuf->b_term != NULL && !term_is_finished(curbuf)))) @@ -3852,7 +3852,7 @@ did_set_modifiable(optset_T *args UNUSED) curbuf->b_p_ma = FALSE; return e_cannot_make_terminal_with_running_job_modifiable; } -# endif +#endif redraw_titles(); return NULL; @@ -4569,10 +4569,10 @@ did_set_undofile(optset_T *args) || args->os_flags == 0) && !curbufIsChanged() && curbuf->b_ml.ml_mfp != NULL) { -#ifdef FEAT_CRYPT +# ifdef FEAT_CRYPT if (crypt_method_is_sodium(crypt_get_method_nr(curbuf))) continue; -#endif +# endif u_compute_hash(hash); u_read_undo(NULL, hash, curbuf->b_fname); } @@ -5377,12 +5377,12 @@ get_option_value( if ((char_u **)varp == &p_pt) // 'pastetoggle' *stringval = str2special_save(*(char_u **)(varp), FALSE, FALSE); -#ifdef FEAT_CRYPT +# ifdef FEAT_CRYPT // never return the value of the crypt key else if ((char_u **)varp == &curbuf->b_p_key && **(char_u **)(varp) != NUL) *stringval = vim_strnsave((char_u *)"*****", STRLEN_LITERAL("*****")); -#endif +# endif else *stringval = vim_strsave(*(char_u **)(varp)); } @@ -6486,11 +6486,11 @@ unset_global_local_option(char_u *name, void *from) case PV_AR: buf->b_p_ar = -1; break; -#ifdef HAVE_FSYNC +# ifdef HAVE_FSYNC case PV_FS: buf->b_p_fs = -1; break; -#endif +# endif case PV_BKC: clear_string_option(&buf->b_p_bkc); buf->b_bkc_flags = 0; diff --git a/src/option.h b/src/option.h index 7372ba924f..e482b86663 100644 --- a/src/option.h +++ b/src/option.h @@ -95,7 +95,7 @@ typedef enum { # ifdef VMS # define DFLT_EFM "%A%p^,%C%%CC-%t-%m,%Cat line number %l in file %f,%f|%l| %m" # else // Unix, probably -#define DFLT_EFM "%*[^\"]\"%f\"%*\\D%l: %m,\"%f\"%*\\D%l: %m,%-Gg%\\?make[%*\\d]: *** [%f:%l:%m,%-Gg%\\?make: *** [%f:%l:%m,%-G%f:%l: (Each undeclared identifier is reported only once,%-G%f:%l: for each function it appears in.),%-GIn file included from %f:%l:%c:,%-GIn file included from %f:%l:%c\\,,%-GIn file included from %f:%l:%c,%-GIn file included from %f:%l,%-G%*[ ]from %f:%l:%c,%-G%*[ ]from %f:%l:,%-G%*[ ]from %f:%l\\,,%-G%*[ ]from %f:%l,%f:%l:%c:%m,%f(%l):%m,%f:%l:%m,\"%f\"\\, line %l%*\\D%c%*[^ ] %m,%D%*\\a[%*\\d]: Entering directory %*[`']%f',%X%*\\a[%*\\d]: Leaving directory %*[`']%f',%D%*\\a: Entering directory %*[`']%f',%X%*\\a: Leaving directory %*[`']%f',%DMaking %*\\a in %f,%f|%l| %m" +# define DFLT_EFM "%*[^\"]\"%f\"%*\\D%l: %m,\"%f\"%*\\D%l: %m,%-Gg%\\?make[%*\\d]: *** [%f:%l:%m,%-Gg%\\?make: *** [%f:%l:%m,%-G%f:%l: (Each undeclared identifier is reported only once,%-G%f:%l: for each function it appears in.),%-GIn file included from %f:%l:%c:,%-GIn file included from %f:%l:%c\\,,%-GIn file included from %f:%l:%c,%-GIn file included from %f:%l,%-G%*[ ]from %f:%l:%c,%-G%*[ ]from %f:%l:,%-G%*[ ]from %f:%l\\,,%-G%*[ ]from %f:%l,%f:%l:%c:%m,%f(%l):%m,%f:%l:%m,\"%f\"\\, line %l%*\\D%c%*[^ ] %m,%D%*\\a[%*\\d]: Entering directory %*[`']%f',%X%*\\a[%*\\d]: Leaving directory %*[`']%f',%D%*\\a: Entering directory %*[`']%f',%X%*\\a: Leaving directory %*[`']%f',%DMaking %*\\a in %f,%f|%l| %m" # endif # endif # endif @@ -437,11 +437,11 @@ EXTERN char_u *p_bg; // 'background' EXTERN int p_bk; // 'backup' EXTERN char_u *p_bkc; // 'backupcopy' EXTERN unsigned bkc_flags; // flags from 'backupcopy' -# define BKC_YES 0x001 -# define BKC_AUTO 0x002 -# define BKC_NO 0x004 -# define BKC_BREAKSYMLINK 0x008 -# define BKC_BREAKHARDLINK 0x010 +#define BKC_YES 0x001 +#define BKC_AUTO 0x002 +#define BKC_NO 0x004 +#define BKC_BREAKSYMLINK 0x008 +#define BKC_BREAKHARDLINK 0x010 EXTERN char_u *p_bdir; // 'backupdir' EXTERN char_u *p_bex; // 'backupext' EXTERN char_u *p_bo; // 'belloff' @@ -680,7 +680,7 @@ EXTERN int p_guipty; // 'guipty' #endif #if defined(FEAT_GUI_GTK) || defined(FEAT_GUI_MSWIN) EXTERN char_u *p_guiligatures; // 'guiligatures' -# endif +#endif #if defined(FEAT_GUI_GTK) || defined(FEAT_GUI_X11) EXTERN long p_ghr; // 'guiheadroom' #endif @@ -718,8 +718,8 @@ EXTERN char_u *p_iconstring; // 'iconstring' EXTERN int p_ic; // 'ignorecase' #if defined(FEAT_XIM) && defined(FEAT_GUI_GTK) EXTERN char_u *p_imak; // 'imactivatekey' -#define IM_ON_THE_SPOT 0L -#define IM_OVER_THE_SPOT 1L +# define IM_ON_THE_SPOT 0L +# define IM_OVER_THE_SPOT 1L EXTERN long p_imst; // 'imstyle' #endif #if defined(FEAT_EVAL) @@ -1127,7 +1127,7 @@ EXTERN char_u *p_wop; // 'wildoptions' EXTERN long p_window; // 'window' #if defined(FEAT_GUI_MSWIN) || defined(FEAT_GUI_MOTIF) || defined(LINT) \ || defined (FEAT_GUI_GTK) || defined(FEAT_GUI_PHOTON) -#define FEAT_WAK +# define FEAT_WAK EXTERN char_u *p_wak; // 'winaltkeys' #endif EXTERN char_u *p_wig; // 'wildignore' diff --git a/src/optiondefs.h b/src/optiondefs.h index 9e56124702..70dba7601e 100644 --- a/src/optiondefs.h +++ b/src/optiondefs.h @@ -166,11 +166,11 @@ # define PV_BRI OPT_WIN(WV_BRI) # define PV_BRIOPT OPT_WIN(WV_BRIOPT) #endif -# define PV_WCR OPT_WIN(WV_WCR) +#define PV_WCR OPT_WIN(WV_WCR) #ifdef FEAT_DIFF # define PV_DIFF OPT_WIN(WV_DIFF) #endif -# define PV_EIW OPT_WIN(WV_EIW) +#define PV_EIW OPT_WIN(WV_EIW) #ifdef FEAT_FOLDING # define PV_FDC OPT_WIN(WV_FDC) # define PV_FEN OPT_WIN(WV_FEN) @@ -225,9 +225,9 @@ # define PV_STL OPT_BOTH(OPT_WIN(WV_STL)) #endif #define PV_UL OPT_BOTH(OPT_BUF(BV_UL)) -# define PV_WFB OPT_WIN(WV_WFB) -# define PV_WFH OPT_WIN(WV_WFH) -# define PV_WFW OPT_WIN(WV_WFW) +#define PV_WFB OPT_WIN(WV_WFB) +#define PV_WFH OPT_WIN(WV_WFH) +#define PV_WFW OPT_WIN(WV_WFW) #define PV_WRAP OPT_WIN(WV_WRAP) #define PV_CRBIND OPT_WIN(WV_CRBIND) #ifdef FEAT_CONCEAL @@ -310,7 +310,7 @@ struct vimoption # define ISP_LATIN1 (char_u *)"@,161-255" #endif -# define HIGHLIGHT_INIT "8:SpecialKey,~:EndOfBuffer,@:NonText,d:Directory,e:ErrorMsg,i:IncSearch,l:Search,y:CurSearch,m:MoreMsg,M:ModeMsg,n:LineNr,a:LineNrAbove,b:LineNrBelow,N:CursorLineNr,G:CursorLineSign,O:CursorLineFold,r:Question,s:StatusLine,S:StatusLineNC,c:VertSplit,t:Title,v:Visual,V:VisualNOS,w:WarningMsg,W:WildMenu,f:Folded,F:FoldColumn,A:DiffAdd,C:DiffChange,D:DiffDelete,T:DiffText,E:DiffTextAdd,>:SignColumn,-:Conceal,B:SpellBad,P:SpellCap,R:SpellRare,L:SpellLocal,+:Pmenu,=:PmenuSel,k:PmenuMatch,<:PmenuMatchSel,[:PmenuKind,]:PmenuKindSel,{:PmenuExtra,}:PmenuExtraSel,x:PmenuSbar,X:PmenuThumb,j:PmenuBorder,H:PmenuShadow,*:TabLine,#:TabLineSel,_:TabLineFill,!:CursorColumn,.:CursorLine,o:ColorColumn,q:QuickFixLine,z:StatusLineTerm,Z:StatusLineTermNC,g:MsgArea,h:ComplMatchIns,%:TabPanel,^:TabPanelSel,&:TabPanelFill,I:PreInsert" +#define HIGHLIGHT_INIT "8:SpecialKey,~:EndOfBuffer,@:NonText,d:Directory,e:ErrorMsg,i:IncSearch,l:Search,y:CurSearch,m:MoreMsg,M:ModeMsg,n:LineNr,a:LineNrAbove,b:LineNrBelow,N:CursorLineNr,G:CursorLineSign,O:CursorLineFold,r:Question,s:StatusLine,S:StatusLineNC,c:VertSplit,t:Title,v:Visual,V:VisualNOS,w:WarningMsg,W:WildMenu,f:Folded,F:FoldColumn,A:DiffAdd,C:DiffChange,D:DiffDelete,T:DiffText,E:DiffTextAdd,>:SignColumn,-:Conceal,B:SpellBad,P:SpellCap,R:SpellRare,L:SpellLocal,+:Pmenu,=:PmenuSel,k:PmenuMatch,<:PmenuMatchSel,[:PmenuKind,]:PmenuKindSel,{:PmenuExtra,}:PmenuExtraSel,x:PmenuSbar,X:PmenuThumb,j:PmenuBorder,H:PmenuShadow,*:TabLine,#:TabLineSel,_:TabLineFill,!:CursorColumn,.:CursorLine,o:ColorColumn,q:QuickFixLine,z:StatusLineTerm,Z:StatusLineTermNC,g:MsgArea,h:ComplMatchIns,%:TabPanel,^:TabPanelSel,&:TabPanelFill,I:PreInsert" // Default python version for pyx* commands #if defined(FEAT_PYTHON) && defined(FEAT_PYTHON3) @@ -1398,10 +1398,10 @@ static struct vimoption options[] = (char_u *)&p_imaf, PV_NONE, did_set_imactivatefunc, NULL, {(char_u *)"", (char_u *)NULL} -# else +#else (char_u *)NULL, PV_NONE, NULL, NULL, {(char_u *)NULL, (char_u *)0L} -# endif +#endif SCTX_INIT}, {"imactivatekey","imak",P_STRING|P_VI_DEF, #if defined(FEAT_XIM) && defined(FEAT_GUI_GTK) @@ -2312,11 +2312,11 @@ static struct vimoption options[] = #ifdef FEAT_QUICKFIX (char_u *)&p_sp, PV_NONE, NULL, NULL, { -#if defined(UNIX) +# if defined(UNIX) (char_u *)"| tee", -#else +# else (char_u *)">", -#endif +# endif (char_u *)0L} #else (char_u *)NULL, PV_NONE, NULL, NULL, @@ -2870,14 +2870,14 @@ static struct vimoption options[] = {"viminfo", "vi", P_STRING|P_ONECOMMA|P_NODUP|P_SECURE, #ifdef FEAT_VIMINFO (char_u *)&p_viminfo, PV_NONE, did_set_viminfo, NULL, -#if defined(MSWIN) +# if defined(MSWIN) {(char_u *)"", (char_u *)"'100,<50,s10,h,rA:,rB:"} -#elif defined(AMIGA) +# elif defined(AMIGA) {(char_u *)"", (char_u *)"'100,<50,s10,h,rdf0:,rdf1:,rdf2:"} -#else +# else {(char_u *)"", (char_u *)"'100,<50,s10,h"} -#endif +# endif #else (char_u *)NULL, PV_NONE, NULL, NULL, {(char_u *)0L, (char_u *)0L} diff --git a/src/optionstr.c b/src/optionstr.c index 153d2baa3f..9aead21248 100644 --- a/src/optionstr.c +++ b/src/optionstr.c @@ -51,9 +51,9 @@ static char *(p_cb_values[]) = {"unnamed", "unnamedplus", #endif #ifdef FEAT_CRYPT static char *(p_cm_values[]) = {"zip", "blowfish", "blowfish2", - # ifdef FEAT_SODIUM +# ifdef FEAT_SODIUM "xchacha20", "xchacha20v2", - # endif +# endif NULL}; #endif static char *(p_cmp_values[]) = {"internal", "keepascii", NULL}; @@ -478,7 +478,7 @@ set_string_option_direct( free_string_option(*varp); *varp = empty_option; } -# ifdef FEAT_EVAL +#ifdef FEAT_EVAL if (set_sid != SID_NONE) { sctx_T script_ctx; @@ -494,7 +494,7 @@ set_string_option_direct( } set_option_sctx_idx(idx, opt_flags, script_ctx); } -# endif +#endif } #if defined(FEAT_PROP_POPUP) || (defined(FEAT_DIFF) && defined(FEAT_FOLDING)) @@ -889,7 +889,7 @@ expand_set_opt_generic( return ret; } -# if defined(FEAT_GUI_MSWIN) || defined(FEAT_GUI_GTK) +#if defined(FEAT_GUI_MSWIN) || defined(FEAT_GUI_GTK) static garray_T *expand_cb_ga; static optexpand_T *expand_cb_args; @@ -1421,33 +1421,33 @@ expand_set_clipmethod(optexpand_T *args, int *numMatches, char_u ***matches) int result; char **values; int count, pos = 0, start = 0; -#ifdef FEAT_EVAL +# ifdef FEAT_EVAL dict_T *providers = get_vim_var_dict(VV_CLIPPROVIDERS); -#else +# else dict_T *providers = NULL; -#endif +# endif hashtab_T *ht = providers == NULL ? NULL : &providers->dv_hashtab; count = (ht == NULL ? 0 : ht->ht_used); -#ifdef FEAT_WAYLAND_CLIPBOARD +# ifdef FEAT_WAYLAND_CLIPBOARD count++; start++; -#endif -#ifdef FEAT_XCLIPBOARD +# endif +# ifdef FEAT_XCLIPBOARD count++; start++; -#endif +# endif values = ALLOC_MULT(char *, count + 1); // Add NULL terminator too if (values == NULL) return FAIL; -#ifdef FEAT_WAYLAND_CLIPBOARD +# ifdef FEAT_WAYLAND_CLIPBOARD values[pos++] = "wayland"; -#endif -#ifdef FEAT_XCLIPBOARD +# endif +# ifdef FEAT_XCLIPBOARD values[pos++] = "x11"; -#endif +# endif if (ht != NULL) for (long_u i = 0; i < ht->ht_mask + 1; i++) @@ -4035,7 +4035,7 @@ did_set_signcolumn(optset_T *args) { char_u **varp = (char_u **)args->os_varp; -#if defined(FEAT_LINEBREAK) +# if defined(FEAT_LINEBREAK) if (check_opt_strings(*varp, p_scl_values, FALSE) != OK) return e_invalid_argument; // When changing the 'signcolumn' to or from 'number', recompute the @@ -4044,7 +4044,7 @@ did_set_signcolumn(optset_T *args) || (*curwin->w_p_scl == 'n' && *(curwin->w_p_scl + 1) =='u')) && (curwin->w_p_nu || curwin->w_p_rnu)) curwin->w_nrwidth_line_count = 0; -#endif +# endif return NULL; } diff --git a/src/os_amiga.c b/src/os_amiga.c index 5655772aac..546ebabc76 100644 --- a/src/os_amiga.c +++ b/src/os_amiga.c @@ -1094,21 +1094,21 @@ mch_get_shellsize(void) mch_get_shellsize(void) { struct ConUnit *conUnit; -#ifndef __amigaos4__ +# ifndef __amigaos4__ char id_a[sizeof(struct InfoData) + 3]; -#endif +# endif struct InfoData *id=0; if (!term_console) // not an amiga window goto out; // insure longword alignment -#ifdef __amigaos4__ +# ifdef __amigaos4__ if (!(id = AllocDosObject(DOS_INFODATA, 0))) goto out; -#else +# else id = (struct InfoData *)(((long)id_a + 3L) & ~3L); -#endif +# endif /* * Should make console aware of real window size, not the one we set. @@ -1149,9 +1149,9 @@ mch_get_shellsize(void) return OK; out: -#ifdef __amigaos4__ +# ifdef __amigaos4__ FreeDosObject(DOS_INFODATA, id); // Safe to pass NULL -#endif +# endif return FAIL; } @@ -1208,7 +1208,7 @@ out_num(long n) //#include //#include -#include +# include /* * Function - dos_packet written by Phil Lindsay, Carolyn Scheppner, and Andy @@ -1492,7 +1492,7 @@ mch_breakcheck(int force UNUSED) // is zero). Since we want to check for our own ^C's #ifdef _DCC -#define Chk_Abort chkabort +# define Chk_Abort chkabort #endif #ifdef LATTICE @@ -1684,11 +1684,11 @@ mch_has_wildcard(char_u *p) ++p; else if (vim_strchr((char_u *) -# ifdef VIM_BACKTICK +#ifdef VIM_BACKTICK "*?[(#$`" -# else +#else "*?[(#$" -# endif +#endif , *p) != NULL || (*p == '~' && p[1] != NUL)) return TRUE; diff --git a/src/os_amiga.h b/src/os_amiga.h index af64752b04..ec65861b85 100644 --- a/src/os_amiga.h +++ b/src/os_amiga.h @@ -165,7 +165,7 @@ typedef long off_t; #ifdef FEAT_VIMINFO # ifndef VIMINFO_FILE -# define VIMINFO_FILE "VIM:.viminfo" +# define VIMINFO_FILE "VIM:.viminfo" # endif #endif diff --git a/src/os_mac_conv.c b/src/os_mac_conv.c index 0938b084b1..c9b349ca26 100644 --- a/src/os_mac_conv.c +++ b/src/os_mac_conv.c @@ -576,13 +576,13 @@ mac_lang_init(void) if (strcasestr(buf, "utf-8") == NULL) strcat(buf, ".UTF-8"); vim_setenv((char_u *)"LANG", (char_u *)buf); -# ifdef HAVE_LOCALE_H +#ifdef HAVE_LOCALE_H setlocale(LC_ALL, ""); -# endif -# if defined(LC_NUMERIC) +#endif +#if defined(LC_NUMERIC) // Make sure strtod() uses a decimal point, not a comma. setlocale(LC_NUMERIC, "C"); -# endif +#endif } } #endif // MACOS_CONVERT diff --git a/src/os_mswin.c b/src/os_mswin.c index 0869772e7a..9c2db64d6a 100644 --- a/src/os_mswin.c +++ b/src/os_mswin.c @@ -2645,7 +2645,7 @@ struct charset_pair BYTE charset; }; -#define STRING_INIT(s) \ +# define STRING_INIT(s) \ {(char_u *)(s), STRLEN_LITERAL(s)} static struct charset_pair charset_pairs[] = @@ -2699,7 +2699,7 @@ quality_pairs[] = { # endif {STRING_INIT("DEFAULT"), DEFAULT_QUALITY} }; -#undef STRING_INIT +# undef STRING_INIT /* * Convert a charset ID to a name. @@ -2739,7 +2739,7 @@ quality_id2name(DWORD id) // The default font height in 100% scaling (96dpi). // (-16 in 96dpi equates to roughly 12pt) -#define DEFAULT_FONT_HEIGHT (-16) +# define DEFAULT_FONT_HEIGHT (-16) static const LOGFONTW s_lfDefault = { diff --git a/src/os_qnx.c b/src/os_qnx.c index e62474c6d6..c0a51c025a 100644 --- a/src/os_qnx.c +++ b/src/os_qnx.c @@ -33,8 +33,8 @@ void qnx_init(void) #if defined(FEAT_GUI_PHOTON) && defined(FEAT_CLIPBOARD) -#define CLIP_TYPE_VIM "VIMTYPE" -#define CLIP_TYPE_TEXT "TEXT" +# define CLIP_TYPE_VIM "VIMTYPE" +# define CLIP_TYPE_TEXT "TEXT" // Turn on the clipboard for a console vim when photon is running void qnx_clip_init(void) diff --git a/src/os_unix.c b/src/os_unix.c index 31e7fd4f48..1bc05b41d6 100644 --- a/src/os_unix.c +++ b/src/os_unix.c @@ -201,8 +201,8 @@ typedef struct { ss_msg_T cmd_msgs[SOCKET_SERVER_MAX_MSG]; // Array of messages } ss_cmd_T; -#define SS_CMD_INFO_SIZE (sizeof(char_u) + (sizeof(uint32_t) * 2)) -#define SS_MSG_INFO_SIZE (sizeof(char_u) + sizeof(uint32_t)) +# define SS_CMD_INFO_SIZE (sizeof(char_u) + (sizeof(uint32_t) * 2)) +# define SS_MSG_INFO_SIZE (sizeof(char_u) + sizeof(uint32_t)) // Represents a pending reply from a command sent to a Vim server. When a // command is sent out, we generate unique serial number with it. When we @@ -903,10 +903,10 @@ check_stack_growth(char *p) #if defined(HAVE_STACK_LIMIT) static char *stack_limit = NULL; -#if defined(_THREAD_SAFE) && defined(HAVE_PTHREAD_NP_H) -# include -# include -#endif +# if defined(_THREAD_SAFE) && defined(HAVE_PTHREAD_NP_H) +# include +# include +# endif /* * Find out until how var the stack can grow without getting into trouble. @@ -924,13 +924,13 @@ get_stack_limit(void) // limit doesn't fit in a long (rlim_cur might be "long long"). if (getrlimit(RLIMIT_STACK, &rlp) == 0 && rlp.rlim_cur < ((rlim_t)1 << (sizeof(long_u) * 8 - 1)) -# ifdef RLIM_INFINITY +# ifdef RLIM_INFINITY && rlp.rlim_cur != RLIM_INFINITY -# endif +# endif ) { lim = (long)rlp.rlim_cur; -#if defined(_THREAD_SAFE) && defined(HAVE_PTHREAD_NP_H) +# if defined(_THREAD_SAFE) && defined(HAVE_PTHREAD_NP_H) { pthread_attr_t attr; size_t size; @@ -946,7 +946,7 @@ get_stack_limit(void) } pthread_attr_destroy(&attr); } -#endif +# endif if (stack_grows_downwards) { stack_limit = (char *)((long)&i - (lim / 16L * 15L)); @@ -1077,11 +1077,11 @@ sig_tstp SIGDEFARG(sigarg) else got_tstp = TRUE; -#if !defined(__ANDROID__) && !defined(__OpenBSD__) && !defined(__DragonFly__) +# if !defined(__ANDROID__) && !defined(__OpenBSD__) && !defined(__DragonFly__) // This is not required on all systems. On some systems (at least Android, // OpenBSD, and DragonFlyBSD) this breaks suspending with CTRL-Z. mch_signal(SIGTSTP, sig_tstp); -#endif +# endif } #endif @@ -1445,20 +1445,20 @@ loose_clipboard(void) { if (clip_star.owned || clip_plus.owned) { -#ifdef FEAT_X11 +# ifdef FEAT_X11 x11_export_final_selection(); -#endif +# endif if (clip_star.owned) clip_lose_selection(&clip_star); if (clip_plus.owned) clip_lose_selection(&clip_plus); -#ifdef FEAT_X11 +# ifdef FEAT_X11 if (x11_display != NULL) XFlush(x11_display); -#endif +# endif } } -#endif +# endif # if defined(USE_SYSTEM) && (defined(FEAT_X11) || defined(FEAT_WAYLAND_CLIPBOARD)) /* @@ -1849,9 +1849,9 @@ x_error_handler(Display *dpy, XErrorEvent *error_event) // like the best alternative. Do preserve files, in case we crash. ml_sync_all(FALSE, FALSE); -#ifdef FEAT_GUI +# ifdef FEAT_GUI if (!gui.in_use) -#endif +# endif msg((char *)IObuff); return 0; // NOTREACHED @@ -1877,10 +1877,10 @@ x_connect_to_server(void) if (exiting || v_dying) return FALSE; -#if defined(FEAT_CLIENTSERVER) +# if defined(FEAT_CLIENTSERVER) if (x_force_connect) return TRUE; -#endif +# endif if (x_no_connect) return FALSE; @@ -1899,8 +1899,8 @@ x_connect_to_server(void) return TRUE; } -#if defined(FEAT_X11) && defined(FEAT_XCLIPBOARD) -# if defined(USING_SETJMP) +# if defined(FEAT_X11) && defined(FEAT_XCLIPBOARD) +# if defined(USING_SETJMP) /* * An X IO Error handler, used to catch error while opening the display. */ @@ -1909,11 +1909,11 @@ x_IOerror_check(Display *dpy UNUSED) { // This function should not return, it causes exit(). Longjump instead. LONGJMP(lc_jump_env, 1); -# if defined(VMS) || defined(__CYGWIN__) +# if defined(VMS) || defined(__CYGWIN__) return 0; // avoid the compiler complains about missing return value -# endif +# endif } -# endif +# endif /* * An X IO Error handler, used to catch terminal errors. @@ -1931,9 +1931,9 @@ x_IOerror_handler(Display *dpy UNUSED) // This function should not return, it causes exit(). Longjump instead. LONGJMP(x_jump_env, 1); -# if defined(VMS) || defined(__CYGWIN__) +# if defined(VMS) || defined(__CYGWIN__) return 0; // avoid the compiler complains about missing return value -# endif +# endif } /* @@ -1949,7 +1949,7 @@ may_restore_x11_clipboard(void) { --xterm_dpy_retry_count; -# ifndef LESSTIF_VERSION +# ifndef LESSTIF_VERSION // This has been reported to avoid Vim getting stuck. if (app_context != (XtAppContext)NULL) { @@ -1957,7 +1957,7 @@ may_restore_x11_clipboard(void) app_context = (XtAppContext)NULL; x11_display = NULL; // freed by XtDestroyApplicationContext() } -# endif +# endif setup_term_clip(); get_x11_title(FALSE); @@ -1985,7 +1985,7 @@ ex_xrestore(exarg_T *eap) may_restore_x11_clipboard(); choose_clipmethod(); } -#endif +# endif /* * Test if "dpy" and x11_window are valid by getting the window title. @@ -2029,10 +2029,10 @@ get_x11_windis(void) { char *winid; static int result = -1; -#define XD_NONE 0 // x11_display not set here -#define XD_HERE 1 // x11_display opened here -#define XD_GUI 2 // x11_display used from gui.dpy -#define XD_XTERM 3 // x11_display used from xterm_dpy +# define XD_NONE 0 // x11_display not set here +# define XD_HERE 1 // x11_display opened here +# define XD_GUI 2 // x11_display used from gui.dpy +# define XD_XTERM 3 // x11_display used from xterm_dpy static int x11_display_from = XD_NONE; static int did_set_error_handler = FALSE; @@ -2043,7 +2043,7 @@ get_x11_windis(void) did_set_error_handler = TRUE; } -#if defined(FEAT_GUI_X11) || defined(FEAT_GUI_GTK) +# if defined(FEAT_GUI_X11) || defined(FEAT_GUI_GTK) if (gui.in_use) { /* @@ -2070,7 +2070,7 @@ get_x11_windis(void) x11_display = NULL; x11_display_from = XD_NONE; } -#endif +# endif // When started with the "-X" argument, don't try connecting. if (!x_connect_to_server()) @@ -2085,7 +2085,7 @@ get_x11_windis(void) if (x11_window == 0 && (winid = getenv("WINDOWID")) != NULL) x11_window = (Window)atol(winid); -#ifdef FEAT_XCLIPBOARD +# ifdef FEAT_XCLIPBOARD if (xterm_dpy == x11_display) // x11_display may have been set to xterm_dpy elsewhere x11_display_from = XD_XTERM; @@ -2115,7 +2115,7 @@ get_x11_windis(void) } return OK; } -#endif +# endif if (x11_window == 0 || x11_display == NULL) result = -1; @@ -2125,17 +2125,17 @@ get_x11_windis(void) if (x11_window != 0 && x11_display == NULL) { -#ifdef SET_SIG_ALARM +# ifdef SET_SIG_ALARM sighandler_T sig_save; -#endif -#ifdef ELAPSED_FUNC +# endif +# ifdef ELAPSED_FUNC elapsed_T start_tv; if (p_verbose > 0) ELAPSED_INIT(start_tv); -#endif +# endif -#ifdef SET_SIG_ALARM +# ifdef SET_SIG_ALARM /* * Opening the Display may hang if the DISPLAY setting is wrong, or * the network connection is bad. Set an alarm timer to get out. @@ -2143,15 +2143,15 @@ get_x11_windis(void) sig_alarm_called = FALSE; sig_save = mch_signal(SIGALRM, sig_alarm); alarm(2); -#endif +# endif x11_display = XOpenDisplay(NULL); -#ifdef SET_SIG_ALARM +# ifdef SET_SIG_ALARM alarm(0); mch_signal(SIGALRM, sig_save); if (p_verbose > 0 && sig_alarm_called) verb_msg(_("Opening the X display timed out")); -#endif +# endif if (x11_display != NULL) { # ifdef ELAPSED_FUNC @@ -2315,11 +2315,11 @@ get_x11_thing( // systems X_HAVE_UTF8_STRING may be defined in a header file but // Xutf8SetWMProperties() is not in the X11 library. Configure checks for // that and defines HAVE_XUTF8SETWMPROPERTIES. -#if defined(X_HAVE_UTF8_STRING) -# if X_HAVE_UTF8_STRING && HAVE_XUTF8SETWMPROPERTIES -# define USE_UTF8_STRING +# if defined(X_HAVE_UTF8_STRING) +# if X_HAVE_UTF8_STRING && HAVE_XUTF8SETWMPROPERTIES +# define USE_UTF8_STRING +# endif # endif -#endif /* * Set x11 Window Title @@ -2332,18 +2332,18 @@ set_x11_title(char_u *title) // XmbSetWMProperties() and Xutf8SetWMProperties() should use a STRING // when possible, COMPOUND_TEXT otherwise. COMPOUND_TEXT isn't // supported everywhere and STRING doesn't work for multi-byte titles. -#ifdef USE_UTF8_STRING +# ifdef USE_UTF8_STRING if (enc_utf8) Xutf8SetWMProperties(x11_display, x11_window, (const char *)title, NULL, NULL, 0, NULL, NULL, NULL); else -#endif +# endif { -#if XtSpecificationRelease >= 4 -# ifdef FEAT_XFONTSET +# if XtSpecificationRelease >= 4 +# ifdef FEAT_XFONTSET XmbSetWMProperties(x11_display, x11_window, (const char *)title, NULL, NULL, 0, NULL, NULL, NULL); -# else +# else XTextProperty text_prop; char *c_title = (char *)title; @@ -2351,10 +2351,10 @@ set_x11_title(char_u *title) (void)XStringListToTextProperty(&c_title, 1, &text_prop); XSetWMProperties(x11_display, x11_window, &text_prop, NULL, NULL, 0, NULL, NULL, NULL); -# endif -#else +# endif +# else XStoreName(x11_display, x11_window, (char *)title); -#endif +# endif } XFlush(x11_display); } @@ -2368,28 +2368,28 @@ set_x11_title(char_u *title) set_x11_icon(char_u *icon) { // See above for comments about using X*SetWMProperties(). -#ifdef USE_UTF8_STRING +# ifdef USE_UTF8_STRING if (enc_utf8) Xutf8SetWMProperties(x11_display, x11_window, NULL, (const char *)icon, NULL, 0, NULL, NULL, NULL); else -#endif +# endif { -#if XtSpecificationRelease >= 4 -# ifdef FEAT_XFONTSET +# if XtSpecificationRelease >= 4 +# ifdef FEAT_XFONTSET XmbSetWMProperties(x11_display, x11_window, NULL, (const char *)icon, NULL, 0, NULL, NULL, NULL); -# else +# else XTextProperty text_prop; char *c_icon = (char *)icon; (void)XStringListToTextProperty(&c_icon, 1, &text_prop); XSetWMProperties(x11_display, x11_window, NULL, &text_prop, NULL, 0, NULL, NULL, NULL); -# endif -#else +# endif +# else XSetIconName(x11_display, x11_window, (char *)icon); -#endif +# endif } XFlush(x11_display); } @@ -3115,7 +3115,7 @@ typedef struct vim_acl_solaris_T { } vim_acl_solaris_T; # endif -#if defined(HAVE_SELINUX) +# if defined(HAVE_SELINUX) /* * Copy security info from "from_file" to "to_file". */ @@ -3169,9 +3169,9 @@ mch_copy_sec(char_u *from_file, char_u *to_file) freecon(to_context); freecon(from_context); } -#endif // HAVE_SELINUX +# endif // HAVE_SELINUX -#if defined(HAVE_SMACK) && !defined(PROTO) +# if defined(HAVE_SMACK) && !defined(PROTO) /* * Copy security info from "from_file" to "to_file". */ @@ -3249,9 +3249,9 @@ mch_copy_sec(char_u *from_file, char_u *to_file) } } } -#endif // HAVE_SMACK +# endif // HAVE_SMACK -#if defined(FEAT_XATTR) +# if defined(FEAT_XATTR) /* * Copy extended attributes from_file to to_file */ @@ -3340,7 +3340,7 @@ error_exit: if (errmsg != NULL) emsg(_(errmsg)); } -#endif +# endif /* * Return a pointer to the ACL of file "fname" in allocated memory. @@ -3350,17 +3350,17 @@ error_exit: mch_get_acl(char_u *fname UNUSED) { vim_acl_T ret = NULL; -#ifdef HAVE_POSIX_ACL +# ifdef HAVE_POSIX_ACL ret = (vim_acl_T)acl_get_file((char *)fname, ACL_TYPE_ACCESS); -#else -#ifdef HAVE_SOLARIS_ZFS_ACL +# else +# ifdef HAVE_SOLARIS_ZFS_ACL acl_t *aclent; if (acl_get((char *)fname, 0, &aclent) < 0) return NULL; ret = (vim_acl_T)aclent; -#else -#ifdef HAVE_SOLARIS_ACL +# else +# ifdef HAVE_SOLARIS_ACL vim_acl_solaris_T *aclent; aclent = malloc(sizeof(vim_acl_solaris_T)); @@ -3384,8 +3384,8 @@ mch_get_acl(char_u *fname UNUSED) return NULL; } ret = (vim_acl_T)aclent; -#else -#if defined(HAVE_AIX_ACL) +# else +# if defined(HAVE_AIX_ACL) int aclsize; struct acl *aclent; @@ -3412,10 +3412,10 @@ mch_get_acl(char_u *fname UNUSED) } } ret = (vim_acl_T)aclent; -#endif // HAVE_AIX_ACL -#endif // HAVE_SOLARIS_ACL -#endif // HAVE_SOLARIS_ZFS_ACL -#endif // HAVE_POSIX_ACL +# endif // HAVE_AIX_ACL +# endif // HAVE_SOLARIS_ACL +# endif // HAVE_SOLARIS_ZFS_ACL +# endif // HAVE_POSIX_ACL return ret; } @@ -3427,22 +3427,22 @@ mch_set_acl(char_u *fname UNUSED, vim_acl_T aclent) { if (aclent == NULL) return; -#ifdef HAVE_POSIX_ACL +# ifdef HAVE_POSIX_ACL acl_set_file((char *)fname, ACL_TYPE_ACCESS, (acl_t)aclent); -#else -#ifdef HAVE_SOLARIS_ZFS_ACL +# else +# ifdef HAVE_SOLARIS_ZFS_ACL acl_set((char *)fname, (acl_t *)aclent); -#else -#ifdef HAVE_SOLARIS_ACL +# else +# ifdef HAVE_SOLARIS_ACL acl((char *)fname, SETACL, ((vim_acl_solaris_T *)aclent)->acl_cnt, ((vim_acl_solaris_T *)aclent)->acl_entry); -#else -#ifdef HAVE_AIX_ACL +# else +# ifdef HAVE_AIX_ACL chacl((char *)fname, aclent, ((struct acl *)aclent)->acl_len); -#endif // HAVE_AIX_ACL -#endif // HAVE_SOLARIS_ACL -#endif // HAVE_SOLARIS_ZFS_ACL -#endif // HAVE_POSIX_ACL +# endif // HAVE_AIX_ACL +# endif // HAVE_SOLARIS_ACL +# endif // HAVE_SOLARIS_ZFS_ACL +# endif // HAVE_POSIX_ACL } void @@ -3450,22 +3450,22 @@ mch_free_acl(vim_acl_T aclent) { if (aclent == NULL) return; -#ifdef HAVE_POSIX_ACL +# ifdef HAVE_POSIX_ACL acl_free((acl_t)aclent); -#else -#ifdef HAVE_SOLARIS_ZFS_ACL +# else +# ifdef HAVE_SOLARIS_ZFS_ACL acl_free((acl_t *)aclent); -#else -#ifdef HAVE_SOLARIS_ACL +# else +# ifdef HAVE_SOLARIS_ACL free(((vim_acl_solaris_T *)aclent)->acl_entry); free(aclent); -#else -#ifdef HAVE_AIX_ACL +# else +# ifdef HAVE_AIX_ACL free(aclent); -#endif // HAVE_AIX_ACL -#endif // HAVE_SOLARIS_ACL -#endif // HAVE_SOLARIS_ZFS_ACL -#endif // HAVE_POSIX_ACL +# endif // HAVE_AIX_ACL +# endif // HAVE_SOLARIS_ACL +# endif // HAVE_SOLARIS_ZFS_ACL +# endif // HAVE_POSIX_ACL } #endif @@ -3877,7 +3877,7 @@ get_tty_fd(int fd) { int tty_fd = fd; -#if defined(HAVE_SVR4_PTYS) && defined(SUN_SYSTEM) +# if defined(HAVE_SVR4_PTYS) && defined(SUN_SYSTEM) // On SunOS: Get the terminal parameters from "fd", or the slave device of // "fd" when it is a master device. if (mch_isatty(fd) > 1) @@ -3892,7 +3892,7 @@ get_tty_fd(int fd) if (tty_fd < 0) return -1; } -#endif +# endif return tty_fd; } @@ -3906,16 +3906,16 @@ mch_tcgetattr(int fd, void *term) if (tty_fd < 0) return -1; -#ifdef NEW_TTY_SYSTEM -# ifdef HAVE_TERMIOS_H +# ifdef NEW_TTY_SYSTEM +# ifdef HAVE_TERMIOS_H retval = tcgetattr(tty_fd, (struct termios *)term); -# else +# else retval = ioctl(tty_fd, TCGETA, (struct termio *)term); -# endif -#else +# endif +# else // for "old" tty systems retval = ioctl(tty_fd, TIOCGETP, (struct sgttyb *)term); -#endif +# endif if (tty_fd != fd) close(tty_fd); return retval; @@ -3926,14 +3926,14 @@ mch_settmode(tmode_T tmode) { static int first = TRUE; -#ifdef NEW_TTY_SYSTEM -# ifdef HAVE_TERMIOS_H +# ifdef NEW_TTY_SYSTEM +# ifdef HAVE_TERMIOS_H static struct termios told; struct termios tnew; -# else +# else static struct termio told; struct termio tnew; -# endif +# endif if (first) { @@ -3949,23 +3949,23 @@ mch_settmode(tmode_T tmode) tnew.c_iflag &= ~(ICRNL | (T_XON == NULL || *T_XON == NUL ? IXON : 0)); tnew.c_lflag &= ~(ICANON | ECHO | ISIG | ECHOE -# if defined(IEXTEN) +# if defined(IEXTEN) | IEXTEN // IEXTEN enables typing ^V on SOLARIS -# endif +# endif ); -# ifdef ONLCR +# ifdef ONLCR // Don't map NL -> CR NL, we do it ourselves. // Also disable expanding tabs if possible. -# ifdef XTABS +# ifdef XTABS tnew.c_oflag &= ~(ONLCR | XTABS); -# else -# ifdef TAB3 - tnew.c_oflag &= ~(ONLCR | TAB3); # else +# ifdef TAB3 + tnew.c_oflag &= ~(ONLCR | TAB3); +# else tnew.c_oflag &= ~ONLCR; +# endif # endif # endif -# endif tnew.c_cc[VMIN] = 1; // return after 1 char tnew.c_cc[VTIME] = 0; // don't wait } @@ -3978,7 +3978,7 @@ mch_settmode(tmode_T tmode) tnew.c_cc[VTIME] = 0; // don't wait } -# if defined(HAVE_TERMIOS_H) +# if defined(HAVE_TERMIOS_H) { int n = 10; @@ -3988,17 +3988,17 @@ mch_settmode(tmode_T tmode) && errno == EINTR && n > 0) --n; } -# else +# else ioctl(read_cmd_fd, TCSETA, &tnew); -# endif +# endif -#else +# else /* * for "old" tty systems */ -# ifndef TIOCSETN -# define TIOCSETN TIOCSETP // for hpux 9.0 -# endif +# ifndef TIOCSETN +# define TIOCSETN TIOCSETP // for hpux 9.0 +# endif static struct sgttyb ttybold; struct sgttyb ttybnew; @@ -4017,7 +4017,7 @@ mch_settmode(tmode_T tmode) else if (tmode == TMODE_SLEEP) ttybnew.sg_flags &= ~(ECHO); ioctl(read_cmd_fd, TIOCSETN, &ttybnew); -#endif +# endif mch_cur_tmode = tmode; } @@ -4058,12 +4058,12 @@ get_stty(void) int get_tty_info(int fd, ttyinfo_T *info) { -#ifdef NEW_TTY_SYSTEM -# ifdef HAVE_TERMIOS_H +# ifdef NEW_TTY_SYSTEM +# ifdef HAVE_TERMIOS_H struct termios keys; -# else +# else struct termio keys; -# endif +# endif if (mch_tcgetattr(fd, &keys) != -1) { @@ -4079,7 +4079,7 @@ get_tty_info(int fd, ttyinfo_T *info) info->nl_does_cr = FALSE; return OK; } -#else +# else // for "old" tty systems struct sgttyb keys; @@ -4091,7 +4091,7 @@ get_tty_info(int fd, ttyinfo_T *info) info->nl_does_cr = TRUE; return OK; } -#endif +# endif return FAIL; } @@ -4280,14 +4280,14 @@ mch_bevalterm_changed(void) void check_mouse_termcode(void) { -# ifdef FEAT_MOUSE_XTERM +#ifdef FEAT_MOUSE_XTERM if (use_xterm_mouse() # ifdef FEAT_MOUSE_URXVT && use_xterm_mouse() != 3 # endif -# ifdef FEAT_GUI +# ifdef FEAT_GUI && !gui.in_use -# endif +# endif ) { set_mouse_termcode(KS_MOUSE, (char_u *)(term_is_8bit(T_NAME) @@ -4302,81 +4302,81 @@ check_mouse_termcode(void) } else del_mouse_termcode(KS_MOUSE); -# endif +#endif -# ifdef FEAT_MOUSE_GPM +#ifdef FEAT_MOUSE_GPM if (!use_xterm_mouse() -# ifdef FEAT_GUI +# ifdef FEAT_GUI && !gui.in_use -# endif +# endif ) set_mouse_termcode(KS_GPM_MOUSE, (char_u *)"\033MG"); else del_mouse_termcode(KS_GPM_MOUSE); -# endif +#endif -# ifdef FEAT_SYSMOUSE +#ifdef FEAT_SYSMOUSE if (!use_xterm_mouse() -# ifdef FEAT_GUI +# ifdef FEAT_GUI && !gui.in_use -# endif +# endif ) set_mouse_termcode(KS_MOUSE, (char_u *)"\033MS"); -# endif +#endif -# ifdef FEAT_MOUSE_JSB +#ifdef FEAT_MOUSE_JSB // Conflicts with xterm mouse: "\033[" and "\033[M" ??? if (!use_xterm_mouse() -# ifdef FEAT_GUI +# ifdef FEAT_GUI && !gui.in_use -# endif +# endif ) set_mouse_termcode(KS_JSBTERM_MOUSE, (char_u *)"\033[0~zw"); else del_mouse_termcode(KS_JSBTERM_MOUSE); -# endif +#endif -# ifdef FEAT_MOUSE_NET +#ifdef FEAT_MOUSE_NET // 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() -# ifdef FEAT_GUI +# ifdef FEAT_GUI && !gui.in_use -# endif +# endif ) set_mouse_termcode(KS_NETTERM_MOUSE, (char_u *)"\033}"); else del_mouse_termcode(KS_NETTERM_MOUSE); -# endif +#endif -# ifdef FEAT_MOUSE_DEC +#ifdef FEAT_MOUSE_DEC // Conflicts with xterm mouse: "\033[" and "\033[M" if (!use_xterm_mouse() -# ifdef FEAT_GUI +# ifdef FEAT_GUI && !gui.in_use -# endif +# endif ) set_mouse_termcode(KS_DEC_MOUSE, (char_u *)(term_is_8bit(T_NAME) ? "\233" : "\033[")); else del_mouse_termcode(KS_DEC_MOUSE); -# endif -# ifdef FEAT_MOUSE_PTERM +#endif +#ifdef FEAT_MOUSE_PTERM // same conflict as the dec mouse if (!use_xterm_mouse() -# ifdef FEAT_GUI +# ifdef FEAT_GUI && !gui.in_use -# endif +# endif ) set_mouse_termcode(KS_PTERM_MOUSE, (char_u *)"\033["); else del_mouse_termcode(KS_PTERM_MOUSE); -# endif -# ifdef FEAT_MOUSE_URXVT +#endif +#ifdef FEAT_MOUSE_URXVT if (use_xterm_mouse() == 3 -# ifdef FEAT_GUI +# ifdef FEAT_GUI && !gui.in_use -# endif +# endif ) { set_mouse_termcode(KS_URXVT_MOUSE, (char_u *)(term_is_8bit(T_NAME) @@ -4390,11 +4390,11 @@ check_mouse_termcode(void) } else del_mouse_termcode(KS_URXVT_MOUSE); -# endif +#endif if (use_xterm_mouse() == 4 -# ifdef FEAT_GUI +#ifdef FEAT_GUI && !gui.in_use -# endif +#endif ) { set_mouse_termcode(KS_SGR_MOUSE, (char_u *)(term_is_8bit(T_NAME) @@ -4469,9 +4469,9 @@ mch_get_shellsize(void) { columns = ts.ts_cols; rows = ts.ts_lines; -# ifdef FEAT_EVAL +# ifdef FEAT_EVAL ch_log(NULL, "Got size with TIOCGSIZE: %ld x %ld", columns, rows); -# endif +# endif } } # endif // TIOCGSIZE @@ -4487,31 +4487,31 @@ mch_get_shellsize(void) if ((p = (char_u *)getenv("LINES"))) { rows = atoi((char *)p); -# ifdef FEAT_EVAL +# ifdef FEAT_EVAL ch_log(NULL, "Got 'lines' from $LINES: %ld", rows); -# endif +# endif } if ((p = (char_u *)getenv("COLUMNS"))) { columns = atoi((char *)p); -# ifdef FEAT_EVAL +# ifdef FEAT_EVAL ch_log(NULL, "Got 'columns' from $COLUMNS: %ld", columns); -# endif +# endif } } -#ifdef HAVE_TGETENT +# ifdef HAVE_TGETENT /* * 3. try reading "co" and "li" entries from termcap */ if (columns == 0 || rows == 0) { getlinecol(&columns, &rows); -# ifdef FEAT_EVAL +# ifdef FEAT_EVAL ch_log(NULL, "Got size from termcap: %ld x %ld", columns, rows); -# endif +# endif } -#endif +# endif /* * 4. If everything fails, use the old values @@ -4538,9 +4538,9 @@ mch_calc_cell_size(struct cellsize *cs_out) int retval = -1; retval = ioctl(fd, TIOCGWINSZ, &ws); -#ifdef FEAT_EVAL +# ifdef FEAT_EVAL ch_log(NULL, "ioctl(TIOCGWINSZ) %s", retval == 0 ? "success" : "failed"); -#endif +# endif if (retval == -1 || ws.ws_col == 0 || ws.ws_row == 0) { @@ -4557,12 +4557,12 @@ mch_calc_cell_size(struct cellsize *cs_out) cs_out->cs_xpixel = x_cell_size; cs_out->cs_ypixel = y_cell_size; -#ifdef FEAT_EVAL +# ifdef FEAT_EVAL ch_log(NULL, "Got cell pixel size with TIOCGWINSZ: %d x %d", x_cell_size, y_cell_size); -#endif +# endif } -#if defined(FEAT_TERMINAL) +# if defined(FEAT_TERMINAL) /* * Report the windows size "rows" and "cols" to tty "fd". */ @@ -4576,7 +4576,7 @@ mch_report_winsize(int fd, int rows, int cols) if (tty_fd < 0) return FAIL; -# if defined(TIOCSWINSZ) +# if defined(TIOCSWINSZ) struct winsize ws; ws.ws_col = cols; @@ -4600,19 +4600,19 @@ mch_report_winsize(int fd, int rows, int cols) retval = ioctl(tty_fd, TIOCSWINSZ, &ws); ch_log(NULL, "ioctl(TIOCSWINSZ) %s", retval == 0 ? "success" : "failed"); -# elif defined(TIOCSSIZE) +# elif defined(TIOCSSIZE) struct ttysize ts; ts.ts_cols = cols; ts.ts_lines = rows; retval = ioctl(tty_fd, TIOCSSIZE, &ts); ch_log(NULL, "ioctl(TIOCSSIZE) %s", retval == 0 ? "success" : "failed"); -# endif +# endif if (tty_fd != fd) close(tty_fd); return retval == 0 ? OK : FAIL; } -#endif +# endif /* * Try to set the window size to Rows and Columns. @@ -4660,11 +4660,11 @@ wait4pid(pid_t child, waitstatus *status) // wait() sometimes hangs for no obvious reason. Use waitpid() // instead and loop (like the GUI). Also needed for other interfaces, // they might call system(). -# ifdef __NeXT__ +#ifdef __NeXT__ wait_pid = wait4(child, status, WNOHANG, (struct rusage *)0); -# else +#else wait_pid = waitpid(child, status, WNOHANG); -# endif +#endif if (wait_pid == 0) { // Wait for 1 to 10 msec before trying again. @@ -4674,9 +4674,9 @@ wait4pid(pid_t child, waitstatus *status) continue; } if (wait_pid <= 0 -# ifdef ECHILD +#ifdef ECHILD && errno == ECHILD -# endif +#endif ) break; } @@ -4794,11 +4794,11 @@ open_pty(int *pty_master_fd, int *pty_slave_fd, char_u **name1, char_u **name2) // Leaving out O_NOCTTY may lead to waitpid() always returning // 0 on Mac OS X 10.7 thereby causing freezes. Let's assume // adding O_NOCTTY always works when defined. -#ifdef O_NOCTTY +# ifdef O_NOCTTY *pty_slave_fd = open(tty_name, O_RDWR | O_NOCTTY | O_EXTRA, 0); -#else +# else *pty_slave_fd = open(tty_name, O_RDWR | O_EXTRA, 0); -#endif +# endif if (*pty_slave_fd < 0) { close(*pty_master_fd); @@ -4820,18 +4820,18 @@ open_pty(int *pty_master_fd, int *pty_slave_fd, char_u **name1, char_u **name2) static void may_send_sigint(int c UNUSED, pid_t pid UNUSED, pid_t wpid UNUSED) { -# ifdef SIGINT +#ifdef SIGINT if (c == Ctrl_C || c == intr_char) { -# ifdef HAVE_SETSID +# ifdef HAVE_SETSID kill(-pid, SIGINT); -# else +# else kill(0, SIGINT); -# endif +# endif if (wpid > 0) kill(wpid, SIGINT); } -# endif +#endif } #if !defined(USE_SYSTEM) || defined(FEAT_TERMINAL) @@ -4971,10 +4971,10 @@ mch_call_shell_system( char_u *cmd, int options) // SHELL_*, see vim.h { -#ifdef VMS +# ifdef VMS char *ifn = NULL; char *ofn = NULL; -#endif +# endif tmode_T tmode = cur_tmode; char_u *newcmd; // only needed for unix int x; @@ -4986,9 +4986,9 @@ mch_call_shell_system( # if defined(FEAT_CLIPBOARD) && (defined(FEAT_X11) \ || defined(FEAT_WAYLAND_CLIPBOARD)) -# if defined(FEAT_X11) || defined(FEAT_WAYLAND_CLIPBOARD) +# if defined(FEAT_X11) || defined(FEAT_WAYLAND_CLIPBOARD) save_clipboard(); -#endif +# endif loose_clipboard(); # endif @@ -5589,11 +5589,11 @@ mch_call_shell_fork( { // CTRL-C sends a signal to the child, we ignore it // ourselves -# ifdef HAVE_SETSID +# ifdef HAVE_SETSID kill(-pid, SIGINT); -# else +# else kill(0, SIGINT); -# endif +# endif if (wpid > 0) kill(wpid, SIGINT); got_int = FALSE; @@ -5738,11 +5738,11 @@ mch_call_shell_fork( // Handle any X events, e.g. serving the clipboard. clip_update(); # endif -#ifdef FEAT_WAYLAND +# ifdef FEAT_WAYLAND // Handle Wayland events such as sending data as the source // client. wayland_update(); -#endif +# endif } finished: p_more = p_more_save; @@ -5796,11 +5796,11 @@ finished: # endif got_int = FALSE; } -# ifdef __NeXT__ +# ifdef __NeXT__ wait_pid = wait4(pid, &status, WNOHANG, (struct rusage *)0); -# else +# else wait_pid = waitpid(pid, &status, WNOHANG); -# endif +# endif if ((wait_pid == (pid_t)-1 && errno == ECHILD) || (wait_pid == pid && WIFEXITED(status))) { @@ -5808,15 +5808,15 @@ finished: break; } -#if defined(FEAT_XCLIPBOARD) && defined(FEAT_X11) +# if defined(FEAT_XCLIPBOARD) && defined(FEAT_X11) // Handle any X events, e.g. serving the clipboard. clip_update(); -#endif -#ifdef FEAT_WAYLAND +# endif +# ifdef FEAT_WAYLAND // Handle Wayland events such as sending data as the source // client. wayland_update(); -#endif +# endif // Wait for 1 to 10 msec. 1 is faster but gives the child // less time, gradually wait longer. @@ -6067,11 +6067,11 @@ mch_job_start(char **argv, job_T *job, jobopt_T *options, int is_terminal) { char *term = (char *)T_NAME; -#ifdef FEAT_GUI +# ifdef FEAT_GUI if (term_is_gui(T_NAME)) // In the GUI 'term' is not what we want, use $TERM. term = getenv("TERM"); -#endif +# endif // Use 'term' or $TERM if it starts with "xterm", otherwise fall // back to "xterm" or "xterm-color". if (term == NULL || *term == NUL || STRNCMP(term, "xterm", 5) != 0) @@ -6124,11 +6124,11 @@ mch_job_start(char **argv, job_T *job, jobopt_T *options, int is_terminal) { // push stream discipline modules setup_slavepty(pty_slave_fd); -# ifdef TIOCSCTTY +# ifdef TIOCSCTTY // Try to become controlling tty (probably doesn't work, // unless run by root) ioctl(pty_slave_fd, TIOCSCTTY, (char *)NULL); -# endif +# endif } // set up stdin for the child @@ -6418,10 +6418,10 @@ mch_signal_job(job_T *job, char_u *how) sig = SIGINT; else if (STRCMP(how, "kill") == 0) sig = SIGKILL; -#ifdef SIGWINCH +# ifdef SIGWINCH else if (STRCMP(how, "winch") == 0) sig = SIGWINCH; -#endif +# endif else if (SAFE_isdigit(*how)) sig = atoi((char *)how); else @@ -6635,13 +6635,13 @@ RealWaitForChar(int fd, long msec, int *check_for_gpm UNUSED, int *interrupted) { int ret; int result; -#if defined(FEAT_XCLIPBOARD) || defined(USE_XSMP) || defined(FEAT_MZSCHEME) +# if defined(FEAT_XCLIPBOARD) || defined(USE_XSMP) || defined(FEAT_MZSCHEME) static int busy = FALSE; // May retry getting characters after an event was handled. -# define MAY_LOOP +# define MAY_LOOP -# ifdef ELAPSED_FUNC +# ifdef ELAPSED_FUNC // Remember at what time we started, so that we know how much longer we // should wait after being interrupted. long start_msec = msec; @@ -6649,61 +6649,61 @@ RealWaitForChar(int fd, long msec, int *check_for_gpm UNUSED, int *interrupted) if (msec > 0) ELAPSED_INIT(start_tv); -# endif +# endif // Handle being called recursively. This may happen for the session // manager stuff, it may save the file, which does a breakcheck. if (busy) return 0; -#endif +# endif -#ifdef MAY_LOOP +# ifdef MAY_LOOP for (;;) -#endif +# endif { -#ifdef MAY_LOOP +# ifdef MAY_LOOP int finished = TRUE; // default is to 'loop' just once -# ifdef FEAT_MZSCHEME +# ifdef FEAT_MZSCHEME int mzquantum_used = FALSE; +# endif # endif -#endif -#ifdef FEAT_WAYLAND +# ifdef FEAT_WAYLAND int wayland_fd = -1; -#endif -#ifndef HAVE_SELECT +# endif +# ifndef HAVE_SELECT // each channel may use in, out and err struct pollfd fds[7 + 3 * MAX_OPEN_CHANNELS]; int nfd; -# ifdef FEAT_SOCKETSERVER +# ifdef FEAT_SOCKETSERVER int socket_server_idx = -1; -# endif -# ifdef FEAT_WAYLAND_CLIPBOARD +# endif +# ifdef FEAT_WAYLAND_CLIPBOARD int wayland_idx = -1; -# endif -# ifdef FEAT_XCLIPBOARD +# endif +# ifdef FEAT_XCLIPBOARD int xterm_idx = -1; -# endif -# ifdef FEAT_MOUSE_GPM +# endif +# ifdef FEAT_MOUSE_GPM int gpm_idx = -1; -# endif -# ifdef USE_XSMP +# endif +# ifdef USE_XSMP int xsmp_idx = -1; -# endif +# endif int towait = (int)msec; -# ifdef FEAT_MZSCHEME +# ifdef FEAT_MZSCHEME mzvim_check_threads(); if (mzthreads_allowed() && p_mzq > 0 && (msec < 0 || msec > p_mzq)) { towait = (int)p_mzq; // don't wait longer than 'mzquantum' mzquantum_used = TRUE; } -# endif +# endif fds[0].fd = fd; fds[0].events = POLLIN; nfd = 1; -# ifdef FEAT_SOCKETSERVER +# ifdef FEAT_SOCKETSERVER if (socket_server_fd != -1) { socket_server_idx = nfd; @@ -6711,9 +6711,9 @@ RealWaitForChar(int fd, long msec, int *check_for_gpm UNUSED, int *interrupted) fds[nfd].events = POLLIN; nfd++; } -# endif +# endif -# ifdef FEAT_WAYLAND +# ifdef FEAT_WAYLAND if ((wayland_fd = wayland_prepare_read()) >= 0) { wayland_idx = nfd; @@ -6721,8 +6721,8 @@ RealWaitForChar(int fd, long msec, int *check_for_gpm UNUSED, int *interrupted) fds[nfd].events = POLLIN; nfd++; } -# endif -# ifdef FEAT_XCLIPBOARD +# endif +# ifdef FEAT_XCLIPBOARD may_restore_clipboard(); if (xterm_Shell != (Widget)0) { @@ -6731,8 +6731,8 @@ RealWaitForChar(int fd, long msec, int *check_for_gpm UNUSED, int *interrupted) fds[nfd].events = POLLIN; nfd++; } -# endif -# ifdef FEAT_MOUSE_GPM +# endif +# ifdef FEAT_MOUSE_GPM if (check_for_gpm != NULL && gpm_flag && gpm_fd >= 0) { gpm_idx = nfd; @@ -6740,8 +6740,8 @@ RealWaitForChar(int fd, long msec, int *check_for_gpm UNUSED, int *interrupted) fds[nfd].events = POLLIN; nfd++; } -# endif -# ifdef USE_XSMP +# endif +# ifdef USE_XSMP if (xsmp_icefd != -1) { xsmp_idx = nfd; @@ -6749,10 +6749,10 @@ RealWaitForChar(int fd, long msec, int *check_for_gpm UNUSED, int *interrupted) fds[nfd].events = POLLIN; nfd++; } -# endif -# ifdef FEAT_JOB_CHANNEL +# endif +# ifdef FEAT_JOB_CHANNEL nfd = channel_poll_setup(nfd, &fds, &towait); -# endif +# endif if (interrupted != NULL) *interrupted = FALSE; @@ -6762,13 +6762,13 @@ RealWaitForChar(int fd, long msec, int *check_for_gpm UNUSED, int *interrupted) if (result == 0 && interrupted != NULL && ret > 0) *interrupted = TRUE; -# ifdef FEAT_MZSCHEME +# ifdef FEAT_MZSCHEME if (ret == 0 && mzquantum_used) // MzThreads scheduling is required and timeout occurred finished = FALSE; -# endif +# endif -# ifdef FEAT_SOCKETSERVER +# ifdef FEAT_SOCKETSERVER if (socket_server_idx >= 0) { if (fds[socket_server_idx].revents & POLLIN) @@ -6779,14 +6779,14 @@ RealWaitForChar(int fd, long msec, int *check_for_gpm UNUSED, int *interrupted) else if (fds[socket_server_idx].revents & (POLLHUP | POLLERR)) socket_server_uninit(); } -# endif +# endif -# ifdef FEAT_WAYLAND +# ifdef FEAT_WAYLAND if (wayland_idx >= 0) wayland_poll_check(fds[wayland_idx].revents); -# endif +# endif -# ifdef FEAT_XCLIPBOARD +# ifdef FEAT_XCLIPBOARD if (xterm_Shell != (Widget)0 && (fds[xterm_idx].revents & POLLIN)) { xterm_update(); // Maybe we should hand out clipboard @@ -6794,12 +6794,12 @@ RealWaitForChar(int fd, long msec, int *check_for_gpm UNUSED, int *interrupted) // Try again finished = FALSE; } -# endif -# ifdef FEAT_MOUSE_GPM +# endif +# ifdef FEAT_MOUSE_GPM if (gpm_idx >= 0 && (fds[gpm_idx].revents & POLLIN)) *check_for_gpm = 1; -# endif -# ifdef USE_XSMP +# endif +# ifdef USE_XSMP if (xsmp_idx >= 0 && (fds[xsmp_idx].revents & (POLLIN | POLLHUP))) { if (fds[xsmp_idx].revents & POLLIN) @@ -6817,14 +6817,14 @@ RealWaitForChar(int fd, long msec, int *check_for_gpm UNUSED, int *interrupted) if (--ret == 0) finished = FALSE; // Try again } -# endif -# ifdef FEAT_JOB_CHANNEL +# endif +# ifdef FEAT_JOB_CHANNEL // also call when ret == 0, we may be polling a keep-open channel if (ret >= 0) channel_poll_check(ret, &fds); -# endif +# endif -#else // HAVE_SELECT +# else // HAVE_SELECT struct timeval tv; struct timeval *tvp; @@ -6834,14 +6834,14 @@ RealWaitForChar(int fd, long msec, int *check_for_gpm UNUSED, int *interrupted) int maxfd; long towait = msec; -# ifdef FEAT_MZSCHEME +# ifdef FEAT_MZSCHEME mzvim_check_threads(); if (mzthreads_allowed() && p_mzq > 0 && (msec < 0 || msec > p_mzq)) { towait = p_mzq; // don't wait longer than 'mzquantum' mzquantum_used = TRUE; } -# endif +# endif if (towait >= 0) { @@ -6860,13 +6860,13 @@ select_eintr: FD_ZERO(&wfds); FD_ZERO(&efds); FD_SET(fd, &rfds); -# ifndef __QNX__ +# ifndef __QNX__ // For QNX select() always returns 1 if this is set. Why? FD_SET(fd, &efds); -# endif +# endif maxfd = fd; -# ifdef FEAT_SOCKETSERVER +# ifdef FEAT_SOCKETSERVER if (socket_server_fd != -1) { FD_SET(socket_server_fd, &rfds); @@ -6874,9 +6874,9 @@ select_eintr: if (maxfd < socket_server_fd) maxfd = socket_server_fd; } -# endif +# endif -# ifdef FEAT_WAYLAND +# ifdef FEAT_WAYLAND if ((wayland_fd = wayland_prepare_read()) >= 0) { FD_SET(wayland_fd, &rfds); @@ -6884,9 +6884,9 @@ select_eintr: if (maxfd < wayland_fd) maxfd = wayland_fd; } -# endif +# endif -# ifdef FEAT_XCLIPBOARD +# ifdef FEAT_XCLIPBOARD may_restore_x11_clipboard(); if (xterm_Shell != (Widget)0) { @@ -6898,8 +6898,8 @@ select_eintr: // particularly, XFlush may cause this. xterm_update(); } -# endif -# ifdef FEAT_MOUSE_GPM +# endif +# ifdef FEAT_MOUSE_GPM if (check_for_gpm != NULL && gpm_flag && gpm_fd >= 0) { FD_SET(gpm_fd, &rfds); @@ -6907,8 +6907,8 @@ select_eintr: if (maxfd < gpm_fd) maxfd = gpm_fd; } -# endif -# ifdef USE_XSMP +# endif +# ifdef USE_XSMP if (xsmp_icefd != -1) { FD_SET(xsmp_icefd, &rfds); @@ -6916,10 +6916,10 @@ select_eintr: if (maxfd < xsmp_icefd) maxfd = xsmp_icefd; } -# endif -# ifdef FEAT_JOB_CHANNEL +# endif +# ifdef FEAT_JOB_CHANNEL maxfd = channel_select_setup(maxfd, &rfds, &wfds, &tv, &tvp); -# endif +# endif if (interrupted != NULL) *interrupted = FALSE; @@ -6931,7 +6931,7 @@ select_eintr: else if (interrupted != NULL && ret > 0) *interrupted = TRUE; -# ifdef EINTR +# ifdef EINTR if (ret == -1 && errno == EINTR) { // Check whether the EINTR is caused by SIGTSTP @@ -6948,9 +6948,9 @@ select_eintr: // SIGWINCH. if (do_resize) { -# ifdef FEAT_EVAL +# ifdef FEAT_EVAL ch_log(NULL, "calling handle_resize() in RealWaitForChar()"); -# endif +# endif handle_resize(); } @@ -6960,34 +6960,34 @@ select_eintr: // external command after the process has finished. goto select_eintr; } -# endif -# ifdef __TANDEM +# endif +# ifdef __TANDEM if (ret == -1 && errno == ENOTSUP) { FD_ZERO(&rfds); FD_ZERO(&efds); ret = 0; } -# endif -# ifdef FEAT_MZSCHEME +# endif +# ifdef FEAT_MZSCHEME if (ret == 0 && mzquantum_used) // loop if MzThreads must be scheduled and timeout occurred finished = FALSE; -# endif +# endif -# ifdef FEAT_SOCKETSERVER +# ifdef FEAT_SOCKETSERVER if (ret > 0 && socket_server_fd != -1 && FD_ISSET(socket_server_fd, &rfds) && socket_server_accept_client() == FAIL) socket_server_uninit(); -# endif +# endif -# ifdef FEAT_WAYLAND +# ifdef FEAT_WAYLAND if (wayland_fd != -1) wayland_select_check(ret > 0 && FD_ISSET(wayland_fd, &rfds)); -# endif +# endif -# ifdef FEAT_XCLIPBOARD +# ifdef FEAT_XCLIPBOARD if (ret > 0 && xterm_Shell != (Widget)0 && FD_ISSET(ConnectionNumber(xterm_dpy), &rfds)) { @@ -7000,8 +7000,8 @@ select_eintr: finished = FALSE; } } -# endif -# ifdef FEAT_MOUSE_GPM +# endif +# ifdef FEAT_MOUSE_GPM if (ret > 0 && check_for_gpm != NULL && gpm_flag && gpm_fd >= 0) { if (FD_ISSET(gpm_fd, &efds)) @@ -7009,8 +7009,8 @@ select_eintr: else if (FD_ISSET(gpm_fd, &rfds)) *check_for_gpm = 1; } -# endif -# ifdef USE_XSMP +# endif +# ifdef USE_XSMP if (ret > 0 && xsmp_icefd != -1) { if (FD_ISSET(xsmp_icefd, &efds)) @@ -7030,45 +7030,45 @@ select_eintr: finished = FALSE; // keep going if event was only one } } -# endif -# ifdef FEAT_JOB_CHANNEL +# endif +# ifdef FEAT_JOB_CHANNEL // also call when ret == 0, we may be polling a keep-open channel if (ret >= 0) (void)channel_select_check(ret, &rfds, &wfds); -# endif +# endif -#endif // HAVE_SELECT +# endif // HAVE_SELECT -#ifdef MAY_LOOP +# ifdef MAY_LOOP if (finished || msec == 0) break; -# if defined(FEAT_CLIENTSERVER) -# ifdef FEAT_X11 +# if defined(FEAT_CLIENTSERVER) +# ifdef FEAT_X11 if (clientserver_method == CLIENTSERVER_METHOD_X11 && server_waiting()) break; -# endif -# ifdef FEAT_SOCKETSERVER +# endif +# ifdef FEAT_SOCKETSERVER if (clientserver_method == CLIENTSERVER_METHOD_SOCKET && socket_server_waiting_accept()) break; +# endif # endif -# endif // We're going to loop around again, find out for how long if (msec > 0) { -# ifdef ELAPSED_FUNC +# ifdef ELAPSED_FUNC // Compute remaining wait time. msec = start_msec - ELAPSED_FUNC(start_tv); -# else +# else // Guess we got interrupted halfway. msec = msec / 2; -# endif +# endif if (msec <= 0) break; // waited long enough } -#endif +# endif } return result; @@ -7102,14 +7102,14 @@ mch_expandpath( * file is pointer to array of pointers to matched file names */ -#ifndef SEEK_SET -# define SEEK_SET 0 -#endif -#ifndef SEEK_END -# define SEEK_END 2 -#endif +# ifndef SEEK_SET +# define SEEK_SET 0 +# endif +# ifndef SEEK_END +# define SEEK_END 2 +# endif -#define SHELL_SPECIAL (char_u *)"\t \"&'$;<>()\\|" +# define SHELL_SPECIAL (char_u *)"\t \"&'$;<>()\\|" int mch_expand_wildcards( @@ -7135,24 +7135,24 @@ mch_expand_wildcards( size_t commandlen; FILE *fd; char_u *buffer; -#define STYLE_ECHO 0 // use "echo", the default -#define STYLE_GLOB 1 // use "glob", for csh -#define STYLE_VIMGLOB 2 // use "vimglob", for Posix sh -#define STYLE_PRINT 3 // use "print -N", for zsh -#define STYLE_BT 4 // `cmd` expansion, execute the pattern directly -#define STYLE_GLOBSTAR 5 // use extended shell glob for bash (this uses extended +# define STYLE_ECHO 0 // use "echo", the default +# define STYLE_GLOB 1 // use "glob", for csh +# define STYLE_VIMGLOB 2 // use "vimglob", for Posix sh +# define STYLE_PRINT 3 // use "print -N", for zsh +# define STYLE_BT 4 // `cmd` expansion, execute the pattern directly +# define STYLE_GLOBSTAR 5 // use extended shell glob for bash (this uses extended // globbing functionality using globstar, needs bash > 4) int shell_style = STYLE_ECHO; int check_spaces; static int did_find_nul = FALSE; int ampersand = FALSE; -#define STRING_INIT(s) \ +# define STRING_INIT(s) \ {(char_u *)(s), STRLEN_LITERAL(s)} // vimglob() function to define for Posix shell static string_T sh_vimglob_func = STRING_INIT("vimglob() { while [ $# -ge 1 ]; do echo \"$1\"; shift; done }; vimglob >"); // vimglob() function with globstar setting enabled, only for bash >= 4.X static string_T sh_globstar_opt = STRING_INIT("[[ ${BASH_VERSINFO[0]} -ge 4 ]] && shopt -s globstar; "); -#undef STRING_INIT +# undef STRING_INIT *num_file = 0; // default: no files found @@ -7238,9 +7238,9 @@ mch_expand_wildcards( { // Count the length of the patterns in the same way as they are put in // "command" below. -#ifdef USE_SYSTEM +# ifdef USE_SYSTEM len += STRLEN(pat[i]) + 3; // add space and two quotes -#else +# else ++len; // add space for (j = 0; pat[i][j] != NUL; ++j) { @@ -7248,7 +7248,7 @@ mch_expand_wildcards( ++len; // may add a backslash ++len; } -#endif +# endif } command = alloc(len); if (command == NULL) @@ -7319,9 +7319,9 @@ mch_expand_wildcards( // When using system() always add extra quotes, because the shell // is started twice. Otherwise put a backslash before special // characters, except inside ``. -#ifdef USE_SYSTEM +# ifdef USE_SYSTEM commandlen += vim_snprintf((char *)command + commandlen, len, " \"%s\"", pat[i]); -#else +# else int intick = FALSE; p = command + commandlen; @@ -7354,7 +7354,7 @@ mch_expand_wildcards( } *p = NUL; commandlen = (size_t)(p - command); -#endif +# endif } } if (flags & EW_SILENT) @@ -7401,16 +7401,16 @@ mch_expand_wildcards( * However with USE_SYSTEM, I don't know how to turn off error messages * from the shell, so screen may still get messed up -- webb. */ -#ifndef USE_SYSTEM +# ifndef USE_SYSTEM if (!(flags & EW_SILENT)) -#endif +# endif { redraw_later_clear(); // probably messed up screen msg_putchar('\n'); // clear bottom line quickly cmdline_row = Rows - 1; // continue on last line -#ifdef USE_SYSTEM +# ifdef USE_SYSTEM if (!(flags & EW_SILENT)) -#endif +# endif { msg(_(e_cannot_expand_wildcards)); msg_start(); // don't overwrite this message @@ -7813,10 +7813,10 @@ gpm_open(void) { static Gpm_Connect gpm_connect; // Must it be kept till closing ? -#ifdef DYNAMIC_GPM +# ifdef DYNAMIC_GPM if (!gpm_available()) return 0; -#endif +# endif if (gpm_flag) return 1; // already open @@ -7892,11 +7892,11 @@ mch_gpm_process(void) Gpm_GetEvent(&gpm_event); -#ifdef FEAT_GUI +# ifdef FEAT_GUI // Don't put events in the input queue now. if (hold_gui_events) return 0; -#endif +# endif row = gpm_event.y - 1; col = gpm_event.x - 1; @@ -8013,11 +8013,11 @@ sig_sysmouse SIGDEFARG(sigarg) int buttons; static int oldbuttons = 0; -#ifdef FEAT_GUI +# ifdef FEAT_GUI // Don't put events in the input queue now. if (hold_gui_events) return; -#endif +# endif mouse.operation = MOUSE_GETINFO; if (ioctl(1, FBIO_GETMODE, &video.vi_mode) != -1 @@ -8560,7 +8560,7 @@ xterm_update(void) { // There is an event to process. XtAppNextEvent(app_context, &event); -#ifdef FEAT_CLIENTSERVER +# ifdef FEAT_CLIENTSERVER { XPropertyEvent *e = (XPropertyEvent *)&event; @@ -8568,7 +8568,7 @@ xterm_update(void) && e->atom == commProperty && e->state == PropertyNewValue) serverEventProc(xterm_dpy, &event, 0); } -#endif +# endif XtDispatchEvent(&event); } else @@ -8777,11 +8777,11 @@ xsmp_init(void) { char errorstring[80]; SmcCallbacks smcallbacks; -#if 0 +# if 0 SmPropValue smname; SmProp smnameprop; SmProp *smprops[1]; -#endif +# endif if (p_verbose > 0) verb_msg(_("XSMP opening connection")); @@ -8837,7 +8837,7 @@ xsmp_init(void) } xsmp.iceconn = SmcGetIceConnection(xsmp.smcconn); -#if 0 +# if 0 // ID ourselves smname.value = "vim"; smname.length = 3; @@ -8848,7 +8848,7 @@ xsmp_init(void) smprops[0] = &smnameprop; SmcSetProperties(xsmp.smcconn, 1, smprops); -#endif +# endif } @@ -8944,10 +8944,10 @@ start_timeout(long msec) timer_created = TRUE; } -# ifdef FEAT_EVAL +# ifdef FEAT_EVAL ch_log(NULL, "setting timeout timer to %d sec %ld nsec", (int)interval.it_value.tv_sec, (long)interval.it_value.tv_nsec); -# endif +# endif ret = timer_settime(timer_id, 0, &interval, NULL); if (ret < 0) semsg(_(e_could_not_set_timeout_str), strerror(errno)); @@ -9314,17 +9314,17 @@ socket_server_init(char_u *name) } serverName = vim_strsave(socket_server_path); -#ifdef FEAT_EVAL +# ifdef FEAT_EVAL set_vim_var_string(VV_SEND_SERVER, serverName, -1); -#endif +# endif socket_server_fd = fd; -#ifdef FEAT_GUI_GTK +# ifdef FEAT_GUI_GTK if (gui.in_use) // Initialize source for GUI if we are using it gui_gtk_init_socket_server(); -#endif +# endif vim_free(path); return OK; @@ -9350,10 +9350,10 @@ socket_server_uninit(void) vim_free(socket_server_path); socket_server_path = NULL; } -#ifdef FEAT_GUI_GTK +# ifdef FEAT_GUI_GTK if (gui.in_use) gui_gtk_uninit_socket_server(); -#endif +# endif } /* @@ -9464,9 +9464,9 @@ socket_server_accept_client(void) if (socket_server_decode_cmd(&cmd, fd, 1000) == FAIL) goto exit; -#ifdef FEAT_EVAL +# ifdef FEAT_EVAL ch_log(NULL, "accepted new client on socket %s", socket_server_path); -#endif +# endif socket_server_exec_cmd(&cmd, fd); socket_server_free_cmd(&cmd); @@ -9559,9 +9559,9 @@ socket_server_send( size_t sz; char_u *final; char_u *path; -#ifdef ELAPSED_FUNC +# ifdef ELAPSED_FUNC elapsed_T start_tv; -#endif +# endif if (!socket_server_valid()) { @@ -9574,9 +9574,9 @@ socket_server_send( if (socket_fd == -1) return -1; -#ifdef FEAT_EVAL +# ifdef FEAT_EVAL ch_log(NULL, "socket_server_send(%s, %s)", path, str); -#endif +# endif // Execute locally if target is ourselves if (serverName != NULL && STRICMP(path, serverName) == 0) @@ -9640,9 +9640,9 @@ socket_server_send( socket_server_init_pending_cmd(&pending); -#ifdef ELAPSED_FUNC +# ifdef ELAPSED_FUNC ELAPSED_INIT(start_tv); -#endif +# endif // Wait for server to send back result while (socket_server_dispatch(500) >= 0) @@ -9650,10 +9650,10 @@ socket_server_send( if (pending.result != NULL) break; -#ifdef ELAPSED_FUNC +# ifdef ELAPSED_FUNC if (ELAPSED_FUNC(start_tv) >= (timeout > 0 ? timeout : 1000)) break; -#endif +# endif } if (pending.result == NULL) @@ -9686,9 +9686,9 @@ socket_server_send( socket_server_read_reply(char_u *client, char_u **str, int timeout UNUSED) { ss_reply_T *reply = NULL; -#ifdef ELAPSED_FUNC +# ifdef ELAPSED_FUNC elapsed_T start_tv; -#endif +# endif if (!socket_server_name_is_valid(client)) return -1; @@ -9696,10 +9696,10 @@ socket_server_read_reply(char_u *client, char_u **str, int timeout UNUSED) if (!socket_server_valid()) return -1; -#ifdef ELAPSED_FUNC +# ifdef ELAPSED_FUNC if (timeout > 0) ELAPSED_INIT(start_tv); -#endif +# endif // Try seeing if there already is a reply in the queue goto get_reply; @@ -9708,10 +9708,10 @@ socket_server_read_reply(char_u *client, char_u **str, int timeout UNUSED) { int fd; -#ifdef ELAPSED_FUNC +# ifdef ELAPSED_FUNC if (timeout > 0 && ELAPSED_FUNC(start_tv) >= timeout) break; -#endif +# endif get_reply: reply = socket_server_get_reply(client, NULL); @@ -10039,26 +10039,26 @@ socket_server_decode_cmd(ss_cmd_T *cmd, int socket_fd, int timeout) size_t total_r = 0; char_u *buf; char_u *cur; -#ifdef ELAPSED_FUNC +# ifdef ELAPSED_FUNC elapsed_T start_tv; -#endif +# endif // We also poll the socket server listening file descriptor to handle // recursive remote calls between Vim instances, such as when one Vim // instance calls remote_expr for an expression that calls remote_expr to // itself again. -#ifndef HAVE_SELECT +# ifndef HAVE_SELECT struct pollfd pfd; pfd.fd = socket_fd; pfd.events = POLLIN; -#else +# else fd_set rfds; struct timeval tv; FD_ZERO(&rfds); FD_SET(socket_fd, &rfds); -#endif +# endif buf = alloc(SS_CMD_INFO_SIZE); @@ -10069,22 +10069,22 @@ socket_server_decode_cmd(ss_cmd_T *cmd, int socket_fd, int timeout) // want to free an uninitialized pointer. memset(cmd, 0, sizeof(*cmd)); -#ifdef ELAPSED_FUNC +# ifdef ELAPSED_FUNC ELAPSED_INIT(start_tv); -#endif +# endif while (TRUE) { int ret; ssize_t r = 0; -#ifndef HAVE_SELECT +# ifndef HAVE_SELECT ret = poll(&pfd, 1, timeout); -#else +# else tv.tv_sec = 0; tv.tv_usec = 500 * 1000; ret = select(socket_fd + 1, &rfds, NULL, NULL, &tv); -#endif +# endif if (ret < 0) goto fail; if (ret == 0) @@ -10145,10 +10145,10 @@ socket_server_decode_cmd(ss_cmd_T *cmd, int socket_fd, int timeout) total_r += r; continue_loop: -#ifdef ELAPSED_FUNC +# ifdef ELAPSED_FUNC if (ELAPSED_FUNC(start_tv) >= timeout) goto fail; -#endif +# endif } // Parse message data @@ -10191,25 +10191,25 @@ socket_server_write(int socket_fd, char_u *data, size_t sz, int timeout) { char_u *cur = data; size_t total_w = 0; -#ifdef ELAPSED_FUNC +# ifdef ELAPSED_FUNC elapsed_T start_tv; -#endif -#ifndef HAVE_SELECT +# endif +# ifndef HAVE_SELECT struct pollfd pfd; pfd.fd = socket_fd; pfd.events = POLLOUT; -#else +# else fd_set wfds; struct timeval tv; FD_ZERO(&wfds); FD_SET(socket_fd, &wfds); -#endif +# endif -#ifdef ELAPSED_FUNC +# ifdef ELAPSED_FUNC ELAPSED_INIT(start_tv); -#endif +# endif while (total_w < sz) { @@ -10217,13 +10217,13 @@ socket_server_write(int socket_fd, char_u *data, size_t sz, int timeout) ssize_t written; errno = 0; -#ifndef HAVE_SELECT +# ifndef HAVE_SELECT ret = poll(&pfd, 1, timeout); -#else +# else tv.tv_sec = 0; tv.tv_usec = 500 * 1000; ret = select(socket_fd + 1, NULL, &wfds, NULL, &tv); -#endif +# endif if (ret < 0) return FAIL; else if (ret == 0) @@ -10237,10 +10237,10 @@ socket_server_write(int socket_fd, char_u *data, size_t sz, int timeout) total_w += written; continue_loop: -#ifdef ELAPSED_FUNC +# ifdef ELAPSED_FUNC if (ELAPSED_FUNC(start_tv) >= timeout) return FAIL; -#endif +# endif } return OK; @@ -10350,11 +10350,11 @@ socket_server_exec_cmd(ss_cmd_T *cmd, int fd) } } -#ifdef FEAT_EVAL +# ifdef FEAT_EVAL ch_log(NULL, "socket_server_exec_cmd(): encoding: %s, result: %s", enc == NULL ? (char_u *)"(null)" : enc, str == NULL ? (char_u *)"(null)" : str); -#endif +# endif if (cmd->cmd_type == SS_CMD_TYPE_EXPR || cmd->cmd_type == SS_CMD_TYPE_KEYSTROKES) @@ -10475,31 +10475,31 @@ socket_server_exec_cmd(ss_cmd_T *cmd, int fd) // Client wants to check if we are still responsive, send back a single // byte as a YES. char_u buf[1] = {1}; -#ifndef HAVE_SELECT +# ifndef HAVE_SELECT struct pollfd pfd; pfd.fd = fd; pfd.events = POLLIN; -#else +# else fd_set rfds; struct timeval tv; FD_ZERO(&rfds); FD_SET(fd, &rfds); -#endif +# endif if (write(fd, buf, 1) == -1) return; // Poll until client closes their end -#ifndef HAVE_SELECT +# ifndef HAVE_SELECT poll(&pfd, 1, 1000); -#else +# else tv.tv_sec = 1; tv.tv_usec = 0; select(fd + 1, &rfds, NULL, NULL, &tv); -#endif +# endif return; } @@ -10515,12 +10515,12 @@ socket_server_exec_cmd(ss_cmd_T *cmd, int fd) socket_server_dispatch(int timeout) { int ret; -#ifndef HAVE_SELECT +# ifndef HAVE_SELECT struct pollfd pfd; pfd.fd = socket_server_fd; pfd.events = POLLIN; -#else +# else fd_set rfds; fd_set efds; struct timeval tv; @@ -10529,35 +10529,35 @@ socket_server_dispatch(int timeout) FD_ZERO(&efds); FD_SET(socket_server_fd, &rfds); FD_SET(socket_server_fd, &efds); -#endif +# endif -#ifndef HAVE_SELECT +# ifndef HAVE_SELECT ret = poll(&pfd, 1, timeout); -#else +# else tv.tv_sec = timeout / 1000; tv.tv_usec = (timeout % 1000) * 1000; ret = select(socket_server_fd + 1, &rfds, NULL, &efds, &tv); -#endif +# endif if (ret < 0) return -1; else if (ret == 0) return 1; -#ifndef HAVE_SELECT +# ifndef HAVE_SELECT if (pfd.revents & POLLIN) -#else +# else if (FD_ISSET(socket_server_fd, &rfds)) -#endif +# endif { socket_server_accept_client(); return 0; } -#ifndef HAVE_SELECT +# ifndef HAVE_SELECT else if (pfd.revents & (POLLHUP | POLLERR)) -#else +# else else if (FD_ISSET(socket_server_fd, &efds)) -#endif +# endif // Connection was closed return -1; else @@ -10578,25 +10578,25 @@ socket_server_check_alive(char_u *name) size_t sz; char_u *final; char_u buf[1] = {0}; -#ifndef HAVE_SELECT +# ifndef HAVE_SELECT struct pollfd pfd; -#else +# else fd_set rfds; struct timeval tv; -#endif +# endif socket_fd = socket_server_connect(name, NULL, TRUE); if (socket_fd == -1) return FALSE; -#ifndef HAVE_SELECT +# ifndef HAVE_SELECT pfd.fd = socket_fd; pfd.events = POLLIN; -#else +# else FD_ZERO(&rfds); FD_SET(socket_fd, &rfds); -#endif +# endif ss_cmd_T cmd; @@ -10614,13 +10614,13 @@ socket_server_check_alive(char_u *name) vim_free(final); // Poll for response -#ifndef HAVE_SELECT +# ifndef HAVE_SELECT ret = poll(&pfd, 1, 1000); -#else +# else tv.tv_sec = 1; tv.tv_usec = 0; ret = select(socket_fd + 1, &rfds, NULL, NULL, &tv); -#endif +# endif if (ret > 0) if (read(socket_fd, buf, 1) == -1) @@ -10665,7 +10665,7 @@ socket_server_name_is_valid(char_u *name) socket_server_waiting_accept(void) { int ret; -#ifndef HAVE_SELECT +# ifndef HAVE_SELECT struct pollfd pfd; pfd.fd = socket_server_fd; @@ -10675,7 +10675,7 @@ socket_server_waiting_accept(void) if (ret > 0 && pfd.revents & POLLIN) return TRUE; -#else +# else fd_set rfds; struct timeval tv; @@ -10691,7 +10691,7 @@ socket_server_waiting_accept(void) if (ret > 0 && FD_ISSET(socket_server_fd, &rfds)) return TRUE; -#endif +# endif return FALSE; } diff --git a/src/os_unix.h b/src/os_unix.h index 2125ae7bad..0472b195d5 100644 --- a/src/os_unix.h +++ b/src/os_unix.h @@ -230,7 +230,7 @@ typedef struct dsc$descriptor DESC; #ifndef USR_VIMRC_FILE # ifdef VMS -# define USR_VIMRC_FILE "sys$login:.vimrc" +# define USR_VIMRC_FILE "sys$login:.vimrc" # else # define USR_VIMRC_FILE "$HOME/.vimrc" # endif @@ -241,7 +241,7 @@ typedef struct dsc$descriptor DESC; # ifdef VMS # define USR_VIMRC_FILE2 "sys$login:vimfiles/vimrc" # else -# define USR_VIMRC_FILE2 "~/.vim/vimrc" +# define USR_VIMRC_FILE2 "~/.vim/vimrc" # endif #endif @@ -433,7 +433,7 @@ typedef struct dsc$descriptor DESC; # define mch_memmove(to, from, len) bcopy((char *)(from), (char *)(to), len) # else // ifdef USEMEMCPY -# define mch_memmove(to, from, len) memcpy((char *)(to), (char *)(from), len) +# define mch_memmove(to, from, len) memcpy((char *)(to), (char *)(from), len) # endif #endif diff --git a/src/os_unixx.h b/src/os_unixx.h index 94ec541821..485ac07e54 100644 --- a/src/os_unixx.h +++ b/src/os_unixx.h @@ -77,7 +77,7 @@ * I don't understand why we don't want termios.h for apollo. */ #if defined(HAVE_TERMIOS_H) && !defined(apollo) -# include +# include #else # ifdef HAVE_TERMIO_H # include diff --git a/src/os_vms.c b/src/os_vms.c index d39b93e0c5..bb93544f09 100644 --- a/src/os_vms.c +++ b/src/os_vms.c @@ -17,7 +17,7 @@ #else // based on Alpha's gen64def.h; the file is absent on VAX typedef struct _generic_64 { -# pragma __nomember_alignment +# pragma __nomember_alignment __union { // You can treat me as... // long long is not available on VAXen // unsigned __int64 gen64$q_quadword; ...a single 64-bit value, or @@ -919,8 +919,8 @@ RealWaitForChar( #if !defined( __VAX) && (__CRTL_VER >= 70301000) -#include -#include +# include +# include // Structure to hold a DECC$* feature name and its desired value @@ -1017,29 +1017,29 @@ vms_init(void) /* Get "vms_init()" into a valid, loaded LIB$INITIALIZE PSECT. */ -#pragma nostandard +# pragma nostandard /* Establish the LIB$INITIALIZE PSECTs, with proper alignment and * other attributes. Note that "nopic" is significant only on VAX. */ -#pragma extern_model save +# pragma extern_model save -#pragma extern_model strict_refdef "LIB$INITIALIZE" 2, nopic, nowrt +# pragma extern_model strict_refdef "LIB$INITIALIZE" 2, nopic, nowrt void (*const x_vms_init)() = vms_init; -#pragma extern_model strict_refdef "LIB$INITIALIZ" 2, nopic, nowrt +# pragma extern_model strict_refdef "LIB$INITIALIZ" 2, nopic, nowrt const int spare[ 8] = { 0 }; -#pragma extern_model restore +# pragma extern_model restore // Fake reference to ensure loading the LIB$INITIALIZE PSECT -#pragma extern_model save +# pragma extern_model save int LIB$INITIALIZE(void); -#pragma extern_model strict_refdef +# pragma extern_model strict_refdef int dmy_lib$initialize = (int) LIB$INITIALIZE; -#pragma extern_model restore +# pragma extern_model restore -#pragma standard +# pragma standard #endif // !defined( __VAX) && (__CRTL_VER >= 70301000) diff --git a/src/os_vms_conf.h b/src/os_vms_conf.h index dbf9e8641b..cef8287255 100644 --- a/src/os_vms_conf.h +++ b/src/os_vms_conf.h @@ -4,9 +4,9 @@ */ #if defined(__VMS) || defined(__vms) -#if !defined(VMS) -#define VMS -#endif +# if !defined(VMS) +# define VMS +# endif #endif #include // Required early for large-file support @@ -158,78 +158,78 @@ // Hardware specific #if defined(__VAX) || defined(VAX) -#undef HAVE_GETTIMEOFDAY -#undef HAVE_USLEEP -#undef HAVE_STRCASECMP -#undef HAVE_STRINGS_H -#undef HAVE_SIGSETJMP -#undef HAVE_ISNAN -#undef HAVE_XOS_R_H -#define HAVE_NO_LONG_LONG -#define LONG_LONG_MIN (-2147483647-1) -#define LONG_LONG_MAX (2147483647) -#define ULONG_LONG_MAX (4294967295U) +# undef HAVE_GETTIMEOFDAY +# undef HAVE_USLEEP +# undef HAVE_STRCASECMP +# undef HAVE_STRINGS_H +# undef HAVE_SIGSETJMP +# undef HAVE_ISNAN +# undef HAVE_XOS_R_H +# define HAVE_NO_LONG_LONG +# define LONG_LONG_MIN (-2147483647-1) +# define LONG_LONG_MAX (2147483647) +# define ULONG_LONG_MAX (4294967295U) #else // ALPHA, IA64, X86_64 -#define HAVE_FSEEKO /* Use off_t. */ -#define HAVE_GETTIMEOFDAY -#define HAVE_USLEEP -#define HAVE_STRCASECMP -#define HAVE_STRINGS_H -#define HAVE_SIGSETJMP -#undef HAVE_XOS_R_H -#undef HAVE_NO_LONG_LONG -#define LONG_LONG_MIN (-9223372036854775807-1) -#define LONG_LONG_MAX (9223372036854775807) -#define ULONG_LONG_MAX (18446744073709551615U) - -#if defined(__DECC) && (__CRTL_VER >= 80500000) && (__STDC_VERSION__ >= 199901L) /* C99 */ -#define HAVE_ISINF -#define HAVE_ISNAN -#endif - -#define HAVE_XOS_R_H +# define HAVE_FSEEKO /* Use off_t. */ +# define HAVE_GETTIMEOFDAY +# define HAVE_USLEEP +# define HAVE_STRCASECMP +# define HAVE_STRINGS_H +# define HAVE_SIGSETJMP +# undef HAVE_XOS_R_H +# undef HAVE_NO_LONG_LONG +# define LONG_LONG_MIN (-9223372036854775807-1) +# define LONG_LONG_MAX (9223372036854775807) +# define ULONG_LONG_MAX (18446744073709551615U) + +# if defined(__DECC) && (__CRTL_VER >= 80500000) && (__STDC_VERSION__ >= 199901L) /* C99 */ +# define HAVE_ISINF +# define HAVE_ISNAN +# endif + +# define HAVE_XOS_R_H #endif /* VAX [else] */ // Compiler specific #if defined(VAXC) || defined(__VAXC) -#undef HAVE_SELECT -#undef HAVE_FCNTL_H -#undef HAVE_UNISTD_H -#undef HAVE_SYS_TIME_H -#undef HAVE_LOCALE_H -#define BROKEN_LOCALE -#undef DYNAMIC_ICONV -#undef HAVE_STRFTIME +# undef HAVE_SELECT +# undef HAVE_FCNTL_H +# undef HAVE_UNISTD_H +# undef HAVE_SYS_TIME_H +# undef HAVE_LOCALE_H +# define BROKEN_LOCALE +# undef DYNAMIC_ICONV +# undef HAVE_STRFTIME #else // DECC -#define HAVE_SELECT -#define HAVE_FCNTL_H -#define HAVE_UNISTD_H 1 -#define HAVE_SYS_TIME_H -#define HAVE_LOCALE_H -#define BROKEN_LOCALE -#undef DYNAMIC_ICONV -#define HAVE_STRFTIME +# define HAVE_SELECT +# define HAVE_FCNTL_H +# define HAVE_UNISTD_H 1 +# define HAVE_SYS_TIME_H +# define HAVE_LOCALE_H +# define BROKEN_LOCALE +# undef DYNAMIC_ICONV +# define HAVE_STRFTIME #endif #if defined(USE_ICONV) -#define HAVE_ICONV_H -#define HAVE_ICONV +# define HAVE_ICONV_H +# define HAVE_ICONV #else -#undef HAVE_ICONV_H -#undef HAVE_ICONV +# undef HAVE_ICONV_H +# undef HAVE_ICONV #endif // GUI support defines #if defined(FEAT_GUI_MOTIF) || defined(FEAT_GUI_GTK) -#define X_INCLUDE_GRP_H // To use getgrgid -#define XUSE_MTSAFE_API -#define HAVE_X11 -#define WANT_X11 -#ifdef HAVE_XPM -#define HAVE_X11_XPM_H -#endif -#define USE_FONTSET -#undef X_LOCALE +# define X_INCLUDE_GRP_H // To use getgrgid +# define XUSE_MTSAFE_API +# define HAVE_X11 +# define WANT_X11 +# ifdef HAVE_XPM +# define HAVE_X11_XPM_H +# endif +# define USE_FONTSET +# undef X_LOCALE #endif diff --git a/src/os_win32.h b/src/os_win32.h index 4105a452c4..ae162dbf05 100644 --- a/src/os_win32.h +++ b/src/os_win32.h @@ -23,8 +23,8 @@ # define HAVE_MATH_H #endif #ifndef __GNUC__ -#define HAVE_STRICMP -#define HAVE_STRNICMP +# define HAVE_STRICMP +# define HAVE_STRNICMP #endif #ifndef HAVE_STRFTIME # define HAVE_STRFTIME // guessed diff --git a/src/popupwin.c b/src/popupwin.c index b74a9445bb..a126822d0d 100644 --- a/src/popupwin.c +++ b/src/popupwin.c @@ -2454,7 +2454,7 @@ popup_create(typval_T *argvars, typval_T *rettv, create_type_T type) for (i = 0; i < 8; ++i) wp->w_border_char[i] = 0; -# ifdef FEAT_QUICKFIX +#ifdef FEAT_QUICKFIX if (type == TYPE_INFO) { wp->w_popup_pos = POPPOS_TOPLEFT; @@ -2466,7 +2466,7 @@ popup_create(typval_T *argvars, typval_T *rettv, create_type_T type) add_border_left_right_padding(wp); parse_completepopup(wp); } -# endif +#endif wp->w_want_scrollbar = 1; wp->w_popup_fixed = 0; @@ -2914,10 +2914,10 @@ f_popup_close(typval_T *argvars, typval_T *rettv UNUSED) id = (int)tv_get_number(argvars); if ( -# ifdef FEAT_TERMINAL +#ifdef FEAT_TERMINAL // if the popup contains a terminal it will become hidden curbuf->b_term == NULL && -# endif +#endif ERROR_IF_ANY_POPUP_WINDOW) return; @@ -3112,9 +3112,9 @@ error_if_popup_window(int also_with_term UNUSED) // commands are disallowed then. When a terminal runs in the popup most // things are allowed. When a terminal is finished it can be closed. if (WIN_IS_POPUP(curwin) -# ifdef FEAT_TERMINAL +#ifdef FEAT_TERMINAL && (also_with_term || curbuf->b_term == NULL) -# endif +#endif ) { error_for_popup_window(); @@ -3569,13 +3569,13 @@ f_popup_getoptions(typval_T *argvars, typval_T *rettv) wp->w_popup_close == POPCLOSE_BUTTON ? "button" : wp->w_popup_close == POPCLOSE_CLICK ? "click" : "none")); -# if defined(FEAT_TIMERS) +#if defined(FEAT_TIMERS) dict_add_number(dict, "time", wp->w_popup_timer != NULL ? (long)wp->w_popup_timer->tr_interval : 0L); -# endif +#endif } -# if defined(FEAT_TERMINAL) +#if defined(FEAT_TERMINAL) /* * Return TRUE if the current window is running a terminal in a popup window. * Return FALSE when the job has ended. @@ -3591,7 +3591,7 @@ error_if_term_popup_window(void) } return FALSE; } -# endif +#endif /* * Reset all the "handled_flag" flags in global popup windows and popup windows @@ -4986,7 +4986,7 @@ popup_set_title(win_T *wp) redraw_win_later(wp, UPD_VALID); } -# if defined(FEAT_QUICKFIX) +#if defined(FEAT_QUICKFIX) /* * If there is a preview window, update the title. * Used after changing directory. @@ -4999,6 +4999,6 @@ popup_update_preview_title(void) if (wp != NULL) popup_set_title(wp); } -# endif +#endif #endif // FEAT_PROP_POPUP diff --git a/src/profiler.c b/src/profiler.c index 68adac0b25..aa127a419f 100644 --- a/src/profiler.c +++ b/src/profiler.c @@ -21,11 +21,11 @@ void profile_start(proftime_T *tm) { -# ifdef MSWIN +# ifdef MSWIN QueryPerformanceCounter(tm); -# else +# else PROF_GET_TIME(tm); -# endif +# endif } /* @@ -36,10 +36,10 @@ profile_end(proftime_T *tm) { proftime_T now; -# ifdef MSWIN +# ifdef MSWIN QueryPerformanceCounter(&now); tm->QuadPart = now.QuadPart - tm->QuadPart; -# else +# else PROF_GET_TIME(&now); tm->tv_fsec = now.tv_fsec - tm->tv_fsec; tm->tv_sec = now.tv_sec - tm->tv_sec; @@ -48,7 +48,7 @@ profile_end(proftime_T *tm) tm->tv_fsec += TV_FSEC_SEC; --tm->tv_sec; } -# endif +# endif } /* @@ -57,9 +57,9 @@ profile_end(proftime_T *tm) void profile_sub(proftime_T *tm, proftime_T *tm2) { -# ifdef MSWIN +# ifdef MSWIN tm->QuadPart -= tm2->QuadPart; -# else +# else tm->tv_fsec -= tm2->tv_fsec; tm->tv_sec -= tm2->tv_sec; if (tm->tv_fsec < 0) @@ -67,7 +67,7 @@ profile_sub(proftime_T *tm, proftime_T *tm2) tm->tv_fsec += TV_FSEC_SEC; --tm->tv_sec; } -# endif +# endif } /* @@ -79,14 +79,14 @@ profile_msg(proftime_T *tm) { static char buf[50]; -# ifdef MSWIN +# ifdef MSWIN LARGE_INTEGER fr; QueryPerformanceFrequency(&fr); sprintf(buf, "%10.6lf", (double)tm->QuadPart / (double)fr.QuadPart); -# else +# else sprintf(buf, PROF_TIME_FORMAT, (long)tm->tv_sec, (long)tm->tv_fsec); -# endif +# endif return buf; } @@ -96,14 +96,14 @@ profile_msg(proftime_T *tm) float_T profile_float(proftime_T *tm) { -# ifdef MSWIN +# ifdef MSWIN LARGE_INTEGER fr; QueryPerformanceFrequency(&fr); return (float_T)tm->QuadPart / (float_T)fr.QuadPart; -# else +# else return (float_T)tm->tv_sec + (float_T)tm->tv_fsec / (float_T)TV_FSEC_SEC; -# endif +# endif } /* @@ -116,13 +116,13 @@ profile_setlimit(long msec, proftime_T *tm) profile_zero(tm); else { -# ifdef MSWIN +# ifdef MSWIN LARGE_INTEGER fr; QueryPerformanceCounter(tm); QueryPerformanceFrequency(&fr); tm->QuadPart += (LONGLONG)((double)msec / 1000.0 * (double)fr.QuadPart); -# else +# else varnumber_T fsec; // this should be 64 bit if possible PROF_GET_TIME(tm); @@ -130,7 +130,7 @@ profile_setlimit(long msec, proftime_T *tm) + (varnumber_T)msec * (varnumber_T)(TV_FSEC_SEC / 1000); tm->tv_fsec = fsec % (long)TV_FSEC_SEC; tm->tv_sec += fsec / (long)TV_FSEC_SEC; -# endif +# endif } } @@ -142,18 +142,18 @@ profile_passed_limit(proftime_T *tm) { proftime_T now; -# ifdef MSWIN +# ifdef MSWIN if (tm->QuadPart == 0) // timer was not set return FALSE; QueryPerformanceCounter(&now); return (now.QuadPart > tm->QuadPart); -# else +# else if (tm->tv_sec == 0) // timer was not set return FALSE; PROF_GET_TIME(&now); return (now.tv_sec > tm->tv_sec || (now.tv_sec == tm->tv_sec && now.tv_fsec > tm->tv_fsec)); -# endif +# endif } /* @@ -162,20 +162,20 @@ profile_passed_limit(proftime_T *tm) void profile_zero(proftime_T *tm) { -# ifdef MSWIN +# ifdef MSWIN tm->QuadPart = 0; -# else +# else tm->tv_fsec = 0; tm->tv_sec = 0; -# endif +# endif } # endif // FEAT_PROFILE || FEAT_RELTIME -#if defined(FEAT_SYN_HL) && defined(FEAT_RELTIME) && defined(FEAT_PROFILE) -# if defined(HAVE_MATH_H) -# include -# endif +# if defined(FEAT_SYN_HL) && defined(FEAT_RELTIME) && defined(FEAT_PROFILE) +# if defined(HAVE_MATH_H) +# include +# endif /* * Divide the time "tm" by "count" and store in "tm2". @@ -187,18 +187,18 @@ profile_divide(proftime_T *tm, int count, proftime_T *tm2) profile_zero(tm2); else { -# ifdef MSWIN +# ifdef MSWIN tm2->QuadPart = tm->QuadPart / count; -# else +# else double fsec = (tm->tv_sec * (float_T)TV_FSEC_SEC + tm->tv_fsec) / count; tm2->tv_sec = floor(fsec / (float_T)TV_FSEC_SEC); tm2->tv_fsec = vim_round(fsec - (tm2->tv_sec * (float_T)TV_FSEC_SEC)); -# endif +# endif } } -#endif +# endif # if defined(FEAT_PROFILE) /* @@ -212,9 +212,9 @@ static proftime_T prof_wait_time; void profile_add(proftime_T *tm, proftime_T *tm2) { -# ifdef MSWIN +# ifdef MSWIN tm->QuadPart += tm2->QuadPart; -# else +# else tm->tv_fsec += tm2->tv_fsec; tm->tv_sec += tm2->tv_sec; if (tm->tv_fsec >= TV_FSEC_SEC) @@ -222,7 +222,7 @@ profile_add(proftime_T *tm, proftime_T *tm2) tm->tv_fsec -= TV_FSEC_SEC; ++tm->tv_sec; } -# endif +# endif } /* @@ -233,15 +233,15 @@ profile_self(proftime_T *self, proftime_T *total, proftime_T *children) { // Check that the result won't be negative. Can happen with recursive // calls. -#ifdef MSWIN +# ifdef MSWIN if (total->QuadPart <= children->QuadPart) return; -#else +# else if (total->tv_sec < children->tv_sec || (total->tv_sec == children->tv_sec && total->tv_fsec <= children->tv_fsec)) return; -#endif +# endif profile_add(self, total); profile_sub(self, children); } @@ -273,11 +273,11 @@ profile_sub_wait(proftime_T *tm, proftime_T *tma) static int profile_equal(proftime_T *tm1, proftime_T *tm2) { -# ifdef MSWIN +# ifdef MSWIN return (tm1->QuadPart == tm2->QuadPart); -# else +# else return (tm1->tv_fsec == tm2->tv_fsec && tm1->tv_sec == tm2->tv_sec); -# endif +# endif } /* @@ -286,15 +286,15 @@ profile_equal(proftime_T *tm1, proftime_T *tm2) int profile_cmp(const proftime_T *tm1, const proftime_T *tm2) { -# ifdef MSWIN +# ifdef MSWIN return tm2->QuadPart == tm1->QuadPart ? 0 : tm2->QuadPart > tm1->QuadPart ? 1 : -1; -# else +# else if (tm1->tv_sec == tm2->tv_sec) return tm2->tv_fsec == tm1->tv_fsec ? 0 : tm2->tv_fsec > tm1->tv_fsec ? 1 : -1; return tm2->tv_sec > tm1->tv_sec ? 1 : -1; -# endif +# endif } static char_u *profile_fname = NULL; diff --git a/src/proto.h b/src/proto.h index d7390c079c..e46b25624f 100644 --- a/src/proto.h +++ b/src/proto.h @@ -177,9 +177,9 @@ void mbyte_im_set_active(int active_arg); # include "profiler.pro" # endif # include "quickfix.pro" -#ifdef FEAT_WAYLAND -# include "wayland.pro" -#endif +# ifdef FEAT_WAYLAND +# include "wayland.pro" +# endif # include "regexp.pro" # include "register.pro" # include "scriptfile.pro" diff --git a/src/pty.c b/src/pty.c index f11a22dcd8..5600cbd9a1 100644 --- a/src/pty.c +++ b/src/pty.c @@ -182,7 +182,7 @@ setup_slavepty(int fd) } #if defined(HAVE_POSIX_OPENPT) && !defined(PTY_DONE) -#define PTY_DONE +# define PTY_DONE int mch_openpty(char **ttyn) { @@ -212,7 +212,7 @@ mch_openpty(char **ttyn) #endif #if defined(OSX) && !defined(PTY_DONE) -#define PTY_DONE +# define PTY_DONE int mch_openpty(char **ttyn) { @@ -229,7 +229,7 @@ mch_openpty(char **ttyn) #if (defined(sequent) || defined(_SEQUENT_)) && defined(HAVE_GETPSEUDOTTY) \ && !defined(PTY_DONE) -#define PTY_DONE +# define PTY_DONE int mch_openpty(char **ttyn) { @@ -241,9 +241,9 @@ mch_openpty(char **ttyn) if ((f = getpseudotty(&s, &m)) < 0) return -1; -#ifdef _SEQUENT_ +# ifdef _SEQUENT_ fvhangup(s); -#endif +# endif vim_strncpy((char_u *)PtyName, (char_u *)m, sizeof(PtyName) - 1); vim_strncpy((char_u *)TtyName, (char_u *)s, sizeof(TtyName) - 1); initmaster(f); @@ -253,7 +253,7 @@ mch_openpty(char **ttyn) #endif #if defined(MIPS) && defined(HAVE_DEV_PTC) && !defined(PTY_DONE) -#define PTY_DONE +# define PTY_DONE int mch_openpty(char **ttyn) { @@ -281,7 +281,7 @@ mch_openpty(char **ttyn) // NOTE: Even though HPUX can have /dev/ptmx, the code below doesn't work! // Same for Mac OS X Leopard (10.5). -#define PTY_DONE +# define PTY_DONE int mch_openpty(char **ttyn) { @@ -314,11 +314,11 @@ mch_openpty(char **ttyn) #endif #if defined(_AIX) && defined(HAVE_DEV_PTC) && !defined(PTY_DONE) -#define PTY_DONE +# define PTY_DONE -#ifdef _IBMR2 +# ifdef _IBMR2 static int aixhack = -1; -#endif +# endif int mch_openpty(char **ttyn) @@ -394,7 +394,7 @@ mch_openpty(char **ttyn) close(f); continue; } -#if defined(SUN_SYSTEM) && defined(TIOCGPGRP) && !defined(SUNOS3) +# if defined(SUN_SYSTEM) && defined(TIOCGPGRP) && !defined(SUNOS3) // Hack to ensure that the slave side of the pty is // unused. May not work in anything other than SunOS4.1 { @@ -407,7 +407,7 @@ mch_openpty(char **ttyn) continue; } } -#endif +# endif initmaster(f); *ttyn = TtyName; return f; @@ -423,7 +423,7 @@ mch_openpty(char **ttyn) int mch_isatty(int fd) { -# if defined(I_STR) && defined(HAVE_SYS_PTMS_H) && defined(HAVE_SVR4_PTYS) \ +#if defined(I_STR) && defined(HAVE_SYS_PTMS_H) && defined(HAVE_SVR4_PTYS) \ && defined(SUN_SYSTEM) // On SunOS, isatty() for /dev/ptmx returns false or sometimes can hang up // in the inner ioctl(), and therefore first determine whether "fd" is a @@ -439,7 +439,7 @@ mch_isatty(int fd) // Trick: return 2 in order to advice the caller that "fd" is a master // device. cf. src/os_unix.c:get_tty_fd() return 2; -# endif +#endif return isatty(fd); } diff --git a/src/quickfix.c b/src/quickfix.c index 87b154dbb6..a7ec10bfe0 100644 --- a/src/quickfix.c +++ b/src/quickfix.c @@ -51,8 +51,8 @@ struct qfline_S /* * There is a stack of error lists. */ -#define INVALID_QFIDX (-1) -#define INVALID_QFBUFNR (0) +# define INVALID_QFIDX (-1) +# define INVALID_QFBUFNR (0) /* * Quickfix list type. @@ -122,7 +122,7 @@ static qf_info_T ql_info_actual; // global quickfix list static qf_info_T *ql_info; // points to ql_info_actual if memory allocation is successful. static int_u last_qf_id = 0; // Last used quickfix list id -#define FMT_PATTERNS 14 // maximum number of % recognized +# define FMT_PATTERNS 14 // maximum number of % recognized /* * Structure used to hold the info of one part of 'errorformat' @@ -201,25 +201,25 @@ static qf_info_T *ll_get_or_alloc_list(win_T *); static int entry_is_closer_to_target(qfline_T *entry, qfline_T *other_entry, int target_fnum, int target_lnum, int target_col); // Quickfix window check helper macro -#define IS_QF_WINDOW(wp) (bt_quickfix((wp)->w_buffer) && (wp)->w_llist_ref == NULL) +# define IS_QF_WINDOW(wp) (bt_quickfix((wp)->w_buffer) && (wp)->w_llist_ref == NULL) // Location list window check helper macro -#define IS_LL_WINDOW(wp) (bt_quickfix((wp)->w_buffer) && (wp)->w_llist_ref != NULL) +# define IS_LL_WINDOW(wp) (bt_quickfix((wp)->w_buffer) && (wp)->w_llist_ref != NULL) // Quickfix and location list stack check helper macros -#define IS_QF_STACK(qi) ((qi)->qfl_type == QFLT_QUICKFIX) -#define IS_LL_STACK(qi) ((qi)->qfl_type == QFLT_LOCATION) -#define IS_QF_LIST(qfl) ((qfl)->qfl_type == QFLT_QUICKFIX) -#define IS_LL_LIST(qfl) ((qfl)->qfl_type == QFLT_LOCATION) +# define IS_QF_STACK(qi) ((qi)->qfl_type == QFLT_QUICKFIX) +# define IS_LL_STACK(qi) ((qi)->qfl_type == QFLT_LOCATION) +# define IS_QF_LIST(qfl) ((qfl)->qfl_type == QFLT_QUICKFIX) +# define IS_LL_LIST(qfl) ((qfl)->qfl_type == QFLT_LOCATION) /* * Return location list for window 'wp' * For location list window, return the referenced location list */ -#define GET_LOC_LIST(wp) (IS_LL_WINDOW(wp) ? (wp)->w_llist_ref : (wp)->w_llist) +# define GET_LOC_LIST(wp) (IS_LL_WINDOW(wp) ? (wp)->w_llist_ref : (wp)->w_llist) // Macro to loop through all the items in a quickfix list // Quickfix item index starts from 1, so i below starts at 1 -#define FOR_ALL_QFL_ITEMS(qfl, qfp, i) \ +# define FOR_ALL_QFL_ITEMS(qfl, qfp, i) \ for ((i) = 1, (qfp) = (qfl)->qf_start; \ !got_int && (i) <= (qfl)->qf_count && (qfp) != NULL; \ ++(i), (qfp) = (qfp)->qf_next) @@ -273,7 +273,7 @@ qfga_clear(void) /* * Maximum number of bytes allowed per line while reading a errorfile. */ -#define LINE_MAXLEN 4096 +# define LINE_MAXLEN 4096 /* * Patterns used. Keep in sync with qf_parse_fmt[]. @@ -292,9 +292,9 @@ static struct fmtpattern {'c', "\\d\\+"}, // 5 {'k', "\\d\\+"}, // 6 {'t', "."}, // 7 -#define FMT_PATTERN_M 8 +# define FMT_PATTERN_M 8 {'m', ".\\+"}, // 8 -#define FMT_PATTERN_R 9 +# define FMT_PATTERN_R 9 {'r', ".*"}, // 9 {'p', "[- .]*"}, // 10 {'v', "\\d\\+"}, // 11 @@ -335,7 +335,7 @@ efmpat_to_regpat( efminfo->addr[idx] = (char_u)++round; *regpat++ = '\\'; *regpat++ = '('; -#ifdef BACKSLASH_IN_FILENAME +# ifdef BACKSLASH_IN_FILENAME if (*efmpat == 'f') { // Also match "c:" in the file name, even when @@ -344,7 +344,7 @@ efmpat_to_regpat( STRCPY(regpat, "\\%(\\a:\\)\\="); regpat += 10; } -#endif +# endif if (*efmpat == 'f' && efmpat[1] != NUL) { if (efmpat[1] != '\\' && efmpat[1] != '%') @@ -555,11 +555,11 @@ efm_regpat_bufsz(char_u *efm) sz = (FMT_PATTERNS * 3) + ((int)STRLEN(efm) << 2); for (i = FMT_PATTERNS; i > 0; ) sz += (int)STRLEN(fmt_pat[--i].pattern); -#ifdef BACKSLASH_IN_FILENAME +# ifdef BACKSLASH_IN_FILENAME sz += 12; // "%f" can become twelve chars longer (see efm_to_regpat) -#else +# else sz += 2; // "%f" can become two chars longer -#endif +# endif return sz; } @@ -940,10 +940,10 @@ qf_get_nextline(qfstate_T *state) if (state->linelen > 0 && state->linebuf[state->linelen - 1] == '\n') { state->linebuf[state->linelen - 1] = NUL; -#ifdef USE_CRNL +# ifdef USE_CRNL if (state->linelen > 1 && state->linebuf[state->linelen - 2] == '\r') state->linebuf[state->linelen - 2] = NUL; -#endif +# endif } remove_bom(state->linebuf); @@ -2194,28 +2194,28 @@ decr_quickfix_busy(void) vim_free(q); } } -#ifdef ABORT_ON_INTERNAL_ERROR +# ifdef ABORT_ON_INTERNAL_ERROR if (quickfix_busy < 0) { emsg("quickfix_busy has become negative"); abort(); } -#endif +# endif } -#if defined(EXITFREE) +# if defined(EXITFREE) void check_quickfix_busy(void) { if (quickfix_busy != 0) { semsg("quickfix_busy not zero on exit: %ld", (long)quickfix_busy); -# ifdef ABORT_ON_INTERNAL_ERROR +# ifdef ABORT_ON_INTERNAL_ERROR abort(); -# endif +# endif } } -#endif +# endif /* * Add an entry to the end of the list of errors. @@ -2734,14 +2734,14 @@ qf_get_fnum(qf_list_T *qfl, char_u *directory, char_u *fname) if (fname == NULL || *fname == NUL) // no file name return 0; -#ifdef VMS +# ifdef VMS vms_remove_version(fname); -#endif -#ifdef BACKSLASH_IN_FILENAME +# endif +# ifdef BACKSLASH_IN_FILENAME if (directory != NULL) slash_adjust(directory); slash_adjust(fname); -#endif +# endif if (directory != NULL && !vim_isAbsName(fname) && (ptr = concat_fnames(directory, fname, TRUE)) != NULL) { @@ -3785,10 +3785,10 @@ qf_jump_to_buffer( qf_jump_goto_line(qf_ptr->qf_lnum, qf_ptr->qf_col, qf_ptr->qf_viscol, qf_ptr->qf_pattern); -#ifdef FEAT_FOLDING +# ifdef FEAT_FOLDING if ((fdo_flags & FDO_QUICKFIX) && openfold) foldOpenCursor(); -#endif +# endif if (print_message) qf_jump_print_msg(qi, qf_index, qf_ptr, old_curbuf, old_lnum); @@ -4571,13 +4571,13 @@ qf_set_cwindow_options(void) 0L, (char_u *)"quickfix", OPT_LOCAL); set_option_value_give_err((char_u *)"bh", 0L, (char_u *)"hide", OPT_LOCAL); RESET_BINDING(curwin); -#ifdef FEAT_DIFF +# ifdef FEAT_DIFF curwin->w_p_diff = FALSE; -#endif -#ifdef FEAT_FOLDING +# endif +# ifdef FEAT_FOLDING set_option_value_give_err((char_u *)"fdm", 0L, (char_u *)"manual", OPT_LOCAL); -#endif +# endif } /* @@ -4686,9 +4686,9 @@ ex_copen(exarg_T *eap) height = QF_WINHEIGHT; reset_VIsual_and_resel(); // stop Visual mode -#ifdef FEAT_GUI +# ifdef FEAT_GUI need_mouse_correct = TRUE; -#endif +# endif // Find an existing quickfix window, or open a new one. if (cmdmod.cmod_tab == 0) @@ -5363,9 +5363,9 @@ get_mef_name(void) char_u *name; static int start = -1; static int off = 0; -#ifdef HAVE_LSTAT +# ifdef HAVE_LSTAT stat_T sb; -#endif +# endif if (*p_mef == NUL) { @@ -5397,10 +5397,10 @@ get_mef_name(void) sprintf((char *)name + (p - p_mef), "%d%d", start, off); STRCAT(name, p + 2); if (mch_getperm(name) < 0 -#ifdef HAVE_LSTAT +# ifdef HAVE_LSTAT // Don't accept a symbolic link, it's a security risk. && mch_lstat((char *)name, &sb) < 0 -#endif +# endif ) break; vim_free(name); @@ -5471,10 +5471,10 @@ ex_make(exarg_T *eap) if (au_name != NULL && apply_autocmds(EVENT_QUICKFIXCMDPRE, au_name, curbuf->b_fname, TRUE, curbuf)) { -#ifdef FEAT_EVAL +# ifdef FEAT_EVAL if (aborting()) return; -#endif +# endif } enc = (*curbuf->b_p_menc != NUL) ? curbuf->b_p_menc : p_menc; @@ -5497,11 +5497,11 @@ ex_make(exarg_T *eap) // let the shell know if we are redirecting output or not do_shell(cmd, *p_sp != NUL ? SHELL_DOOUT : 0); -#ifdef AMIGA +# ifdef AMIGA out_flush(); // read window status report and redraw before message (void)char_avail(); -#endif +# endif incr_quickfix_busy(); @@ -6203,14 +6203,14 @@ ex_cfile(exarg_T *eap) if (au_name != NULL && apply_autocmds(EVENT_QUICKFIXCMDPRE, au_name, NULL, FALSE, curbuf)) { -#ifdef FEAT_EVAL +# ifdef FEAT_EVAL if (aborting()) return; -#endif +# endif } enc = (*curbuf->b_p_menc != NUL) ? curbuf->b_p_menc : p_menc; -#ifdef FEAT_BROWSE +# ifdef FEAT_BROWSE if (cmdmod.cmod_flags & CMOD_BROWSE) { char_u *browse_file = do_browse(0, (char_u *)_("Error file"), eap->arg, @@ -6222,7 +6222,7 @@ ex_cfile(exarg_T *eap) vim_free(browse_file); } else -#endif +# endif if (*eap->arg != NUL) set_string_option_direct((char_u *)"ef", -1, eap->arg, OPT_FREE, 0); @@ -6352,16 +6352,16 @@ vgr_load_dummy_buf( char_u *dirname_now) { int save_mls; -#if defined(FEAT_SYN_HL) +# if defined(FEAT_SYN_HL) char_u *save_ei = NULL; -#endif +# endif buf_T *buf; -#if defined(FEAT_SYN_HL) +# if defined(FEAT_SYN_HL) // Don't do Filetype autocommands to avoid loading syntax and // indent scripts, a great speed improvement. save_ei = au_event_disable(",Filetype"); -#endif +# endif // Don't use modelines here, it's useless. save_mls = p_mls; p_mls = 0; @@ -6371,9 +6371,9 @@ vgr_load_dummy_buf( buf = load_dummy_buffer(fname, dirname_start, dirname_now); p_mls = save_mls; -#if defined(FEAT_SYN_HL) +# if defined(FEAT_SYN_HL) au_event_restore(save_ei); -#endif +# endif return buf; } @@ -6790,10 +6790,10 @@ vgr_process_files( aucmd_prepbuf(&aco, buf); if (curbuf == buf) { -#if defined(FEAT_SYN_HL) +# if defined(FEAT_SYN_HL) apply_autocmds(EVENT_FILETYPE, buf->b_p_ft, buf->b_fname, TRUE, buf); -#endif +# endif do_modelines(OPT_NOWIN); aucmd_restbuf(&aco); } @@ -6837,10 +6837,10 @@ ex_vimgrep(exarg_T *eap) if (au_name != NULL && apply_autocmds(EVENT_QUICKFIXCMDPRE, au_name, curbuf->b_fname, TRUE, curbuf)) { -#ifdef FEAT_EVAL +# ifdef FEAT_EVAL if (aborting()) return; -#endif +# endif } qi = qf_cmd_get_or_alloc_stack(eap, &wp); @@ -6910,11 +6910,11 @@ ex_vimgrep(exarg_T *eap) // may have messed up things, need to redraw and recompute folds. if (redraw_for_dummy) { -#ifdef FEAT_FOLDING +# ifdef FEAT_FOLDING foldUpdateAll(curwin); -#else +# else redraw_later(UPD_NOT_VALID); -#endif +# endif } theend: @@ -7086,22 +7086,22 @@ wipe_dummy_buffer(buf_T *buf, char_u *dirname_start) if (curbuf != buf && buf->b_nwindows == 0) // safety check { -#if defined(FEAT_EVAL) +# if defined(FEAT_EVAL) cleanup_T cs; // Reset the error/interrupt/exception state here so that aborting() // returns FALSE when wiping out the buffer. Otherwise it doesn't // work when got_int is set. enter_cleanup(&cs); -#endif +# endif wipe_buffer(buf, TRUE); -#if defined(FEAT_EVAL) +# if defined(FEAT_EVAL) // Restore the error/interrupt/exception state if not discarded by a // new aborting error, interrupt, or uncaught exception. leave_cleanup(&cs); -#endif +# endif if (dirname_start != NULL) // When autocommands/'autochdir' option changed directory: go back. restore_start_dir(dirname_start); @@ -7131,7 +7131,7 @@ unload_dummy_buffer(buf_T *buf, char_u *dirname_start) restore_start_dir(dirname_start); } -#if defined(FEAT_EVAL) +# if defined(FEAT_EVAL) /* * Copy the specified quickfix entry items into a new dict and append the dict * to 'list'. Returns OK on success. @@ -8410,7 +8410,7 @@ set_ref_in_quickfix(int copyID) return abort; } -#endif +# endif /* * Return the autocmd name for the :cbuffer Ex commands @@ -8505,10 +8505,10 @@ ex_cbuffer(exarg_T *eap) if (au_name != NULL && apply_autocmds(EVENT_QUICKFIXCMDPRE, au_name, curbuf->b_fname, TRUE, curbuf)) { -#ifdef FEAT_EVAL +# ifdef FEAT_EVAL if (aborting()) return; -#endif +# endif } // Must come after autocommands. @@ -8568,7 +8568,7 @@ ex_cbuffer(exarg_T *eap) decr_quickfix_busy(); } -#if defined(FEAT_EVAL) +# if defined(FEAT_EVAL) /* * Return the autocmd name for the :cexpr Ex commands. */ @@ -8675,7 +8675,7 @@ ex_cexpr(exarg_T *eap) (void)cexpr_core(eap, tv); free_tv(tv); } -#endif +# endif /* * Get the location list for ":lhelpgrep" @@ -8792,9 +8792,9 @@ hgr_search_files_in_dir( char_u *dirname, regmatch_T *p_regmatch, vimconv_T *p_vc -#ifdef FEAT_MULTI_LANG +# ifdef FEAT_MULTI_LANG , char_u *lang -#endif +# endif ) { int fcount; @@ -8810,7 +8810,7 @@ hgr_search_files_in_dir( { for (fi = 0; fi < fcount && !got_int; ++fi) { -#ifdef FEAT_MULTI_LANG +# ifdef FEAT_MULTI_LANG // Skip files for a different language. if (lang != NULL && STRNICMP(lang, fnames[fi] @@ -8819,7 +8819,7 @@ hgr_search_files_in_dir( && STRNICMP("txt", fnames[fi] + STRLEN(fnames[fi]) - 3, 3) == 0)) continue; -#endif +# endif hgr_search_file(qfl, fnames[fi], p_vc, p_regmatch); } @@ -8853,9 +8853,9 @@ hgr_search_in_rtp(qf_list_T *qfl, regmatch_T *p_regmatch, char_u *lang) copy_option_part(&p, NameBuff, MAXPATHL, ","); hgr_search_files_in_dir(qfl, NameBuff, p_regmatch, &vc -#ifdef FEAT_MULTI_LANG +# ifdef FEAT_MULTI_LANG , lang -#endif +# endif ); } @@ -8887,10 +8887,10 @@ ex_helpgrep(exarg_T *eap) if (au_name != NULL && apply_autocmds(EVENT_QUICKFIXCMDPRE, au_name, curbuf->b_fname, TRUE, curbuf)) { -#ifdef FEAT_EVAL +# ifdef FEAT_EVAL if (aborting()) return; -#endif +# endif } if (is_loclist_cmd(eap->cmdidx)) @@ -8912,10 +8912,10 @@ ex_helpgrep(exarg_T *eap) incr_quickfix_busy(); -#ifdef FEAT_MULTI_LANG +# ifdef FEAT_MULTI_LANG // Check for a specified language lang = check_help_lang(eap->arg); -#endif +# endif regmatch.regprog = vim_regcomp(eap->arg, RE_MAGIC + RE_STRING); regmatch.rm_ic = FALSE; if (regmatch.regprog != NULL) diff --git a/src/regexp_bt.c b/src/regexp_bt.c index b684872db1..5689518874 100644 --- a/src/regexp_bt.c +++ b/src/regexp_bt.c @@ -5188,11 +5188,11 @@ regdump(char_u *pattern, bt_regprog_T *r) char_u *end = NULL; FILE *f; -#ifdef BT_REGEXP_LOG +# ifdef BT_REGEXP_LOG f = fopen("bt_regexp_log.log", "a"); -#else +# else f = stdout; -#endif +# endif if (f == NULL) return; fprintf(f, "-------------------------------------\n\r\nregcomp(%s):\r\n", pattern); @@ -5255,9 +5255,9 @@ regdump(char_u *pattern, bt_regprog_T *r) fprintf(f, "must have \"%s\"", r->regmust); fprintf(f, "\r\n"); -#ifdef BT_REGEXP_LOG +# ifdef BT_REGEXP_LOG fclose(f); -#endif +# endif } #endif // BT_REGEXP_DUMP @@ -5550,7 +5550,7 @@ regprop(char_u *op) case NCLOSE: p = "NCLOSE"; break; -#ifdef FEAT_SYN_HL +# ifdef FEAT_SYN_HL case ZOPEN + 1: case ZOPEN + 2: case ZOPEN + 3: @@ -5587,7 +5587,7 @@ regprop(char_u *op) buflen += sprintf(buf + buflen, "ZREF%d", OP(op) - ZREF); p = NULL; break; -#endif +# endif case STAR: p = "STAR"; break; diff --git a/src/regexp_nfa.c b/src/regexp_nfa.c index 8e4b30f872..7d55278516 100644 --- a/src/regexp_nfa.c +++ b/src/regexp_nfa.c @@ -544,14 +544,14 @@ realloc_post_list(void) static int nfa_recognize_char_class(char_u *start, char_u *end, int extra_newl) { -# define CLASS_not 0x80 -# define CLASS_af 0x40 -# define CLASS_AF 0x20 -# define CLASS_az 0x10 -# define CLASS_AZ 0x08 -# define CLASS_o7 0x04 -# define CLASS_o9 0x02 -# define CLASS_underscore 0x01 +#define CLASS_not 0x80 +#define CLASS_af 0x40 +#define CLASS_AF 0x20 +#define CLASS_az 0x10 +#define CLASS_AZ 0x08 +#define CLASS_o7 0x04 +#define CLASS_o9 0x02 +#define CLASS_underscore 0x01 int newl = FALSE; char_u *p; @@ -2600,7 +2600,7 @@ nfa_set_code(int c) case NFA_BACKREF7: STRCPY(code, "NFA_BACKREF7"); break; case NFA_BACKREF8: STRCPY(code, "NFA_BACKREF8"); break; case NFA_BACKREF9: STRCPY(code, "NFA_BACKREF9"); break; -#ifdef FEAT_SYN_HL +# ifdef FEAT_SYN_HL case NFA_ZREF1: STRCPY(code, "NFA_ZREF1"); break; case NFA_ZREF2: STRCPY(code, "NFA_ZREF2"); break; case NFA_ZREF3: STRCPY(code, "NFA_ZREF3"); break; @@ -2610,7 +2610,7 @@ nfa_set_code(int c) case NFA_ZREF7: STRCPY(code, "NFA_ZREF7"); break; case NFA_ZREF8: STRCPY(code, "NFA_ZREF8"); break; case NFA_ZREF9: STRCPY(code, "NFA_ZREF9"); break; -#endif +# endif case NFA_SKIP: STRCPY(code, "NFA_SKIP"); break; case NFA_PREV_ATOM_NO_WIDTH: @@ -2676,7 +2676,7 @@ nfa_set_code(int c) STRCPY(code, "NFA_MCLOSE(x)"); code[11] = c - NFA_MCLOSE + '0'; break; -#ifdef FEAT_SYN_HL +# ifdef FEAT_SYN_HL case NFA_ZOPEN: case NFA_ZOPEN1: case NFA_ZOPEN2: @@ -2703,7 +2703,7 @@ nfa_set_code(int c) STRCPY(code, "NFA_ZCLOSE(x)"); code[11] = c - NFA_ZCLOSE + '0'; break; -#endif +# endif case NFA_EOL: STRCPY(code, "NFA_EOL "); break; case NFA_BOL: STRCPY(code, "NFA_BOL "); break; case NFA_EOW: STRCPY(code, "NFA_EOW "); break; @@ -2803,7 +2803,7 @@ nfa_set_code(int c) } -#ifdef ENABLE_LOG +# ifdef ENABLE_LOG static FILE *log_fd; static char_u e_log_open_failed[] = N_("Could not open temporary log file for writing, displaying on stderr... "); @@ -2933,7 +2933,7 @@ nfa_dump(nfa_regprog_T *prog) fclose(debugf); } -#endif // ENABLE_LOG +# endif // ENABLE_LOG #endif // DEBUG /* @@ -5878,9 +5878,9 @@ nfa_regmatch( ++rex.nfa_listid; if (prog->re_engine == AUTOMATIC_ENGINE && (rex.nfa_listid >= NFA_MAX_STATES -# ifdef FEAT_EVAL +#ifdef FEAT_EVAL || nfa_fail_for_testing -# endif +#endif )) { // too many states, retry with old engine diff --git a/src/register.c b/src/register.c index 6ac774cdaf..2cc840dd58 100644 --- a/src/register.c +++ b/src/register.c @@ -264,13 +264,13 @@ get_yank_register(int regname, int writing) // When clipboard is not available, use register 0 instead of '+' else if (clip_plus.available && regname == '+') { -#ifdef FEAT_CLIPBOARD_PROVIDER +# ifdef FEAT_CLIPBOARD_PROVIDER // We want to use the actual + register, since PLUS_REGISTER may be // pointing to STAR_REGISTER. if (clipmethod == CLIPMETHOD_PROVIDER) i = REAL_PLUS_REGISTER; else -#endif +# endif i = PLUS_REGISTER; ret = TRUE; } @@ -2686,10 +2686,10 @@ get_reg_type(int regname, long *reglen) #ifdef FEAT_CLIPBOARD_PROVIDER call_clip_provider_request(regname); #endif -# ifdef FEAT_CLIPBOARD +#ifdef FEAT_CLIPBOARD if (clipmethod != CLIPMETHOD_PROVIDER) regname = may_get_selection(regname); -# endif +#endif if (regname != NUL && !valid_yank_reg(regname, FALSE)) return MAUTO; @@ -2766,9 +2766,9 @@ get_reg_contents(int regname, int flags) if (regname != NUL && !valid_yank_reg(regname, FALSE)) return NULL; -#ifdef FEAT_CLIPBOARD_PROVIDER +# ifdef FEAT_CLIPBOARD_PROVIDER call_clip_provider_request(regname); -#endif +# endif # ifdef FEAT_CLIPBOARD if (clipmethod != CLIPMETHOD_PROVIDER) regname = may_get_selection(regname); @@ -2937,9 +2937,9 @@ write_reg_contents_lst( finish_write_reg(name, old_y_previous, old_y_current); -#ifdef FEAT_CLIPBOARD_PROVIDER +# ifdef FEAT_CLIPBOARD_PROVIDER call_clip_provider_set(name); -#endif +# endif } void @@ -3015,9 +3015,9 @@ write_reg_contents_ex( finish_write_reg(name, old_y_previous, old_y_current); -#ifdef FEAT_CLIPBOARD_PROVIDER +# ifdef FEAT_CLIPBOARD_PROVIDER call_clip_provider_set(name); -#endif +# endif } #endif // FEAT_EVAL diff --git a/src/screen.c b/src/screen.c index 123276b5d0..57f37966c9 100644 --- a/src/screen.c +++ b/src/screen.c @@ -491,9 +491,9 @@ screen_line( if (endcol > Columns) endcol = Columns; -# ifdef FEAT_CLIPBOARD +#ifdef FEAT_CLIPBOARD clip_may_clear_selection(row, row); -# endif +#endif off_from = (unsigned)(current_ScreenLine - ScreenLines); off_to = LineOffset[row] + coloff; @@ -1159,14 +1159,14 @@ win_redr_custom( curattr = attr; else if (hltab[n].userhl < 0) curattr = syn_id2attr(-hltab[n].userhl); -#ifdef FEAT_TERMINAL +# ifdef FEAT_TERMINAL else if (wp != NULL && wp != curwin && bt_terminal(wp->w_buffer) && wp->w_status_height != 0) curattr = highlight_stltermnc[hltab[n].userhl - 1]; else if (wp != NULL && bt_terminal(wp->w_buffer) && wp->w_status_height != 0) curattr = highlight_stlterm[hltab[n].userhl - 1]; -#endif +# endif else if (wp != NULL && wp != curwin && wp->w_status_height != 0) curattr = highlight_stlnc[hltab[n].userhl - 1]; else @@ -2122,9 +2122,9 @@ redraw_block(int row, int end, win_T *wp) int col; int width; -# ifdef FEAT_CLIPBOARD +#ifdef FEAT_CLIPBOARD clip_may_clear_selection(row, end - 1); -# endif +#endif if (wp == NULL) { diff --git a/src/search.c b/src/search.c index 72d4bbe91b..6400ceb3dc 100644 --- a/src/search.c +++ b/src/search.c @@ -94,10 +94,10 @@ static int lastc_bytelen = 1; // >1 for multi-byte char static spat_T saved_spats[ARRAY_LENGTH(spats)]; static char_u *saved_mr_pattern = NULL; static size_t saved_mr_patternlen = 0; -# ifdef FEAT_SEARCH_EXTRA +#ifdef FEAT_SEARCH_EXTRA static int saved_spats_last_idx = 0; static int saved_spats_no_hlsearch = 0; -# endif +#endif // allocated copy of pattern used by search_regcomp() static char_u *mr_pattern = NULL; @@ -579,9 +579,9 @@ set_last_search_pat( spats[idx].magic = magic; spats[idx].no_scs = FALSE; spats[idx].off.dir = '/'; -#if defined(FEAT_EVAL) +# if defined(FEAT_EVAL) set_vv_searchforward(); -#endif +# endif spats[idx].off.line = FALSE; spats[idx].off.end = FALSE; spats[idx].off.off = 0; @@ -899,9 +899,9 @@ searchit( break; matchpos = regmatch.startpos[0]; endpos = regmatch.endpos[0]; -# ifdef FEAT_EVAL +#ifdef FEAT_EVAL submatch = first_submatch(®match); -# endif +#endif // Need to get the line pointer again, a // multi-line search may have made it invalid. @@ -946,9 +946,9 @@ searchit( match_ok = TRUE; matchpos = regmatch.startpos[0]; endpos = regmatch.endpos[0]; -# ifdef FEAT_EVAL +#ifdef FEAT_EVAL submatch = first_submatch(®match); -# endif +#endif } else break; @@ -3430,9 +3430,9 @@ find_pattern_in_path( char_u *already = NULL; char_u *startp = NULL; char_u *inc_opt = NULL; -#if defined(FEAT_QUICKFIX) +# if defined(FEAT_QUICKFIX) win_T *curwin_save = NULL; -#endif +# endif regmatch.regprog = NULL; incl_regmatch.regprog = NULL; @@ -3895,9 +3895,9 @@ search_line: { found = TRUE; if (depth == -1 && lnum == curwin->w_cursor.lnum -#if defined(FEAT_QUICKFIX) +# if defined(FEAT_QUICKFIX) && g_do_tagpreview == 0 -#endif +# endif ) emsg(_(e_match_is_on_current_line)); else if (action == ACTION_SHOW) @@ -3909,17 +3909,17 @@ search_line: } else { -#ifdef FEAT_GUI +# ifdef FEAT_GUI need_mouse_correct = TRUE; -#endif -#if defined(FEAT_QUICKFIX) +# endif +# if defined(FEAT_QUICKFIX) // ":psearch" uses the preview window if (g_do_tagpreview != 0) { curwin_save = curwin; prepare_tagpreview(TRUE, TRUE, FALSE); } -#endif +# endif if (action == ACTION_SPLIT) { if (win_split(0, 0) == FAIL) @@ -3929,7 +3929,7 @@ search_line: if (depth == -1) { // match in current file -#if defined(FEAT_QUICKFIX) +# if defined(FEAT_QUICKFIX) if (g_do_tagpreview != 0) { if (!win_valid(curwin_save)) @@ -3940,7 +3940,7 @@ search_line: break; // failed to jump to file } else -#endif +# endif setpcmark(); curwin->w_cursor.lnum = lnum; check_cursor(); @@ -3962,7 +3962,7 @@ search_line: curwin->w_set_curswant = TRUE; } -#if defined(FEAT_QUICKFIX) +# if defined(FEAT_QUICKFIX) if (g_do_tagpreview != 0 && curwin != curwin_save && win_valid(curwin_save)) { @@ -3971,12 +3971,12 @@ search_line: redraw_later(UPD_VALID); win_enter(curwin_save, TRUE); } -# ifdef FEAT_PROP_POPUP +# ifdef FEAT_PROP_POPUP else if (WIN_IS_POPUP(curwin)) // can't keep focus in popup window win_enter(firstwin, TRUE); +# endif # endif -#endif break; } exit_matched: @@ -4253,9 +4253,9 @@ f_searchcount(typval_T *argvars, typval_T *rettv) } save_last_search_pattern(); -#ifdef FEAT_SEARCH_EXTRA +# ifdef FEAT_SEARCH_EXTRA save_incsearch_state(); -#endif +# endif if (pattern != NULL) { if (*pattern == NUL) @@ -4279,8 +4279,8 @@ f_searchcount(typval_T *argvars, typval_T *rettv) the_end: restore_last_search_pattern(); -#ifdef FEAT_SEARCH_EXTRA +# ifdef FEAT_SEARCH_EXTRA restore_incsearch_state(); -#endif +# endif } #endif diff --git a/src/session.c b/src/session.c index bf51643833..80d4ffb706 100644 --- a/src/session.c +++ b/src/session.c @@ -74,9 +74,9 @@ ses_fname(FILE *fd, buf_T *buf, unsigned *flagp, int add_eol) if (buf->b_sfname != NULL && flagp == &ssop_flags && (ssop_flags & (SSOP_CURDIR | SSOP_SESDIR)) -#ifdef FEAT_AUTOCHDIR +# ifdef FEAT_AUTOCHDIR && !p_acd -#endif +# endif && !did_lcd) name = buf->b_sfname; else @@ -141,12 +141,12 @@ ses_arglist( static int ses_do_win(win_T *wp) { -#ifdef FEAT_TERMINAL +# ifdef FEAT_TERMINAL if (bt_terminal(wp->w_buffer)) return !term_is_finished(wp->w_buffer) && (ssop_flags & SSOP_TERMINAL) && term_should_restore(wp->w_buffer); -#endif +# endif if (wp->w_buffer->b_fname == NULL // When 'buftype' is "nofile" can't restore the window contents. || bt_nofilename(wp->w_buffer)) @@ -397,7 +397,7 @@ put_view( // No file in this buffer, just make it empty. if (put_line(fd, "enew") == FAIL) return FAIL; -#ifdef FEAT_QUICKFIX +# ifdef FEAT_QUICKFIX if (wp->w_buffer->b_ffname != NULL) { // The buffer does have a name, but it's not a file name. @@ -405,7 +405,7 @@ put_view( || ses_fname(fd, wp->w_buffer, flagp, TRUE) == FAIL) return FAIL; } -#endif +# endif do_cursor = FALSE; } } @@ -441,10 +441,10 @@ put_view( if (*flagp & (SSOP_OPTIONS | SSOP_LOCALOPTIONS)) f = makeset(fd, OPT_LOCAL, flagp == &vop_flags || !(*flagp & SSOP_OPTIONS)); -#ifdef FEAT_FOLDING +# ifdef FEAT_FOLDING else if (*flagp & SSOP_FOLDS) f = makefoldset(fd); -#endif +# endif else f = OK; curwin = save_curwin; @@ -452,7 +452,7 @@ put_view( if (f == FAIL) return FAIL; -#ifdef FEAT_FOLDING +# ifdef FEAT_FOLDING // Save Folds when 'buftype' is empty and for help files. if ((*flagp & SSOP_FOLDS) && wp->w_buffer->b_ffname != NULL @@ -461,7 +461,7 @@ put_view( if (put_folds(fd, wp) == FAIL) return FAIL; } -#endif +# endif // Set the cursor after creating folds, since that moves the cursor. if (do_cursor) @@ -534,7 +534,7 @@ put_view( return OK; } -#ifdef FEAT_EVAL +# ifdef FEAT_EVAL static int store_session_globals(FILE *fd) { @@ -600,7 +600,7 @@ store_session_globals(FILE *fd) } return OK; } -#endif +# endif /* * Write openfile commands for the current buffers to an .exrc file. @@ -626,24 +626,24 @@ makeopens( int next_arg_idx = 0; int ret = FAIL; tabpage_T *tp; -#ifdef FEAT_TERMINAL +# ifdef FEAT_TERMINAL hashtab_T terminal_bufs; hash_init(&terminal_bufs); -#endif +# endif if (ssop_flags & SSOP_BUFFERS) only_save_windows = FALSE; // Save ALL buffers // Begin by setting the this_session variable, and then other // sessionable variables. -#ifdef FEAT_EVAL +# ifdef FEAT_EVAL if (put_line(fd, "let v:this_session=expand(\":p\")") == FAIL) goto fail; if (ssop_flags & SSOP_GLOBALS) if (store_session_globals(fd) == FAIL) goto fail; -#endif +# endif // Close all windows and tabs but one. if (put_line(fd, "silent only") == FAIL) @@ -725,7 +725,7 @@ makeopens( goto fail; } -#ifdef FEAT_GUI +# ifdef FEAT_GUI if (gui.in_use && (ssop_flags & SSOP_WINPOS)) { int x, y; @@ -737,7 +737,7 @@ makeopens( goto fail; } } -#endif +# endif // When there are two or more tabpages and 'showtabline' is 1 the tabline // will be displayed when creating the next tab. That resizes the windows @@ -903,11 +903,11 @@ makeopens( continue; if (put_view(fd, wp, tp, wp != edited_win, &ssop_flags, cur_arg_idx, -#ifdef FEAT_TERMINAL +# ifdef FEAT_TERMINAL &terminal_bufs -#else +# else NULL -#endif +# endif ) == FAIL) goto fail; if (nr > 1 && put_line(fd, "wincmd w") == FAIL) @@ -990,9 +990,9 @@ makeopens( ret = OK; fail: -#ifdef FEAT_TERMINAL +# ifdef FEAT_TERMINAL hash_clear_all(&terminal_bufs, 0); -#endif +# endif return ret; } @@ -1040,11 +1040,11 @@ get_view_file(int c) else if (vim_ispathsep(*p)) { *s++ = '='; -#if defined(BACKSLASH_IN_FILENAME) || defined(AMIGA) || defined(VMS) +# if defined(BACKSLASH_IN_FILENAME) || defined(AMIGA) || defined(VMS) if (*p == ':') *s++ = '-'; else -#endif +# endif *s++ = '+'; } else @@ -1343,10 +1343,10 @@ ex_mkrc(exarg_T *eap) if (put_line(fd, "let &g:so = s:so_save | let &g:siso = s:siso_save") == FAIL) failed = TRUE; -#ifdef FEAT_SEARCH_EXTRA +# ifdef FEAT_SEARCH_EXTRA if (no_hlsearch && put_line(fd, "nohlsearch") == FAIL) failed = TRUE; -#endif +# endif if (put_line(fd, "doautoall SessionLoadPost") == FAIL) failed = TRUE; if (eap->cmdidx == CMD_mksession) diff --git a/src/sha256.c b/src/sha256.c index e433925020..6db0a1f9cc 100644 --- a/src/sha256.c +++ b/src/sha256.c @@ -25,7 +25,7 @@ #if defined(FEAT_CRYPT) || defined(FEAT_PERSISTENT_UNDO) -#define GET_UINT32(n, b, i) \ +# define GET_UINT32(n, b, i) \ { \ (n) = ( (UINT32_T)(b)[(i) ] << 24) \ | ( (UINT32_T)(b)[(i) + 1] << 16) \ @@ -33,7 +33,7 @@ | ( (UINT32_T)(b)[(i) + 3] ); \ } -#define PUT_UINT32(n,b,i) \ +# define PUT_UINT32(n,b,i) \ { \ (b)[(i) ] = (char_u)((n) >> 24); \ (b)[(i) + 1] = (char_u)((n) >> 16); \ @@ -80,25 +80,25 @@ sha256_process(context_sha256_T *ctx, char_u data[64]) GET_UINT32(W[14], data, 56); GET_UINT32(W[15], data, 60); -#define SHR(x, n) (((x) & 0xFFFFFFFF) >> (n)) -#define ROTR(x, n) (SHR(x, n) | ((x) << (32 - (n)))) +# define SHR(x, n) (((x) & 0xFFFFFFFF) >> (n)) +# define ROTR(x, n) (SHR(x, n) | ((x) << (32 - (n)))) -#define S0(x) (ROTR(x, 7) ^ ROTR(x, 18) ^ SHR(x, 3)) -#define S1(x) (ROTR(x, 17) ^ ROTR(x, 19) ^ SHR(x, 10)) +# define S0(x) (ROTR(x, 7) ^ ROTR(x, 18) ^ SHR(x, 3)) +# define S1(x) (ROTR(x, 17) ^ ROTR(x, 19) ^ SHR(x, 10)) -#define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22)) -#define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25)) +# define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22)) +# define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25)) -#define F0(x, y, z) (((x) & (y)) | ((z) & ((x) | (y)))) -#define F1(x, y, z) ((z) ^ ((x) & ((y) ^ (z)))) +# define F0(x, y, z) (((x) & (y)) | ((z) & ((x) | (y)))) +# define F1(x, y, z) ((z) ^ ((x) & ((y) ^ (z)))) -#define R(t) \ +# define R(t) \ ( \ W[t] = S1(W[(t) - 2]) + W[(t) - 7] + \ S0(W[(t) - 15]) + W[(t) - 16] \ ) -#define P(a,b,c,d,e,f,g,h,x,K) \ +# define P(a,b,c,d,e,f,g,h,x,K) \ { \ temp1 = (h) + S3(e) + F1(e, f, g) + (K) + (x); \ temp2 = S2(a) + F0(a, b, c); \ diff --git a/src/spell.h b/src/spell.h index c25b3b9502..1f473732a9 100644 --- a/src/spell.h +++ b/src/spell.h @@ -299,9 +299,9 @@ SPELL_EXTERN spelltab_T spelltab; SPELL_EXTERN int did_set_spelltab; // Values for "what" argument of spell_add_word() -#define SPELL_ADD_GOOD 0 -#define SPELL_ADD_BAD 1 -#define SPELL_ADD_RARE 2 +# define SPELL_ADD_GOOD 0 +# define SPELL_ADD_BAD 1 +# define SPELL_ADD_RARE 2 typedef struct wordcount_S { @@ -309,9 +309,9 @@ typedef struct wordcount_S char_u wc_word[1]; // word, actually longer } wordcount_T; -#define WC_KEY_OFF offsetof(wordcount_T, wc_word) -#define HI2WC(hi) ((wordcount_T *)((hi)->hi_key - WC_KEY_OFF)) -#define MAXWORDCOUNT 0xffff +# define WC_KEY_OFF offsetof(wordcount_T, wc_word) +# define HI2WC(hi) ((wordcount_T *)((hi)->hi_key - WC_KEY_OFF)) +# define MAXWORDCOUNT 0xffff // Remember what "z?" replaced. SPELL_EXTERN char_u *repl_from SPELL_INIT(= NULL); diff --git a/src/spellfile.c b/src/spellfile.c index 762653d45c..53243c8da6 100644 --- a/src/spellfile.c +++ b/src/spellfile.c @@ -2079,10 +2079,10 @@ spell_check_msm(void) * compressing the tree. * Based on code from Olaf Seibert. */ -#define PRINTLINESIZE 1000 -#define PRINTWIDTH 6 +# define PRINTLINESIZE 1000 +# define PRINTWIDTH 6 -#define PRINTSOME(l, depth, fmt, a1, a2) vim_snprintf(l + depth * PRINTWIDTH, \ +# define PRINTSOME(l, depth, fmt, a1, a2) vim_snprintf(l + depth * PRINTWIDTH, \ PRINTLINESIZE - PRINTWIDTH * depth, fmt, a1, a2) static char line1[PRINTLINESIZE]; diff --git a/src/strings.c b/src/strings.c index b548783022..782249fb75 100644 --- a/src/strings.c +++ b/src/strings.c @@ -156,9 +156,9 @@ vim_strsave_shellescape(char_u *string, int do_special, int do_newline) int fish_like; char_u *shname; int powershell; -# ifdef MSWIN +#ifdef MSWIN int double_quotes; -# endif +#endif // Only csh and similar shells expand '!' within single quotes. For sh and // the like we must not put a backslash before it, it will be taken @@ -173,24 +173,24 @@ vim_strsave_shellescape(char_u *string, int do_special, int do_newline) // PowerShell uses its own version for quoting single quotes shname = gettail(p_sh); powershell = strstr((char *)shname, "pwsh") != NULL; -# ifdef MSWIN +#ifdef MSWIN powershell = powershell || strstr((char *)shname, "powershell") != NULL; // PowerShell only accepts single quotes so override shellslash. double_quotes = !powershell && !p_ssl; -# endif +#endif // First count the number of extra bytes required. length = (unsigned)STRLEN(string) + 3; // two quotes and a trailing NUL for (p = string; *p != NUL; MB_PTR_ADV(p)) { -# ifdef MSWIN +#ifdef MSWIN if (double_quotes) { if (*p == '"') ++length; // " -> "" } else -# endif +#endif if (*p == '\'') { if (powershell) @@ -221,16 +221,16 @@ vim_strsave_shellescape(char_u *string, int do_special, int do_newline) d = escaped_string; // add opening quote -# ifdef MSWIN +#ifdef MSWIN if (double_quotes) *d++ = '"'; else -# endif +#endif *d++ = '\''; for (p = string; *p != NUL; ) { -# ifdef MSWIN +#ifdef MSWIN if (double_quotes) { if (*p == '"') @@ -242,7 +242,7 @@ vim_strsave_shellescape(char_u *string, int do_special, int do_newline) } } else -# endif +#endif if (*p == '\'') { if (powershell) @@ -288,11 +288,11 @@ vim_strsave_shellescape(char_u *string, int do_special, int do_newline) } // add terminating quote and finish with a NUL -# ifdef MSWIN +#ifdef MSWIN if (double_quotes) *d++ = '"'; else -# endif +#endif *d++ = '\''; *d = NUL; } @@ -2933,7 +2933,7 @@ format_overflow_error(const char *pstart) semsg(_(e_out_of_memory_allocating_nr_bytes), arglen); } -#define MAX_ALLOWED_STRING_WIDTH 1048576 // 1 MiB +# define MAX_ALLOWED_STRING_WIDTH 1048576 // 1 MiB static int get_unsigned_int( @@ -2981,7 +2981,7 @@ parse_fmt_types( int any_arg = 0; int arg_idx; -#define CHECK_POS_ARG do { \ +# define CHECK_POS_ARG do { \ if (any_pos && any_arg) \ { \ semsg(_( e_cannot_mix_positional_and_non_positional_str), fmt); \ diff --git a/src/structs.h b/src/structs.h index 6df682307b..58046abf29 100644 --- a/src/structs.h +++ b/src/structs.h @@ -208,13 +208,13 @@ typedef struct # define w_p_briopt w_onebuf_opt.wo_briopt // 'breakindentopt' #endif char_u *wo_wcr; -# define w_p_wcr w_onebuf_opt.wo_wcr // 'wincolor' +#define w_p_wcr w_onebuf_opt.wo_wcr // 'wincolor' #ifdef FEAT_DIFF int wo_diff; # define w_p_diff w_onebuf_opt.wo_diff // 'diff' #endif char_u *wo_eiw; -# define w_p_eiw w_onebuf_opt.wo_eiw // 'eventignorewin' +#define w_p_eiw w_onebuf_opt.wo_eiw // 'eventignorewin' #ifdef FEAT_FOLDING long wo_fdc; # define w_p_fdc w_onebuf_opt.wo_fdc // 'foldcolumn' @@ -240,7 +240,7 @@ typedef struct # define w_p_fdn w_onebuf_opt.wo_fdn // 'foldnestmax' # ifdef FEAT_EVAL char_u *wo_fde; -# define w_p_fde w_onebuf_opt.wo_fde // 'foldexpr' +# define w_p_fde w_onebuf_opt.wo_fde // 'foldexpr' char_u *wo_fdt; # define w_p_fdt w_onebuf_opt.wo_fdt // 'foldtext' # endif @@ -272,9 +272,9 @@ typedef struct int wo_wfb; #define w_p_wfb w_onebuf_opt.wo_wfb // 'winfixbuf' int wo_wfh; -# define w_p_wfh w_onebuf_opt.wo_wfh // 'winfixheight' +#define w_p_wfh w_onebuf_opt.wo_wfh // 'winfixheight' int wo_wfw; -# define w_p_wfw w_onebuf_opt.wo_wfw // 'winfixwidth' +#define w_p_wfw w_onebuf_opt.wo_wfw // 'winfixwidth' #if defined(FEAT_QUICKFIX) int wo_pvw; # define w_p_pvw w_onebuf_opt.wo_pvw // 'previewwindow' @@ -307,11 +307,11 @@ typedef struct #endif #ifdef FEAT_LINEBREAK char_u *wo_sbr; -#define w_p_sbr w_onebuf_opt.wo_sbr // 'showbreak' +# define w_p_sbr w_onebuf_opt.wo_sbr // 'showbreak' #endif #ifdef FEAT_STL_OPT char_u *wo_stl; -#define w_p_stl w_onebuf_opt.wo_stl // 'statusline' +# define w_p_stl w_onebuf_opt.wo_stl // 'statusline' #endif int wo_scb; #define w_p_scb w_onebuf_opt.wo_scb // 'scrollbind' @@ -340,9 +340,9 @@ typedef struct # define w_p_scl w_onebuf_opt.wo_scl // 'signcolumn' #endif long wo_siso; -# define w_p_siso w_onebuf_opt.wo_siso // 'sidescrolloff' local value +#define w_p_siso w_onebuf_opt.wo_siso // 'sidescrolloff' local value long wo_so; -# define w_p_so w_onebuf_opt.wo_so // 'scrolloff' local value +#define w_p_so w_onebuf_opt.wo_so // 'scrolloff' local value #ifdef FEAT_TERMINAL char_u *wo_twk; # define w_p_twk w_onebuf_opt.wo_twk // 'termwinkey' @@ -704,10 +704,10 @@ typedef struct expand_T *xpc; // struct being used for expansion, xp_pattern // may point into cmdbuff int xp_context; // type of expansion -# ifdef FEAT_EVAL +#ifdef FEAT_EVAL char_u *xp_arg; // user-defined expansion arg int input_fn; // when TRUE Invoked for input() function -# endif +#endif } cmdline_info_T; /* @@ -961,11 +961,11 @@ typedef struct sign_attrs_S { #if defined(FEAT_SIGNS) // Macros to get the sign group structure from the group name -#define SGN_KEY_OFF offsetof(signgroup_T, sg_name) -#define HI2SG(hi) ((signgroup_T *)((hi)->hi_key - SGN_KEY_OFF)) +# define SGN_KEY_OFF offsetof(signgroup_T, sg_name) +# define HI2SG(hi) ((signgroup_T *)((hi)->hi_key - SGN_KEY_OFF)) // Default sign priority for highlighting -#define SIGN_DEF_PRIO 10 +# define SIGN_DEF_PRIO 10 #endif @@ -1037,50 +1037,50 @@ typedef struct { eslist_T *cs_emsg_silent_list; // saved values of "emsg_silent" char cs_lflags; // loop flags: CSL_ flags } cstack_T; -# define cs_rettv cs_pend.csp_rv -# define cs_exception cs_pend.csp_ex +#define cs_rettv cs_pend.csp_rv +#define cs_exception cs_pend.csp_ex // There is no CSF_IF, the lack of CSF_WHILE, CSF_FOR and CSF_TRY means ":if" // was used. -# define CSF_TRUE 0x0001 // condition was TRUE -# define CSF_ACTIVE 0x0002 // current state is active -# define CSF_ELSE 0x0004 // ":else" has been passed -# define CSF_WHILE 0x0008 // is a ":while" -# define CSF_FOR 0x0010 // is a ":for" -# define CSF_BLOCK 0x0020 // is a "{" block - -# define CSF_TRY 0x0100 // is a ":try" -# define CSF_FINALLY 0x0200 // ":finally" has been passed -# define CSF_CATCH 0x0400 // ":catch" has been seen -# define CSF_THROWN 0x0800 // exception thrown to this try conditional -# define CSF_CAUGHT 0x1000 // exception caught by this try conditional -# define CSF_FINISHED 0x2000 // CSF_CAUGHT was handled by finish_exception() -# define CSF_SILENT 0x4000 // "emsg_silent" reset by ":try" +#define CSF_TRUE 0x0001 // condition was TRUE +#define CSF_ACTIVE 0x0002 // current state is active +#define CSF_ELSE 0x0004 // ":else" has been passed +#define CSF_WHILE 0x0008 // is a ":while" +#define CSF_FOR 0x0010 // is a ":for" +#define CSF_BLOCK 0x0020 // is a "{" block + +#define CSF_TRY 0x0100 // is a ":try" +#define CSF_FINALLY 0x0200 // ":finally" has been passed +#define CSF_CATCH 0x0400 // ":catch" has been seen +#define CSF_THROWN 0x0800 // exception thrown to this try conditional +#define CSF_CAUGHT 0x1000 // exception caught by this try conditional +#define CSF_FINISHED 0x2000 // CSF_CAUGHT was handled by finish_exception() +#define CSF_SILENT 0x4000 // "emsg_silent" reset by ":try" // Note that CSF_ELSE is only used when CSF_TRY and CSF_WHILE are unset // (an ":if"), and CSF_SILENT is only used when CSF_TRY is set. -# define CSF_FUNC_DEF 0x8000 // a function was defined in this block +#define CSF_FUNC_DEF 0x8000 // a function was defined in this block /* * What's pending for being reactivated at the ":endtry" of this try * conditional: */ -# define CSTP_NONE 0 // nothing pending in ":finally" clause -# define CSTP_ERROR 1 // an error is pending -# define CSTP_INTERRUPT 2 // an interrupt is pending -# define CSTP_THROW 4 // a throw is pending -# define CSTP_BREAK 8 // ":break" is pending -# define CSTP_CONTINUE 16 // ":continue" is pending -# define CSTP_RETURN 24 // ":return" is pending -# define CSTP_FINISH 32 // ":finish" is pending +#define CSTP_NONE 0 // nothing pending in ":finally" clause +#define CSTP_ERROR 1 // an error is pending +#define CSTP_INTERRUPT 2 // an interrupt is pending +#define CSTP_THROW 4 // a throw is pending +#define CSTP_BREAK 8 // ":break" is pending +#define CSTP_CONTINUE 16 // ":continue" is pending +#define CSTP_RETURN 24 // ":return" is pending +#define CSTP_FINISH 32 // ":finish" is pending /* * Flags for the cs_lflags item in cstack_T. */ -# define CSL_HAD_LOOP 1 // just found ":while" or ":for" -# define CSL_HAD_ENDLOOP 2 // just found ":endwhile" or ":endfor" -# define CSL_HAD_CONT 4 // just found ":continue" -# define CSL_HAD_FINA 8 // just found ":finally" +#define CSL_HAD_LOOP 1 // just found ":while" or ":for" +#define CSL_HAD_ENDLOOP 2 // just found ":endwhile" or ":endfor" +#define CSL_HAD_CONT 4 // just found ":continue" +#define CSL_HAD_FINA 8 // just found ":finally" /* * A list of error messages that can be converted to an exception. "throw_msg" @@ -1182,10 +1182,10 @@ typedef struct buf_state { int bs_idx; // index of pattern int bs_flags; // flags for pattern -#ifdef FEAT_CONCEAL +# ifdef FEAT_CONCEAL int bs_seqnr; // stores si_seqnr int bs_cchar; // stores si_cchar -#endif +# endif reg_extmatch_T *bs_extmatch; // external matches from start pattern } bufstate_T; @@ -1236,24 +1236,24 @@ typedef struct attr_entry short_u bg_color; // background color number short_u ul_color; // underline color number short_u font; // font number -# ifdef FEAT_TERMGUICOLORS +#ifdef FEAT_TERMGUICOLORS guicolor_T fg_rgb; // foreground color RGB guicolor_T bg_rgb; // background color RGB guicolor_T ul_rgb; // underline color RGB -# endif +#endif } cterm; -# ifdef FEAT_GUI +#ifdef FEAT_GUI struct { guicolor_T fg_color; // foreground color handle guicolor_T bg_color; // background color handle guicolor_T sp_color; // special color handle GuiFont font; // font handle -# ifdef FEAT_XFONTSET +# ifdef FEAT_XFONTSET GuiFontset fontset; // fontset handle -# endif - } gui; # endif + } gui; +#endif } ae_u; } attrentry_T; @@ -1311,13 +1311,13 @@ typedef struct { int vc_type; // zero or one of the CONV_ values int vc_factor; // max. expansion factor -# ifdef MSWIN +#ifdef MSWIN int vc_cpfrom; // codepage to convert from (CONV_CODEPAGE) int vc_cpto; // codepage to convert to (CONV_CODEPAGE) -# endif -# ifdef USE_ICONV +#endif +#ifdef USE_ICONV iconv_t vc_fd; // for CONV_ICONV -# endif +#endif int vc_fail; // fail for invalid char, don't use '?' } vimconv_T; @@ -2010,38 +2010,38 @@ struct ufunc_S }; // flags used in uf_flags -#define FC_ABORT 0x01 // abort function on error -#define FC_RANGE 0x02 // function accepts range -#define FC_DICT 0x04 // Dict function, uses "self" -#define FC_CLOSURE 0x08 // closure, uses outer scope variables -#define FC_DELETED 0x10 // :delfunction used while uf_refcount > 0 -#define FC_REMOVED 0x20 // function redefined while uf_refcount > 0 -#define FC_SANDBOX 0x40 // function defined in the sandbox -#define FC_DEAD 0x80 // function kept only for reference to dfunc -#define FC_EXPORT 0x100 // "export def Func()" -#define FC_NOARGS 0x200 // no a: variables in lambda -#define FC_VIM9 0x400 // defined in Vim9 script file -#define FC_CFUNC 0x800 // defined as Lua C func -#define FC_COPY 0x1000 // copy of another function by +# define FC_ABORT 0x01 // abort function on error +# define FC_RANGE 0x02 // function accepts range +# define FC_DICT 0x04 // Dict function, uses "self" +# define FC_CLOSURE 0x08 // closure, uses outer scope variables +# define FC_DELETED 0x10 // :delfunction used while uf_refcount > 0 +# define FC_REMOVED 0x20 // function redefined while uf_refcount > 0 +# define FC_SANDBOX 0x40 // function defined in the sandbox +# define FC_DEAD 0x80 // function kept only for reference to dfunc +# define FC_EXPORT 0x100 // "export def Func()" +# define FC_NOARGS 0x200 // no a: variables in lambda +# define FC_VIM9 0x400 // defined in Vim9 script file +# define FC_CFUNC 0x800 // defined as Lua C func +# define FC_COPY 0x1000 // copy of another function by // copy_lambda_to_global_func() -#define FC_LAMBDA 0x2000 // one line "return {expr}" +# define FC_LAMBDA 0x2000 // one line "return {expr}" -#define FC_OBJECT 0x4000 // object method -#define FC_NEW 0x8000 // constructor -#define FC_ABSTRACT 0x10000 // abstract method -#define FC_GENERIC 0x20000 // generic function +# define FC_OBJECT 0x4000 // object method +# define FC_NEW 0x8000 // constructor +# define FC_ABSTRACT 0x10000 // abstract method +# define FC_GENERIC 0x20000 // generic function // Is "ufunc" an object method? -#define IS_OBJECT_METHOD(ufunc) ((ufunc->uf_flags & FC_OBJECT) == FC_OBJECT) +# define IS_OBJECT_METHOD(ufunc) ((ufunc->uf_flags & FC_OBJECT) == FC_OBJECT) // Is "ufunc" a class new() constructor method? -#define IS_CONSTRUCTOR_METHOD(ufunc) ((ufunc->uf_flags & FC_NEW) == FC_NEW) +# define IS_CONSTRUCTOR_METHOD(ufunc) ((ufunc->uf_flags & FC_NEW) == FC_NEW) // Is "ufunc" an abstract class method? -#define IS_ABSTRACT_METHOD(ufunc) ((ufunc->uf_flags & FC_ABSTRACT) == FC_ABSTRACT) -#define IS_GENERIC_FUNC(ufunc) (((ufunc)->uf_flags & FC_GENERIC) == FC_GENERIC) +# define IS_ABSTRACT_METHOD(ufunc) ((ufunc->uf_flags & FC_ABSTRACT) == FC_ABSTRACT) +# define IS_GENERIC_FUNC(ufunc) (((ufunc)->uf_flags & FC_GENERIC) == FC_GENERIC) -#define MAX_FUNC_ARGS 20 // maximum number of function arguments -#define VAR_SHORT_LEN 20 // short variable name length -#define FIXVAR_CNT 12 // number of fixed variables +# define MAX_FUNC_ARGS 20 // maximum number of function arguments +# define VAR_SHORT_LEN 20 // short variable name length +# define FIXVAR_CNT 12 // number of fixed variables /* * Structure to hold info for a function that is currently being executed. @@ -2071,9 +2071,9 @@ struct funccall_S ectx_T *fc_ectx; // execution context for :def function, NULL // otherwise -#ifdef FEAT_PROFILE +# ifdef FEAT_PROFILE proftime_T fc_prof_child; // time spent in a child -#endif +# endif funccall_T *fc_caller; // calling function or NULL; or next funccal in // list pointed to by previous_funccal. @@ -2110,9 +2110,9 @@ struct funccal_entry { }; // From user function to hashitem and back. -#define UF2HIKEY(fp) ((fp)->uf_name) -#define HIKEY2UF(p) ((ufunc_T *)((p) - offsetof(ufunc_T, uf_name))) -#define HI2UF(hi) HIKEY2UF((hi)->hi_key) +# define UF2HIKEY(fp) ((fp)->uf_name) +# define HIKEY2UF(p) ((ufunc_T *)((p) - offsetof(ufunc_T, uf_name))) +# define HI2UF(hi) HIKEY2UF((hi)->hi_key) /* * Holds the hashtab with variables local to each sourced script. @@ -2149,13 +2149,13 @@ struct sallvar_S { * HIKEY2SAV() converts a hashitem key pointer to a sallvar_T pointer. * HI2SAV() converts a hashitem pointer to a sallvar_T pointer. */ -#define SAV2HIKEY(sav) ((sav)->sav_key) -#define HIKEY2SAV(p) ((sallvar_T *)(p - offsetof(sallvar_T, sav_key))) -#define HI2SAV(hi) HIKEY2SAV((hi)->hi_key) +# define SAV2HIKEY(sav) ((sav)->sav_key) +# define HIKEY2SAV(p) ((sallvar_T *)(p - offsetof(sallvar_T, sav_key))) +# define HI2SAV(hi) HIKEY2SAV((hi)->hi_key) -#define SVFLAG_TYPE_ALLOCATED 1 // call free_type() for "sv_type" -#define SVFLAG_EXPORTED 2 // "export let var = val" -#define SVFLAG_ASSIGNED 4 // assigned a value +# define SVFLAG_TYPE_ALLOCATED 1 // call free_type() for "sv_type" +# define SVFLAG_EXPORTED 2 // "export let var = val" +# define SVFLAG_ASSIGNED 4 // assigned a value /* * Entry for "sn_var_vals". Used for script-local variables. @@ -2174,8 +2174,8 @@ typedef struct { int imp_flags; // IMP_FLAGS_ values } imported_T; -#define IMP_FLAGS_RELOAD 2 // script reloaded, OK to redefine -#define IMP_FLAGS_AUTOLOAD 4 // script still needs to be loaded +# define IMP_FLAGS_RELOAD 2 // script reloaded, OK to redefine +# define IMP_FLAGS_AUTOLOAD 4 // script still needs to be loaded /* * Info about an encountered script. @@ -2248,10 +2248,10 @@ typedef struct # endif } scriptitem_T; -#define SN_STATE_NEW 0 // newly loaded script, nothing done -#define SN_STATE_NOT_LOADED 1 // script located but not loaded -#define SN_STATE_RELOAD 2 // script loaded before, nothing done -#define SN_STATE_HAD_COMMAND 9 // a command was executed +# define SN_STATE_NEW 0 // newly loaded script, nothing done +# define SN_STATE_NOT_LOADED 1 // script located but not loaded +# define SN_STATE_RELOAD 2 // script loaded before, nothing done +# define SN_STATE_HAD_COMMAND 9 // a command was executed // Struct passed through eval() functions. // See EVALARG_EVALUATE for a fixed value with eval_flags set to EVAL_EVALUATE. @@ -2293,7 +2293,7 @@ typedef struct { } evalarg_T; // Flag for expression evaluation. -#define EVAL_EVALUATE 1 // when missing don't actually evaluate +# define EVAL_EVALUATE 1 // when missing don't actually evaluate # ifdef FEAT_PROFILE /* @@ -2634,9 +2634,9 @@ typedef enum { typedef struct { sock_T ch_fd; // socket/stdin/stdout/stderr, -1 if not used -# if defined(UNIX) && !defined(HAVE_SELECT) +#if defined(UNIX) && !defined(HAVE_SELECT) int ch_poll_idx; // used by channel_poll_setup() -# endif +#endif #ifdef FEAT_GUI_X11 XtInputId ch_inputHandler; // Cookie for input @@ -3064,9 +3064,9 @@ typedef struct { long b_syn_sync_linebreaks; // offset for multi-line pattern char_u *b_syn_linecont_pat; // line continuation pattern regprog_T *b_syn_linecont_prog; // line continuation program -#ifdef FEAT_PROFILE +# ifdef FEAT_PROFILE syn_time_T b_syn_linecont_time; -#endif +# endif int b_syn_linecont_ic; // ignore-case flag for above int b_syn_topgrp; // for ":syntax include" # ifdef FEAT_CONCEAL @@ -3328,8 +3328,8 @@ struct file_buffer char_u *b_p_bh; // 'bufhidden' char_u *b_p_bt; // 'buftype' #ifdef FEAT_QUICKFIX -#define BUF_HAS_QF_ENTRY 1 -#define BUF_HAS_LL_ENTRY 2 +# define BUF_HAS_QF_ENTRY 1 +# define BUF_HAS_LL_ENTRY 2 int b_has_qf_entry; #endif int b_p_bl; // 'buflisted' @@ -4415,34 +4415,34 @@ typedef struct cmdarg_S * struct to store values from 'guicursor' and 'mouseshape' */ // Indexes in shape_table[] -#define SHAPE_IDX_N 0 // Normal mode -#define SHAPE_IDX_V 1 // Visual mode -#define SHAPE_IDX_I 2 // Insert mode -#define SHAPE_IDX_R 3 // Replace mode -#define SHAPE_IDX_C 4 // Command line Normal mode -#define SHAPE_IDX_CI 5 // Command line Insert mode -#define SHAPE_IDX_CR 6 // Command line Replace mode -#define SHAPE_IDX_O 7 // Operator-pending mode -#define SHAPE_IDX_VE 8 // Visual mode with 'selection' exclusive -#define SHAPE_IDX_CLINE 9 // On command line -#define SHAPE_IDX_STATUS 10 // A status line -#define SHAPE_IDX_SDRAG 11 // dragging a status line -#define SHAPE_IDX_VSEP 12 // A vertical separator line -#define SHAPE_IDX_VDRAG 13 // dragging a vertical separator line -#define SHAPE_IDX_MORE 14 // Hit-return or More -#define SHAPE_IDX_MOREL 15 // Hit-return or More in last line -#define SHAPE_IDX_SM 16 // showing matching paren -#define SHAPE_IDX_COUNT 17 - -#define SHAPE_BLOCK 0 // block cursor -#define SHAPE_HOR 1 // horizontal bar cursor -#define SHAPE_VER 2 // vertical bar cursor - -#define MSHAPE_NUMBERED 1000 // offset for shapes identified by number -#define MSHAPE_HIDE 1 // hide mouse pointer - -#define SHAPE_MOUSE 1 // used for mouse pointer shape -#define SHAPE_CURSOR 2 // used for text cursor shape +# define SHAPE_IDX_N 0 // Normal mode +# define SHAPE_IDX_V 1 // Visual mode +# define SHAPE_IDX_I 2 // Insert mode +# define SHAPE_IDX_R 3 // Replace mode +# define SHAPE_IDX_C 4 // Command line Normal mode +# define SHAPE_IDX_CI 5 // Command line Insert mode +# define SHAPE_IDX_CR 6 // Command line Replace mode +# define SHAPE_IDX_O 7 // Operator-pending mode +# define SHAPE_IDX_VE 8 // Visual mode with 'selection' exclusive +# define SHAPE_IDX_CLINE 9 // On command line +# define SHAPE_IDX_STATUS 10 // A status line +# define SHAPE_IDX_SDRAG 11 // dragging a status line +# define SHAPE_IDX_VSEP 12 // A vertical separator line +# define SHAPE_IDX_VDRAG 13 // dragging a vertical separator line +# define SHAPE_IDX_MORE 14 // Hit-return or More +# define SHAPE_IDX_MOREL 15 // Hit-return or More in last line +# define SHAPE_IDX_SM 16 // showing matching paren +# define SHAPE_IDX_COUNT 17 + +# define SHAPE_BLOCK 0 // block cursor +# define SHAPE_HOR 1 // horizontal bar cursor +# define SHAPE_VER 2 // vertical bar cursor + +# define MSHAPE_NUMBERED 1000 // offset for shapes identified by number +# define MSHAPE_HIDE 1 // hide mouse pointer + +# define SHAPE_MOUSE 1 // used for mouse pointer shape +# define SHAPE_CURSOR 2 // used for text cursor shape typedef struct cursor_entry { @@ -4462,31 +4462,31 @@ typedef struct cursor_entry #ifdef FEAT_MENU // Indices into vimmenu_T->strings[] and vimmenu_T->noremap[] for each mode -#define MENU_INDEX_INVALID -1 -#define MENU_INDEX_NORMAL 0 -#define MENU_INDEX_VISUAL 1 -#define MENU_INDEX_SELECT 2 -#define MENU_INDEX_OP_PENDING 3 -#define MENU_INDEX_INSERT 4 -#define MENU_INDEX_CMDLINE 5 -#define MENU_INDEX_TERMINAL 6 -#define MENU_INDEX_TIP 7 -#define MENU_MODES 8 +# define MENU_INDEX_INVALID -1 +# define MENU_INDEX_NORMAL 0 +# define MENU_INDEX_VISUAL 1 +# define MENU_INDEX_SELECT 2 +# define MENU_INDEX_OP_PENDING 3 +# define MENU_INDEX_INSERT 4 +# define MENU_INDEX_CMDLINE 5 +# define MENU_INDEX_TERMINAL 6 +# define MENU_INDEX_TIP 7 +# define MENU_MODES 8 // Menu modes -#define MENU_NORMAL_MODE (1 << MENU_INDEX_NORMAL) -#define MENU_VISUAL_MODE (1 << MENU_INDEX_VISUAL) -#define MENU_SELECT_MODE (1 << MENU_INDEX_SELECT) -#define MENU_OP_PENDING_MODE (1 << MENU_INDEX_OP_PENDING) -#define MENU_INSERT_MODE (1 << MENU_INDEX_INSERT) -#define MENU_CMDLINE_MODE (1 << MENU_INDEX_CMDLINE) -#define MENU_TERMINAL_MODE (1 << MENU_INDEX_TERMINAL) -#define MENU_TIP_MODE (1 << MENU_INDEX_TIP) -#define MENU_ALL_MODES ((1 << MENU_INDEX_TIP) - 1) +# define MENU_NORMAL_MODE (1 << MENU_INDEX_NORMAL) +# define MENU_VISUAL_MODE (1 << MENU_INDEX_VISUAL) +# define MENU_SELECT_MODE (1 << MENU_INDEX_SELECT) +# define MENU_OP_PENDING_MODE (1 << MENU_INDEX_OP_PENDING) +# define MENU_INSERT_MODE (1 << MENU_INDEX_INSERT) +# define MENU_CMDLINE_MODE (1 << MENU_INDEX_CMDLINE) +# define MENU_TERMINAL_MODE (1 << MENU_INDEX_TERMINAL) +# define MENU_TIP_MODE (1 << MENU_INDEX_TIP) +# define MENU_ALL_MODES ((1 << MENU_INDEX_TIP) - 1) // note MENU_INDEX_TIP is not a 'real' mode // Start a menu name with this to not include it on the main menu bar -#define MNU_HIDDEN_CHAR ']' +# define MNU_HIDDEN_CHAR ']' struct VimMenu { @@ -4494,65 +4494,65 @@ struct VimMenu int enabled; // for which modes the menu is enabled char_u *name; // Name of menu, possibly translated char_u *dname; // Displayed Name ("name" without '&') -#ifdef FEAT_MULTI_LANG +# ifdef FEAT_MULTI_LANG char_u *en_name; // "name" untranslated, NULL when "name" // was not translated char_u *en_dname; // "dname" untranslated, NULL when "dname" // was not translated -#endif +# endif char_u *actext; // accelerator text (after TAB) int mnemonic; // mnemonic key (after '&') int priority; // Menu order priority -#ifdef FEAT_GUI +# ifdef FEAT_GUI void (*cb)(vimmenu_T *); // Call-back function -#endif -#ifdef FEAT_TOOLBAR +# endif +# ifdef FEAT_TOOLBAR char_u *iconfile; // name of file for icon or NULL int iconidx; // icon index (-1 if not set) int icon_builtin; // icon names is BuiltIn{nr} -#endif +# endif char_u *strings[MENU_MODES]; // Mapped string for each mode int noremap[MENU_MODES]; // A REMAP_ flag for each mode char silent[MENU_MODES]; // A silent flag for each mode vimmenu_T *children; // Children of sub-menu vimmenu_T *parent; // Parent of menu vimmenu_T *next; // Next item in menu -#ifdef FEAT_GUI_X11 +# ifdef FEAT_GUI_X11 Widget id; // Manage this to enable item Widget submenu_id; // If this is submenu, add children here -#endif -#ifdef FEAT_GUI_GTK +# endif +# ifdef FEAT_GUI_GTK GtkWidget *id; // Manage this to enable item GtkWidget *submenu_id; // If this is submenu, add children here -# if defined(GTK_CHECK_VERSION) && !GTK_CHECK_VERSION(3,4,0) +# if defined(GTK_CHECK_VERSION) && !GTK_CHECK_VERSION(3,4,0) GtkWidget *tearoff_handle; -# endif +# endif GtkWidget *label; // Used by "set wak=" code. -#endif -#ifdef FEAT_GUI_MOTIF +# endif +# ifdef FEAT_GUI_MOTIF int sensitive; // turn button on/off char **xpm; // pixmap data char *xpm_fname; // file with pixmap data -#endif -#ifdef FEAT_BEVAL_TIP +# endif +# ifdef FEAT_BEVAL_TIP BalloonEval *tip; // tooltip for this menu item -#endif -#ifdef FEAT_GUI_MSWIN +# endif +# ifdef FEAT_GUI_MSWIN UINT id; // Id of menu item HMENU submenu_id; // If this is submenu, add children here HWND tearoff_handle; // hWnd of tearoff if created -#endif -#ifdef FEAT_GUI_HAIKU +# endif +# ifdef FEAT_GUI_HAIKU BMenuItem *id; // Id of menu item BMenu *submenu_id; // If this is submenu, add children here -# ifdef FEAT_TOOLBAR +# ifdef FEAT_TOOLBAR BPictureButton *button; +# endif # endif -#endif -#ifdef FEAT_GUI_PHOTON +# ifdef FEAT_GUI_PHOTON PtWidget_t *id; PtWidget_t *submenu_id; -#endif +# endif }; #else // For generating prototypes when FEAT_MENU isn't defined. @@ -4907,19 +4907,19 @@ typedef enum { #define DELETION_REGISTER 36 #if defined(FEAT_CLIPBOARD) || defined(HAVE_CLIPMETHOD) # define STAR_REGISTER 37 -# if defined(FEAT_X11) || defined(FEAT_WAYLAND) -# define PLUS_REGISTER 38 -# define REAL_PLUS_REGISTER PLUS_REGISTER -# else -# define PLUS_REGISTER STAR_REGISTER // there is only one -# ifdef FEAT_EVAL +# if defined(FEAT_X11) || defined(FEAT_WAYLAND) +# define PLUS_REGISTER 38 +# define REAL_PLUS_REGISTER PLUS_REGISTER +# else +# define PLUS_REGISTER STAR_REGISTER // there is only one +# ifdef FEAT_EVAL // Make it so that if clipmethod is "none", the plus register is not available, // but if clipmethod is a provider, then expose the plus register for use. -# define REAL_PLUS_REGISTER 38 -# else -# define REAL_PLUS_REGISTER STAR_REGISTER -# endif +# define REAL_PLUS_REGISTER 38 +# else +# define REAL_PLUS_REGISTER STAR_REGISTER # endif +# endif #endif #ifdef FEAT_DND # define TILDE_REGISTER (PLUS_REGISTER + 1) diff --git a/src/tag.c b/src/tag.c index 796fd12a9b..b2ecb56561 100644 --- a/src/tag.c +++ b/src/tag.c @@ -188,7 +188,7 @@ did_set_tagfunc(optset_T *args) } #endif -# if defined(EXITFREE) +#if defined(EXITFREE) void free_tagfunc_option(void) { @@ -196,7 +196,7 @@ free_tagfunc_option(void) free_callback(&tfu_cb); # endif } -# endif +#endif #if defined(FEAT_EVAL) /* @@ -935,9 +935,9 @@ end_do_tag: if (use_tagstack && tagstackidx <= curwin->w_tagstacklen) curwin->w_tagstackidx = tagstackidx; postponed_split = 0; // don't split next time -# ifdef FEAT_QUICKFIX +#ifdef FEAT_QUICKFIX g_do_tagpreview = 0; // don't do tag preview next time -# endif +#endif vim_free(tofree); #ifdef FEAT_CSCOPE @@ -1515,11 +1515,11 @@ find_tagfunc_tags( break; } -#ifdef FEAT_EMACS_TAGS +# ifdef FEAT_EMACS_TAGS len = 3; -#else +# else len = 2; -#endif +# endif res_name = NULL; res_fname = NULL; res_cmd = NULL; @@ -1581,9 +1581,9 @@ find_tagfunc_tags( *p++ = MT_GL_OTH + 1; // mtt *p++ = TAG_SEP; // no tag file name -#ifdef FEAT_EMACS_TAGS +# ifdef FEAT_EMACS_TAGS *p++ = TAG_SEP; -#endif +# endif STRCPY(p, res_name); p += STRLEN(p); @@ -2199,11 +2199,11 @@ findtags_start_state_handler( // When "!_TAG_FILE_SORTED" found: start binary search if // flag set. // For cscope, it's always linear. -# ifdef FEAT_CSCOPE +#ifdef FEAT_CSCOPE if (st->linear || use_cscope) -# else +#else if (st->linear) -# endif +#endif st->state = TS_LINEAR; else if (st->tag_file_sorted == NUL) st->state = TS_BINARY; @@ -3219,10 +3219,10 @@ find_tags( if (st.stop_searching || st.linear || (!p_ic && noic) || st.orgpat->regmatch.rm_ic) break; -# ifdef FEAT_CSCOPE +#ifdef FEAT_CSCOPE if (use_cscope) break; -# endif +#endif // try another time while ignoring case st.orgpat->regmatch.rm_ic = TRUE; @@ -4680,14 +4680,14 @@ set_tagstack(win_T *wp, dict_T *d, int action) dictitem_T *di; list_T *l = NULL; -#ifdef FEAT_EVAL +# ifdef FEAT_EVAL // not allowed to alter the tag stack entries from inside tagfunc if (tfu_in_use) { emsg(_(e_cannot_modify_tag_stack_within_tagfunc)); return FAIL; } -#endif +# endif if ((di = dict_find(d, (char_u *)"items", -1)) != NULL) { diff --git a/src/terminal.c b/src/terminal.c index 138579ab33..de187f7ca7 100644 --- a/src/terminal.c +++ b/src/terminal.c @@ -831,7 +831,7 @@ ex_terminal(exarg_T *eap) // Note: Keep this in sync with get_terminalopt_name. -# define OPTARG_HAS(name) ((int)(p - cmd) == sizeof(name) - 1 \ +#define OPTARG_HAS(name) ((int)(p - cmd) == sizeof(name) - 1 \ && STRNICMP(cmd, name, sizeof(name) - 1) == 0) if (OPTARG_HAS("close")) opt.jo_term_finish = 'c'; @@ -918,7 +918,7 @@ ex_terminal(exarg_T *eap) semsg(_(e_invalid_attribute_str), cmd); goto theend; } -# undef OPTARG_HAS +#undef OPTARG_HAS cmd = skipwhite(p); } if (*cmd == NUL) @@ -1110,10 +1110,10 @@ term_write_session(FILE *fd, win_T *wp, hashtab_T *terminal_bufs) if (fprintf(fd, "terminal ++curwin ++cols=%d ++rows=%d ", term->tl_cols, term->tl_rows) < 0) return FAIL; -#ifdef MSWIN +# ifdef MSWIN if (fprintf(fd, "++type=%s ", term->tl_job->jv_tty_type) < 0) return FAIL; -#endif +# endif if (term->tl_command != NULL && fputs((char *)term->tl_command, fd) < 0) return FAIL; if (put_eol(fd) != OK) @@ -2980,7 +2980,7 @@ terminal_loop(int blocking) goto theend; } } -# ifdef MSWIN +#ifdef MSWIN if (!enc_utf8 && has_mbyte && raw_c >= 0x80) { WCHAR wc; @@ -2991,7 +2991,7 @@ terminal_loop(int blocking) if (MultiByteToWideChar(GetACP(), 0, (char*)mb, 2, &wc, 1) > 0) raw_c = wc; } -# endif +#endif if (send_keys_to_term(curbuf->b_term, raw_c, mod_mask, TRUE) != OK) { if (raw_c == K_MOUSEMOVE) @@ -4425,40 +4425,40 @@ init_default_colors(term_T *term) if (cterm_normal_fg_color > 0) { cterm_color2vterm(cterm_normal_fg_color - 1, fg); -# if defined(MSWIN) && (!defined(FEAT_GUI_MSWIN) || defined(VIMDLL)) -# ifdef VIMDLL +#if defined(MSWIN) && (!defined(FEAT_GUI_MSWIN) || defined(VIMDLL)) +# ifdef VIMDLL if (!gui.in_use) -# endif +# endif { tmp = fg->red; fg->red = fg->blue; fg->blue = tmp; } -# endif +#endif } -# ifdef FEAT_TERMRESPONSE +#ifdef FEAT_TERMRESPONSE else term_get_fg_color(&fg->red, &fg->green, &fg->blue); -# endif +#endif if (cterm_normal_bg_color > 0) { cterm_color2vterm(cterm_normal_bg_color - 1, bg); -# if defined(MSWIN) && (!defined(FEAT_GUI_MSWIN) || defined(VIMDLL)) -# ifdef VIMDLL +#if defined(MSWIN) && (!defined(FEAT_GUI_MSWIN) || defined(VIMDLL)) +# ifdef VIMDLL if (!gui.in_use) -# endif +# endif { tmp = fg->red; fg->red = fg->blue; fg->blue = tmp; } -# endif +#endif } -# ifdef FEAT_TERMRESPONSE +#ifdef FEAT_TERMRESPONSE else term_get_bg_color(&bg->red, &bg->green, &bg->blue); -# endif +#endif } } @@ -4471,12 +4471,12 @@ init_default_colors(term_T *term) term_use_palette(void) { if (0 -#ifdef FEAT_GUI +# ifdef FEAT_GUI || gui.in_use -#endif -#ifdef FEAT_TERMGUICOLORS +# endif +# ifdef FEAT_TERMGUICOLORS || p_tgc -#endif +# endif ) return TRUE; return FALSE; @@ -6967,11 +6967,11 @@ term_send_eof(channel_T *ch) (int)STRLEN(term->tl_eof_chars), NULL); channel_send(ch, PART_IN, (char_u *)"\r", 1, NULL); } -# ifdef MSWIN +#ifdef MSWIN else // Default: CTRL-D channel_send(ch, PART_IN, (char_u *)"\004\r", 2, NULL); -# endif +#endif } } @@ -6983,7 +6983,7 @@ term_getjob(term_T *term) } #endif -# if defined(MSWIN) +#if defined(MSWIN) /////////////////////////////////////// // 2. MS-Windows implementation. @@ -7216,7 +7216,7 @@ conpty_term_and_job_init( if (create_vterm(term, term->tl_rows, term->tl_cols) == FAIL) goto failed; -#if defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS) +# if defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS) if (term_use_palette()) { if (term->tl_palette != NULL) @@ -7224,7 +7224,7 @@ conpty_term_and_job_init( else init_vterm_ansi_colors(term->tl_vterm); } -#endif +# endif channel_set_job(channel, job, opt); job_set_options(job, opt); @@ -7322,9 +7322,9 @@ use_conpty(void) return has_conpty; } -#define WINPTY_SPAWN_FLAG_AUTO_SHUTDOWN 1ul -#define WINPTY_SPAWN_FLAG_EXIT_AFTER_SHUTDOWN 2ull -#define WINPTY_MOUSE_MODE_FORCE 2 +# define WINPTY_SPAWN_FLAG_AUTO_SHUTDOWN 1ul +# define WINPTY_SPAWN_FLAG_EXIT_AFTER_SHUTDOWN 2ull +# define WINPTY_MOUSE_MODE_FORCE 2 void* (*winpty_config_new)(UINT64, void*); void* (*winpty_open)(void*, void*); @@ -7343,7 +7343,7 @@ LPCWSTR (*winpty_error_msg)(void*); BOOL (*winpty_set_size)(void*, int, int, void*); HANDLE (*winpty_agent_process)(void*); -#define WINPTY_DLL "winpty.dll" +# define WINPTY_DLL "winpty.dll" static HINSTANCE hWinPtyDLL = NULL; @@ -7554,7 +7554,7 @@ winpty_term_and_job_init( if (create_vterm(term, term->tl_rows, term->tl_cols) == FAIL) goto failed; -#if defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS) +# if defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS) if (term_use_palette()) { if (term->tl_palette != NULL) @@ -7562,7 +7562,7 @@ winpty_term_and_job_init( else init_vterm_ansi_colors(term->tl_vterm); } -#endif +# endif channel_set_job(channel, job, opt); job_set_options(job, opt); @@ -7795,7 +7795,7 @@ terminal_enabled(void) return dyn_winpty_init(FALSE) == OK || dyn_conpty_init(FALSE) == OK; } -# else +#else /////////////////////////////////////// // 3. Unix-like implementation. @@ -7820,7 +7820,7 @@ term_and_job_init( if (create_vterm(term, term->tl_rows, term->tl_cols) == FAIL) return FAIL; -#if defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS) +# if defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS) if (term_use_palette()) { if (term->tl_palette != NULL) @@ -7828,7 +7828,7 @@ term_and_job_init( else init_vterm_ansi_colors(term->tl_vterm); } -#endif +# endif // This may change a string in "argvar". term->tl_job = job_start(argvar, argv, opt, &term->tl_job); @@ -7891,6 +7891,6 @@ term_report_winsize(term_T *term, int rows, int cols) mch_signal_job(term->tl_job, (char_u *)"winch"); } -# endif +#endif #endif // FEAT_TERMINAL diff --git a/src/testing.c b/src/testing.c index f8ed67be47..dd8dc8e512 100644 --- a/src/testing.c +++ b/src/testing.c @@ -1288,11 +1288,11 @@ f_test_setmouse(typval_T *argvars, typval_T *rettv UNUSED) mouse_col = (time_t)tv_get_number(&argvars[1]) - 1; } -# ifdef FEAT_GUI +#ifdef FEAT_GUI static int test_gui_drop_files(dict_T *args UNUSED) { -# if defined(HAVE_DROP_FILE) +# if defined(HAVE_DROP_FILE) int row; int col; int_u mods; @@ -1343,12 +1343,12 @@ test_gui_drop_files(dict_T *args UNUSED) gui_handle_drop(TEXT_X(col - 1), TEXT_Y(row - 1), mods, fnames, count); else vim_free(fnames); -# endif +# endif return TRUE; } -#if defined(FIND_REPLACE_DIALOG) +# if defined(FIND_REPLACE_DIALOG) static int test_gui_find_repl(dict_T *args) { @@ -1375,7 +1375,7 @@ test_gui_find_repl(dict_T *args) return retval; } -#endif +# endif static int test_gui_mouse_event(dict_T *args) @@ -1464,10 +1464,10 @@ test_gui_scrollbar(dict_T *args) return FALSE; } gui_drag_scrollbar(sb, value, dragging); -# ifndef USE_ON_FLY_SCROLL +# ifndef USE_ON_FLY_SCROLL // need to loop through normal_cmd() to handle the scroll events exec_normal(FALSE, TRUE, FALSE); -# endif +# endif return TRUE; } @@ -1475,7 +1475,7 @@ test_gui_scrollbar(dict_T *args) static int test_gui_tabline_event(dict_T *args UNUSED) { -# ifdef FEAT_GUI_TABLINE +# ifdef FEAT_GUI_TABLINE int tabnr; if (!dict_has_key(args, "tabnr")) @@ -1484,15 +1484,15 @@ test_gui_tabline_event(dict_T *args UNUSED) tabnr = (int)dict_get_number(args, "tabnr"); return send_tabline_event(tabnr); -# else +# else return FALSE; -# endif +# endif } static int test_gui_tabmenu_event(dict_T *args UNUSED) { -# ifdef FEAT_GUI_TABLINE +# ifdef FEAT_GUI_TABLINE int tabnr; int item; @@ -1504,15 +1504,15 @@ test_gui_tabmenu_event(dict_T *args UNUSED) item = (int)dict_get_number(args, "item"); send_tabline_menu_event(tabnr, item); -# endif +# endif return TRUE; } -# endif +#endif void f_test_mswin_event(typval_T *argvars UNUSED, typval_T *rettv UNUSED) { -# ifdef MSWIN +#ifdef MSWIN rettv->v_type = VAR_BOOL; rettv->vval.v_number = FALSE; @@ -1530,13 +1530,13 @@ f_test_mswin_event(typval_T *argvars UNUSED, typval_T *rettv UNUSED) char_u *event = tv_get_string(&argvars[0]); rettv->vval.v_number = test_mswin_event(event, argvars[1].vval.v_dict); -# endif +#endif } void f_test_gui_event(typval_T *argvars UNUSED, typval_T *rettv UNUSED) { -# ifdef FEAT_GUI +#ifdef FEAT_GUI char_u *event; rettv->v_type = VAR_BOOL; @@ -1556,14 +1556,14 @@ f_test_gui_event(typval_T *argvars UNUSED, typval_T *rettv UNUSED) event = tv_get_string(&argvars[0]); if (STRCMP(event, "dropfiles") == 0) rettv->vval.v_number = test_gui_drop_files(argvars[1].vval.v_dict); -# if defined(FIND_REPLACE_DIALOG) +# if defined(FIND_REPLACE_DIALOG) else if (STRCMP(event, "findrepl") == 0) rettv->vval.v_number = test_gui_find_repl(argvars[1].vval.v_dict); -# endif -# ifdef MSWIN +# endif +# ifdef MSWIN else if (STRCMP(event, "key") == 0 || STRCMP(event, "mouse") == 0 || STRCMP(event, "set_keycode_trans_strategy") == 0) rettv->vval.v_number = test_mswin_event(event, argvars[1].vval.v_dict); -# endif +# endif else if (STRCMP(event, "mouse") == 0) rettv->vval.v_number = test_gui_mouse_event(argvars[1].vval.v_dict); else if (STRCMP(event, "scrollbar") == 0) @@ -1577,7 +1577,7 @@ f_test_gui_event(typval_T *argvars UNUSED, typval_T *rettv UNUSED) semsg(_(e_invalid_argument_str), event); return; } -# endif +#endif } void diff --git a/src/textformat.c b/src/textformat.c index 4f8cb1c219..8f4f2dd08a 100644 --- a/src/textformat.c +++ b/src/textformat.c @@ -1145,9 +1145,9 @@ format_lines( if (cindent_on()) { indent = -# ifdef FEAT_EVAL +#ifdef FEAT_EVAL *curbuf->b_p_inde != NUL ? get_expr_indent() : -# endif +#endif get_c_indent(); } else diff --git a/src/time.c b/src/time.c index 12c23cc652..7b91a7c01c 100644 --- a/src/time.c +++ b/src/time.c @@ -65,11 +65,11 @@ vim_localtime( time_T vim_time(void) { -# ifdef FEAT_EVAL +#ifdef FEAT_EVAL return time_for_testing == 0 ? time(NULL) : time_for_testing; -# else +#else return time(NULL); -# endif +#endif } /* @@ -129,9 +129,9 @@ get_ctime(time_t thetime, int add_newline) #if defined(FEAT_EVAL) -#if defined(MACOS_X) -# include // for time_t -#endif +# if defined(MACOS_X) +# include // for time_t +# endif /* * "localtime()" function @@ -267,14 +267,14 @@ f_reltimestr(typval_T *argvars UNUSED, typval_T *rettv) proftime_T tm; if (list2proftime(&argvars[0], &tm) == OK) { -# ifdef MSWIN +# ifdef MSWIN rettv->vval.v_string = vim_strsave((char_u *)profile_msg(&tm)); -# else +# else static char buf[50]; long usec = tm.tv_fsec / (TV_FSEC_SEC / 1000000); vim_snprintf(buf, sizeof(buf), "%3ld.%06ld", (long)tm.tv_sec, usec); rettv->vval.v_string = vim_strsave((char_u *)buf); -# endif +# endif } else if (in_vim9script()) emsg(_(e_invalid_argument)); @@ -313,7 +313,7 @@ f_strftime(typval_T *argvars, typval_T *rettv) return; } -# ifdef MSWIN +# ifdef MSWIN WCHAR result_buf[256]; WCHAR *wp; @@ -324,7 +324,7 @@ f_strftime(typval_T *argvars, typval_T *rettv) result_buf[0] = NUL; rettv->vval.v_string = utf16_to_enc(result_buf, NULL); vim_free(wp); -# else +# else char_u result_buf[256]; vimconv_T conv; char_u *enc; @@ -349,7 +349,7 @@ f_strftime(typval_T *argvars, typval_T *rettv) // Release conversion descriptors convert_setup(&conv, NULL, NULL); vim_free(enc); -# endif +# endif } # endif @@ -498,7 +498,7 @@ timer_callback(timer_T *timer) typval_T rettv; typval_T argv[2]; -#ifdef FEAT_EVAL +# ifdef FEAT_EVAL if (ch_log_active()) { callback_T *cb = &timer->tr_callback; @@ -506,7 +506,7 @@ timer_callback(timer_T *timer) ch_log(NULL, "invoking timer callback %s", cb->cb_partial != NULL ? cb->cb_partial->pt_name : cb->cb_name); } -#endif +# endif argv[0].v_type = VAR_NUMBER; argv[0].vval.v_number = (varnumber_T)timer->tr_id; @@ -516,9 +516,9 @@ timer_callback(timer_T *timer) call_callback(&timer->tr_callback, -1, &rettv, 1, argv); clear_tv(&rettv); -#ifdef FEAT_EVAL +# ifdef FEAT_EVAL ch_log(NULL, "timer callback finished"); -#endif +# endif } /* @@ -633,7 +633,7 @@ check_due_timer(void) if (did_one) redraw_after_callback(need_update_screen, FALSE); -#ifdef FEAT_BEVAL_TERM +# ifdef FEAT_BEVAL_TERM if (bevalexpr_due_set) { this_due = proftime_time_left(&bevalexpr_due, &now); @@ -655,11 +655,11 @@ check_due_timer(void) else if (next_due == -1 || next_due > this_due) next_due = this_due; } -#endif -#ifdef FEAT_TERMINAL +# endif +# ifdef FEAT_TERMINAL // Some terminal windows may need their buffer updated. next_due = term_check_timers(next_due, &now); -#endif +# endif return current_id != last_timer_id ? 1 : next_due; } @@ -799,7 +799,7 @@ timer_valid(timer_T *timer) return FALSE; } -# if defined(EXITFREE) +# if defined(EXITFREE) void timer_free_all(void) { @@ -810,7 +810,7 @@ timer_free_all(void) free_timer(timer); } } -# endif +# endif /* * "timer_info([timer])" function diff --git a/src/typval.c b/src/typval.c index bf8e9ab6ca..f704f039cd 100644 --- a/src/typval.c +++ b/src/typval.c @@ -391,15 +391,15 @@ tv_get_float_chk(typval_T *varp, int *error) emsg(_(e_using_special_value_as_float)); break; case VAR_JOB: -# ifdef FEAT_JOB_CHANNEL +#ifdef FEAT_JOB_CHANNEL emsg(_(e_using_job_as_float)); break; -# endif +#endif case VAR_CHANNEL: -# ifdef FEAT_JOB_CHANNEL +#ifdef FEAT_JOB_CHANNEL emsg(_(e_using_channel_as_float)); break; -# endif +#endif case VAR_BLOB: emsg(_(e_using_blob_as_float)); break; diff --git a/src/ui.c b/src/ui.c index 0cee122cb7..aa985e4ee8 100644 --- a/src/ui.c +++ b/src/ui.c @@ -277,11 +277,11 @@ inchar_loop( int did_start_blocking = FALSE; long wait_time; long elapsed_time = 0; -#ifdef ELAPSED_FUNC +# ifdef ELAPSED_FUNC elapsed_T start_tv; ELAPSED_INIT(start_tv); -#endif +# endif // repeat until we got a character or waited long enough for (;;) @@ -291,7 +291,7 @@ inchar_loop( if (resize_func != NULL) resize_func(FALSE); -#ifdef MESSAGE_QUEUE +# ifdef MESSAGE_QUEUE // Only process messages when waiting. if (wtime != 0) { @@ -300,7 +300,7 @@ inchar_loop( if (typebuf_changed(tb_change_cnt)) return 0; } -#endif +# endif if (wtime < 0 && did_start_blocking) // blocking and already waited for p_ut wait_time = -1; @@ -311,9 +311,9 @@ inchar_loop( else // going to block after p_ut wait_time = p_ut; -#ifdef ELAPSED_FUNC +# ifdef ELAPSED_FUNC elapsed_time = ELAPSED_FUNC(start_tv); -#endif +# endif wait_time -= elapsed_time; // If the waiting time is now zero or less, we timed out. However, @@ -357,7 +357,7 @@ inchar_loop( } } -#ifdef FEAT_JOB_CHANNEL +# ifdef FEAT_JOB_CHANNEL if (wait_time < 0 || wait_time > 100L) { // Checking if a job ended requires polling. Do this at least @@ -370,13 +370,13 @@ inchar_loop( if (channel_any_readahead()) wait_time = 10L; } -#endif -#ifdef FEAT_BEVAL_GUI +# endif +# ifdef FEAT_BEVAL_GUI if (p_beval && wait_time > 100L) // The 'balloonexpr' may indirectly invoke a callback while waiting // for a character, need to check often. wait_time = 100L; -#endif +# endif // Wait for a character to be typed or another event, such as the winch // signal or an event on the monitored file descriptors. @@ -400,30 +400,30 @@ inchar_loop( } // Timed out or interrupted with no character available. -#ifndef ELAPSED_FUNC +# ifndef ELAPSED_FUNC // estimate the elapsed time elapsed_time += wait_time; -#endif +# endif if ((resize_func != NULL && resize_func(TRUE)) -#if defined(FEAT_CLIENTSERVER) && defined(UNIX) +# if defined(FEAT_CLIENTSERVER) && defined(UNIX) || ( -# ifdef FEAT_X11 +# ifdef FEAT_X11 (clientserver_method == CLIENTSERVER_METHOD_X11 && server_waiting()) -# endif -# if defined(FEAT_X11) && defined(FEAT_SOCKETSERVER) +# endif +# if defined(FEAT_X11) && defined(FEAT_SOCKETSERVER) || -# endif -# ifdef FEAT_SOCKETSERVER +# endif +# ifdef FEAT_SOCKETSERVER (clientserver_method == CLIENTSERVER_METHOD_SOCKET && socket_server_waiting_accept()) -# endif +# endif ) -#endif -#ifdef MESSAGE_QUEUE +# endif +# ifdef MESSAGE_QUEUE || interrupted -#endif +# endif || wait_time > 0 || (wtime < 0 && !did_start_blocking)) // no character available, but something to be done, keep going @@ -745,16 +745,16 @@ ui_breakcheck_force(int force) * descriptions which would otherwise overflow. The buffer is considered full * when only this extra space (or part of it) remains. */ -#if defined(FEAT_JOB_CHANNEL) || defined(FEAT_CLIENTSERVER) +# if defined(FEAT_JOB_CHANNEL) || defined(FEAT_CLIENTSERVER) /* * NetBeans stuffs debugger commands into the input buffer. * This requires a larger buffer... * (Madsen) Go with this for remote input as well ... */ -# define INBUFLEN 4096 -#else -# define INBUFLEN 250 -#endif +# define INBUFLEN 4096 +# else +# define INBUFLEN 250 +# endif static char_u inbuf[INBUFLEN + MAX_KEY_CODE_LEN]; static int inbufcount = 0; // number of chars in inbuf[] @@ -777,21 +777,21 @@ vim_is_input_buf_empty(void) return (inbufcount == 0); } -#if defined(FEAT_OLE) +# if defined(FEAT_OLE) int vim_free_in_input_buf(void) { return (INBUFLEN - inbufcount); } -#endif +# endif -#if defined(FEAT_GUI_GTK) +# if defined(FEAT_GUI_GTK) int vim_used_in_input_buf(void) { return inbufcount; } -#endif +# endif /* * Return the current contents of the input buffer and make it empty. @@ -915,29 +915,29 @@ read_from_input_buf(char_u *buf, long maxlen) void fill_input_buf(int exit_on_error UNUSED) { -#if defined(UNIX) || defined(VMS) || defined(MACOS_X) +# if defined(UNIX) || defined(VMS) || defined(MACOS_X) int len; int try; static int did_read_something = FALSE; static char_u *rest = NULL; // unconverted rest of previous read static int restlen = 0; int unconverted; -#endif +# endif -#ifdef FEAT_GUI +# ifdef FEAT_GUI if (gui.in_use -# ifdef NO_CONSOLE_INPUT +# ifdef NO_CONSOLE_INPUT // Don't use the GUI input when the window hasn't been opened yet. // We get here from ui_inchar() when we should try reading from stdin. && !no_console_input() -# endif +# endif ) { gui_mch_update(); return; } -#endif -#if defined(UNIX) || defined(VMS) || defined(MACOS_X) +# endif +# if defined(UNIX) || defined(VMS) || defined(MACOS_X) if (vim_is_input_buf_full()) return; /* @@ -999,13 +999,13 @@ fill_input_buf(int exit_on_error UNUSED) // back to cooked mode, use another descriptor and set the mode to // what it was. settmode(TMODE_COOK); -#ifdef HAVE_DUP +# ifdef HAVE_DUP // Use stderr for stdin, also works for shell commands. close(0); vim_ignored = dup(2); -#else +# else read_cmd_fd = 2; // read from stderr instead of stdin -#endif +# endif settmode(m); } if (!exit_on_error) @@ -1066,7 +1066,7 @@ fill_input_buf(int exit_on_error UNUSED) ++inbufcount; } } -#endif // UNIX || VMS || MACOS_X +# endif // UNIX || VMS || MACOS_X } #endif // USE_INPUT_BUF @@ -1173,9 +1173,9 @@ ui_find_longest_lnum(void) // line numbers, topline and botline can be invalid when displaying is // postponed. if ( -# ifdef FEAT_GUI +#ifdef FEAT_GUI (!gui.in_use || vim_strchr(p_go, GO_HORSCROLL) == NULL) && -# endif +#endif curwin->w_topline <= curwin->w_cursor.lnum && curwin->w_botline > curwin->w_cursor.lnum && curwin->w_botline <= curbuf->b_ml.ml_line_count + 1) @@ -1224,11 +1224,11 @@ ui_focus_change( if (in_focus && last_time + 2 < time(NULL)) { need_redraw = check_timestamps( -# ifdef FEAT_GUI +#ifdef FEAT_GUI gui.in_use -# else +#else FALSE -# endif +#endif ); last_time = time(NULL); } diff --git a/src/undo.c b/src/undo.c index 54fdd22715..3b0a1524e5 100644 --- a/src/undo.c +++ b/src/undo.c @@ -812,19 +812,19 @@ u_get_undo_file_name(char_u *buf_ffname, int reading) stat_T st; char_u *ffname = buf_ffname; size_t ffnamelen; -#ifdef HAVE_READLINK +# ifdef HAVE_READLINK char_u fname_buf[MAXPATHL]; -#endif +# endif if (ffname == NULL) return NULL; -#ifdef HAVE_READLINK +# ifdef HAVE_READLINK // Expand symlink in the file name, so that we put the undo file with the // actual file instead of with the symlink. if (resolve_symlink(ffname, fname_buf) == OK) ffname = fname_buf; -#endif +# endif ffnamelen = STRLEN(ffname); // Loop over 'undodir'. When reading find the first file that exists. @@ -842,20 +842,20 @@ u_get_undo_file_name(char_u *buf_ffname, int reading) break; p = gettail(undo_file_name); plen = (size_t)(ffnamelen - (p - undo_file_name)); -#ifdef VMS +# ifdef VMS // VMS can not handle more than one dot in the filenames // use "dir/name" -> "dir/_un_name" - add _un_ // at the beginning to keep the extension mch_memmove(p + 4, p, plen + 1); mch_memmove(p, "_un_", 4); -#else +# else // Use same directory as the ffname, // "dir/name" -> "dir/.name.un~" mch_memmove(p + 1, p, plen + 1); *p = '.'; STRCPY(p + plen + 1, ".un~"); -#endif +# endif } else { @@ -916,7 +916,7 @@ u_free_uhp(u_header_T *uhp) static int undo_write(bufinfo_T *bi, char_u *ptr, size_t len) { -#ifdef FEAT_CRYPT +# ifdef FEAT_CRYPT if (bi->bi_buffer != NULL) { size_t len_todo = len; @@ -940,13 +940,13 @@ undo_write(bufinfo_T *bi, char_u *ptr, size_t len) } return OK; } -#endif +# endif if (fwrite(ptr, len, (size_t)1, bi->bi_fp) != 1) return FAIL; return OK; } -#ifdef FEAT_CRYPT +# ifdef FEAT_CRYPT static int undo_flush(bufinfo_T *bi) { @@ -961,7 +961,7 @@ undo_flush(bufinfo_T *bi) } return OK; } -#endif +# endif /* * Write "ptr[len]" and crypt the bytes when needed. @@ -970,7 +970,7 @@ undo_flush(bufinfo_T *bi) static int fwrite_crypt(bufinfo_T *bi, char_u *ptr, size_t len) { -#ifdef FEAT_CRYPT +# ifdef FEAT_CRYPT char_u *copy; char_u small_buf[100]; size_t i; @@ -994,7 +994,7 @@ fwrite_crypt(bufinfo_T *bi, char_u *ptr, size_t len) vim_free(copy); return i == 1 ? OK : FAIL; } -#endif +# endif return undo_write(bi, ptr, len); } @@ -1028,7 +1028,7 @@ put_header_ptr(bufinfo_T *bi, u_header_T *uhp) static int undo_read_4c(bufinfo_T *bi) { -#ifdef FEAT_CRYPT +# ifdef FEAT_CRYPT if (bi->bi_buffer != NULL) { char_u buf[4]; @@ -1038,14 +1038,14 @@ undo_read_4c(bufinfo_T *bi) n = ((unsigned)buf[0] << 24) + (buf[1] << 16) + (buf[2] << 8) + buf[3]; return n; } -#endif +# endif return get4c(bi->bi_fp); } static int undo_read_2c(bufinfo_T *bi) { -#ifdef FEAT_CRYPT +# ifdef FEAT_CRYPT if (bi->bi_buffer != NULL) { char_u buf[2]; @@ -1055,14 +1055,14 @@ undo_read_2c(bufinfo_T *bi) n = (buf[0] << 8) + buf[1]; return n; } -#endif +# endif return get2c(bi->bi_fp); } static int undo_read_byte(bufinfo_T *bi) { -#ifdef FEAT_CRYPT +# ifdef FEAT_CRYPT if (bi->bi_buffer != NULL) { char_u buf[1]; @@ -1070,14 +1070,14 @@ undo_read_byte(bufinfo_T *bi) undo_read(bi, buf, (size_t)1); return buf[0]; } -#endif +# endif return getc(bi->bi_fp); } static time_t undo_read_time(bufinfo_T *bi) { -#ifdef FEAT_CRYPT +# ifdef FEAT_CRYPT if (bi->bi_buffer != NULL) { char_u buf[8]; @@ -1089,7 +1089,7 @@ undo_read_time(bufinfo_T *bi) n = (n << 8) + buf[i]; return n; } -#endif +# endif return get8ctime(bi->bi_fp); } @@ -1102,7 +1102,7 @@ undo_read(bufinfo_T *bi, char_u *buffer, size_t size) { int retval = OK; -#ifdef FEAT_CRYPT +# ifdef FEAT_CRYPT if (bi->bi_buffer != NULL) { int size_todo = (int)size; @@ -1134,7 +1134,7 @@ undo_read(bufinfo_T *bi, char_u *buffer, size_t size) } } else -#endif +# endif if (fread(buffer, size, 1, bi->bi_fp) != 1) retval = FAIL; @@ -1168,10 +1168,10 @@ read_string_decrypt(bufinfo_T *bi, int len) // In case there are text properties there already is a NUL, but // checking for that is more expensive than just adding a dummy byte. ptr[len] = NUL; -#ifdef FEAT_CRYPT +# ifdef FEAT_CRYPT if (bi->bi_state != NULL && bi->bi_buffer == NULL) crypt_decode_inplace(bi->bi_state, ptr, len, FALSE); -#endif +# endif return ptr; } @@ -1191,7 +1191,7 @@ serialize_header(bufinfo_T *bi, char_u *hash) // If the buffer is encrypted then all text bytes following will be // encrypted. Numbers and other info is not crypted. -#ifdef FEAT_CRYPT +# ifdef FEAT_CRYPT if (*buf->b_p_key != NUL) { char_u *header; @@ -1225,7 +1225,7 @@ serialize_header(bufinfo_T *bi, char_u *hash) } } else -#endif +# endif undo_write_bytes(bi, (long_u)UF_VERSION, 2); @@ -1320,9 +1320,9 @@ unserialize_uhp(bufinfo_T *bi, char_u *file_name) if (uhp == NULL) return NULL; CLEAR_POINTER(uhp); -#ifdef U_DEBUG +# ifdef U_DEBUG uhp->uh_magic = UH_MAGIC; -#endif +# endif uhp->uh_next.seq = undo_read_4c(bi); uhp->uh_prev.seq = undo_read_4c(bi); uhp->uh_alt_next.seq = undo_read_4c(bi); @@ -1436,9 +1436,9 @@ unserialize_uep(bufinfo_T *bi, int *error, char_u *file_name) if (uep == NULL) return NULL; CLEAR_POINTER(uep); -#ifdef U_DEBUG +# ifdef U_DEBUG uep->ue_magic = UE_MAGIC; -#endif +# endif uep->ue_top = undo_read_4c(bi); uep->ue_bot = undo_read_4c(bi); uep->ue_lcount = undo_read_4c(bi); @@ -1549,18 +1549,18 @@ u_write_undo( u_header_T *uhp; char_u *file_name; int mark; -#ifdef U_DEBUG +# ifdef U_DEBUG int headers_written = 0; -#endif +# endif int fd; FILE *fp = NULL; int perm; int write_ok = FALSE; -#ifdef UNIX +# ifdef UNIX int st_old_valid = FALSE; stat_T st_old; stat_T st_new; -#endif +# endif bufinfo_T bi; CLEAR_FIELD(bi); @@ -1591,17 +1591,17 @@ u_write_undo( perm = 0600; if (buf->b_ffname != NULL) { -#ifdef UNIX +# ifdef UNIX if (mch_stat((char *)buf->b_ffname, &st_old) >= 0) { perm = st_old.st_mode; st_old_valid = TRUE; } -#else +# else perm = mch_getperm(buf->b_ffname); if (perm < 0) perm = 0600; -#endif +# endif } // strip any s-bit and executable bit @@ -1680,12 +1680,12 @@ u_write_undo( verbose_leave(); } -#ifdef U_DEBUG +# ifdef U_DEBUG // Check there is no problem in undo info before writing. u_check(FALSE); -#endif +# endif -#ifdef UNIX +# ifdef UNIX /* * Try to set the group of the undo file same as the original file. If * this fails, set the protection bits for the group same as the @@ -1694,16 +1694,16 @@ u_write_undo( if (st_old_valid && mch_stat((char *)file_name, &st_new) >= 0 && st_new.st_gid != st_old.st_gid -# ifdef HAVE_FCHOWN // sequent-ptx lacks fchown() +# ifdef HAVE_FCHOWN // sequent-ptx lacks fchown() && fchown(fd, (uid_t)-1, st_old.st_gid) != 0 -# endif +# endif ) mch_setperm(file_name, (perm & 0707) | ((perm & 07) << 3)); -# if defined(HAVE_SELINUX) || defined(HAVE_SMACK) +# if defined(HAVE_SELINUX) || defined(HAVE_SMACK) if (buf->b_ffname != NULL) mch_copy_sec(buf->b_ffname, file_name); +# endif # endif -#endif fp = fdopen(fd, "w"); if (fp == NULL) @@ -1736,9 +1736,9 @@ u_write_undo( if (uhp->uh_walk != mark) { uhp->uh_walk = mark; -#ifdef U_DEBUG +# ifdef U_DEBUG ++headers_written; -#endif +# endif if (serialize_uhp(&bi, uhp) == FAIL) goto write_error; } @@ -1760,37 +1760,37 @@ u_write_undo( if (undo_write_bytes(&bi, (long_u)UF_HEADER_END_MAGIC, 2) == OK) write_ok = TRUE; -#ifdef U_DEBUG +# ifdef U_DEBUG if (headers_written != buf->b_u_numhead) { semsg("Written %ld headers, ...", headers_written); semsg("... but numhead is %ld", buf->b_u_numhead); } -#endif +# endif -#ifdef FEAT_CRYPT +# ifdef FEAT_CRYPT if (bi.bi_state != NULL && undo_flush(&bi) == FAIL) write_ok = FALSE; -#endif +# endif -#if defined(UNIX) && defined(HAVE_FSYNC) +# if defined(UNIX) && defined(HAVE_FSYNC) if ((buf->b_p_fs >= 0 ? buf->b_p_fs : p_fs) && fflush(fp) == 0 && vim_fsync(fd) != 0) write_ok = FALSE; -#endif +# endif write_error: fclose(fp); if (!write_ok) semsg(_(e_write_error_in_undo_file_str), file_name); -#if defined(MSWIN) +# if defined(MSWIN) // Copy file attributes; for systems where this can only be done after // closing the file. if (buf->b_ffname != NULL) (void)mch_copy_file_attribute(buf->b_ffname, file_name); -#endif -#ifdef HAVE_ACL +# endif +# ifdef HAVE_ACL if (buf->b_ffname != NULL) { vim_acl_T acl; @@ -1800,14 +1800,14 @@ write_error: mch_set_acl(file_name, acl); mch_free_acl(acl); } -#endif +# endif theend: -#ifdef FEAT_CRYPT +# ifdef FEAT_CRYPT if (bi.bi_state != NULL) crypt_free_state(bi.bi_state); vim_free(bi.bi_buffer); -#endif +# endif if (file_name != name) vim_free(file_name); } @@ -1842,13 +1842,13 @@ u_read_undo(char_u *name, char_u *hash, char_u *orig_name UNUSED) u_header_T **uhp_table = NULL; char_u read_hash[UNDO_HASH_SIZE]; char_u magic_buf[UF_START_MAGIC_LEN]; -#ifdef U_DEBUG +# ifdef U_DEBUG int *uhp_table_used; -#endif -#ifdef UNIX +# endif +# ifdef UNIX stat_T st_orig; stat_T st_undo; -#endif +# endif bufinfo_T bi; CLEAR_FIELD(bi); @@ -1862,7 +1862,7 @@ u_read_undo(char_u *name, char_u *hash, char_u *orig_name UNUSED) if (file_name == NULL) return; -#ifdef UNIX +# ifdef UNIX // For safety we only read an undo file if the owner is equal to the // owner of the text file or equal to the current user. if (mch_stat((char *)orig_name, &st_orig) >= 0 @@ -1879,7 +1879,7 @@ u_read_undo(char_u *name, char_u *hash, char_u *orig_name UNUSED) } return; } -#endif +# endif } else file_name = name; @@ -1913,7 +1913,7 @@ u_read_undo(char_u *name, char_u *hash, char_u *orig_name UNUSED) version = get2c(fp); if (version == UF_VERSION_CRYPT) { -#ifdef FEAT_CRYPT +# ifdef FEAT_CRYPT if (*curbuf->b_p_key == NUL) { semsg(_(e_non_encrypted_file_has_encrypted_undo_file_str), @@ -1938,10 +1938,10 @@ u_read_undo(char_u *name, char_u *hash, char_u *orig_name UNUSED) bi.bi_avail = 0; bi.bi_used = 0; } -#else +# else semsg(_(e_undo_file_is_encrypted_str), file_name); goto error; -#endif +# endif } else if (version != UF_VERSION) { @@ -2055,12 +2055,12 @@ u_read_undo(char_u *name, char_u *hash, char_u *orig_name UNUSED) goto error; } -#ifdef U_DEBUG +# ifdef U_DEBUG uhp_table_used = alloc_clear(sizeof(int) * num_head + 1); -# define SET_FLAG(j) ++uhp_table_used[j] -#else -# define SET_FLAG(j) -#endif +# define SET_FLAG(j) ++uhp_table_used[j] +# else +# define SET_FLAG(j) +# endif // We have put all of the headers into a table. Now we iterate through the // table and swizzle each sequence number we have stored in uh_*_seq into @@ -2145,13 +2145,13 @@ u_read_undo(char_u *name, char_u *hash, char_u *orig_name UNUSED) curbuf->b_u_synced = TRUE; vim_free(uhp_table); -#ifdef U_DEBUG +# ifdef U_DEBUG for (i = 0; i < num_head; ++i) if (uhp_table_used[i] == 0) semsg("uhp_table entry %ld not used, leaking memory", i); vim_free(uhp_table_used); u_check(TRUE); -#endif +# endif if (name != NULL) smsg(_("Finished reading undo file %s"), file_name); @@ -2168,11 +2168,11 @@ error: } theend: -#ifdef FEAT_CRYPT +# ifdef FEAT_CRYPT if (bi.bi_state != NULL) crypt_free_state(bi.bi_state); vim_free(bi.bi_buffer); -#endif +# endif if (fp != NULL) fclose(fp); if (file_name != name) @@ -3690,7 +3690,7 @@ f_undofile(typval_T *argvars, typval_T *rettv) return; rettv->v_type = VAR_STRING; -#ifdef FEAT_PERSISTENT_UNDO +# ifdef FEAT_PERSISTENT_UNDO { char_u *fname = tv_get_string(&argvars[0]); @@ -3708,11 +3708,11 @@ f_undofile(typval_T *argvars, typval_T *rettv) vim_free(ffname); } } -#else +# else rettv->vval.v_string = NULL; -#endif +# endif } -#ifdef FEAT_PERSISTENT_UNDO +# ifdef FEAT_PERSISTENT_UNDO /* * Reset undofile option and delete the undofile */ @@ -3733,7 +3733,7 @@ u_undofile_reset_and_delete(buf_T *buf) set_option_value_give_err((char_u *)"undofile", 0L, NULL, OPT_LOCAL); } - #endif +# endif /* * "undotree(expr)" function diff --git a/src/usercmd.c b/src/usercmd.c index 9308cd9827..c151261ec0 100644 --- a/src/usercmd.c +++ b/src/usercmd.c @@ -24,9 +24,9 @@ typedef struct ucmd cmd_addr_T uc_addr_type; // The command's address type sctx_T uc_script_ctx; // SCTX where the command was defined int uc_flags; // some UC_ flags -# ifdef FEAT_EVAL +#ifdef FEAT_EVAL char_u *uc_compl_arg; // completion argument if any -# endif +#endif } ucmd_T; // List of all user commands. @@ -207,14 +207,14 @@ find_ucmd( if (complp != NULL) *complp = uc->uc_compl; -# ifdef FEAT_EVAL +#ifdef FEAT_EVAL if (xp != NULL) { xp->xp_arg = uc->uc_compl_arg; xp->xp_script_ctx = uc->uc_script_ctx; xp->xp_script_ctx.sc_lnum += SOURCING_LNUM; } -# endif +#endif // Do not search for further abbreviations // if this is an exact match. matchlen = k; @@ -830,9 +830,9 @@ parse_compl_arg( char_u **compl_arg UNUSED) { char_u *arg = NULL; -# if defined(FEAT_EVAL) +#if defined(FEAT_EVAL) size_t arglen = 0; -# endif +#endif int i; int valend = vallen; keyvalue_T target; @@ -845,9 +845,9 @@ parse_compl_arg( if (value[i] == ',') { arg = &value[i + 1]; -# if defined(FEAT_EVAL) +#if defined(FEAT_EVAL) arglen = vallen - i - 1; -# endif +#endif valend = i; break; } @@ -882,17 +882,17 @@ parse_compl_arg( *argt |= EX_XFILE; if ( -# if defined(FEAT_EVAL) +#if defined(FEAT_EVAL) *complp != EXPAND_USER_DEFINED && *complp != EXPAND_USER_LIST && -# endif +#endif arg != NULL) { emsg(_(e_completion_argument_only_allowed_for_custom_completion)); return FAIL; } -# if defined(FEAT_EVAL) +#if defined(FEAT_EVAL) if ((*complp == EXPAND_USER_DEFINED || *complp == EXPAND_USER_LIST) && arg == NULL) { @@ -902,7 +902,7 @@ parse_compl_arg( if (arg != NULL) *compl_arg = vim_strnsave(arg, arglen); -# endif +#endif return OK; } @@ -1380,9 +1380,9 @@ uc_clear(garray_T *gap) vim_free(cmd->uc_name); cmd->uc_namelen = 0; vim_free(cmd->uc_rep); -# if defined(FEAT_EVAL) +#if defined(FEAT_EVAL) vim_free(cmd->uc_compl_arg); -# endif +#endif } ga_clear(gap); } @@ -1434,9 +1434,9 @@ ex_delcommand(exarg_T *eap) vim_free(cmd->uc_name); vim_free(cmd->uc_rep); -# if defined(FEAT_EVAL) +#if defined(FEAT_EVAL) vim_free(cmd->uc_compl_arg); -# endif +#endif --gap->ga_len; @@ -1995,9 +1995,9 @@ do_ucmd(exarg_T *eap) if (*ksp == K_SPECIAL && (start == NULL || ksp < start || end == NULL) && ((ksp[1] == KS_SPECIAL && ksp[2] == KE_FILLER) -# ifdef FEAT_GUI +#ifdef FEAT_GUI || (ksp[1] == KS_EXTRA && ksp[2] == (int)KE_CSI) -# endif +#endif )) { // K_SPECIAL has been put in the buffer as K_SPECIAL diff --git a/src/version.c b/src/version.c index 60c86985b0..87702d84b7 100644 --- a/src/version.c +++ b/src/version.c @@ -41,13 +41,13 @@ init_longVersion(void) * VAX C can't concatenate strings in the preprocessor. */ strcpy(longVersion, VIM_VERSION_LONG_DATE); -#ifdef BUILD_DATE +# ifdef BUILD_DATE strcat(longVersion, BUILD_DATE); -#else +# else strcat(longVersion, __DATE__); strcat(longVersion, " "); strcat(longVersion, __TIME__); -#endif +# endif strcat(longVersion, ")"); } @@ -60,11 +60,11 @@ init_longVersion(void) if (longVersion != NULL) return; -#ifdef BUILD_DATE +# ifdef BUILD_DATE char *date_time = BUILD_DATE; -#else +# else char *date_time = __DATE__ " " __TIME__; -#endif +# endif char *msg = _("%s (%s, compiled %s)"); size_t len = strlen(msg) + strlen(VIM_VERSION_LONG_ONLY) @@ -684,11 +684,11 @@ static char *(features[]) = "-X11", # endif #endif -# ifdef FEAT_XATTR +#ifdef FEAT_XATTR "+xattr", -# else +#else "-xattr", -# endif +#endif #ifdef FEAT_XFONTSET "+xfontset", #else @@ -734,6 +734,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 2083, /**/ 2082, /**/ @@ -5355,14 +5357,14 @@ list_version(void) version_msg(_("Compilation: ")); version_msg((char *)all_cflags); version_msg("\n"); -#ifdef VMS +# ifdef VMS if (*compiler_version != NUL) { version_msg(_("Compiler: ")); version_msg((char *)compiler_version); version_msg("\n"); } -#endif +# endif version_msg(_("Linking: ")); version_msg((char *)all_lflags); #endif @@ -5432,9 +5434,9 @@ intro_message( NULL, NULL, NULL, -#ifdef MODIFIED_BY +# ifdef MODIFIED_BY NULL, -#endif +# endif NULL, NULL, NULL, diff --git a/src/version.h b/src/version.h index 13f3bac9ff..929625a7e9 100644 --- a/src/version.h +++ b/src/version.h @@ -37,13 +37,13 @@ // For details see https://github.com/vim/vim-win32-installer/pull/277 // and https://github.com/vim/vim-win32-installer/pull/285 #if VIM_VERSION_PATCHLEVEL < 10 -#define LEADZERO(x) 000 ## x +# define LEADZERO(x) 000 ## x #elif VIM_VERSION_PATCHLEVEL < 100 -#define LEADZERO(x) 00 ## x +# define LEADZERO(x) 00 ## x #elif VIM_VERSION_PATCHLEVEL < 1000 -#define LEADZERO(x) 0 ## x +# define LEADZERO(x) 0 ## x #else -#define LEADZERO(x) x +# define LEADZERO(x) x #endif #define VIM_VERSION_PATCHLEVEL_STR VIM_TOSTR(LEADZERO(VIM_VERSION_PATCHLEVEL)) diff --git a/src/vim.h b/src/vim.h index 4bd6c7001b..bd8b4a5d67 100644 --- a/src/vim.h +++ b/src/vim.h @@ -7,7 +7,7 @@ */ #ifndef VIM__H -# define VIM__H +#define VIM__H #include "protodef.h" @@ -52,9 +52,9 @@ * This guard will be removed once the remaining NeXT-specific code paths * are deleted in a future release. */ -#if defined(NeXT) || defined(__NeXT__) -# error "NeXTSTEP / OPENSTEP support has been deprecated." -#endif +# if defined(NeXT) || defined(__NeXT__) +# error "NeXTSTEP / OPENSTEP support has been deprecated." +# endif # if (defined(__linux__) && !defined(__ANDROID__)) || defined(__CYGWIN__) || defined(__GNU__) // Needed for strptime(). Needs to be done early, since header files can @@ -182,7 +182,7 @@ # endif #endif #if defined(MACOS_X) && !defined(HAVE_CONFIG_H) -# define VIM_SIZEOF_INT __SIZEOF_INT__ +# define VIM_SIZEOF_INT __SIZEOF_INT__ #endif #if VIM_SIZEOF_INT < 4 && !defined(PROTO) @@ -369,7 +369,7 @@ # define PATH_ESC_CHARS ((char_u *)" \t\n*?[{`$\\%#'\"|!<") # define SHELL_ESC_CHARS ((char_u *)" \t\n*?[{`$\\%#'\"|!<>();&") # endif -# define BUFFER_ESC_CHARS ((char_u *)" \t\n*?[`$\\%#'\"|!<") +# define BUFFER_ESC_CHARS ((char_u *)" \t\n*?[`$\\%#'\"|!<") #endif // length of a buffer to store a number in ASCII (64 bits binary + NUL) @@ -1835,9 +1835,9 @@ void *vim_memset(void *, int, size_t); // STRICMP() only handles the system locale version, which often does not // handle non-ascii properly. -# define MB_STRICMP(d, s) mb_strnicmp((char_u *)(d), (char_u *)(s), (int)MAXCOL) -# define MB_STRNICMP(d, s, n) mb_strnicmp((char_u *)(d), (char_u *)(s), (int)(n)) -# define MB_STRNICMP2(d, s, n1, n2) mb_strnicmp2((char_u *)(d), (char_u *)(s), (n1), (n2)) +#define MB_STRICMP(d, s) mb_strnicmp((char_u *)(d), (char_u *)(s), (int)MAXCOL) +#define MB_STRNICMP(d, s, n) mb_strnicmp((char_u *)(d), (char_u *)(s), (int)(n)) +#define MB_STRNICMP2(d, s, n1, n2) mb_strnicmp2((char_u *)(d), (char_u *)(s), (n1), (n2)) #define STRCAT(d, s) strcat((char *)(d), (char *)(s)) #define STRNCAT(d, s, n) strncat((char *)(d), (char *)(s), (size_t)(n)) @@ -2031,11 +2031,11 @@ typedef enum { * bits elsewhere. That causes memory corruption. Define time_T and use it * for global variables to avoid that. */ -# ifdef MSWIN +#ifdef MSWIN typedef __time64_t time_T; -# else +#else typedef time_t time_T; -# endif +#endif #ifdef _WIN64 typedef __int64 sock_T; @@ -2352,13 +2352,13 @@ typedef struct short_u origin_end_col; short_u word_start_col; short_u word_end_col; -#ifdef FEAT_PROP_POPUP +# ifdef FEAT_PROP_POPUP // limits for selection inside a popup window short_u min_col; short_u max_col; short_u min_row; short_u max_row; -#endif +# endif pos_T prev; // Previous position short_u state; // Current selection state @@ -2536,7 +2536,7 @@ typedef int (*opt_expand_cb_T)(optexpand_T *args, int *numMatches, char_u ***mat # define USE_MCH_ERRMSG #endif -# if defined(FEAT_EVAL) \ +#if defined(FEAT_EVAL) \ && (!defined(FEAT_GUI_MSWIN) || !defined(FEAT_MBYTE_IME)) // Whether IME is supported by im_get_status() defined in mbyte.c. // For Win32 GUI it's in gui_w32.c when FEAT_MBYTE_IME is defined. @@ -2599,21 +2599,21 @@ typedef int (*opt_expand_cb_T)(optexpand_T *args, int *numMatches, char_u ***mat #ifdef _MSC_VER // Avoid useless warning "conversion from X to Y of greater size". - #pragma warning(disable : 4312) +# pragma warning(disable : 4312) // Avoid warning for old style function declarators - #pragma warning(disable : 4131) +# pragma warning(disable : 4131) // Avoid warning for conversion to type with smaller range - #pragma warning(disable : 4244) +# pragma warning(disable : 4244) // Avoid warning for conversion to larger size - #pragma warning(disable : 4306) +# pragma warning(disable : 4306) // Avoid warning for unreferenced formal parameter - #pragma warning(disable : 4100) +# pragma warning(disable : 4100) // Avoid warning for differs in indirection to slightly different base type - #pragma warning(disable : 4057) +# pragma warning(disable : 4057) // Avoid warning for constant conditional expression - #pragma warning(disable : 4127) +# pragma warning(disable : 4127) // Avoid warning for assignment within conditional - #pragma warning(disable : 4706) +# pragma warning(disable : 4706) #endif // Note: a NULL argument for vim_realloc() is not portable, don't use it. diff --git a/src/viminfo.c b/src/viminfo.c index c87f54a1f6..893195bb3c 100644 --- a/src/viminfo.c +++ b/src/viminfo.c @@ -3356,11 +3356,11 @@ write_viminfo(char_u *file, int forceit) ++viminfo_errcnt; semsg(_(e_cant_rename_viminfo_file_to_str), fname); } -# ifdef MSWIN +#ifdef MSWIN // If the viminfo file was hidden then also hide the new file. else if (hidden) mch_hide(fname); -# endif +#endif } if (viminfo_errcnt > 0) mch_remove(tempname); diff --git a/src/wayland.c b/src/wayland.c index bd2cdefea7..59694b400d 100644 --- a/src/wayland.c +++ b/src/wayland.c @@ -541,17 +541,17 @@ vwl_seat_destroy(vwl_seat_T *self) static void vwl_connection_destroy(vwl_connection_T *self) { -#ifdef FEAT_WAYLAND_CLIPBOARD +# ifdef FEAT_WAYLAND_CLIPBOARD VWL_DESTROY_GOBJECT(self, ext_data_control_manager_v1) VWL_DESTROY_GOBJECT(self, zwlr_data_control_manager_v1) -# ifdef FEAT_WAYLAND_CLIPBOARD_FS +# ifdef FEAT_WAYLAND_CLIPBOARD_FS VWL_DESTROY_GOBJECT(self, wl_data_device_manager) VWL_DESTROY_GOBJECT(self, wl_shm) VWL_DESTROY_GOBJECT(self, wl_compositor) VWL_DESTROY_GOBJECT(self, xdg_wm_base) VWL_DESTROY_GOBJECT(self, zwp_primary_selection_device_manager_v1) +# endif # endif -#endif for (int i = 0; i < self->gobjects.seats.ga_len; i++) vwl_seat_destroy(((vwl_seat_T **)self->gobjects.seats.ga_data)[i]); @@ -592,7 +592,7 @@ vwl_connection_get_seat(vwl_connection_T *self, const char *label) return NULL; } -#ifdef FEAT_WAYLAND_CLIPBOARD_FS +# ifdef FEAT_WAYLAND_CLIPBOARD_FS /* * Get keyboard object from seat and return it. NULL is returned on * failure such as when a keyboard is not available for seat. @@ -605,7 +605,7 @@ vwl_seat_get_keyboard(vwl_seat_T *self) return wl_seat_get_keyboard(self->proxy); } -#endif +# endif #endif @@ -896,7 +896,7 @@ vwl_connection_get_data_device_manager( if (zwlr_data_control_manager_v1_get_version(manager->proxy) >= 2) *supported |= WAYLAND_SELECTION_PRIMARY; } -#ifdef FEAT_WAYLAND_CLIPBOARD_FS +# ifdef FEAT_WAYLAND_CLIPBOARD_FS else if (self->gobjects.wl_data_device_manager != NULL && req_sel == WAYLAND_SELECTION_REGULAR) { @@ -916,7 +916,7 @@ vwl_connection_get_data_device_manager( *supported |= WAYLAND_SELECTION_PRIMARY; } -#endif +# endif if (!(*supported & req_sel)) { @@ -944,7 +944,7 @@ vwl_data_device_manager_get_data_device( device->proxy = zwlr_data_control_manager_v1_get_data_device( self->proxy, seat->proxy); break; -#ifdef FEAT_WAYLAND_CLIPBOARD_FS +# ifdef FEAT_WAYLAND_CLIPBOARD_FS case VWL_DATA_PROTOCOL_CORE: device->proxy = wl_data_device_manager_get_data_device( self->proxy, seat->proxy); @@ -953,7 +953,7 @@ vwl_data_device_manager_get_data_device( device->proxy = zwp_primary_selection_device_manager_v1_get_device( self->proxy, seat->proxy); break; -#endif +# endif default: vim_free(device); return NULL; @@ -978,7 +978,7 @@ vwl_data_device_manager_create_data_source(vwl_data_device_manager_T *self) source->proxy = zwlr_data_control_manager_v1_create_data_source( self->proxy); break; -#ifdef FEAT_WAYLAND_CLIPBOARD_FS +# ifdef FEAT_WAYLAND_CLIPBOARD_FS case VWL_DATA_PROTOCOL_CORE: source->proxy = wl_data_device_manager_create_data_source( self->proxy); @@ -988,7 +988,7 @@ vwl_data_device_manager_create_data_source(vwl_data_device_manager_T *self) zwp_primary_selection_device_manager_v1_create_source( self->proxy); break; -#endif +# endif default: vim_free(source); return NULL; @@ -1018,19 +1018,19 @@ vwl_data_device_wrap_offer_proxy(vwl_data_device_T *self, void *proxy) return offer; } -#ifdef FEAT_WAYLAND_CLIPBOARD_FS -# define VWL_CODE_DATA_PROXY_FS_DESTROY(type) \ +# ifdef FEAT_WAYLAND_CLIPBOARD_FS +# define VWL_CODE_DATA_PROXY_FS_DESTROY(type) \ case VWL_DATA_PROTOCOL_CORE: \ wl_data_##type##_destroy(self->proxy); \ break; \ case VWL_DATA_PROTOCOL_PRIMARY: \ zwp_primary_selection_##type##_v1_destroy(self->proxy); \ break; -#else -# define VWL_CODE_DATA_PROXY_FS_DESTROY(type) -#endif +# else +# define VWL_CODE_DATA_PROXY_FS_DESTROY(type) +# endif -#define VWL_FUNC_DATA_PROXY_DESTROY(type) \ +# define VWL_FUNC_DATA_PROXY_DESTROY(type) \ void \ vwl_data_##type##_destroy(vwl_data_##type##_T *self) \ { \ @@ -1067,14 +1067,14 @@ vwl_data_offer_destroy(vwl_data_offer_T *self) case VWL_DATA_PROTOCOL_WLR: zwlr_data_control_offer_v1_destroy(self->proxy); break; -#ifdef FEAT_WAYLAND_CLIPBOARD_FS +# ifdef FEAT_WAYLAND_CLIPBOARD_FS case VWL_DATA_PROTOCOL_CORE: wl_data_offer_destroy(self->proxy); break; case VWL_DATA_PROTOCOL_PRIMARY: zwp_primary_selection_offer_v1_destroy(self->proxy); break; -#endif +# endif default: break; } @@ -1093,7 +1093,7 @@ vwl_data_device_manager_discard(vwl_data_device_manager_T *self) vim_free(self); } -#define VWL_FUNC_DATA_DEVICE_EVENT_DATA_OFFER(device_type, offer_type) \ +# define VWL_FUNC_DATA_DEVICE_EVENT_DATA_OFFER(device_type, offer_type) \ static void \ device_type##_listener_event_data_offer( \ void *data, \ @@ -1107,7 +1107,7 @@ vwl_data_device_manager_discard(vwl_data_device_manager_T *self) // We want to set the offer to NULL after the selection callback, because the // callback may free the offer, and we don't want a dangling pointer. -#define VWL_FUNC_DATA_DEVICE_EVENT_SELECTION(device_type, offer_type) \ +# define VWL_FUNC_DATA_DEVICE_EVENT_SELECTION(device_type, offer_type) \ static void \ device_type##_listener_event_selection( \ void *data, \ @@ -1120,7 +1120,7 @@ vwl_data_device_manager_discard(vwl_data_device_manager_T *self) self->offer = NULL; \ } \ -#define VWL_FUNC_DATA_DEVICE_EVENT_PRIMARY_SELECTION(device_type, offer_type) \ +# define VWL_FUNC_DATA_DEVICE_EVENT_PRIMARY_SELECTION(device_type, offer_type) \ static void \ device_type##_listener_event_primary_selection( \ void *data, \ @@ -1133,7 +1133,7 @@ vwl_data_device_manager_discard(vwl_data_device_manager_T *self) self->offer = NULL; \ } -#define VWL_FUNC_DATA_DEVICE_EVENT_FINISHED(device_type) \ +# define VWL_FUNC_DATA_DEVICE_EVENT_FINISHED(device_type) \ static void \ device_type##_listener_event_finished( \ void *data, \ @@ -1147,11 +1147,11 @@ VWL_FUNC_DATA_DEVICE_EVENT_DATA_OFFER( ext_data_control_device_v1, ext_data_control_offer_v1) VWL_FUNC_DATA_DEVICE_EVENT_DATA_OFFER( zwlr_data_control_device_v1, zwlr_data_control_offer_v1) -#ifdef FEAT_WAYLAND_CLIPBOARD_FS +# ifdef FEAT_WAYLAND_CLIPBOARD_FS VWL_FUNC_DATA_DEVICE_EVENT_DATA_OFFER(wl_data_device, wl_data_offer) VWL_FUNC_DATA_DEVICE_EVENT_DATA_OFFER( zwp_primary_selection_device_v1, zwp_primary_selection_offer_v1) -#endif +# endif VWL_FUNC_DATA_DEVICE_EVENT_SELECTION( ext_data_control_device_v1, ext_data_control_offer_v1 @@ -1165,13 +1165,13 @@ VWL_FUNC_DATA_DEVICE_EVENT_PRIMARY_SELECTION( VWL_FUNC_DATA_DEVICE_EVENT_PRIMARY_SELECTION( zwlr_data_control_device_v1, zwlr_data_control_offer_v1 ) -#ifdef FEAT_WAYLAND_CLIPBOARD_FS +# ifdef FEAT_WAYLAND_CLIPBOARD_FS VWL_FUNC_DATA_DEVICE_EVENT_SELECTION( wl_data_device, wl_data_offer ) VWL_FUNC_DATA_DEVICE_EVENT_PRIMARY_SELECTION( zwp_primary_selection_device_v1, zwp_primary_selection_offer_v1) -#endif +# endif VWL_FUNC_DATA_DEVICE_EVENT_FINISHED(ext_data_control_device_v1) VWL_FUNC_DATA_DEVICE_EVENT_FINISHED(zwlr_data_control_device_v1) @@ -1192,7 +1192,7 @@ static const struct zwlr_data_control_device_v1_listener zwlr_data_control_device_v1_listener_event_primary_selection, .finished = zwlr_data_control_device_v1_listener_event_finished }; -#ifdef FEAT_WAYLAND_CLIPBOARD_FS +# ifdef FEAT_WAYLAND_CLIPBOARD_FS static const struct wl_data_device_listener wl_data_device_listener = { .data_offer = wl_data_device_listener_event_data_offer, .selection = wl_data_device_listener_event_selection, @@ -1203,9 +1203,9 @@ static const struct zwp_primary_selection_device_v1_listener .selection = zwp_primary_selection_device_v1_listener_event_primary_selection, }; -# endif +# endif -# define VWL_FUNC_DATA_SOURCE_EVENT_SEND(source_type) \ +# define VWL_FUNC_DATA_SOURCE_EVENT_SEND(source_type) \ static void \ source_type##_listener_event_send( \ void *data, struct source_type *source UNUSED, \ @@ -1215,7 +1215,7 @@ static const struct zwp_primary_selection_device_v1_listener self->listener->send(self->data, self, mime_type, fd); \ } -# define VWL_FUNC_DATA_SOURCE_EVENT_CANCELLED(source_type) \ +# define VWL_FUNC_DATA_SOURCE_EVENT_CANCELLED(source_type) \ static void \ source_type##_listener_event_cancelled( \ void *data, struct source_type *source UNUSED) \ @@ -1226,17 +1226,17 @@ static const struct zwp_primary_selection_device_v1_listener VWL_FUNC_DATA_SOURCE_EVENT_SEND(ext_data_control_source_v1) VWL_FUNC_DATA_SOURCE_EVENT_SEND(zwlr_data_control_source_v1) -#ifdef FEAT_WAYLAND_CLIPBOARD_FS +# ifdef FEAT_WAYLAND_CLIPBOARD_FS VWL_FUNC_DATA_SOURCE_EVENT_SEND(wl_data_source) VWL_FUNC_DATA_SOURCE_EVENT_SEND(zwp_primary_selection_source_v1) -#endif +# endif VWL_FUNC_DATA_SOURCE_EVENT_CANCELLED(ext_data_control_source_v1) VWL_FUNC_DATA_SOURCE_EVENT_CANCELLED(zwlr_data_control_source_v1) -#ifdef FEAT_WAYLAND_CLIPBOARD_FS +# ifdef FEAT_WAYLAND_CLIPBOARD_FS VWL_FUNC_DATA_SOURCE_EVENT_CANCELLED(wl_data_source) VWL_FUNC_DATA_SOURCE_EVENT_CANCELLED(zwp_primary_selection_source_v1) -#endif +# endif static const struct ext_data_control_source_v1_listener ext_data_control_source_v1_listener = { @@ -1248,7 +1248,7 @@ static const struct zwlr_data_control_source_v1_listener .send = zwlr_data_control_source_v1_listener_event_send, .cancelled = zwlr_data_control_source_v1_listener_event_cancelled }; -#ifdef FEAT_WAYLAND_CLIPBOARD_FS +# ifdef FEAT_WAYLAND_CLIPBOARD_FS static const struct wl_data_source_listener wl_data_source_listener = { .send = wl_data_source_listener_event_send, .cancelled = wl_data_source_listener_event_cancelled @@ -1258,9 +1258,9 @@ static const struct zwp_primary_selection_source_v1_listener .send = zwp_primary_selection_source_v1_listener_event_send, .cancelled = zwp_primary_selection_source_v1_listener_event_cancelled }; -#endif +# endif -#define VWL_FUNC_DATA_OFFER_EVENT_OFFER(offer_type) \ +# define VWL_FUNC_DATA_OFFER_EVENT_OFFER(offer_type) \ static void \ offer_type##_listener_event_offer( \ void *data, \ @@ -1285,10 +1285,10 @@ static const struct zwp_primary_selection_source_v1_listener VWL_FUNC_DATA_OFFER_EVENT_OFFER(ext_data_control_offer_v1) VWL_FUNC_DATA_OFFER_EVENT_OFFER(zwlr_data_control_offer_v1) -#ifdef FEAT_WAYLAND_CLIPBOARD_FS +# ifdef FEAT_WAYLAND_CLIPBOARD_FS VWL_FUNC_DATA_OFFER_EVENT_OFFER(wl_data_offer) VWL_FUNC_DATA_OFFER_EVENT_OFFER(zwp_primary_selection_offer_v1) -#endif +# endif static const struct ext_data_control_offer_v1_listener ext_data_control_offer_v1_listener = { @@ -1298,7 +1298,7 @@ static const struct zwlr_data_control_offer_v1_listener zwlr_data_control_offer_v1_listener = { .offer = zwlr_data_control_offer_v1_listener_event_offer }; -#ifdef FEAT_WAYLAND_CLIPBOARD_FS +# ifdef FEAT_WAYLAND_CLIPBOARD_FS static const struct wl_data_offer_listener wl_data_offer_listener = { .offer = wl_data_offer_listener_event_offer @@ -1307,10 +1307,10 @@ static const struct zwp_primary_selection_offer_v1_listener zwp_primary_selection_offer_v1_listener = { .offer = zwp_primary_selection_offer_v1_listener_event_offer }; -#endif +# endif -#ifdef FEAT_WAYLAND_CLIPBOARD_FS -# define VWL_CODE_DATA_PROXY_FS_ADD_LISTENER(type) \ +# ifdef FEAT_WAYLAND_CLIPBOARD_FS +# define VWL_CODE_DATA_PROXY_FS_ADD_LISTENER(type) \ case VWL_DATA_PROTOCOL_CORE: \ wl_data_##type##_add_listener(self->proxy, \ &wl_data_##type##_listener, self); \ @@ -1319,11 +1319,11 @@ static const struct zwp_primary_selection_offer_v1_listener zwp_primary_selection_##type##_v1_add_listener(self->proxy, \ &zwp_primary_selection_##type##_v1_listener, self); \ break; -#else -# define VWL_CODE_DATA_PROXY_FS_ADD_LISTENER(type) -#endif +# else +# define VWL_CODE_DATA_PROXY_FS_ADD_LISTENER(type) +# endif -#define VWL_FUNC_DATA_PROXY_ADD_LISTENER(type) \ +# define VWL_FUNC_DATA_PROXY_ADD_LISTENER(type) \ void \ vwl_data_##type##_add_listener( \ vwl_data_##type##_T *self, \ @@ -1378,11 +1378,11 @@ vwl_data_device_set_selection( case VWL_DATA_PROTOCOL_WLR: zwlr_data_control_device_v1_set_selection(self->proxy, proxy); break; -#ifdef FEAT_WAYLAND_CLIPBOARD_FS +# ifdef FEAT_WAYLAND_CLIPBOARD_FS case VWL_DATA_PROTOCOL_CORE: wl_data_device_set_selection(self->proxy, proxy, serial); break; -#endif +# endif default: break; } @@ -1401,12 +1401,12 @@ vwl_data_device_set_selection( self->proxy, proxy ); break; -#ifdef FEAT_WAYLAND_CLIPBOARD_FS +# ifdef FEAT_WAYLAND_CLIPBOARD_FS case VWL_DATA_PROTOCOL_PRIMARY: zwp_primary_selection_device_v1_set_selection( self->proxy, proxy, serial); break; -#endif +# endif default: break; } @@ -1424,14 +1424,14 @@ vwl_data_source_offer(vwl_data_source_T *self, const char *mime_type) case VWL_DATA_PROTOCOL_WLR: zwlr_data_control_source_v1_offer(self->proxy, mime_type); break; -#ifdef FEAT_WAYLAND_CLIPBOARD_FS +# ifdef FEAT_WAYLAND_CLIPBOARD_FS case VWL_DATA_PROTOCOL_CORE: wl_data_source_offer(self->proxy, mime_type); break; case VWL_DATA_PROTOCOL_PRIMARY: zwp_primary_selection_source_v1_offer(self->proxy, mime_type); break; -#endif +# endif default: break; } @@ -1451,14 +1451,14 @@ vwl_data_offer_receive( case VWL_DATA_PROTOCOL_WLR: zwlr_data_control_offer_v1_receive(self->proxy, mime_type, fd); break; -#ifdef FEAT_WAYLAND_CLIPBOARD_FS +# ifdef FEAT_WAYLAND_CLIPBOARD_FS case VWL_DATA_PROTOCOL_CORE: wl_data_offer_receive(self->proxy, mime_type, fd); break; case VWL_DATA_PROTOCOL_PRIMARY: zwp_primary_selection_offer_v1_receive(self->proxy, mime_type, fd); break; -#endif +# endif default: break; } diff --git a/src/wayland.h b/src/wayland.h index 0a181541b4..f83502febd 100644 --- a/src/wayland.h +++ b/src/wayland.h @@ -32,10 +32,10 @@ typedef enum { VWL_DATA_PROTOCOL_NONE, VWL_DATA_PROTOCOL_EXT, VWL_DATA_PROTOCOL_WLR, -#ifdef FEAT_WAYLAND_CLIPBOARD_FS +# ifdef FEAT_WAYLAND_CLIPBOARD_FS VWL_DATA_PROTOCOL_CORE, VWL_DATA_PROTOCOL_PRIMARY -#endif +# endif } vwl_data_protocol_T; #endif // FEAT_WAYLAND_CLIPBOARD @@ -151,11 +151,11 @@ struct vwl_data_device_manager_S { vwl_data_protocol_T protocol; }; -#ifdef FEAT_WAYLAND_CLIPBOARD_FS +# ifdef FEAT_WAYLAND_CLIPBOARD_FS // Dummy functions to handle keyboard events we don't care about. -#define VWL_FUNCS_DUMMY_KEYBOARD_EVENTS() \ +# define VWL_FUNCS_DUMMY_KEYBOARD_EVENTS() \ static void \ clip_wl_fs_keyboard_listener_keymap( \ void *data UNUSED, \ @@ -204,7 +204,7 @@ clip_wl_fs_keyboard_listener_repeat_info( \ { \ } -#endif +# endif #endif // FEAT_WAYLAND_CLIPBOARD diff --git a/src/window.c b/src/window.c index 3ceee02f62..491b74e23d 100644 --- a/src/window.c +++ b/src/window.c @@ -1476,11 +1476,11 @@ win_split_ins( if (size != 0) p_wiw = size; -# ifdef FEAT_GUI +#ifdef FEAT_GUI // When 'guioptions' includes 'L' or 'R' may have to add scrollbars. if (gui.in_use) gui_init_which_components(NULL); -# endif +#endif } else { @@ -3120,11 +3120,11 @@ make_win_info_dict( tv.vval.v_number = topline; if (dict_add_tv(d, "topline", &tv) == FAIL) break; -#ifdef FEAT_DIFF +# ifdef FEAT_DIFF tv.vval.v_number = topfill; -#else +# else tv.vval.v_number = 0; -#endif +# endif if (dict_add_tv(d, "topfill", &tv) == FAIL) break; tv.vval.v_number = leftcol; @@ -3228,15 +3228,15 @@ check_window_scroll_resize( int width = wp->w_width - wp->w_last_width; int height = wp->w_height - wp->w_last_height; int topline = wp->w_topline - wp->w_last_topline; -#ifdef FEAT_DIFF +# ifdef FEAT_DIFF int topfill = wp->w_topfill - wp->w_last_topfill; -#endif +# endif int leftcol = wp->w_leftcol - wp->w_last_leftcol; int skipcol = wp->w_skipcol - wp->w_last_skipcol; dict_T *d = make_win_info_dict(width, height, topline, -#ifdef FEAT_DIFF +# ifdef FEAT_DIFF topfill, -#endif +# endif leftcol, skipcol); if (d == NULL) break; @@ -3252,9 +3252,9 @@ check_window_scroll_resize( tot_width += abs(width); tot_height += abs(height); tot_topline += abs(topline); -#ifdef FEAT_DIFF +# ifdef FEAT_DIFF tot_topfill += abs(topfill); -#endif +# endif tot_leftcol += abs(leftcol); tot_skipcol += abs(skipcol); } @@ -4646,16 +4646,16 @@ win_init_size(void) alloc_tabpage(void) { tabpage_T *tp; -# ifdef FEAT_GUI +#ifdef FEAT_GUI int i; -# endif +#endif tp = ALLOC_CLEAR_ONE(tabpage_T); if (tp == NULL) return NULL; -# ifdef FEAT_EVAL +#ifdef FEAT_EVAL // init t: variables tp->tp_vars = dict_alloc_id(aid_newtabpage_tvars); if (tp->tp_vars == NULL) @@ -4664,15 +4664,15 @@ alloc_tabpage(void) return NULL; } init_var_dict(tp->tp_vars, &tp->tp_winvar, VAR_SCOPE); -# endif +#endif -# ifdef FEAT_GUI +#ifdef FEAT_GUI for (i = 0; i < 3; i++) tp->tp_prev_which_scrollbars[i] = -1; -# endif -# ifdef FEAT_DIFF +#endif +#ifdef FEAT_DIFF tp->tp_diff_invalid = TRUE; -# endif +#endif tp->tp_ch_used = p_ch; return tp; @@ -4683,10 +4683,10 @@ free_tabpage(tabpage_T *tp) { int idx; -# ifdef FEAT_DIFF +#ifdef FEAT_DIFF diff_clear(tp); -# endif -# ifdef FEAT_PROP_POPUP +#endif +#ifdef FEAT_PROP_POPUP while (tp->tp_first_popupwin != NULL) popup_close_tabpage(tp, tp->tp_first_popupwin->w_id, TRUE); #endif @@ -5243,10 +5243,10 @@ goto_tabpage_win(tabpage_T *tp, win_T *wp) if (curtab == tp && win_valid(wp)) { win_enter(wp, TRUE); -# ifdef FEAT_GUI_TABLINE +#ifdef FEAT_GUI_TABLINE if (gui_use_tabline()) gui_mch_set_curtab(tabpage_index(curtab)); -# endif +#endif } } @@ -7669,9 +7669,9 @@ only_one_window(void) FOR_ALL_WINDOWS(wp) if (wp->w_buffer != NULL && (!((bt_help(wp->w_buffer) && !bt_help(curbuf)) -# ifdef FEAT_QUICKFIX +#ifdef FEAT_QUICKFIX || wp->w_p_pvw -# endif +#endif ) || wp == curwin) && !is_aucmd_win(wp)) ++count; return (count <= 1); diff --git a/src/xxd/xxd.c b/src/xxd/xxd.c index ddc11ee96b..88c30234df 100644 --- a/src/xxd/xxd.c +++ b/src/xxd/xxd.c @@ -136,7 +136,7 @@ * FILE is defined on OS 4.x, not on 5.x (Solaris). * if __SVR4 is defined (some Solaris versions), don't include this. */ -#if defined(sun) && defined(FILE) && !defined(__SVR4) && defined(__STDC__) +# if defined(sun) && defined(FILE) && !defined(__SVR4) && defined(__STDC__) # define __P(a) a /* excerpt from my sun_stdlib.h */ extern int fprintf __P((FILE *, char *, ...)); @@ -686,13 +686,13 @@ get_color_char (int e, int ebcdic) } else /* ASCII */ { - #if defined(__MVS__) && __CHARSET_LIB == 0 +#if defined(__MVS__) && __CHARSET_LIB == 0 if (e >= 64) return COLOR_GREEN; - #else +#else if (e > 31 && e < 127) return COLOR_GREEN; - #endif +#endif else if (e == 9 || e == 10 || e == 13) return COLOR_YELLOW; -- 2.47.3