| 
									
										
										
										
											2011-02-18 13:58:08 +00:00
										 |  |  | /*
 | 
					
						
							| 
									
										
										
										
											2002-10-12 11:37:38 +00:00
										 |  |  |  * This program is free software; you can redistribute it and/or | 
					
						
							|  |  |  |  * modify it under the terms of the GNU General Public License | 
					
						
							|  |  |  |  * as published by the Free Software Foundation; either version 2 | 
					
						
							| 
									
										
										
										
											2008-04-16 22:40:48 +00:00
										 |  |  |  * of the License, or (at your option) any later version. | 
					
						
							| 
									
										
										
										
											2002-10-12 11:37:38 +00:00
										 |  |  |  * | 
					
						
							|  |  |  |  * This program is distributed in the hope that it will be useful, | 
					
						
							|  |  |  |  * but WITHOUT ANY WARRANTY; without even the implied warranty of | 
					
						
							|  |  |  |  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
					
						
							|  |  |  |  * GNU General Public License for more details. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * You should have received a copy of the GNU General Public License | 
					
						
							|  |  |  |  * along with this program; if not, write to the Free Software Foundation, | 
					
						
							| 
									
										
										
										
											2010-02-12 13:34:04 +00:00
										 |  |  |  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | 
					
						
							| 
									
										
										
										
											2002-10-12 11:37:38 +00:00
										 |  |  |  * | 
					
						
							|  |  |  |  * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. | 
					
						
							|  |  |  |  * All rights reserved. | 
					
						
							|  |  |  |  */ | 
					
						
							| 
									
										
										
										
											2018-06-17 16:32:54 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-02-17 18:59:41 +00:00
										 |  |  | #ifndef __BLI_WINSTUFF_H__
 | 
					
						
							|  |  |  | #define __BLI_WINSTUFF_H__
 | 
					
						
							| 
									
										
										
										
											2009-09-24 19:50:15 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-02-18 08:08:12 +11:00
										 |  |  | /** \file
 | 
					
						
							|  |  |  |  * \ingroup bli | 
					
						
							|  |  |  |  * \brief Compatibility-like things for windows. | 
					
						
							| 
									
										
										
										
											2011-02-18 13:58:08 +00:00
										 |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-04-15 07:54:07 +00:00
										 |  |  | #ifndef _WIN32
 | 
					
						
							|  |  |  | #  error "This include is for Windows only!"
 | 
					
						
							|  |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2010-01-26 11:25:39 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2002-10-12 11:37:38 +00:00
										 |  |  | #define WIN32_LEAN_AND_MEAN
 | 
					
						
							| 
									
										
										
										
											2005-03-19 20:04:25 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | #ifndef WIN32_SKIP_HKEY_PROTECTION
 | 
					
						
							| 
									
										
										
										
											2012-04-15 07:54:07 +00:00
										 |  |  | #  undef HKEY
 | 
					
						
							| 
									
										
										
										
											2012-05-12 20:39:39 +00:00
										 |  |  | #  define HKEY WIN32_HKEY  /* prevent competing definitions */
 | 
					
						
							| 
									
										
										
										
											2012-04-15 07:54:07 +00:00
										 |  |  | #  include <windows.h>
 | 
					
						
							|  |  |  | #  undef HKEY
 | 
					
						
							| 
									
										
										
										
											2005-03-19 20:04:25 +00:00
										 |  |  | #else
 | 
					
						
							| 
									
										
										
										
											2012-04-15 07:54:07 +00:00
										 |  |  | #  include <windows.h>
 | 
					
						
							| 
									
										
										
										
											2005-03-19 20:04:25 +00:00
										 |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2002-10-12 11:37:38 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | #undef near
 | 
					
						
							|  |  |  | #undef far
 | 
					
						
							|  |  |  | #undef rad
 | 
					
						
							|  |  |  | #undef rad1
 | 
					
						
							|  |  |  | #undef rad2
 | 
					
						
							|  |  |  | #undef rad3
 | 
					
						
							|  |  |  | #undef vec
 | 
					
						
							|  |  |  | #undef rect
 | 
					
						
							|  |  |  | #undef rct1
 | 
					
						
							|  |  |  | #undef rct2
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #undef small
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-03-02 05:05:12 +00:00
										 |  |  | // These definitions are also in BLI_math for simplicity
 | 
					
						
							| 
									
										
										
										
											2005-03-19 20:04:25 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-08-22 15:00:30 +00:00
										 |  |  | #ifdef __cplusplus
 | 
					
						
							|  |  |  | extern "C" { | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-09-06 13:20:05 +00:00
										 |  |  | #define _USE_MATH_DEFINES
 | 
					
						
							| 
									
										
										
										
											2002-10-12 11:37:38 +00:00
										 |  |  | #define MAXPATHLEN MAX_PATH
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2002-12-01 22:41:22 +00:00
										 |  |  | #ifndef S_ISREG
 | 
					
						
							| 
									
										
										
										
											2012-05-12 20:39:39 +00:00
										 |  |  | #  define S_ISREG(x) (((x) & _S_IFREG) == _S_IFREG)
 | 
					
						
							| 
									
										
										
										
											2002-12-01 22:41:22 +00:00
										 |  |  | #endif
 | 
					
						
							|  |  |  | #ifndef S_ISDIR
 | 
					
						
							| 
									
										
										
										
											2012-05-12 20:39:39 +00:00
										 |  |  | #  define S_ISDIR(x) (((x) & _S_IFDIR) == _S_IFDIR)
 | 
					
						
							| 
									
										
										
										
											2002-12-01 22:41:22 +00:00
										 |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2002-10-12 11:37:38 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-09-06 13:20:05 +00:00
										 |  |  | /* defines for using ISO C++ conformant names */ | 
					
						
							| 
									
										
										
										
											2015-12-10 11:49:53 +01:00
										 |  |  | #if !defined(_MSC_VER) || _MSC_VER < 1900
 | 
					
						
							|  |  |  | #  define snprintf _snprintf
 | 
					
						
							|  |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2009-09-06 13:20:05 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-05-27 15:34:55 -04:00
										 |  |  | #if defined(_MSC_VER)
 | 
					
						
							| 
									
										
										
										
											2013-03-05 07:39:52 +00:00
										 |  |  | #  define	R_OK	4
 | 
					
						
							|  |  |  | #  define	W_OK	2
 | 
					
						
							| 
									
										
										
										
											2013-03-13 19:48:07 +00:00
										 |  |  | // not accepted by access() on windows
 | 
					
						
							|  |  |  | //#  define	X_OK	1
 | 
					
						
							| 
									
										
										
										
											2013-03-05 07:39:52 +00:00
										 |  |  | #  define	F_OK	0
 | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2002-10-12 11:37:38 +00:00
										 |  |  | typedef unsigned int mode_t; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-07-06 10:19:04 +00:00
										 |  |  | /* use functions that take a 64 bit offset for files larger than 4GB */ | 
					
						
							| 
									
										
										
										
											2017-05-27 15:34:55 -04:00
										 |  |  | #include <stdio.h>
 | 
					
						
							|  |  |  | #define fseek(stream, offset, origin) _fseeki64(stream, offset, origin)
 | 
					
						
							|  |  |  | #define ftell(stream) _ftelli64(stream)
 | 
					
						
							|  |  |  | #define lseek(fd, offset, origin) _lseeki64(fd, offset, origin)
 | 
					
						
							|  |  |  | #define tell(fd) _telli64(fd)
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-07-06 10:19:04 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-09-24 10:04:43 +00:00
										 |  |  | #ifndef _SSIZE_T_
 | 
					
						
							| 
									
										
										
										
											2012-04-15 07:54:07 +00:00
										 |  |  | #  define _SSIZE_T_
 | 
					
						
							| 
									
										
										
										
											2009-09-24 10:41:28 +00:00
										 |  |  | /* python uses HAVE_SSIZE_T */ | 
					
						
							| 
									
										
										
										
											2012-04-15 07:54:07 +00:00
										 |  |  | #  ifndef HAVE_SSIZE_T
 | 
					
						
							|  |  |  | #    define HAVE_SSIZE_T 1
 | 
					
						
							| 
									
										
										
										
											2009-09-24 10:41:28 +00:00
										 |  |  | typedef long ssize_t; | 
					
						
							| 
									
										
										
										
											2012-04-15 07:54:07 +00:00
										 |  |  | #  endif
 | 
					
						
							| 
									
										
										
										
											2009-09-24 10:04:43 +00:00
										 |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2009-09-24 09:29:59 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2002-10-12 11:37:38 +00:00
										 |  |  | struct dirent { | 
					
						
							|  |  |  | 	int d_ino; | 
					
						
							|  |  |  | 	int d_off; | 
					
						
							|  |  |  | 	unsigned short d_reclen; | 
					
						
							|  |  |  | 	char *d_name; | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-06-16 09:40:17 +10:00
										 |  |  | /* intentionally opaque to users */ | 
					
						
							|  |  |  | typedef struct __dirstream DIR; | 
					
						
							| 
									
										
										
										
											2002-10-12 11:37:38 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-05-12 20:39:39 +00:00
										 |  |  | DIR *opendir(const char *path); | 
					
						
							| 
									
										
										
										
											2002-10-12 11:37:38 +00:00
										 |  |  | struct dirent *readdir(DIR *dp); | 
					
						
							| 
									
										
										
										
											2012-05-12 20:39:39 +00:00
										 |  |  | int closedir(DIR *dp); | 
					
						
							| 
									
										
										
										
											2014-01-14 23:57:00 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | void RegisterBlendExtension(void); | 
					
						
							| 
									
										
										
										
											2008-04-29 21:43:17 +00:00
										 |  |  | void get_default_root(char *root); | 
					
						
							|  |  |  | int check_file_chars(char *filename); | 
					
						
							| 
									
										
										
										
											2012-04-12 02:50:21 +00:00
										 |  |  | const char *dirname(char *path); | 
					
						
							| 
									
										
										
										
											2002-10-12 11:37:38 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-12-20 10:02:00 +00:00
										 |  |  | int BLI_getInstallationDir(char *str); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-08-22 15:00:30 +00:00
										 |  |  | #ifdef __cplusplus
 | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-02-17 18:59:41 +00:00
										 |  |  | #endif /* __BLI_WINSTUFF_H__ */
 |