]>
Commit | Line | Data |
---|---|---|
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 | ||
6ee276d2 | 10 | # if defined (WIN32) || defined (OS2) && defined (__IBMC__) |
4caf866b | 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 | |
885824d3 | 21 | # ifndef FALSE |
0bd4c301 | 22 | /*@constant bool FALSE=false@*/ |
23 | # define FALSE false | |
885824d3 | 24 | # endif |
25 | ||
26 | # ifndef TRUE | |
0bd4c301 | 27 | /*@constant bool TRUE=true@*/ |
28 | # define TRUE true | |
885824d3 | 29 | # endif |
4caf866b | 30 | # endif |
885824d3 | 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 | ||
6483a926 | 40 | extern bool bool_isReasonable (/*@sef@*/ bool p_b) /*@*/ ; |
41 | /*@-boolcompare@*/ | |
42 | # define bool_isReasonable(b) (((b) == TRUE) || ((b) == FALSE)) | |
43 | /*@=boolcompare@*/ | |
44 | ||
885824d3 | 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 |