Mercurial > hg > th-libs
comparison th_types.h @ 453:efd33accdc81
Break backwards compatibility by renaming BOOL, TRUE and FALSE to lowercase.
Introduce optional but default use of stdbool.h.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Tue, 02 Jan 2018 22:56:03 +0200 |
parents | 1b3472ba7b23 |
children | 347bfd3e017e |
comparison
equal
deleted
inserted
replaced
452:4471eadea472 | 453:efd33accdc81 |
---|---|
20 #elif defined(HAVE_SYS_TYPES_H) | 20 #elif defined(HAVE_SYS_TYPES_H) |
21 # include <sys/types.h> | 21 # include <sys/types.h> |
22 # ifndef HAVE_INT_TYPES | 22 # ifndef HAVE_INT_TYPES |
23 # define HAVE_INT_TYPES 1 | 23 # define HAVE_INT_TYPES 1 |
24 # endif | 24 # endif |
25 #endif | |
26 | |
27 #ifdef HAVE_STDBOOL_H | |
28 # define HAVE_BOOL 1 | |
29 # include <stdbool.h> | |
25 #endif | 30 #endif |
26 | 31 |
27 #ifdef HAVE_INTTYPES_H | 32 #ifdef HAVE_INTTYPES_H |
28 # include <inttypes.h> | 33 # include <inttypes.h> |
29 #endif | 34 #endif |
177 * Also in future this type may be changed to hold 32-bit UNICODE | 182 * Also in future this type may be changed to hold 32-bit UNICODE |
178 */ | 183 */ |
179 typedef char char_t; | 184 typedef char char_t; |
180 | 185 |
181 | 186 |
182 /* Define a boolean type | 187 /* Define a boolean type, if needed |
183 */ | 188 */ |
184 #if !defined(FALSE) && !defined(TRUE) && !defined(BOOL) | 189 #ifndef HAVE_BOOL |
185 typedef enum { FALSE = 0, TRUE = 1 } BOOL; | 190 # if !defined(false) && !defined(true) && !defined(bool) |
186 #endif | 191 typedef enum { false = 0, true = 1 } bool; |
187 | 192 # endif |
188 #ifndef BOOL | 193 # ifndef bool |
189 # ifdef bool | 194 # define bool int |
190 # define BOOL bool | 195 # endif |
191 # else | 196 |
192 # define BOOL int | 197 #endif // !HAVE_BOOL |
193 # endif | 198 |
194 #endif | |
195 | 199 |
196 #endif // TH_TYPES_H | 200 #endif // TH_TYPES_H |