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