Blender  V3.3
BLI_winstuff.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later
2  * Copyright 2001-2002 NaN Holding BV. All rights reserved. */
3 
4 #pragma once
5 
11 #ifndef _WIN32
12 # error "This include is for Windows only!"
13 #endif
14 
15 #include "BLI_sys_types.h"
16 
17 #define WIN32_LEAN_AND_MEAN
18 
19 #include <windows.h>
20 
21 #undef rad
22 #undef rad1
23 #undef rad2
24 #undef rad3
25 #undef vec
26 #undef rect
27 #undef rct1
28 #undef rct2
29 
30 #undef small
31 
32 /* These definitions are also in BLI_math for simplicity. */
33 
34 #ifdef __cplusplus
35 extern "C" {
36 #endif
37 
38 #if !defined(_USE_MATH_DEFINES)
39 # define _USE_MATH_DEFINES
40 #endif
41 
42 #define MAXPATHLEN MAX_PATH
43 
44 #ifndef S_ISREG
45 # define S_ISREG(x) (((x)&_S_IFREG) == _S_IFREG)
46 #endif
47 #ifndef S_ISDIR
48 # define S_ISDIR(x) (((x)&_S_IFDIR) == _S_IFDIR)
49 #endif
50 
51 /* Defines for using ISO C++ conferment names. */
52 #if !defined(_MSC_VER) || _MSC_VER < 1900
53 # define snprintf _snprintf
54 #endif
55 
56 #if defined(_MSC_VER)
57 # define R_OK 4
58 # define W_OK 2
59 /* Not accepted by `access()` on windows. */
60 //# define X_OK 1
61 # define F_OK 0
62 #endif
63 
64 typedef unsigned int mode_t;
65 
66 #ifndef _SSIZE_T_
67 # define _SSIZE_T_
68 /* python uses HAVE_SSIZE_T */
69 # ifndef HAVE_SSIZE_T
70 # define HAVE_SSIZE_T 1
71 typedef SSIZE_T ssize_t;
72 # endif
73 #endif
74 
76 struct dirent {
77  int d_ino;
78  int d_off;
79  unsigned short d_reclen;
80  char *d_name;
81 };
82 
84 typedef struct __dirstream DIR;
85 
86 DIR *opendir(const char *path);
87 struct dirent *readdir(DIR *dp);
88 int closedir(DIR *dp);
89 const char *dirname(char *path);
90 
91 /* Windows utility functions. */
92 
94 void BLI_windows_get_default_root_dir(char root_dir[4]);
96 
97 #ifdef __cplusplus
98 }
99 #endif
struct __dirstream DIR
Definition: BLI_winstuff.h:84
void BLI_windows_get_default_root_dir(char root_dir[4])
int BLI_windows_get_executable_dir(char *str)
int closedir(DIR *dp)
bool BLI_windows_register_blend_extension(bool background)
SSIZE_T ssize_t
Definition: BLI_winstuff.h:71
const char * dirname(char *path)
unsigned int mode_t
Definition: BLI_winstuff.h:64
struct dirent * readdir(DIR *dp)
DIR * opendir(const char *path)
#define str(s)
unsigned short d_reclen
Definition: BLI_winstuff.h:79
int d_off
Definition: BLI_winstuff.h:78
char * d_name
Definition: BLI_winstuff.h:80
int d_ino
Definition: BLI_winstuff.h:77