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