lwpa  0.1.0
LightWeight Platform Abstraction (lwpa)
View other versions:
lwpa_bool.h
1 /******************************************************************************
2  * Copyright 2018 ETC Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *******************************************************************************
16  * This file is a part of lwpa. For more information, go to:
17  * https://github.com/ETCLabs/lwpa
18  ******************************************************************************/
19 
20 /* lwpa_bool.h: Provide a C boolean type for non-C99 environments. */
21 #ifndef _LWPA_BOOL_H_
22 #define _LWPA_BOOL_H_
23 
45 #ifndef __cplusplus
46 
47 #if ((defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || (defined(_MSC_VER) && _MSC_VER >= 1800) || \
48  HAVE_STDBOOL_H)
49 /* We are being compiled with C99 or later, Visual Studio 2013 or later, or the
50  * user has defined HAVE_STDBOOL_H to 1 to force inclusion of stdbool.h */
51 #include <stdbool.h>
52 #else /* __STDC_VERSION__ */
53 
56 #ifndef bool
57 #define bool char
58 #endif
59 
61 #ifndef false
62 #define false 0
63 #endif
64 
66 #ifndef true
67 #define true 1
68 #endif
69 
70 #endif /* __STDC_VERSION__ */
71 
72 #endif /* __cplusplus */
73 
76 #endif /* _LWPA_BOOL_H_ */