1 /* @(#)windows.h	1.4 13/10/26 Copyright 2011-2013 J. Schilling */
2 /*
3  *	Definitions for windows.h
4  *
5  *	Copyright (c) 2011-2013 J. Schilling
6  */
7 /*
8  * The contents of this file are subject to the terms of the
9  * Common Development and Distribution License, Version 1.0 only
10  * (the "License").  You may not use this file except in compliance
11  * with the License.
12  *
13  * See the file CDDL.Schily.txt in this distribution for details.
14  * A copy of the CDDL is also available via the Internet at
15  * http://www.opensource.org/licenses/cddl1.txt
16  *
17  * When distributing Covered Code, include this CDDL HEADER in each
18  * file and include the License file CDDL.Schily.txt from this distribution.
19  */
20 
21 #ifndef _SCHILY_WINDOWS_H
22 #define	_SCHILY_WINDOWS_H
23 
24 #ifndef	_SCHILY_MCONFIG_H
25 #include <schily/mconfig.h>
26 #endif
27 
28 #ifdef	HAVE_WINDOWS_H
29 #ifndef	_INCL_WINDOWS_H
30 
31 /*
32  * configure believes they are missing and #define's them:
33  */
34 #if defined(_MSC_VER) || defined(__MINGW32__)
35 /* BEGIN CSTYLED */
36 #undef	u_char
37 #undef	u_short
38 #undef	u_int
39 #undef	u_long
40 /* END CSTYLED */
41 #endif
42 
43 #if defined(__CYGWIN32__) || defined(__CYGWIN__)
44 
45 /*
46  * Cygwin-1.7.17 (Autumn 2012) makes life hard as it prevents to rename
47  * the Cygwin BOOL definition. Note that we have our own BOOL definition
48  * in schily/standard.h that exists since 1982 which happened before Microsoft
49  * introduced their BOOL.
50  *
51  * Previous Cygwin versions have been compatible to the original MS include
52  * files and allowed to rename the BOOL from windows.h (windef.h) by just using
53  * #define BOOL WBOOL before #include <windows.h>.
54  *
55  * Recent Cygwin version are unfriendly to us and prevent this.
56  * We now need a two level #define to redirect the BOOL from windows.h to the
57  * Cygwin specific WINBOOL typedef.
58  *
59  * If we do not include schily/standard.h with newer Cygwin, we cannot get
60  * working typedefs for "PBOOL" and "LPBOOL".
61  */
62 #include <schily/standard.h>	/* Get our BOOL typedef */
63 
64 #define	_NO_BOOL_TYPEDEF	/* Avoid 2nd BOOL typedef on Cygwin-1.7.17 */
65 
66 #define	WBOOL	WINBOOL		/* Cygwin-1.7.17 prevents to avoid BOOL */
67 #endif	/* defined(__CYGWIN32__) || defined(__CYGWIN__) */
68 
69 
70 #define	BOOL	WBOOL		/* This is the Win BOOL		*/
71 #define	format	__ms_format	/* Avoid format parameter hides global ... */
72 
73 #ifdef	timerclear		/* struct timeval has already been declared */
74 #define	timeval	__ms_timeval
75 #endif
76 
77 #include <windows.h>
78 
79 #undef	BOOL			/* MS Code uses WBOOL or #define BOOL WBOOL */
80 #undef	format			/* Return to previous definition */
81 #undef	timeval
82 
83 #define	_INCL_WINDOWS_H
84 #endif
85 
86 #endif	/* HAVE_WINDOWS_H */
87 
88 #endif	/* _SCHILY_WINDOWS_H */
89