diff options
Diffstat (limited to 'includes')
-rw-r--r-- | includes/Rts.h | 1 | ||||
-rw-r--r-- | includes/RtsAPI.h | 9 | ||||
-rw-r--r-- | includes/rts/SimpleMain.h | 38 |
3 files changed, 40 insertions, 8 deletions
diff --git a/includes/Rts.h b/includes/Rts.h index 0fae58956d..b0654d7fa8 100644 --- a/includes/Rts.h +++ b/includes/Rts.h @@ -218,6 +218,7 @@ void _assertFail(const char *filename, unsigned int linenum) #include "rts/Utils.h" #include "rts/PrimFloat.h" #include "rts/Main.h" +#include "rts/SimpleMain.h" #include "rts/Profiling.h" #include "rts/StaticPtrTable.h" #include "rts/Libdw.h" diff --git a/includes/RtsAPI.h b/includes/RtsAPI.h index a9afab8a5c..5f75e54381 100644 --- a/includes/RtsAPI.h +++ b/includes/RtsAPI.h @@ -16,6 +16,7 @@ extern "C" { #endif #include "HsFFI.h" +#include "rts/SimpleMain.h" // For RtsOptsEnabledEnum #include "rts/Time.h" #include "rts/EventLogWriter.h" @@ -51,14 +52,6 @@ typedef struct CapabilityPublic_ { RTS configuration settings, for passing to hs_init_ghc() ------------------------------------------------------------------------- */ -typedef enum { - RtsOptsNone, // +RTS causes an error - RtsOptsIgnore, // Ignore command line arguments - RtsOptsIgnoreAll, // Ignore command line and Environment arguments - RtsOptsSafeOnly, // safe RTS options allowed; others cause an error - RtsOptsAll // all RTS options allowed - } RtsOptsEnabledEnum; - struct GCDetails_; // The RtsConfig struct is passed (by value) to hs_init_ghc(). The diff --git a/includes/rts/SimpleMain.h b/includes/rts/SimpleMain.h new file mode 100644 index 0000000000..5d7fdca826 --- /dev/null +++ b/includes/rts/SimpleMain.h @@ -0,0 +1,38 @@ +/* ----------------------------------------------------------------------------- + * + * (c) The GHC Team, 2009 + * + * Reduced-functionality entry point for standalone Haskell programs. + * + * See Note [Simple main] in RtsMain.c. + * ---------------------------------------------------------------------------*/ + +#pragma once + +#include <stdbool.h> + +struct StgClosure_; + +typedef enum { + RtsOptsNone, // +RTS causes an error + RtsOptsIgnore, // Ignore command line arguments + RtsOptsIgnoreAll, // Ignore command line and Environment arguments + RtsOptsSafeOnly, // safe RTS options allowed; others cause an error + RtsOptsAll // all RTS options allowed + } RtsOptsEnabledEnum; + +struct RtsSimpleConfig { + RtsOptsEnabledEnum rts_opts_enabled; + bool rts_opts_suggestions; + bool keep_cafs; + const char *rts_opts; +}; + +#if defined(__GNUC__) +// N.B. Don't use GNU_ATTRIBUTE to avoid dependency on Stg.h. +__attribute__((noreturn)) +#endif +void hs_simple_main (int argc, char *argv[], + struct StgClosure_ *main_closure, + struct RtsSimpleConfig rts_config); + |