Edinburgh Speech Tools  2.4-release
 All Classes Functions Variables Typedefs Enumerations Enumerator Friends Pages
EST_bool.h
1  /************************************************************************/
2  /* */
3  /* Centre for Speech Technology Research */
4  /* University of Edinburgh, UK */
5  /* Copyright (c) 1996,1997 */
6  /* All Rights Reserved. */
7  /* */
8  /* Permission is hereby granted, free of charge, to use and distribute */
9  /* this software and its documentation without restriction, including */
10  /* without limitation the rights to use, copy, modify, merge, publish, */
11  /* distribute, sublicense, and/or sell copies of this work, and to */
12  /* permit persons to whom this work is furnished to do so, subject to */
13  /* the following conditions: */
14  /* 1. The code must retain the above copyright notice, this list of */
15  /* conditions and the following disclaimer. */
16  /* 2. Any modifications must be clearly marked as such. */
17  /* 3. Original authors' names are not deleted. */
18  /* 4. The authors' names are not used to endorse or promote products */
19  /* derived from this software without specific prior written */
20  /* permission. */
21  /* */
22  /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */
23  /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */
24  /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */
25  /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */
26  /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */
27  /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */
28  /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */
29  /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */
30  /* THIS SOFTWARE. */
31  /* */
32  /************************************************************************/
33  /* Author: Richard Caley (rjc@cstr.ed.ac.uk) */
34  /* Date: Tue Apr 1 1997 */
35  /************************************************************************/
36  /* */
37  /* Temporary bool type definition. */
38  /* */
39  /************************************************************************/
40 
41 #ifndef __EST_BOOL_H__
42 #define __EST_BOOL_H__
43 
44 #if defined(__GNUC__) || defined(SYSTEM_IS_WIN32)
45 
46  /* GCC seems to be so very fond of bool -- it's built into
47  * the compiler and it chokes on my definition.
48  */
49 
50 #ifdef __cplusplus
51 extern "C" {
52 #endif
53 
54 #ifndef TRUE
55 #define TRUE (1==1)
56 #endif
57 #ifndef FALSE
58 #define FALSE (1==0)
59 #endif
60 
61 #ifdef __cplusplus
62 }
63 #endif
64 
65 #else /* __GNUC__ */
66 
67  /* For a boring type we still #define everything for code
68  * which uses ifdef to see if bool is defined.
69  */
70 
71 #undef true
72 #undef false
73 #undef TRUE
74 #undef FALSE
75 
76 #ifdef __cplusplus
77 #if 0
78 
79  class BoolType {
80 
81  private:
82  int p_val;
83 
84  public:
85  BoolType(int i) { p_val = i!=0;};
86  BoolType() { p_val = 1==0;};
87 
88  operator int () const { return p_val; };
89 
90  BoolType operator == (BoolType b) const { return p_val == b.p_val;};
91  BoolType operator != (BoolType b) const { return p_val != b.p_val;};
92 
93  };
94 
95 #define true BoolType(1)
96 #define false BoolType(0)
97 #define TRUE BoolType(1)
98 #define FALSE BoolType(0)
99 #define bool BoolType
100 
101 #else /* 0 */
102 
103 /* Because SunCC is stupid we pretend we can't do better than we */
104 /* could with C. */
105 #if __SUNPRO_CC_COMPAT != 5
106 #define bool int
107 #endif
108 #define TRUE (1==1)
109 #define FALSE (1==0)
110 #define true TRUE
111 #define false FALSE
112 
113 #endif
114 
115 #else /* __cplusplus */
116 
117 #define bool int
118 #define TRUE (1==1)
119 #define FALSE (1==0)
120 
121 #endif /* __cplusplus */
122 #endif /* not __GNUC__ */
123 
124 #endif