aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/os/win_defs.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/nvim/os/win_defs.h')
-rw-r--r--src/nvim/os/win_defs.h30
1 files changed, 25 insertions, 5 deletions
diff --git a/src/nvim/os/win_defs.h b/src/nvim/os/win_defs.h
index 6a29f86e79..356094baa1 100644
--- a/src/nvim/os/win_defs.h
+++ b/src/nvim/os/win_defs.h
@@ -1,6 +1,10 @@
#ifndef NVIM_OS_WIN_DEFS_H
#define NVIM_OS_WIN_DEFS_H
+#ifndef WIN32
+# error Header must be included only when compiling for Windows.
+#endif
+
// winsock2.h must be first to avoid incompatibilities
// with winsock.h (included by windows.h)
#include <winsock2.h>
@@ -15,18 +19,21 @@
#define NAME_MAX _MAX_PATH
-#define TEMP_DIR_NAMES {"$TMP", "$TEMP", "$USERPROFILE", ""}
+#define TEMP_DIR_NAMES { "$TMPDIR", "$TMP", "$TEMP", "$USERPROFILE", "" }
#define TEMP_FILE_PATH_MAXLEN _MAX_PATH
#define FNAME_ILLEGAL "\"*?><|"
-// Separator character for environment variables.
+// Character that separates entries in $PATH.
#define ENV_SEPCHAR ';'
+#define ENV_SEPSTR ";"
#define USE_CRNL
-// We have our own RGB macro in macros.h.
-#undef RGB
+// Windows defines a RGB macro that produces 0x00bbggrr color values for use
+// with GDI. Our macro is different, and we don't use GDI.
+// Duplicated from macros.h to avoid include-order sensitivity.
+#define RGB_(r, g, b) ((r << 16) | (g << 8) | b)
#ifdef _MSC_VER
# ifndef inline
@@ -35,6 +42,9 @@
# ifndef restrict
# define restrict __restrict
# endif
+# ifndef STDIN_FILENO
+# define STDIN_FILENO _fileno(stdin)
+# endif
# ifndef STDOUT_FILENO
# define STDOUT_FILENO _fileno(stdout)
# endif
@@ -49,7 +59,7 @@
#define BACKSLASH_IN_FILENAME
#ifdef _MSC_VER
-typedef SSIZE_T ssize_t;
+typedef int mode_t;
#endif
#ifndef SSIZE_MAX
@@ -86,4 +96,14 @@ typedef SSIZE_T ssize_t;
# define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR)
#endif
+#ifndef STDIN_FILENO
+# define STDIN_FILENO 0
+#endif
+#ifndef STDOUT_FILENO
+# define STDOUT_FILENO 1
+#endif
+#ifndef STDERR_FILENO
+# define STDERR_FILENO 2
+#endif
+
#endif // NVIM_OS_WIN_DEFS_H