[project @ 1996-01-08 20:28:12 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 #else
57 #define ASSERT(e)
58 #endif
59
60 -- ToDo: ghci needs to load far too many bits of the backend because
61 --       this ATTACK_PRAGMA stuff encourages Utils.lhs to tell
62 --       everyone about everyone else.  I guess we need to add some
63 --       more conditional stuff in.
64 #ifdef USE_ATTACK_PRAGMAS
65 #define IF_ATTACK_PRAGMAS(x) x
66 #else
67 #define IF_ATTACK_PRAGMAS(x) {--}
68 #endif
69
70 #if GHCI
71 #define IF_GHCI(stuff) stuff
72 #else 
73 #define IF_GHCI(stuff) {-nothing-}
74 #endif
75
76 #if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ >= 26
77 #define trace _trace
78 #endif
79
80 #if defined(__GLASGOW_HASKELL__)
81 #define FAST_INT Int#
82 #define ILIT(x) (x#)
83 #define IBOX(x) (I# (x))
84 #define _ADD_ `plusInt#`
85 #define _SUB_ `minusInt#`
86 #define _MUL_ `timesInt#`
87 #define _DIV_ `divInt#`
88 #define _QUOT_ `quotInt#`
89 #define _NEG_ negateInt#
90 #define _EQ_ `eqInt#`
91 #define _LT_ `ltInt#`
92 #define _LE_ `leInt#`
93 #define _GE_ `geInt#`
94 #define _GT_ `gtInt#`
95
96 #define FAST_BOOL Int#
97 #define _TRUE_ 1#
98 #define _FALSE_ 0#
99 #define _IS_TRUE_(x) ((x) `eqInt#` 1#)
100
101 #else {- ! __GLASGOW_HASKELL__ -}
102
103 #define FAST_INT Int
104 #define ILIT(x) (x)
105 #define IBOX(x) (x)
106 #define _ADD_ +
107 #define _SUB_ -
108 #define _MUL_ *
109 #define _DIV_ `div`
110 #define _QUOT_ `quot`
111 #define _NEG_ -
112 #define _EQ_ ==
113 #define _LT_ <
114 #define _LE_ <=
115 #define _GE_ >=
116 #define _GT_ >
117
118 #define FAST_BOOL Bool
119 #define _TRUE_ True
120 #define _FALSE_ False
121 #define _IS_TRUE_(x) (x)
122
123 #endif  {- ! __GLASGOW_HASKELL__ -}
124
125 #if __GLASGOW_HASKELL__ >= 23
126 #define USE_FAST_STRINGS 1
127 #define FAST_STRING _PackedString
128 #define SLIT(x)     (_packCString (A# x#))
129 #define _CMP_STRING_ cmpPString
130 #define _NULL_      _nullPS
131 #define _NIL_       _nilPS
132 #define _CONS_      _consPS
133 #define _HEAD_      _headPS
134 #define _TAIL_      _tailPS
135 #define _LENGTH_    _lengthPS
136 #define _PK_        _packString
137 #define _UNPK_      _unpackPS
138 #define _SUBSTR_    _substrPS
139 #define _APPEND_    `_appendPS`
140 #define _CONCAT_    _concatPS
141 #else
142 #define FAST_STRING String
143 #define SLIT(x)     (x)
144 #define _CMP_STRING_ cmpString
145 #define _NULL_      null
146 #define _NIL_       ""
147 #define _CONS_      (:)
148 #define _HEAD_      head
149 #define _TAIL_      tail
150 #define _LENGTH_    length
151 #define _PK_        (\x->x)
152 #define _UNPK_      (\x->x)
153 #define _SUBSTR_    substr{-from Utils-}
154 #define _APPEND_    ++
155 #define _CONCAT_    concat
156 #endif
157
158 #if __HASKELL1__ < 3
159 {- To avoid confusion with Haskell 1.3, we use Swahili.
160
161    data Maybe a = Nothing | Just a
162    data Labda a = Hamna   | Ni   a
163
164    Should we ever need to increase confusion with HBC, we will
165    use Swedish:
166
167    data Kanske a = Ingenting | Bara a
168 -}
169 # define Maybe Labda
170 # define Just Ni
171 # define Nothing Hamna
172 #else
173 # define MAYBE Labda
174 # define JUST Ni
175 # define NOTHING Hamna
176 #endif
177
178 #endif