[project @ 2004-11-18 00:56:18 by igloo]
[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 #if __GLASGOW_HASKELL__ >= 504
14
15 #define CONCURRENT  Control.Concurrent
16 #define EXCEPTION   Control.Exception
17      /* If you want Control.Exception.try, get it as Panic.try, which
18         deals with the shift from 'tryAllIO' to 'try'.  */
19 #define DYNAMIC     Data.Dynamic
20 #define GLAEXTS     GHC.Exts
21 #define DATA_BITS   Data.Bits
22 #define DATA_INT    Data.Int
23 #define DATA_WORD   Data.Word
24 #define UNSAFE_IO   System.IO.Unsafe
25 #define TRACE       Debug.Trace
26 #define DATA_IOREF  Data.IORef
27 #define FIX_IO      System.IO
28 #define MONAD_ST    Control.Monad.ST
29 #define ST_ARRAY    Data.Array.ST
30
31 #else
32
33 #define CONCURRENT  Concurrent
34 #define EXCEPTION   Exception
35 #define DYNAMIC     Dynamic
36 #define GLAEXTS     GlaExts
37 #define DATA_BITS   Bits
38 #define DATA_INT    Int
39 #define DATA_WORD   Word
40 #define UNSAFE_IO   IOExts
41 #define TRACE       IOExts
42 #define DATA_IOREF  IOExts
43 #define FIX_IO      IOExts
44 #define MONAD_ST    ST
45 #define ST_ARRAY    ST
46
47 #endif
48
49 #ifdef __GLASGOW_HASKELL__
50 #define GLOBAL_VAR(name,value,ty)  \
51 name = Util.global (value) :: IORef (ty); \
52 {-# NOINLINE name #-}
53 #endif
54
55 #if __GLASGOW_HASKELL__ >= 620
56 #define UNBOX_FIELD !!
57 #else
58 #define UNBOX_FIELD !
59 #endif
60
61 #define COMMA ,
62
63 #ifdef DEBUG
64 #define ASSERT(e) if (not (e)) then (assertPanic __FILE__ __LINE__) else
65 #define ASSERT2(e,msg) if (not (e)) then (assertPprPanic __FILE__ __LINE__ (msg)) else
66 #define WARN( e, msg ) (warnPprTrace (e) __FILE__ __LINE__ (msg))
67 #define ASSERTM(mbool) do { bool <- mbool; ASSERT(bool) return () }
68 #define ASSERTM2(mbool,msg) do { bool <- mbool; ASSERT2(bool,msg) return () }
69 #else
70 #define ASSERT(e)      if False then error "ASSERT"  else
71 #define ASSERT2(e,msg) if False then error "ASSERT2" else
72 #define ASSERTM(e)
73 #define ASSERTM2(e,msg)
74 #define WARN(e,msg)    if False then error "WARN"    else
75 #endif
76
77 -- This #ifndef lets us switch off the "import FastString"
78 -- when compiling FastString itself
79 #ifndef COMPILING_FAST_STRING
80 -- 
81 import qualified FastString 
82 #endif
83
84 #define SLIT(x)  (FastString.mkLitString# (x#))
85 #define FSLIT(x) (FastString.mkFastString# (x#))
86
87 #endif /* HsVersions.h */
88