forked from aniani/vim
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)
This commit is contained in:
@@ -20,7 +20,7 @@
|
||||
#endif
|
||||
|
||||
/* Note: when making changes here also adjust configure.ac. */
|
||||
#ifdef WIN32
|
||||
#ifdef MSWIN
|
||||
/* WinSock API is separated from C API, thus we can't use read(), write(),
|
||||
* errno... */
|
||||
# define SOCK_ERRNO errno = WSAGetLastError()
|
||||
@@ -65,7 +65,7 @@ static int safe_to_invoke_callback = 0;
|
||||
|
||||
static char *part_names[] = {"sock", "out", "err", "in"};
|
||||
|
||||
#ifdef WIN32
|
||||
#ifdef MSWIN
|
||||
static int
|
||||
fd_read(sock_T fd, char *buf, size_t len)
|
||||
{
|
||||
@@ -234,7 +234,7 @@ ch_error(channel_T *ch, const char *fmt, ...)
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
#ifdef MSWIN
|
||||
# undef PERROR
|
||||
# define PERROR(msg) (void)semsg("%s: %s", msg, strerror_win32(errno))
|
||||
|
||||
@@ -687,7 +687,7 @@ channel_open(
|
||||
int sd = -1;
|
||||
struct sockaddr_in server;
|
||||
struct hostent *host;
|
||||
#ifdef WIN32
|
||||
#ifdef MSWIN
|
||||
u_short port = port_in;
|
||||
u_long val = 1;
|
||||
#else
|
||||
@@ -696,7 +696,7 @@ channel_open(
|
||||
channel_T *channel;
|
||||
int ret;
|
||||
|
||||
#ifdef WIN32
|
||||
#ifdef MSWIN
|
||||
channel_init_winsock();
|
||||
#endif
|
||||
|
||||
@@ -758,7 +758,7 @@ channel_open(
|
||||
{
|
||||
/* Make connect() non-blocking. */
|
||||
if (
|
||||
#ifdef _WIN32
|
||||
#ifdef MSWIN
|
||||
ioctlsocket(sd, FIONBIO, &val) < 0
|
||||
#else
|
||||
fcntl(sd, F_SETFL, O_NONBLOCK) < 0
|
||||
@@ -804,14 +804,14 @@ channel_open(
|
||||
|
||||
/* If connect() didn't finish then try using select() to wait for the
|
||||
* connection to be made. For Win32 always use select() to wait. */
|
||||
#ifndef WIN32
|
||||
#ifndef MSWIN
|
||||
if (errno != ECONNREFUSED)
|
||||
#endif
|
||||
{
|
||||
struct timeval tv;
|
||||
fd_set rfds;
|
||||
fd_set wfds;
|
||||
#ifndef WIN32
|
||||
#ifndef MSWIN
|
||||
int so_error = 0;
|
||||
socklen_t so_error_len = sizeof(so_error);
|
||||
struct timeval start_tv;
|
||||
@@ -824,7 +824,7 @@ channel_open(
|
||||
|
||||
tv.tv_sec = waitnow / 1000;
|
||||
tv.tv_usec = (waitnow % 1000) * 1000;
|
||||
#ifndef WIN32
|
||||
#ifndef MSWIN
|
||||
gettimeofday(&start_tv, NULL);
|
||||
#endif
|
||||
ch_log(channel,
|
||||
@@ -842,7 +842,7 @@ channel_open(
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#ifdef WIN32
|
||||
#ifdef MSWIN
|
||||
/* On Win32: select() is expected to work and wait for up to
|
||||
* "waitnow" msec for the socket to be open. */
|
||||
if (FD_ISSET(sd, &wfds))
|
||||
@@ -893,7 +893,7 @@ channel_open(
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifndef WIN32
|
||||
#ifndef MSWIN
|
||||
if (waittime > 1 && elapsed_msec < waittime)
|
||||
{
|
||||
/* The port isn't ready but we also didn't get an error.
|
||||
@@ -930,7 +930,7 @@ channel_open(
|
||||
|
||||
if (waittime >= 0)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
#ifdef MSWIN
|
||||
val = 0;
|
||||
ioctlsocket(sd, FIONBIO, &val);
|
||||
#else
|
||||
@@ -1029,7 +1029,7 @@ ch_close_part(channel_T *channel, ch_part_T part)
|
||||
&& (part == PART_OUT || channel->CH_OUT_FD != *fd)
|
||||
&& (part == PART_ERR || channel->CH_ERR_FD != *fd))
|
||||
{
|
||||
#ifdef WIN32
|
||||
#ifdef MSWIN
|
||||
if (channel->ch_named_pipe)
|
||||
DisconnectNamedPipe((HANDLE)fd);
|
||||
#endif
|
||||
@@ -1427,7 +1427,7 @@ can_write_buf_line(channel_T *channel)
|
||||
in_part->ch_block_write = 1;
|
||||
|
||||
/* TODO: Win32 implementation, probably using WaitForMultipleObjects() */
|
||||
#ifndef WIN32
|
||||
#ifndef MSWIN
|
||||
{
|
||||
# if defined(HAVE_SELECT)
|
||||
struct timeval tval;
|
||||
@@ -1759,7 +1759,7 @@ channel_get_all(channel_T *channel, ch_part_T part, int *outlen)
|
||||
{
|
||||
if (*p == NUL)
|
||||
*p = NL;
|
||||
#ifdef WIN32
|
||||
#ifdef MSWIN
|
||||
else if (*p == 0x1b)
|
||||
{
|
||||
// crush the escape sequence OSC 0/1/2: ESC ]0;
|
||||
@@ -2064,7 +2064,7 @@ channel_parse_json(channel_T *channel, ch_part_T part)
|
||||
(int)buflen);
|
||||
reader.js_used = 0;
|
||||
chanpart->ch_wait_len = buflen;
|
||||
#ifdef WIN32
|
||||
#ifdef MSWIN
|
||||
chanpart->ch_deadline = GetTickCount() + 100L;
|
||||
#else
|
||||
gettimeofday(&chanpart->ch_deadline, NULL);
|
||||
@@ -2079,7 +2079,7 @@ channel_parse_json(channel_T *channel, ch_part_T part)
|
||||
else
|
||||
{
|
||||
int timeout;
|
||||
#ifdef WIN32
|
||||
#ifdef MSWIN
|
||||
timeout = GetTickCount() > chanpart->ch_deadline;
|
||||
#else
|
||||
{
|
||||
@@ -3198,7 +3198,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 WIN32
|
||||
# ifdef MSWIN
|
||||
if (fd != channel->CH_SOCK_FD)
|
||||
{
|
||||
DWORD nread;
|
||||
@@ -3554,7 +3554,7 @@ channel_read_json_block(
|
||||
timeout = timeout_arg;
|
||||
if (chanpart->ch_wait_len > 0)
|
||||
{
|
||||
#ifdef WIN32
|
||||
#ifdef MSWIN
|
||||
timeout = chanpart->ch_deadline - GetTickCount() + 1;
|
||||
#else
|
||||
{
|
||||
@@ -3680,7 +3680,7 @@ theend:
|
||||
free_job_options(&opt);
|
||||
}
|
||||
|
||||
# if defined(WIN32) || defined(FEAT_GUI_X11) || defined(FEAT_GUI_GTK) \
|
||||
# if defined(MSWIN) || defined(FEAT_GUI_X11) || defined(FEAT_GUI_GTK) \
|
||||
|| defined(PROTO)
|
||||
/*
|
||||
* Lookup the channel from the socket. Set "partp" to the fd index.
|
||||
@@ -3707,7 +3707,7 @@ channel_fd2channel(sock_T fd, ch_part_T *partp)
|
||||
}
|
||||
# endif
|
||||
|
||||
# if defined(WIN32) || defined(FEAT_GUI) || defined(PROTO)
|
||||
# if defined(MSWIN) || defined(FEAT_GUI) || defined(PROTO)
|
||||
/*
|
||||
* Check the channels for anything that is ready to be read.
|
||||
* The data is put in the read queue.
|
||||
@@ -3772,7 +3772,7 @@ channel_set_nonblock(channel_T *channel, ch_part_T part)
|
||||
|
||||
if (fd != INVALID_FD)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
#ifdef MSWIN
|
||||
u_long val = 1;
|
||||
|
||||
ioctlsocket(fd, FIONBIO, &val);
|
||||
@@ -3853,7 +3853,7 @@ channel_send(
|
||||
else
|
||||
{
|
||||
res = fd_write(fd, (char *)buf, len);
|
||||
#ifdef WIN32
|
||||
#ifdef MSWIN
|
||||
if (channel->ch_named_pipe && res < 0)
|
||||
{
|
||||
DisconnectNamedPipe((HANDLE)fd);
|
||||
@@ -4213,7 +4213,7 @@ channel_poll_check(int ret_in, void *fds_in)
|
||||
}
|
||||
# endif /* UNIX && !HAVE_SELECT */
|
||||
|
||||
# if (!defined(WIN32) && defined(HAVE_SELECT)) || defined(PROTO)
|
||||
# if (!defined(MSWIN) && defined(HAVE_SELECT)) || defined(PROTO)
|
||||
|
||||
/*
|
||||
* The "fd_set" type is hidden to avoid problems with the function proto.
|
||||
@@ -4313,7 +4313,7 @@ channel_select_check(int ret_in, void *rfds_in, void *wfds_in)
|
||||
|
||||
return ret;
|
||||
}
|
||||
# endif /* !WIN32 && HAVE_SELECT */
|
||||
# endif /* !MSWIN && HAVE_SELECT */
|
||||
|
||||
/*
|
||||
* Execute queued up commands.
|
||||
@@ -5039,7 +5039,7 @@ get_job_options(typval_T *tv, jobopt_T *opt, int supported, int supported2)
|
||||
break;
|
||||
opt->jo_cwd = tv_get_string_buf_chk(item, opt->jo_cwd_buf);
|
||||
if (opt->jo_cwd == NULL || !mch_isdir(opt->jo_cwd)
|
||||
#ifndef WIN32 // Win32 directories don't have the concept of "executable"
|
||||
#ifndef MSWIN // Win32 directories don't have the concept of "executable"
|
||||
|| mch_access((char *)opt->jo_cwd, X_OK) != 0
|
||||
#endif
|
||||
)
|
||||
@@ -5199,7 +5199,7 @@ job_free_contents(job_T *job)
|
||||
#ifdef UNIX
|
||||
vim_free(job->jv_termsig);
|
||||
#endif
|
||||
#ifdef WIN3264
|
||||
#ifdef MSWIN
|
||||
vim_free(job->jv_tty_type);
|
||||
#endif
|
||||
free_callback(job->jv_exit_cb, job->jv_exit_partial);
|
||||
@@ -5971,7 +5971,7 @@ job_info(job_T *job, dict_T *dict)
|
||||
#ifdef UNIX
|
||||
dict_add_string(dict, "termsig", job->jv_termsig);
|
||||
#endif
|
||||
#ifdef WIN3264
|
||||
#ifdef MSWIN
|
||||
dict_add_string(dict, "tty_type", job->jv_tty_type);
|
||||
#endif
|
||||
|
||||
|
Reference in New Issue
Block a user