1 /* -----------------------------------------------------------------------------
2 * $Id: Stg.h,v 1.9 1999/03/15 16:30:25 simonm Exp $
4 * (c) The GHC Team, 1998-1999
6 * Top-level include file for everything STG-ish.
8 * This file is included *automatically* by all .hc files.
10 * ---------------------------------------------------------------------------*/
15 #ifndef NON_POSIX_SOURCE
21 #ifdef __HUGS__ /* vile hack till the GHC folks come on board */
25 /* ToDo: Set this flag properly: COMPILER and INTERPRETER should not be mutually exclusive. */
30 /* This is a feature test - doesn't belong here. FixMe. */
32 #define HAVE_WIN32_DLL_SUPPORT
35 #ifdef HAVE_WIN32_DLL_SUPPORT
36 # if __GNUC__ && !defined(__declspec)
39 # define DLLIMPORT __declspec(dllimport)
40 # define DLLIMPORT_DATA(x) _imp__##x
47 #define DLL_IMPORT DLLIMPORT
48 #define DLL_IMPORT_RTS
49 #define DLL_IMPORT_DATA
50 #define DLL_IMPORT_DATA_VAR(x) x
53 #define DLL_IMPORT_RTS DLLIMPORT
54 #define DLL_IMPORT_DATA DLLIMPORT
55 # ifdef HAVE_WIN32_DLL_SUPPORT
56 # define DLL_IMPORT_DATA_VAR(x) _imp__##x
58 # define DLL_IMPORT_DATA_VAR(x) x
64 #define BITS_PER_BYTE 8
65 #define BITS_IN(x) (BITS_PER_BYTE * sizeof(x))
67 /* -----------------------------------------------------------------------------
68 Assertions and Debuggery
69 -------------------------------------------------------------------------- */
72 #define ASSERT(predicate) /* nothing */
75 void _stgAssert (char *, unsigned int);
77 #define ASSERT(predicate) \
81 _stgAssert(__FILE__, __LINE__)
84 /* -----------------------------------------------------------------------------
85 Include everything STG-ish
86 -------------------------------------------------------------------------- */
88 /* Global type definitions*/
91 /* Global constaints */
92 #include "Constants.h"
94 /* Profiling information */
95 #include "Profiling.h"
97 /* Storage format definitions */
99 #include "ClosureTypes.h"
100 #include "InfoTables.h"
103 /* STG/Optimised-C related stuff */
104 #include "MachRegs.h"
106 #include "TailCalls.h"
108 /* these are all ANSI C headers */
127 /* Wired-in Prelude identifiers */
130 /* Storage Manager */
131 #include "StgStorage.h"
133 /* Macros for STG/C code */
134 #include "ClosureMacros.h"
135 #include "InfoMacros.h"
136 #include "StgMacros.h"
140 #include "StgTicky.h"
144 /* Built-in entry points */
145 #include "StgMiscClosures.h"
147 /* Runtime-system hooks */
150 /* Misc stuff without a home */
151 #ifdef BUILDING_RTS_DLL
152 extern DLLIMPORT char **prog_argv; /* so we can get at these from Haskell */
153 extern DLLIMPORT int prog_argc;
155 extern char **prog_argv; /* so we can get at these from Haskell */
156 extern int prog_argc;
159 extern char **environ;
161 /* Creating and destroying an adjustor thunk.
162 I cannot make myself create a separate .h file
165 extern void* createAdjustor(int cconv, StgStablePtr hptr, StgFunPtr wptr);
166 extern void freeHaskellFunctionPtr(void* ptr);