{-# OPTIONS -fno-warn-incomplete-patterns -optc-DNON_POSIX_SOURCE #-}
-----------------------------------------------------------------------------
--- $Id: Main.hs,v 1.117 2002/12/19 09:37:32 simonmar Exp $
+-- $Id: Main.hs,v 1.119 2003/02/17 12:24:27 simonmar Exp $
--
-- GHC Driver program
--
import BasicTypes ( failed )
import Outputable
import Util
-import Panic ( GhcException(..), panic )
+import Panic ( GhcException(..), panic, installSignalHandlers )
import DATA_IOREF ( readIORef, writeIORef )
import EXCEPTION ( throwDyn, Exception(..),
AsyncException(StackOverflow) )
-#ifndef mingw32_HOST_OS
-import CONCURRENT ( myThreadId )
-# if __GLASGOW_HASKELL__ < 500
-import EXCEPTION ( raiseInThread )
-#define throwTo raiseInThread
-# else
-import EXCEPTION ( throwTo )
-# endif
-
-#if __GLASGOW_HASKELL__ > 504
-import System.Posix.Signals
-#else
-import Posix ( Handler(Catch), installHandler, sigINT, sigQUIT )
-#endif
-
-import DYNAMIC ( toDyn )
-#endif
-
-- Standard Haskell libraries
import IO
import Directory ( doesFileExist )
-- so there shouldn't be any difficulty if we receive further
-- signals.
- -- install signal handlers
-#ifndef mingw32_HOST_OS
- main_thread <- myThreadId
- let sig_handler = Catch (throwTo main_thread
- (DynException (toDyn Interrupted)))
- installHandler sigQUIT sig_handler Nothing
- installHandler sigINT sig_handler Nothing
-#endif
+ installSignalHandlers
argv <- getArgs
let (minusB_args, argv') = partition (prefixMatch "-B") argv
when (failed ok_flag) (exitWith (ExitFailure 1))
return ()
where
- looks_like_an_input m = haskellish_src_file m || '.' `notElem` m
+ {-
+ The following things should be considered compilation manager inputs:
+
+ - haskell source files (strings ending in .hs, .lhs or other
+ haskellish extension),
+
+ - module names (not forgetting hierarchical module names),
+
+ - and finally we consider everything not containing a '.' to be
+ a comp manager input, as shorthand for a .hs or .lhs filename.
+
+ Everything else is considered to be a linker object, and passed
+ straight through to the linker.
+ -}
+ looks_like_an_input m = haskellish_src_file m
+ || looksLikeModuleName m
+ || '.' `notElem` m
beginInteractive :: [String] -> IO ()