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