summaryrefslogtreecommitdiff
path: root/src/port/stdbool.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/port/stdbool.h')
-rw-r--r--src/port/stdbool.h35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/port/stdbool.h b/src/port/stdbool.h
new file mode 100644
index 0000000..9c011e4
--- /dev/null
+++ b/src/port/stdbool.h
@@ -0,0 +1,35 @@
+#ifndef __STDBOOL_H
+#define __STDBOOL_H
+
+#include "sys.h"
+
+/* C99 Boolean types for compilers without C99 support, see
+ * http://www.opengroup.org/onlinepubs/009695399/basedefs/stdbool.h.html */
+
+/* don't define bool in C++, it exists already! */
+#ifndef __cplusplus
+
+#ifdef HAVE_STDBOOL_H
+#include <stdbool.h>
+#else
+
+#if !defined HAVE_ENUM_BOOL
+typedef enum {
+ _Bool_must_promote_to_int = -1,
+ false = 0,
+ true = 1
+} _Bool;
+#endif /* !defined HAVE_ENUM_BOOL */
+
+#define bool _Bool
+
+#define true 1
+#define false 0
+
+#define __bool_true_false_are_defined 1
+
+#endif /* ifdef HAVE_STDBOOL_H */
+
+#endif /* ifndef __cplusplus */
+
+#endif /* ifndef STDBOOL_H */