1 /* -----------------------------------------------------------------------------
2 * $Id: Main.c,v 1.12 1999/11/02 15:05:58 simonmar Exp $
4 * (c) The GHC Team 1998-1999
6 * Main function for a standalone Haskell program.
8 * ---------------------------------------------------------------------------*/
10 #define COMPILING_RTS_MAIN
19 #include "Printer.h" /* for printing */
23 #include "Assembler.h"
37 /* Hack: we assume that we're building a batch-mode system unless
40 # ifndef INTERPRETER /* Hack */
41 int main(int argc, char *argv[])
43 SchedulerStatus status;
44 startupHaskell(argc,argv);
47 /* ToDo: want to start with a larger stack size */
48 status = rts_evalIO((StgClosure *)&mainIO_closure, NULL);
50 if (IAmMainThread == rtsTrue) {
51 /*Just to show we're alive */
52 fprintf(stderr, "Main Thread Started ...\n");
54 status = rts_evalIO((StgClosure *)&mainIO_closure, NULL);
56 WaitForPEOp(PP_FINISH,SysManTask);
62 barf("Scheduler stopped, all threads blocked");
65 barf("No threads to run! Deadlock?");
67 belch("%s: warning: main thread killed", prog_argv[0]);
72 shutdownHaskellAndExit(EXIT_SUCCESS);
74 # endif /* BATCH_MODE */