diff src/main.c @ 15868:7fad90423bd2 v8.1.0941

patch 8.1.0941: macros for MS-Windows are inconsistent commit https://github.com/vim/vim/commit/4f97475d326c2773a78561fb874e4f23c25cbcd9 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Feb 17 17:44:42 2019 +0100 patch 8.1.0941: macros for MS-Windows are inconsistent Problem: Macros for MS-Windows are inconsistent, using "32", "3264 and others. Solution: Use MSWIN for all MS-Windows builds. Use FEAT_GUI_MSWIN for the GUI build. (Hirohito Higashi, closes #3932)
author Bram Moolenaar <Bram@vim.org>
date Sun, 17 Feb 2019 17:45:08 +0100
parents a6ca8cf07a98
children a246b020984c
line wrap: on
line diff
--- a/src/main.c
+++ b/src/main.c
@@ -11,7 +11,7 @@
 #include "vim.h"
 
 #ifdef __CYGWIN__
-# ifndef WIN32
+# ifndef MSWIN
 #  include <cygwin/version.h>
 #  include <sys/cygwin.h>	/* for cygwin_conv_to_posix_path() and/or
 				 * cygwin_conv_path() */
@@ -19,7 +19,7 @@
 # include <limits.h>
 #endif
 
-#if defined(WIN3264) && !defined(FEAT_GUI_W32)
+#if defined(MSWIN) && !defined(FEAT_GUI_MSWIN)
 # include "iscygpty.h"
 #endif
 
@@ -119,7 +119,7 @@ main
      */
     mch_early_init();
 
-#if defined(WIN32)
+#ifdef MSWIN
     /*
      * MinGW expands command line arguments, which confuses our code to
      * convert when 'encoding' changes.  Get the unexpanded arguments.
@@ -250,7 +250,7 @@ main
 	params.fname = alist_name(&GARGLIST[0]);
     }
 
-#if defined(WIN32)
+#ifdef MSWIN
     {
 	extern void set_alist_count(void);
 
@@ -854,7 +854,7 @@ vim_main2(void)
     }
 #endif
 
-#if defined(WIN3264) && !defined(FEAT_GUI_W32)
+#if defined(MSWIN) && !defined(FEAT_GUI_MSWIN)
     mch_set_winsize_now();	    /* Allow winsize changes from now on */
 #endif
 
@@ -880,7 +880,7 @@ vim_main2(void)
     {
 # ifdef FEAT_GUI
 #  if !defined(FEAT_GUI_X11) && !defined(FEAT_GUI_GTK)  \
-		&& !defined(FEAT_GUI_W32)
+		&& !defined(FEAT_GUI_MSWIN)
 	if (gui.in_use)
 	{
 	    mch_errmsg(_("netbeans is not supported with this GUI\n"));
@@ -1534,7 +1534,7 @@ getout(int exitval)
     if (garbage_collect_at_exit)
 	garbage_collect(FALSE);
 #endif
-#if defined(WIN32)
+#ifdef MSWIN
     free_cmd_argsW();
 #endif
 
@@ -1559,7 +1559,7 @@ init_locale(void)
     setlocale(LC_NUMERIC, "C");
 # endif
 
-# ifdef WIN32
+# ifdef MSWIN
     /* Apparently MS-Windows printf() may cause a crash when we give it 8-bit
      * text while it's expecting text in the current locale.  This call avoids
      * that. */
@@ -1642,8 +1642,8 @@ early_arg_scan(mparm_T *parmp UNUSED)
 	}
 # endif
 
-# if defined(FEAT_GUI_GTK) || defined(FEAT_GUI_W32)
-#  ifdef FEAT_GUI_W32
+# if defined(FEAT_GUI_GTK) || defined(FEAT_GUI_MSWIN)
+#  ifdef FEAT_GUI_MSWIN
 	else if (STRICMP(argv[i], "--windowid") == 0)
 #  else
 	else if (STRICMP(argv[i], "--socketid") == 0)
@@ -1661,7 +1661,7 @@ early_arg_scan(mparm_T *parmp UNUSED)
 	    if (count != 1)
 		mainerr(ME_INVALID_ARG, (char_u *)argv[i]);
 	    else
-#  ifdef FEAT_GUI_W32
+#  ifdef FEAT_GUI_MSWIN
 		win_socket_id = id;
 #  else
 		gtk_socket_id = id;
@@ -1942,7 +1942,7 @@ command_line_scan(mparm_T *parmp)
 		    }
 		}
 #endif
-#if defined(FEAT_GUI_GTK) || defined(FEAT_GUI_W32)
+#if defined(FEAT_GUI_GTK) || defined(FEAT_GUI_MSWIN)
 # ifdef FEAT_GUI_GTK
 		else if (STRNICMP(argv[0] + argv_idx, "socketid", 8) == 0)
 # else
@@ -2237,7 +2237,7 @@ command_line_scan(mparm_T *parmp)
 	    case 'u':		/* "-u {vimrc}" vim inits file */
 	    case 'U':		/* "-U {gvimrc}" gvim inits file */
 	    case 'W':		/* "-W {scriptout}" overwrite */
-#ifdef FEAT_GUI_W32
+#ifdef FEAT_GUI_MSWIN
 	    case 'P':		/* "-P {parent title}" MDI parent */
 #endif
 		want_argument = TRUE;
@@ -2399,7 +2399,7 @@ scripterror:
 		    }
 		    break;
 
-#ifdef FEAT_GUI_W32
+#ifdef FEAT_GUI_MSWIN
 		case 'P':		/* "-P {parent title}" MDI parent */
 		    gui_mch_set_parent(argv[0]);
 		    break;
@@ -2445,7 +2445,7 @@ scripterror:
 		}
 	    }
 #endif
-#if defined(__CYGWIN32__) && !defined(WIN32)
+#if defined(__CYGWIN32__) && !defined(MSWIN)
 	    /*
 	     * If vim is invoked by non-Cygwin tools, convert away any
 	     * DOS paths, so things like .swp files are created correctly.
@@ -2481,7 +2481,7 @@ scripterror:
 #endif
 		    );
 
-#if defined(WIN32)
+#ifdef MSWIN
 	    {
 		/* Remember this argument has been added to the argument list.
 		 * Needed when 'encoding' is changed. */
@@ -2561,7 +2561,7 @@ check_tty(mparm_T *parmp)
 	    exit(1);
 	}
 #endif
-#if defined(WIN3264) && !defined(FEAT_GUI_W32)
+#if defined(MSWIN) && !defined(FEAT_GUI_MSWIN)
 	if (is_cygpty_used())
 	{
 # if defined(HAVE_BIND_TEXTDOMAIN_CODESET) \
@@ -3423,7 +3423,7 @@ usage(void)
     main_msg(_("--socketid <xid>\tOpen Vim inside another GTK widget"));
     main_msg(_("--echo-wid\t\tMake gvim echo the Window ID on stdout"));
 #endif
-#ifdef FEAT_GUI_W32
+#ifdef FEAT_GUI_MSWIN
     main_msg(_("-P <parent title>\tOpen Vim inside parent application"));
     main_msg(_("--windowid <HWND>\tOpen Vim inside another win32 widget"));
 #endif
@@ -3460,7 +3460,7 @@ check_swap_exists_action(void)
 #if defined(STARTUPTIME) || defined(PROTO)
 static struct timeval	prev_timeval;
 
-# ifdef WIN3264
+# ifdef MSWIN
 /*
  * Windows doesn't have gettimeofday(), although it does have struct timeval.
  */
@@ -3567,7 +3567,7 @@ set_progpath(char_u *argv0)
 {
     char_u *val = argv0;
 
-# if defined(WIN32)
+# ifdef MSWIN
     /* A relative path containing a "/" will become invalid when using ":cd",
      * turn it into a full path.
      * On MS-Windows "vim" should be expanded to "vim.exe", thus always do
@@ -3600,7 +3600,7 @@ set_progpath(char_u *argv0)
 
     set_vim_var_string(VV_PROGPATH, val, -1);
 
-# ifdef WIN32
+# ifdef MSWIN
     vim_free(path);
 # endif
 }
@@ -3623,7 +3623,7 @@ exec_on_server(mparm_T *parmp)
 {
     if (parmp->serverName_arg == NULL || *parmp->serverName_arg != NUL)
     {
-# ifdef WIN32
+# ifdef MSWIN
 	/* Initialise the client/server messaging infrastructure. */
 	serverInitMessaging();
 # endif
@@ -3645,7 +3645,7 @@ exec_on_server(mparm_T *parmp)
 	 * clipboard first, it's further down. */
 	parmp->servername = serverMakeName(parmp->serverName_arg,
 							      parmp->argv[0]);
-# ifdef WIN32
+# ifdef MSWIN
 	if (parmp->servername != NULL)
 	{
 	    serverSetName(parmp->servername);
@@ -3842,7 +3842,7 @@ cmdsrv_main(
 		break;
 	    }
 
-# ifdef FEAT_GUI_W32
+# ifdef FEAT_GUI_MSWIN
 	    /* Guess that when the server name starts with "g" it's a GUI
 	     * server, which we can bring to the foreground here.
 	     * Foreground() in the server doesn't work very well. */
@@ -3860,7 +3860,7 @@ cmdsrv_main(
 		int	j;
 		char_u  *done = alloc(numFiles);
 		char_u  *p;
-# ifdef FEAT_GUI_W32
+# ifdef FEAT_GUI_MSWIN
 		NOTIFYICONDATA ni;
 		int	count = 0;
 		extern HWND message_window;
@@ -3870,7 +3870,7 @@ cmdsrv_main(
 		    /* Skip "+cmd" argument, don't wait for it to be edited. */
 		    --numFiles;
 
-# ifdef FEAT_GUI_W32
+# ifdef FEAT_GUI_MSWIN
 		ni.cbSize = sizeof(ni);
 		ni.hWnd = message_window;
 		ni.uID = 0;
@@ -3884,7 +3884,7 @@ cmdsrv_main(
 		vim_memset(done, 0, numFiles);
 		while (memchr(done, 0, numFiles) != NULL)
 		{
-# ifdef WIN32
+# ifdef MSWIN
 		    p = serverGetReply(srv, NULL, TRUE, TRUE, 0);
 		    if (p == NULL)
 			break;
@@ -3895,7 +3895,7 @@ cmdsrv_main(
 		    j = atoi((char *)p);
 		    if (j >= 0 && j < numFiles)
 		    {
-# ifdef FEAT_GUI_W32
+# ifdef FEAT_GUI_MSWIN
 			++count;
 			sprintf(ni.szTip, _("%d of %d edited"),
 							     count, numFiles);
@@ -3904,7 +3904,7 @@ cmdsrv_main(
 			done[j] = 1;
 		    }
 		}
-# ifdef FEAT_GUI_W32
+# ifdef FEAT_GUI_MSWIN
 		Shell_NotifyIcon(NIM_DELETE, &ni);
 # endif
 	    }
@@ -3913,7 +3913,7 @@ cmdsrv_main(
 	{
 	    if (i == *argc - 1)
 		mainerr_arg_missing((char_u *)argv[i]);
-# ifdef WIN32
+# ifdef MSWIN
 	    /* Win32 always works? */
 	    if (serverSendToVim(sname, (char_u *)argv[i + 1],
 						  &res, NULL, 1, 0, FALSE) < 0)
@@ -3935,7 +3935,7 @@ cmdsrv_main(
 	}
 	else if (STRICMP(argv[i], "--serverlist") == 0)
 	{
-# ifdef WIN32
+# ifdef MSWIN
 	    /* Win32 always works? */
 	    res = serverGetVimNames();
 # else