[project @ 1997-11-24 20:22:28 by sof]
[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 COMMA ,
14
15 #ifdef DEBUG
16 #define ASSERT(e) if (not (e)) then (assertPanic __FILE__ __LINE__) else
17 #define ASSERT2(e,msg) if (not (e)) then (assertPprPanic __FILE__ __LINE__ (msg)) else
18 #else
19 #define ASSERT(e)
20 #define ASSERT2(e,msg)
21 #endif
22
23 #if __STDC__
24 #define CAT2(a,b)a##b
25 #else
26 #define CAT2(a,b)a/**/b
27 #endif
28
29 #if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ == 201
30 # define REALLY_HASKELL_1_3
31 # define SYN_IE(a) a
32 # define EXP_MODULE(a) module a
33 # define IMPORT_DELOOPER(mod) import mod
34 # define IMPORT_1_3(mod) import mod
35 # define _tagCmp compare
36 # define _LT LT
37 # define _EQ EQ
38 # define _GT GT
39 # define _Addr GHCbase.Addr
40 # define _ByteArray GHCbase.ByteArray
41 # define _MutableByteArray GHCbase.MutableByteArray
42 # define _MutableArray GHCbase.MutableArray
43 # define _RealWorld GHCbase.RealWorld
44 # define _ST GHCbase.ST
45 # define _ForeignObj GHCbase.ForeignObj
46 # define _runST STbase.runST
47 # define failWith fail
48 # define MkST ST
49 # define STATE_TOK(x)  (S# x)
50 # define ST_RET(x,y)   (x,y)
51 # define unsafePerformST(x)  unsafePerformPrimIO (x)
52 # define ST_TO_PrimIO(x) x
53 # define MkIOError(h,errt,msg) (errt msg)
54 # define Text Show
55 # define IMP_FASTSTRING()
56 # define IMP_Ubiq() IMPORT_DELOOPER(Ubiq); import qualified GHCbase
57 # define CHK_Ubiq() IMPORT_DELOOPER(Ubiq); import qualified GHCbase
58 # define minInt (minBound::Int)
59 # define maxInt (maxBound::Int)
60 #elif defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ >= 202
61 # define REALLY_HASKELL_1_3
62 # define SYN_IE(a) a
63 # define EXP_MODULE(a) module a
64 # define IMPORT_DELOOPER(mod) import mod
65 # define IMPORT_1_3(mod) import mod
66 # define _CMP_TAG Ordering
67 # define _tagCmp compare
68 # define _LT LT
69 # define _EQ EQ
70 # define _GT GT
71 # define _Addr GlaExts.Addr
72 # define _ByteArray GlaExts.ByteArray
73 # define _MutableByteArray GlaExts.MutableByteArray
74 # define _MutableArray GlaExts.MutableArray
75 # define _RealWorld GlaExts.RealWorld
76 # define _ST GlaExts.ST
77 # define _ForeignObj Foreign.ForeignObj
78 # define _runST ST.runST
79 # define seqStrictlyST seqST
80 # define thenStrictlyST thenST
81 # define returnStrictlyST return
82 # define _readHandle IOHandle.readHandle
83 # define _writeHandle IOHandle.writeHandle
84 # define _newHandle   IOHandle.newdHandle
85 # define MkST ST
86 # if __GLASGOW_HASKELL__ >= 209
87 #  define STATE_TOK(x)    x
88 #  define ST_RET(x,y)     STret (y) (x)
89 #  define unsafePerformST(x)  runST (x)
90 #  define ST_TO_PrimIO(x) (stToIO (x))
91 # else
92 #  define STATE_TOK(x)  (S# x)
93 #  define ST_RET(x,y)   (x,y)
94 #  define unsafePerformST(x) unsafePerformPrimIO(x)
95 #  define ST_TO_PrimIO(x) x
96 # endif
97 # define failWith fail
98 # define MkIOError(h,errt,msg) (IOError (Just h) errt msg)
99 # define CCALL_THEN thenIO_Prim
100 # define _filePtr IOHandle.filePtr
101 # define Text Show
102 # define IMP_FASTSTRING() import FastString
103 # if __GLASGOW_HASKELL__ >= 209
104 #  define IMP_Ubiq() import GlaExts ; import Addr(Addr(..)); import FastString
105 #  define CHK_Ubiq() import GlaExts ; import Addr(Addr(..)); import FastString
106 # else
107 #  define IMP_Ubiq() import GlaExts ; import FastString
108 #  define CHK_Ubiq() import GlaExts ; import FastString
109 # endif
110 # define minInt (minBound::Int)
111 # define maxInt (maxBound::Int)
112 #else
113 # define SYN_IE(a) a(..)
114 # define EXP_MODULE(a) a..
115 # define IMPORT_DELOOPER(mod) import mod
116 # define IMPORT_1_3(mod) {--}
117 # define IMP_FASTSTRING() import FastString
118 # define IMP_Ubiq() IMPORT_DELOOPER(Ubiq) ; import FastString
119 # define CHK_Ubiq() IMPORT_DELOOPER(Ubiq) ; import FastString
120 # define MkST
121 # define CCALL_THEN thenPrimIO
122 # define MkIOError(h,errt,msg) (errt msg)
123 #endif
124
125 #if __GLASGOW_HASKELL__ >= 26 && __GLASGOW_HASKELL__ < 200
126 #define trace _trace
127 #endif
128
129 #define TAG_ Int#
130 #define LT_ -1#
131 #define EQ_ 0#
132 #define GT_ 1#
133 #define GT__ _
134
135 #if defined(__GLASGOW_HASKELL__)
136 #define FAST_INT Int#
137 #define ILIT(x) (x#)
138 #define IBOX(x) (I# (x))
139 #if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ <= 201
140 #define _ADD_ `plusInt#`
141 #define _SUB_ `minusInt#`
142 #define _MUL_ `timesInt#`
143 #define _DIV_ `divInt#`
144 #define _QUOT_ `quotInt#`
145 #define _NEG_ negateInt#
146 #define _EQ_ `eqInt#`
147 #define _LT_ `ltInt#`
148 #define _LE_ `leInt#`
149 #define _GE_ `geInt#`
150 #define _GT_ `gtInt#`
151 #else
152 #define _ADD_ +#
153 #define _SUB_ -#
154 #define _MUL_ *#
155 #define _DIV_ /#
156 #define _QUOT_ `quotInt#`
157 #define _NEG_ negateInt#
158 #define _EQ_ ==#
159 #define _LT_ <#
160 #define _LE_ <=#
161 #define _GE_ >=#
162 #define _GT_ >#
163 #endif
164
165 #define FAST_BOOL Int#
166 #define _TRUE_ 1#
167 #define _FALSE_ 0#
168 #define _IS_TRUE_(x) ((x) _EQ_ 1#)
169
170 #else {- ! __GLASGOW_HASKELL__ -}
171
172 #define FAST_INT Int
173 #define ILIT(x) (x)
174 #define IBOX(x) (x)
175 #define _ADD_ +
176 #define _SUB_ -
177 #define _MUL_ *
178 #define _DIV_ `div`
179 #define _QUOT_ `quot`
180 #define _NEG_ -
181 #define _EQ_ ==
182 #define _LT_ <
183 #define _LE_ <=
184 #define _GE_ >=
185 #define _GT_ >
186
187 #define FAST_BOOL Bool
188 #define _TRUE_ True
189 #define _FALSE_ False
190 #define _IS_TRUE_(x) (x)
191
192 #endif  {- ! __GLASGOW_HASKELL__ -}
193
194 #if __GLASGOW_HASKELL__ >= 23
195 # define USE_FAST_STRINGS 1
196 # if __GLASGOW_HASKELL__ < 200 || __GLASGOW_HASKELL__ >= 202
197 #  define FAST_STRING   FastString {-_PackedString -}
198 #  if __GLASGOW_HASKELL__ < 200
199 #    define SLIT(x)     (mkFastCharString (A# (x#)))
200 #  elif __GLASGOW_HASKELL__ < 209
201 #    define SLIT(x)     (mkFastCharString (GlaExts.A# (x#)))
202 #  else
203 #    define SLIT(x)     (mkFastCharString (Addr.A# (x#)))
204 #  endif
205 #  define _CMP_STRING_  cmpPString
206         /* cmpPString defined in utils/Util.lhs */
207 #  define _NULL_        nullFastString {-_nullPS-}
208 #  define _NIL_         (mkFastString "") {-_nilPS -}
209 #  define _CONS_        consFS {-_consPS-}
210 #  define _HEAD_        headFS {-_headPS-}
211 #  define _TAIL_        tailFS {-_tailPS-} 
212 #  define _LENGTH_      lengthFS {-_lengthPS-}
213 #  define _PK_          mkFastString {-_packString-}
214 #  define _UNPK_        unpackFS {-_unpackPS-}
215      /* #  define _SUBSTR_      _substrPS */
216 #  define _APPEND_      `appendFS` {-`_appendPS`-}
217 #  define _CONCAT_      concatFS {-_concatPS-}
218 # else
219 #  define FAST_STRING   GHCbase.PackedString
220 #  define SLIT(x)       (packCString (GHCbase.A# x#))
221 #  define _CMP_STRING_  cmpPString
222 #  define _NULL_        nullPS
223 #  define _NIL_         nilPS
224 #  define _CONS_        consPS
225 #  define _HEAD_        headPS
226 #  define _TAIL_        tailPS
227 #  define _LENGTH_      lengthPS
228 #  define _PK_          packString
229 #  define _UNPK_        unpackPS
230 #  define _SUBSTR_      substrPS
231 #  define _APPEND_      `appendPS`
232 #  define _CONCAT_      concatPS
233 # endif
234 #else
235 # define FAST_STRING String
236 # define SLIT(x)      (x)
237 # define _CMP_STRING_ cmpString
238 # define _NULL_       null
239 # define _NIL_        ""
240 # define _CONS_       (:)
241 # define _HEAD_       head
242 # define _TAIL_       tail
243 # define _LENGTH_     length
244 # define _PK_         (\x->x)
245 # define _UNPK_       (\x->x)
246 # define _SUBSTR_     substr{-from Utils-}
247 # define _APPEND_     ++
248 # define _CONCAT_     concat
249 #endif
250
251 #endif