win_defs.h (1846B)
1 #pragma once 2 // IWYU pragma: private, include "nvim/os/os_defs.h" 3 4 #ifndef MSWIN 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 11 // uncrustify:off 12 #include <winsock2.h> 13 // uncrustify:on 14 #include <io.h> 15 #include <stdio.h> 16 #include <sys/stat.h> 17 #include <windows.h> 18 19 // Windows does not have S_IFLNK but libuv defines it 20 // and sets the flag for us when calling uv_fs_stat. 21 #include <uv.h> 22 23 #define NAME_MAX _MAX_PATH 24 25 #define TEMP_DIR_NAMES { "$TMPDIR", "$TMP", "$TEMP", "$USERPROFILE", "" } 26 #define TEMP_FILE_PATH_MAXLEN _MAX_PATH 27 28 #define FNAME_ILLEGAL "\"*?><|" 29 30 // Character that separates entries in $PATH. 31 #define ENV_SEPCHAR ';' 32 #define ENV_SEPSTR ";" 33 34 #define USE_CRNL 35 36 // Windows defines a RGB macro that produces 0x00bbggrr color values for use 37 // with GDI. Our macro is different, and we don't use GDI. 38 // Duplicated from macros.h to avoid include-order sensitivity. 39 #define RGB_(r, g, b) (((r) << 16) | ((g) << 8) | (b)) 40 41 #ifdef _MSC_VER 42 # ifndef inline 43 # define inline __inline 44 # endif 45 # ifndef restrict 46 # define restrict __restrict 47 # endif 48 # ifndef STDIN_FILENO 49 # define STDIN_FILENO _fileno(stdin) 50 # endif 51 # ifndef STDOUT_FILENO 52 # define STDOUT_FILENO _fileno(stdout) 53 # endif 54 # ifndef STDERR_FILENO 55 # define STDERR_FILENO _fileno(stderr) 56 # endif 57 # ifndef S_IXUSR 58 # define S_IXUSR S_IEXEC 59 # endif 60 #endif 61 62 #define BACKSLASH_IN_FILENAME 63 64 #ifdef _MSC_VER 65 typedef int mode_t; 66 #endif 67 68 #ifndef SSIZE_MAX 69 # ifdef _WIN64 70 # define SSIZE_MAX _I64_MAX 71 # else 72 # define SSIZE_MAX LONG_MAX 73 # endif 74 #endif 75 76 #ifndef O_NOFOLLOW 77 # define O_NOFOLLOW 0 78 #endif 79 80 #ifndef STDIN_FILENO 81 # define STDIN_FILENO 0 82 #endif 83 #ifndef STDOUT_FILENO 84 # define STDOUT_FILENO 1 85 #endif 86 #ifndef STDERR_FILENO 87 # define STDERR_FILENO 2 88 #endif