[project @ 1996-03-19 08:58:34 by partain]
[ghc-hetmet.git] / ghc / compiler / HsVersions.h
1 #ifndef HSVERSIONS_H
2 #define HSVERSIONS_H
3
4 #if 0
5
6 IMPORTANT!  If you put extra tabs/spaces in these macro definitions,
7 you will screw up the layout where they are used in case expressions!
8
9 (This is cpp-dependent, of course)
10
11 #endif
12
13 #define MkInt I#
14 #define MkChar C#
15 #define MkArray _Array
16
17 #ifdef __GLASGOW_HASKELL__
18 #define TAG_ Int#
19 #define LT_ -1#
20 #define EQ_ 0#
21 #define GT_ 1#
22 #endif
23 #define GT__ _
24
25 #ifdef __HBC__
26 #define IMPORT_Trace import Trace
27 #define BSCC(l) (
28 #define ESCC    )
29 #else
30 #define IMPORT_Trace {--}
31 #define BSCC(l) (_scc_ l (
32 #define ESCC    ))
33 #endif
34
35 -- these are overridable
36 #ifndef BIND
37 #define BIND case
38 #endif /* BIND */
39 #ifndef _TO_
40 #define _TO_ of {
41 #endif /* _TO_ */
42 #ifndef BEND
43 #define BEND }
44 #endif /* BEND */
45 #ifndef RETN
46 #define RETN {--}
47 #endif /* RETN */
48 #ifndef RETN_TYPE
49 #define RETN_TYPE {--}
50 #endif /* RETN_TYPE */
51
52 #define COMMA ,
53
54 #ifdef DEBUG
55 #define ASSERT(e) if (not (e)) then (assertPanic __FILE__ __LINE__) else
56 #define CHK_Ubiq() import Ubiq
57 #else
58 #define ASSERT(e)
59 #define CHK_Ubiq()
60 #endif
61
62 -- ToDo: ghci needs to load far too many bits of the backend because
63 --       this ATTACK_PRAGMA stuff encourages Utils.lhs to tell
64 --       everyone about everyone else.  I guess we need to add some
65 --       more conditional stuff in.
66 #ifdef USE_ATTACK_PRAGMAS
67 #define IF_ATTACK_PRAGMAS(x) x
68 #else
69 #define IF_ATTACK_PRAGMAS(x) {--}
70 #endif
71
72 #if GHCI
73 #define IF_GHCI(stuff) stuff
74 #else 
75 #define IF_GHCI(stuff) {-nothing-}
76 #endif
77
78 #if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ >= 26
79 #define trace _trace
80 #endif
81
82 #if defined(__GLASGOW_HASKELL__)
83 #define FAST_INT Int#
84 #define ILIT(x) (x#)
85 #define IBOX(x) (I# (x))
86 #define _ADD_ `plusInt#`
87 #define _SUB_ `minusInt#`
88 #define _MUL_ `timesInt#`
89 #define _DIV_ `divInt#`
90 #define _QUOT_ `quotInt#`
91 #define _NEG_ negateInt#
92 #define _EQ_ `eqInt#`
93 #define _LT_ `ltInt#`
94 #define _LE_ `leInt#`
95 #define _GE_ `geInt#`
96 #define _GT_ `gtInt#`
97
98 #define FAST_BOOL Int#
99 #define _TRUE_ 1#
100 #define _FALSE_ 0#
101 #define _IS_TRUE_(x) ((x) `eqInt#` 1#)
102
103 #else {- ! __GLASGOW_HASKELL__ -}
104
105 #define FAST_INT Int
106 #define ILIT(x) (x)
107 #define IBOX(x) (x)
108 #define _ADD_ +
109 #define _SUB_ -
110 #define _MUL_ *
111 #define _DIV_ `div`
112 #define _QUOT_ `quot`
113 #define _NEG_ -
114 #define _EQ_ ==
115 #define _LT_ <
116 #define _LE_ <=
117 #define _GE_ >=
118 #define _GT_ >
119
120 #define FAST_BOOL Bool
121 #define _TRUE_ True
122 #define _FALSE_ False
123 #define _IS_TRUE_(x) (x)
124
125 #endif  {- ! __GLASGOW_HASKELL__ -}
126
127 #if __GLASGOW_HASKELL__ >= 23
128 #define USE_FAST_STRINGS 1
129 #define FAST_STRING _PackedString
130 #define SLIT(x)     (_packCString (A# x#))
131 #define _CMP_STRING_ cmpPString
132 #define _NULL_      _nullPS
133 #define _NIL_       _nilPS
134 #define _CONS_      _consPS
135 #define _HEAD_      _headPS
136 #define _TAIL_      _tailPS
137 #define _LENGTH_    _lengthPS
138 #define _PK_        _packString
139 #define _UNPK_      _unpackPS
140 #define _SUBSTR_    _substrPS
141 #define _APPEND_    `_appendPS`
142 #define _CONCAT_    _concatPS
143 #else
144 #define FAST_STRING String
145 #define SLIT(x)     (x)
146 #define _CMP_STRING_ cmpString
147 #define _NULL_      null
148 #define _NIL_       ""
149 #define _CONS_      (:)
150 #define _HEAD_      head
151 #define _TAIL_      tail
152 #define _LENGTH_    length
153 #define _PK_        (\x->x)
154 #define _UNPK_      (\x->x)
155 #define _SUBSTR_    substr{-from Utils-}
156 #define _APPEND_    ++
157 #define _CONCAT_    concat
158 #endif
159
160 #if __HASKELL1__ < 3
161 {- To avoid confusion with Haskell 1.3, we use Swahili.
162
163    data Maybe a = Nothing | Just a
164    data Labda a = Hamna   | Ni   a
165
166    Should we ever need to increase confusion with HBC, we will
167    use Swedish:
168
169    data Kanske a = Ingenting | Bara a
170 -}
171 # define Maybe Labda
172 # define Just Ni
173 # define Nothing Hamna
174 #else
175 # define MAYBE Labda
176 # define JUST Ni
177 # define NOTHING Hamna
178 #endif
179
180 #endif