Pyrogenesis  trunk
crt_posix.h
Go to the documentation of this file.
1 /* Copyright (c) 2010 Wildfire Games
2  *
3  * Permission is hereby granted, free of charge, to any person obtaining
4  * a copy of this software and associated documentation files (the
5  * "Software"), to deal in the Software without restriction, including
6  * without limitation the rights to use, copy, modify, merge, publish,
7  * distribute, sublicense, and/or sell copies of the Software, and to
8  * permit persons to whom the Software is furnished to do so, subject to
9  * the following conditions:
10  *
11  * The above copyright notice and this permission notice shall be included
12  * in all copies or substantial portions of the Software.
13  *
14  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
17  * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
18  * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
19  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
20  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21  */
22 
23 /**
24  * see rationale in wposix.h.
25  * we need to have CRT functions (e.g. _open) declared correctly
26  * but must prevent POSIX functions (e.g. open) from being declared -
27  * they would conflict with our wrapper function.
28  *
29  * since the headers only declare POSIX stuff \#if !__STDC__, a solution
30  * would be to set this flag temporarily. note that MSDN says that
31  * such predefined macros cannot be redefined nor may they change during
32  * compilation, but this works and seems to be a fairly common practice.
33  **/
34 
35 // undefine include guards set by no_crt_posix
36 #if defined(_INC_IO) && defined(WPOSIX_DEFINED_IO_INCLUDE_GUARD)
37 # undef _INC_IO
38 #endif
39 #if defined(_INC_DIRECT) && defined(WPOSIX_DEFINED_DIRECT_INCLUDE_GUARD)
40 # undef _INC_DIRECT
41 #endif
42 
43 
44 #define __STDC__ 1
45 
46 #include <io.h> // _open etc.
47 #include <direct.h> // _rmdir
48 
49 #undef __STDC__
50 #define __STDC__ 0