[project @ 1999-05-10 08:23:55 by sof]
[ghc-hetmet.git] / ghc / includes / Stg.h
1 /* -----------------------------------------------------------------------------
2  * $Id: Stg.h,v 1.11 1999/05/10 08:23:57 sof 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 /* Some macros to handle DLLing (Win32 only at the moment). */
26 #include "StgDLL.h"
27
28 /* ToDo: Set this flag properly: COMPILER and INTERPRETER should not be mutually exclusive. */
29 #ifndef INTERPRETER
30 #define COMPILER 1
31 #endif
32
33 /* bit macros
34  */
35 #define BITS_PER_BYTE 8
36 #define BITS_IN(x) (BITS_PER_BYTE * sizeof(x))
37
38 /* -----------------------------------------------------------------------------
39    Assertions and Debuggery
40    -------------------------------------------------------------------------- */
41
42 #ifndef DEBUG
43 #define ASSERT(predicate) /* nothing */
44 #else
45
46 void _stgAssert (char *, unsigned int);
47
48 #define ASSERT(predicate)                       \
49         if (predicate)                          \
50             /*null*/;                           \
51         else                                    \
52             _stgAssert(__FILE__, __LINE__)
53 #endif /* DEBUG */
54
55 /* -----------------------------------------------------------------------------
56    Include everything STG-ish
57    -------------------------------------------------------------------------- */
58
59 /* Global type definitions*/
60 #include "StgTypes.h"
61
62 /* Global constaints */
63 #include "Constants.h"
64
65 /* Profiling information */
66 #include "Profiling.h"
67
68 /* Storage format definitions */
69 #include "Closures.h"
70 #include "ClosureTypes.h"
71 #include "InfoTables.h"
72 #include "TSO.h"
73
74 /* STG/Optimised-C related stuff */
75 #include "MachRegs.h"
76 #include "Regs.h"
77 #include "TailCalls.h"
78
79 /* these are all ANSI C headers */
80 #include <stdlib.h>
81 #include <string.h>
82 #include <math.h>
83 #include <assert.h>
84 #include <errno.h>
85 #include <stdio.h>
86
87 #ifdef HAVE_SIGNAL_H
88 #include <signal.h>
89 #endif
90
91 #ifdef HAVE_UNISTD_H
92 #include <unistd.h>
93 #endif
94
95 /* GNU mp library */
96 #include "gmp.h"
97
98 /* Wired-in Prelude identifiers */
99 #include "Prelude.h"
100
101 /* Storage Manager */
102 #include "StgStorage.h"
103
104 /* Macros for STG/C code */
105 #include "ClosureMacros.h"
106 #include "InfoMacros.h"
107 #include "StgMacros.h"
108 #include "StgProf.h"
109 #include "PrimOps.h"
110 #include "Updates.h"
111 #include "StgTicky.h"
112 #include "CCall.h"
113 #include "Stable.h"
114
115 /* Built-in entry points */
116 #include "StgMiscClosures.h"
117
118 /* Runtime-system hooks */
119 #include "Hooks.h"
120
121 /* Misc stuff without a home */
122 #if defined(ENABLE_WIN32_DLL_SUPPOT) && !defined(COMPILING_RTS)
123 extern DLLIMPORT char **prog_argv;      /* so we can get at these from Haskell */
124 extern DLLIMPORT int    prog_argc;
125 #else
126 extern char **prog_argv;        /* so we can get at these from Haskell */
127 extern int    prog_argc;
128 #endif
129
130 extern char **environ;
131
132 /* Creating and destroying an adjustor thunk.
133    I cannot make myself create a separate .h file
134    for these two (sof.) 
135    
136 */
137 extern void* createAdjustor(int cconv, StgStablePtr hptr, StgFunPtr wptr);
138 extern void  freeHaskellFunctionPtr(void* ptr);
139
140 #endif /* STG_H */