]>
Commit | Line | Data |
---|---|---|
1 | #ifndef BOOL_H | |
2 | #define BOOL_H | |
3 | ||
4 | #ifndef FALSE | |
5 | #define FALSE 0 | |
6 | #endif | |
7 | ||
8 | #ifndef TRUE | |
9 | #define TRUE (!FALSE) | |
10 | #endif | |
11 | ||
12 | typedef int bool; | |
13 | ||
14 | /* | |
15 | ** bool_initMod has no real effect | |
16 | ** Declared with modifies internalState, so no noeffect errors are | |
17 | ** reported when it is called.) | |
18 | */ | |
19 | ||
20 | extern /*@unused@*/ void bool_initMod (void) /*@modifies internalState@*/ ; | |
21 | /*@-mustmod@*/ | |
22 | # define bool_initMod() | |
23 | /*@=mustmod@*/ | |
24 | ||
25 | extern /*@unused@*/ /*@observer@*/ char *bool_unparse (bool b) /*@*/ ; | |
26 | # define bool_unparse(b) ((b) ? "true" : "false" ) | |
27 | ||
28 | extern /*@unused@*/ bool bool_not (bool b) /*@*/ ; | |
29 | # define bool_not(b) ((b) ? FALSE : TRUE) | |
30 | ||
31 | extern /*@unused@*/ bool bool_equal (bool b1, bool b2) /*@*/ ; | |
32 | # define bool_equal(a,b) ((a) ? (b) : !(b)) | |
33 | ||
34 | extern /*@falseexit@*/ void check (bool x); | |
35 | # define check(x) \ | |
36 | do { bool m_res = x; assert (m_res); } while (FALSE) | |
37 | ||
38 | # endif |