]> andersk Git - splint.git/blame - src/Headers/bool.h
Added support for ISO C99 _Bool and stdbool bool/true/false. The
[splint.git] / src / Headers / bool.h
CommitLineData
885824d3 1/*
c0de361f 2** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003.
885824d3 3** See ../LICENSE for license information.
4**
5*/
6# if !defined(BOOL_H)
7
8# define BOOL_H
9
10# ifndef FALSE
0bd4c301 11/*@constant bool FALSE=false@*/
12# define FALSE false
885824d3 13# endif
14
15# ifndef TRUE
0bd4c301 16/*@constant bool TRUE=true@*/
17# define TRUE true
885824d3 18# endif
19
20extern /*@observer@*/ cstring bool_unparse (bool p_b) /*@*/ ;
21extern /*@observer@*/ cstring bool_dump (bool p_b) /*@*/ ;
22extern /*@unused@*/ bool bool_not (bool p_b) /*@*/ ;
23extern bool bool_equal (bool p_b1, bool p_b2) /*@*/ ;
24extern int bool_compare (bool p_b1, bool p_b2) /*@*/ ;
25extern bool bool_fromInt (int p_i) /*@*/ ;
26extern int bool_toInt (bool p_b) /*@*/ ;
27
6483a926 28extern bool bool_isReasonable (/*@sef@*/ bool p_b) /*@*/ ;
29/*@-boolcompare@*/
30# define bool_isReasonable(b) (((b) == TRUE) || ((b) == FALSE))
31/*@=boolcompare@*/
32
885824d3 33# define bool_unparse(b) (cstring_makeLiteralTemp ((b) ? "true" : "false" ))
34# define bool_dump(b) (cstring_makeLiteralTemp ((b) ? "1" : "0" ))
35# define bool_not(b) ((b) ? FALSE : TRUE)
36# define bool_equal(a,b) ((a) ? (b) : !(b))
37# define bool_compare(a,b) ((a) ? ((b) ? 0 : 1) : ((b) ? -1 : 0))
38# define bool_fromInt(i) (((i) != 0) ? TRUE : FALSE)
39# define bool_toInt(b) ((b) ? 1 : 0)
40
41# else
42# error "Multiple include"
43# endif
44
45
46
47
This page took 0.069987 seconds and 5 git commands to generate.