"Fossies" - the Fresh Open Source Software Archive

Member "tin-2.4.5/include/bool.h" (1 Dec 2020, 2697 Bytes) of package /linux/misc/tin-2.4.5.tar.xz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "bool.h" see the Fossies "Dox" file reference documentation and the latest Fossies "Diffs" side-by-side code changes report: 2.4.4_vs_2.4.5.

    1 /*
    2  *  Project   : tin - a Usenet reader
    3  *  Module    : bool.h
    4  *  Author    : Urs Janssen <urs@tin.org>
    5  *  Created   :
    6  *  Updated   : 2013-01-09
    7  *  Notes     :
    8  *
    9  * Copyright (c) 1997-2021 Urs Janssen <urs@tin.org>
   10  * All rights reserved.
   11  *
   12  * Redistribution and use in source and binary forms, with or without
   13  * modification, are permitted provided that the following conditions
   14  * are met:
   15  *
   16  * 1. Redistributions of source code must retain the above copyright notice,
   17  *    this list of conditions and the following disclaimer.
   18  *
   19  * 2. Redistributions in binary form must reproduce the above copyright
   20  *    notice, this list of conditions and the following disclaimer in the
   21  *    documentation and/or other materials provided with the distribution.
   22  *
   23  * 3. Neither the name of the copyright holder nor the names of its
   24  *    contributors may be used to endorse or promote products derived from
   25  *    this software without specific prior written permission.
   26  *
   27  * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
   28  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   29  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   30  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
   31  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
   32  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
   33  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
   34  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
   35  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
   36  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
   37  * POSSIBILITY OF SUCH DAMAGE.
   38  */
   39 
   40 
   41 #ifndef BOOL_H
   42 #   define BOOL_H 1
   43 
   44 #   if 0
   45 /*
   46  * This is the correct way, but causes problems on some systems
   47  * e.g. SuSE-7.3 (IA-32)
   48  */
   49 #       ifndef __cplusplus
   50 #           ifdef HAVE_STDBOOL_H
   51 #               include <stdbool.h>
   52 #               ifdef _Bool
   53     typefdef _Bool t_bool;
   54 #               endif /* _Bool */
   55 #           endif /* HAVE_STDBOOL_H */
   56 #       endif /* __cplusplus */
   57 #       ifndef FALSE
   58 #           define FALSE 0
   59 #       endif /* !FALSE */
   60 #       ifndef TRUE
   61 #           define TRUE (!FALSE)
   62 #       endif /* !TRUE */
   63 #       ifndef t_bool
   64     typedef unsigned t_bool;    /* don't make this a char or short! */
   65 #       endif /* t_bool */
   66 
   67 #   else
   68 
   69 #       ifndef FALSE
   70 #           define FALSE 0
   71 #       endif /* !FALSE */
   72 
   73 #       ifndef TRUE
   74 #           define TRUE (!FALSE)
   75 #       endif /* !TRUE */
   76 
   77     typedef unsigned t_bool;    /* don't make this a char or short! */
   78 
   79 #   endif /* 0 */
   80 
   81 #   define bool_not(b) ((b) ? FALSE : TRUE)
   82 #   define bool_equal(a,b) ((a) ? (b) : (bool_not(b)))
   83 #   define bool_unparse(b) ((b) ? "TRUE" : "FALSE")
   84 
   85 #endif /* !BOOL_H */