f38eba40161634c5606b49547b0ebae0a67c9c00
[ghc-hetmet.git] / ghc / includes / Stg.h
1 /* -----------------------------------------------------------------------------
2  * $Id: Stg.h,v 1.6 1999/02/05 16:02:28 simonm Exp $
3  *
4  * (c) The GHC Team, 1998-1999
5  *
6  * Top-level include file for everything STG-ish.  
7  *
8  * This file is included *automatically* by all .hc files.
9  *
10  * ---------------------------------------------------------------------------*/
11
12 #ifndef STG_H
13 #define STG_H
14
15 #ifndef NON_POSIX_SOURCE
16 #define _POSIX_SOURCE
17 #endif
18
19 /* Configuration */
20 #include "config.h"
21 #ifdef __HUGS__ /* vile hack till the GHC folks come on board */
22 #include "options.h"
23 #endif
24
25 /* ToDo: Set this flag properly: COMPILER and INTERPRETER should not be mutually exclusive. */
26 #ifndef INTERPRETER
27 #define COMPILER 1
28 #endif
29
30 /* bit macros
31  */
32 #define BITS_PER_BYTE 8
33 #define BITS_IN(x) (BITS_PER_BYTE * sizeof(x))
34
35 /* -----------------------------------------------------------------------------
36    Assertions and Debuggery
37    -------------------------------------------------------------------------- */
38
39 #ifndef DEBUG
40 #define ASSERT(predicate) /* nothing */
41 #else
42
43 void _stgAssert (char *, unsigned int);
44
45 #define ASSERT(predicate)                       \
46         if (predicate)                          \
47             /*null*/;                           \
48         else                                    \
49             _stgAssert(__FILE__, __LINE__)
50 #endif /* DEBUG */
51
52 /* -----------------------------------------------------------------------------
53    Include everything STG-ish
54    -------------------------------------------------------------------------- */
55
56 /* Global type definitions*/
57 #include "StgTypes.h"
58
59 /* Global constaints */
60 #include "Constants.h"
61
62 /* Profiling information */
63 #include "Profiling.h"
64
65 /* Storage format definitions */
66 #include "Closures.h"
67 #include "InfoTables.h"
68 #include "TSO.h"
69
70 /* STG/Optimised-C related stuff */
71 #include "MachRegs.h"
72 #include "Regs.h"
73 #include "TailCalls.h"
74
75 /**
76  * Added by Ian McDonald 7/5/98 
77  * XXX The position of this code is very
78  * important - it must come after the 
79  * Regs.h include
80  **/
81 #ifdef nemesis_TARGET_OS
82 #define _NEMESIS_OS_
83 #ifndef __LANGUAGE_C
84 #define __LANGUAGE_C
85 #endif
86 #include <nemesis.h>
87 #endif
88
89 /* these are all ANSI C headers */
90 #include <stdlib.h>
91 #include <string.h>
92 #include <math.h>
93 #include <assert.h>
94 #include <errno.h>
95 #include <stdio.h>
96
97 #ifdef HAVE_SIGNAL_H
98 #include <signal.h>
99 #endif
100
101 #ifdef HAVE_UNISTD_H
102 #include <unistd.h>
103 #endif
104
105 /* GNU mp library */
106 #include "gmp.h"
107
108 /* Wired-in Prelude identifiers */
109 #include "Prelude.h"
110
111 /* Storage Manager */
112 #include "StgStorage.h"
113
114 /* Macros for STG/C code */
115 #include "ClosureMacros.h"
116 #include "InfoMacros.h"
117 #include "StgMacros.h"
118 #include "StgProf.h"
119 #include "PrimOps.h"
120 #include "Updates.h"
121 #include "StgTicky.h"
122 #include "CCall.h"
123 #include "Stable.h"
124
125 /* Built-in entry points */
126 #include "StgMiscClosures.h"
127
128 /* Runtime-system hooks */
129 #include "Hooks.h"
130
131 /* Misc stuff without a home */
132 extern char **prog_argv;        /* so we can get at these from Haskell */
133 extern int    prog_argc;
134
135 extern char **environ;
136
137 /* Creating and destroying an adjustor thunk.
138    I cannot make myself create a separate .h file
139    for these two (sof.)
140 */
141 extern void* createAdjustor(int cconv, StgStablePtr hptr, StgFunPtr wptr);
142 extern void  freeHaskellFunctionPtr(void* ptr);
143
144 #endif /* STG_H */