Blender V2.61 - r43446

BLI_winstuff.h

Go to the documentation of this file.
00001 /*
00002  * ***** BEGIN GPL LICENSE BLOCK *****
00003  *
00004  * This program is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU General Public License
00006  * as published by the Free Software Foundation; either version 2
00007  * of the License, or (at your option) any later version.
00008  *
00009  * This program is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  * GNU General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU General Public License
00015  * along with this program; if not, write to the Free Software Foundation,
00016  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00017  *
00018  * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
00019  * All rights reserved.
00020  *
00021  * The Original Code is: all of this file.
00022  *
00023  * Contributor(s): none yet.
00024  *
00025  * ***** END GPL LICENSE BLOCK *****
00026  */
00027  
00028 #ifndef __WINSTUFF_H__
00029 #define __WINSTUFF_H__
00030 
00036 #ifdef _WIN32
00037 
00038 #ifndef FREE_WINDOWS
00039 #pragma warning(once: 4761 4305 4244 4018)
00040 #else
00041 #ifdef WINVER
00042 #undef WINVER
00043 #endif
00044 
00045 /* Some stuff requires WINVER 0x500, but mingw's default is 0x400 */
00046 #define WINVER 0x0501
00047 #endif
00048 
00049 #define WIN32_LEAN_AND_MEAN
00050 
00051 #ifndef WIN32_SKIP_HKEY_PROTECTION
00052 #undef HKEY
00053 #define HKEY WIN32_HKEY             // prevent competing definitions
00054 #include <windows.h>
00055 #undef HKEY
00056 #else
00057 #include <windows.h>
00058 #endif
00059 
00060 #undef near
00061 #undef far
00062 #undef rad
00063 #undef rad1
00064 #undef rad2
00065 #undef rad3
00066 #undef vec
00067 #undef rect
00068 #undef rct1
00069 #undef rct2
00070 
00071 #define near clipsta
00072 #define far clipend
00073 
00074 #undef small
00075 
00076 // These definitions are also in BLI_math for simplicity
00077 
00078 #ifdef __cplusplus
00079 extern "C" {
00080 #endif
00081 
00082 #define _USE_MATH_DEFINES
00083 #define MAXPATHLEN MAX_PATH
00084 
00085 #ifndef S_ISREG
00086 #define S_ISREG(x) (((x)&_S_IFREG) == _S_IFREG)
00087 #endif
00088 #ifndef S_ISDIR
00089 #define S_ISDIR(x) (((x)&_S_IFDIR) == _S_IFDIR)
00090 #endif
00091 
00092 /* defines for using ISO C++ conformant names */
00093 #define snprintf _snprintf
00094 
00095 #ifndef FREE_WINDOWS
00096 typedef unsigned int mode_t;
00097 #endif
00098 
00099 /* use functions that take a 64 bit offset for files larger than 4GB */
00100 #ifndef FREE_WINDOWS
00101 #include <stdio.h>
00102 #define fseek(stream, offset, origin) _fseeki64(stream, offset, origin)
00103 #define ftell(stream) _ftelli64(stream)
00104 #define lseek(fd, offset, origin) _lseeki64(fd, offset, origin)
00105 #define tell(fd) _telli64(fd)
00106 #endif
00107 
00108 /* mingw using _SSIZE_T_ to declare ssize_t type */
00109 #ifndef _SSIZE_T_
00110 #define _SSIZE_T_
00111 /* python uses HAVE_SSIZE_T */
00112 #ifndef HAVE_SSIZE_T
00113 #define HAVE_SSIZE_T 1
00114 typedef long ssize_t;
00115 #endif
00116 #endif
00117 
00118 struct dirent {
00119     int d_ino;
00120     int d_off;
00121     unsigned short d_reclen;
00122     char *d_name;
00123 };
00124 
00125 typedef struct _DIR {
00126     HANDLE handle;
00127     WIN32_FIND_DATA data;
00128     char path[MAX_PATH];
00129     long dd_loc;
00130     long dd_size;
00131     char dd_buf[4096];
00132     void *dd_direct;
00133     
00134     struct dirent direntry;
00135 } DIR;
00136 
00137 void RegisterBlendExtension(void);
00138 DIR *opendir (const char *path);
00139 struct dirent *readdir(DIR *dp);
00140 int closedir (DIR *dp);
00141 void get_default_root(char *root);
00142 int check_file_chars(char *filename);
00143 char *dirname(char *path);
00144 
00145 int BLI_getInstallationDir(char *str);
00146 
00147 #ifdef __cplusplus
00148 }
00149 #endif
00150 
00151 #endif /* _WIN32 */
00152 
00153 #endif /* __WINSTUFF_H__ */
00154