stdbool.h revision 65918
165918Sasmodai/* 265918Sasmodai * Copyright (c) 2000 Jeroen Ruigrok van der Werven <asmodai@FreeBSD.org> 365918Sasmodai * All rights reserved. 465918Sasmodai * 565918Sasmodai * Redistribution and use in source and binary forms, with or without 665918Sasmodai * modification, are permitted provided that the following conditions 765918Sasmodai * are met: 865918Sasmodai * 1. Redistributions of source code must retain the above copyright 965918Sasmodai * notice, this list of conditions and the following disclaimer. 1065918Sasmodai * 2. Redistributions in binary form must reproduce the above copyright 1165918Sasmodai * notice, this list of conditions and the following disclaimer in the 1265918Sasmodai * documentation and/or other materials provided with the distribution. 1365918Sasmodai * 1465918Sasmodai * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 1565918Sasmodai * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 1665918Sasmodai * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 1765918Sasmodai * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 1865918Sasmodai * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 1965918Sasmodai * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2065918Sasmodai * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2165918Sasmodai * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2265918Sasmodai * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 2365918Sasmodai * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 2465918Sasmodai * SUCH DAMAGE. 2565918Sasmodai * 2665918Sasmodai * $FreeBSD: head/include/stdbool.h 65918 2000-09-16 07:28:44Z asmodai $ 2765918Sasmodai */ 2865918Sasmodai 2965918Sasmodai/* This should be compliant with the ANSI C99 definition */ 3065918Sasmodai 3165918Sasmodai#ifndef _STDBOOL_H_ 3265918Sasmodai#define _STDBOOL_H_ 3365918Sasmodai 3465918Sasmodai/* `_Bool' type must promote to `int' or `unsigned int' */ 3565918Sasmodaitypedef enum { 3665918Sasmodai false = 0, 3765918Sasmodai true = 1 3865918Sasmodai} _Bool; 3965918Sasmodai 4065918Sasmodai/* And those constants must also be available as macros */ 4165918Sasmodai#define false false 4265918Sasmodai#define true true 4365918Sasmodai 4465918Sasmodai/* User visible type `bool' is provided as a macro which may be redefined */ 4565918Sasmodai#define bool _Bool 4665918Sasmodai 4765918Sasmodai/* Inform that everything is fine */ 4865918Sasmodai#define __bool_true_false_are_defined 1 4965918Sasmodai 5065918Sasmodai#if __STDC_VERSION__ < 199901L 5165918Sasmodaitypedef int _Bool; /* not built into pre-C99 compilers */ 5265918Sasmodai#endif 5365918Sasmodai 5465918Sasmodai#endif /* _STDBOOL_H_ */ 55