[project @ 1997-03-14 07:52:06 by simonpj]
[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__ >= 200
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 CAT2(mod,_1_3)
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 Text Show
39 # define IMP_FASTSTRING()
40 # define IMP_Ubiq() IMPORT_DELOOPER(Ubiq); import qualified GHCbase
41 # define CHK_Ubiq() IMPORT_DELOOPER(Ubiq); import qualified GHCbase
42 # define minInt (minBound::Int)
43 # define maxInt (maxBound::Int)
44 #else
45 # define SYN_IE(a) a(..)
46 # define EXP_MODULE(a) a..
47 # define IMPORT_DELOOPER(mod) import mod
48 # define IMPORT_1_3(mod) {--}
49 # define IMP_FASTSTRING() import FastString
50 # define IMP_Ubiq() IMPORT_DELOOPER(Ubiq) ; import FastString
51 # define CHK_Ubiq() IMPORT_DELOOPER(Ubiq) ; import FastString
52 #endif
53
54 #if __GLASGOW_HASKELL__ >= 26 && __GLASGOW_HASKELL__ < 200
55 #define trace _trace
56 #endif
57
58 #define TAG_ Int#
59 #define LT_ -1#
60 #define EQ_ 0#
61 #define GT_ 1#
62 #define GT__ _
63
64 #if defined(__GLASGOW_HASKELL__)
65 #define FAST_INT Int#
66 #define ILIT(x) (x#)
67 #define IBOX(x) (I# (x))
68 #define _ADD_ `plusInt#`
69 #define _SUB_ `minusInt#`
70 #define _MUL_ `timesInt#`
71 #define _DIV_ `divInt#`
72 #define _QUOT_ `quotInt#`
73 #define _NEG_ negateInt#
74 #define _EQ_ `eqInt#`
75 #define _LT_ `ltInt#`
76 #define _LE_ `leInt#`
77 #define _GE_ `geInt#`
78 #define _GT_ `gtInt#`
79
80 #define FAST_BOOL Int#
81 #define _TRUE_ 1#
82 #define _FALSE_ 0#
83 #define _IS_TRUE_(x) ((x) `eqInt#` 1#)
84
85 #else {- ! __GLASGOW_HASKELL__ -}
86
87 #define FAST_INT Int
88 #define ILIT(x) (x)
89 #define IBOX(x) (x)
90 #define _ADD_ +
91 #define _SUB_ -
92 #define _MUL_ *
93 #define _DIV_ `div`
94 #define _QUOT_ `quot`
95 #define _NEG_ -
96 #define _EQ_ ==
97 #define _LT_ <
98 #define _LE_ <=
99 #define _GE_ >=
100 #define _GT_ >
101
102 #define FAST_BOOL Bool
103 #define _TRUE_ True
104 #define _FALSE_ False
105 #define _IS_TRUE_(x) (x)
106
107 #endif  {- ! __GLASGOW_HASKELL__ -}
108
109 #if __GLASGOW_HASKELL__ >= 23
110 # define USE_FAST_STRINGS 1
111 # if __GLASGOW_HASKELL__ < 200
112 #  define FAST_STRING   FastString {-_PackedString -}
113 #  define SLIT(x)       (mkFastCharString (A# (x#))) {- (_packCString (A# x#)) -}
114 #  define _CMP_STRING_  cmpPString
115         /* cmpPString defined in utils/Util.lhs */
116 #  define _NULL_        nullFastString {-_nullPS-}
117 #  define _NIL_         (mkFastString "") {-_nilPS -}
118 #  define _CONS_        consFS {-_consPS-}
119 #  define _HEAD_        headFS {-_headPS-}
120 #  define _TAIL_        tailFS {-_tailPS-} 
121 #  define _LENGTH_      lengthFS {-_lengthPS-}
122 #  define _PK_          mkFastString {-_packString-}
123 #  define _UNPK_        unpackFS {-_unpackPS-}
124      /* #  define _SUBSTR_      _substrPS */
125 #  define _APPEND_      `appendFS` {-`_appendPS`-}
126 #  define _CONCAT_      concatFS {-_concatPS-}
127 # else
128 #  define FAST_STRING   GHCbase.PackedString
129 #  define SLIT(x)       (packCString (GHCbase.A# x#))
130 #  define _CMP_STRING_  cmpPString
131 #  define _NULL_        nullPS
132 #  define _NIL_         nilPS
133 #  define _CONS_        consPS
134 #  define _HEAD_        headPS
135 #  define _TAIL_        tailPS
136 #  define _LENGTH_      lengthPS
137 #  define _PK_          packString
138 #  define _UNPK_        unpackPS
139 #  define _SUBSTR_      substrPS
140 #  define _APPEND_      `appendPS`
141 #  define _CONCAT_      concatPS
142 # endif
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 #endif