1#ifndef NVIM_OS_WIN_DEFS_H
2#define NVIM_OS_WIN_DEFS_H
3
4#ifndef WIN32
5# error Header must be included only when compiling for Windows.
6#endif
7
8// winsock2.h must be first to avoid incompatibilities
9// with winsock.h (included by windows.h)
10#include <winsock2.h>
11#include <windows.h>
12#include <sys/stat.h>
13#include <io.h>
14#include <stdio.h>
15
16// Windows does not have S_IFLNK but libuv defines it
17// and sets the flag for us when calling uv_fs_stat.
18#include <uv.h>
19
20#define NAME_MAX _MAX_PATH
21
22#define TEMP_DIR_NAMES { "$TMPDIR", "$TMP", "$TEMP", "$USERPROFILE", "" }
23#define TEMP_FILE_PATH_MAXLEN _MAX_PATH
24
25#define FNAME_ILLEGAL "\"*?><|"
26
27// Character that separates entries in $PATH.
28#define ENV_SEPCHAR ';'
29#define ENV_SEPSTR ";"
30
31#define USE_CRNL
32
33// Windows defines a RGB macro that produces 0x00bbggrr color values for use
34// with GDI. Our macro is different, and we don't use GDI.
35// Duplicated from macros.h to avoid include-order sensitivity.
36#define RGB_(r, g, b) ((r << 16) | (g << 8) | b)
37
38#ifdef _MSC_VER
39# ifndef inline
40# define inline __inline
41# endif
42# ifndef restrict
43# define restrict __restrict
44# endif
45# ifndef STDIN_FILENO
46# define STDIN_FILENO _fileno(stdin)
47# endif
48# ifndef STDOUT_FILENO
49# define STDOUT_FILENO _fileno(stdout)
50# endif
51# ifndef STDERR_FILENO
52# define STDERR_FILENO _fileno(stderr)
53# endif
54# ifndef S_IXUSR
55# define S_IXUSR S_IEXEC
56# endif
57#endif
58
59#define BACKSLASH_IN_FILENAME
60
61#ifdef _MSC_VER
62typedef int mode_t;
63#endif
64
65#ifndef SSIZE_MAX
66# ifdef _WIN64
67# define SSIZE_MAX _I64_MAX
68# else
69# define SSIZE_MAX LONG_MAX
70# endif
71#endif
72
73#ifndef O_NOFOLLOW
74# define O_NOFOLLOW 0
75#endif
76
77#if !defined(S_ISDIR) && defined(S_IFDIR)
78# define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
79#endif
80#if !defined(S_ISREG) && defined(S_IFREG)
81# define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
82#endif
83#if !defined(S_ISLNK) && defined(S_IFLNK)
84# define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK)
85#endif
86#if !defined(S_ISBLK) && defined(S_IFBLK)
87# define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK)
88#endif
89#if !defined(S_ISSOCK) && defined(S_IFSOCK)
90# define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK)
91#endif
92#if !defined(S_ISFIFO) && defined(S_IFIFO)
93# define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO)
94#endif
95#if !defined(S_ISCHR) && defined(S_IFCHR)
96# define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR)
97#endif
98
99#ifndef STDIN_FILENO
100# define STDIN_FILENO 0
101#endif
102#ifndef STDOUT_FILENO
103# define STDOUT_FILENO 1
104#endif
105#ifndef STDERR_FILENO
106# define STDERR_FILENO 2
107#endif
108
109#endif // NVIM_OS_WIN_DEFS_H
110