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