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