1*1c4468cfSMatthias Ringwald /* 2*1c4468cfSMatthias Ringwald * Copyright (C) 2019 BlueKitchen GmbH 3*1c4468cfSMatthias Ringwald * 4*1c4468cfSMatthias Ringwald * Redistribution and use in source and binary forms, with or without 5*1c4468cfSMatthias Ringwald * modification, are permitted provided that the following conditions 6*1c4468cfSMatthias Ringwald * are met: 7*1c4468cfSMatthias Ringwald * 8*1c4468cfSMatthias Ringwald * 1. Redistributions of source code must retain the above copyright 9*1c4468cfSMatthias Ringwald * notice, this list of conditions and the following disclaimer. 10*1c4468cfSMatthias Ringwald * 2. Redistributions in binary form must reproduce the above copyright 11*1c4468cfSMatthias Ringwald * notice, this list of conditions and the following disclaimer in the 12*1c4468cfSMatthias Ringwald * documentation and/or other materials provided with the distribution. 13*1c4468cfSMatthias Ringwald * 3. Neither the name of the copyright holders nor the names of 14*1c4468cfSMatthias Ringwald * contributors may be used to endorse or promote products derived 15*1c4468cfSMatthias Ringwald * from this software without specific prior written permission. 16*1c4468cfSMatthias Ringwald * 4. Any redistribution, use, or modification is done solely for 17*1c4468cfSMatthias Ringwald * personal benefit and not for any commercial purpose or for 18*1c4468cfSMatthias Ringwald * monetary gain. 19*1c4468cfSMatthias Ringwald * 20*1c4468cfSMatthias Ringwald * THIS SOFTWARE IS PROVIDED BY BLUEKITCHEN GMBH AND CONTRIBUTORS 21*1c4468cfSMatthias Ringwald * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22*1c4468cfSMatthias Ringwald * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 23*1c4468cfSMatthias Ringwald * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL MATTHIAS 24*1c4468cfSMatthias Ringwald * RINGWALD OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 25*1c4468cfSMatthias Ringwald * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 26*1c4468cfSMatthias Ringwald * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS 27*1c4468cfSMatthias Ringwald * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 28*1c4468cfSMatthias Ringwald * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 29*1c4468cfSMatthias Ringwald * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF 30*1c4468cfSMatthias Ringwald * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31*1c4468cfSMatthias Ringwald * SUCH DAMAGE. 32*1c4468cfSMatthias Ringwald * 33*1c4468cfSMatthias Ringwald * Please inquire about commercial licensing options at 34*1c4468cfSMatthias Ringwald * [email protected] 35*1c4468cfSMatthias Ringwald * 36*1c4468cfSMatthias Ringwald */ 37*1c4468cfSMatthias Ringwald 38*1c4468cfSMatthias Ringwald /* 39*1c4468cfSMatthias Ringwald * btstack_bool.h 40*1c4468cfSMatthias Ringwald * 41*1c4468cfSMatthias Ringwald * Provide bool type */ 42*1c4468cfSMatthias Ringwald 43*1c4468cfSMatthias Ringwald #ifndef BTSTACK_BOOL_H 44*1c4468cfSMatthias Ringwald #define BTSTACK_BOOL_H 45*1c4468cfSMatthias Ringwald 46*1c4468cfSMatthias Ringwald #if !defined(__cplusplus) 47*1c4468cfSMatthias Ringwald 48*1c4468cfSMatthias Ringwald // 49*1c4468cfSMatthias Ringwald // Check for C99 50*1c4468cfSMatthias Ringwald // see: https://sourceforge.net/p/predef/wiki/Standards/ 51*1c4468cfSMatthias Ringwald // 52*1c4468cfSMatthias Ringwald #if defined(__STDC__) 53*1c4468cfSMatthias Ringwald # if defined(__STDC_VERSION__) 54*1c4468cfSMatthias Ringwald # if (__STDC_VERSION__ >= 199901L) 55*1c4468cfSMatthias Ringwald # define PREDEF_STANDARD_C_1999 56*1c4468cfSMatthias Ringwald # endif 57*1c4468cfSMatthias Ringwald # endif 58*1c4468cfSMatthias Ringwald #endif /* __STDC__ */ 59*1c4468cfSMatthias Ringwald 60*1c4468cfSMatthias Ringwald // define boolean type - required for MISRA-C 2012 Essential Type System 61*1c4468cfSMatthias Ringwald #ifdef PREDEF_STANDARD_C_1999 62*1c4468cfSMatthias Ringwald 63*1c4468cfSMatthias Ringwald // use <stdbool.h> if C99 or higher 64*1c4468cfSMatthias Ringwald # include <stdbool.h> 65*1c4468cfSMatthias Ringwald 66*1c4468cfSMatthias Ringwald #else /* PREDEF_STANDARD_C_1999 */ 67*1c4468cfSMatthias Ringwald 68*1c4468cfSMatthias Ringwald // backport for pre-c99 compilers 69*1c4468cfSMatthias Ringwald #define bool unsigned char 70*1c4468cfSMatthias Ringwald #define false 0 71*1c4468cfSMatthias Ringwald #define true 1 72*1c4468cfSMatthias Ringwald 73*1c4468cfSMatthias Ringwald #endif /* PREDEF_STANDARD_C_1999 */ 74*1c4468cfSMatthias Ringwald 75*1c4468cfSMatthias Ringwald #endif /* __cplusplus */ 76*1c4468cfSMatthias Ringwald 77*1c4468cfSMatthias Ringwald #endif /* BTSTACK_BOOL_H */ 78