[project @ 2000-10-26 16:51:44 by sewardj]
authorsewardj <unknown>
Thu, 26 Oct 2000 16:51:44 +0000 (16:51 +0000)
committersewardj <unknown>
Thu, 26 Oct 2000 16:51:44 +0000 (16:51 +0000)
Final changes to get it to compile.

ghc/compiler/ghci/CompManager.lhs
ghc/compiler/main/CmdLineOpts.lhs
ghc/compiler/main/DriverState.hs
ghc/compiler/main/Main.hs
ghc/compiler/parser/Parser.y

index dc03339..f3bedc6 100644 (file)
@@ -4,6 +4,13 @@
 \section[CompManager]{The Compilation Manager}
 
 \begin{code}
+#if 1
+module CompManager ( )
+where
+the_answer = "42"
+
+#else
+
 module CompManager ( cmInit, cmLoadModule, 
                      cmGetExpr, cmRunExpr,
                      CmState, emptyCmState  -- abstract
@@ -526,5 +533,5 @@ downsweep rootNm finder
                 if null newHomeSummaries
                  then return homeSummaries
                  else loop (newHomeSummaries ++ homeSummaries)
-                 
+#endif                 
 \end{code}
index ab25539..a678e34 100644 (file)
@@ -14,6 +14,8 @@ module CmdLineOpts (
        DynFlag(..),    -- needed non-abstractly by DriverFlags
        DynFlags(..),
 
+       v_Static_hsc_opts,
+
        intSwitchSet,
        switchIsOn,
        isStaticHscFlag,
@@ -97,6 +99,7 @@ module CmdLineOpts (
 
 import Array   ( array, (//) )
 import GlaExts
+import IOExts  ( IORef, readIORef )
 import Argv
 import Constants       -- Default values for some flags
 import Util
@@ -314,15 +317,22 @@ dopt_HscLang = hscLang
 %************************************************************************
 
 \begin{code}
+-- v_Statis_hsc_opts is here to avoid a circular dependency with
+-- main/DriverState.
+GLOBAL_VAR(v_Static_hsc_opts, [], [String])
+
 lookUp          :: FAST_STRING -> Bool
 lookup_int              :: String -> Maybe Int
 lookup_def_int   :: String -> Int -> Int
 lookup_def_float :: String -> Float -> Float
 lookup_str       :: String -> Maybe String
 
-lookUp     sw = sw `elem` argv
+unpacked_static_opts = unsafePerformIO (readIORef v_Static_hsc_opts)
+packed_static_opts   = map _PK_ unpacked_static_opts
+
+lookUp     sw = sw `elem` packed_static_opts
        
-lookup_str sw = firstJust (map (startsWith sw) unpacked_opts)
+lookup_str sw = firstJust (map (startsWith sw) unpacked_static_opts)
 
 lookup_int sw = case (lookup_str sw) of
                  Nothing -> Nothing
@@ -340,7 +350,6 @@ lookup_def_float sw def = case (lookup_str sw) of
                            Nothing -> def              -- Use default
                            Just xx -> read xx
 
-unpacked_opts = map _UNPK_ argv
 
 {-
  Putting the compiler options into temporary at-files
@@ -352,7 +361,7 @@ unpacked_opts :: [String]
 unpacked_opts =
   concat $
   map (expandAts) $
-  map _UNPK_ argv
+  map _UNPK_ argv  -- NOT ARGV any more: v_Static_hsc_opts
   where
    expandAts ('@':fname) = words (unsafePerformIO (readFile fname))
    expandAts l = [l]
index 49476af..f3299af 100644 (file)
@@ -1,5 +1,5 @@
 -----------------------------------------------------------------------------
--- $Id: DriverState.hs,v 1.7 2000/10/26 16:21:02 sewardj Exp $
+-- $Id: DriverState.hs,v 1.8 2000/10/26 16:51:44 sewardj Exp $
 --
 -- Settings for the driver
 --
@@ -93,8 +93,6 @@ cHaskell1Version = "5" -- i.e., Haskell 98
 -----------------------------------------------------------------------------
 -- Global compilation flags
 
-GLOBAL_VAR(v_Static_hsc_opts, [], [String])
-
 -- location of compiler-related files
 GLOBAL_VAR(v_TopDir,  clibdir, String)
 GLOBAL_VAR(v_Inplace, False,   Bool)
index bc5d04b..e3e58f0 100644 (file)
@@ -1,6 +1,6 @@
 {-# OPTIONS -W -fno-warn-incomplete-patterns #-}
 -----------------------------------------------------------------------------
--- $Id: Main.hs,v 1.10 2000/10/26 16:21:02 sewardj Exp $
+-- $Id: Main.hs,v 1.11 2000/10/26 16:51:44 sewardj Exp $
 --
 -- GHC Driver program
 --
@@ -21,7 +21,7 @@ import DriverFlags
 import DriverMkDepend
 import DriverUtil
 import DriverPhases    ( Phase(..) )
-import CmdLineOpts     ( HscLang(..), DynFlags(..) )
+import CmdLineOpts     ( HscLang(..), DynFlags(..), v_Static_hsc_opts )
 import TmpFiles
 import Config
 import Util
@@ -42,6 +42,8 @@ import List
 import System
 import Maybe
 
+import CompManager
+
 -----------------------------------------------------------------------------
 -- Changes:
 
index 7cf5dd2..6e7fbf6 100644 (file)
@@ -1,6 +1,6 @@
 {-
 -----------------------------------------------------------------------------
-$Id: Parser.y,v 1.44 2000/10/24 13:23:33 sewardj Exp $
+$Id: Parser.y,v 1.45 2000/10/26 16:51:44 sewardj Exp $
 
 Haskell grammar.
 
@@ -12,7 +12,6 @@ Author(s): Simon Marlow, Sven Panne 1997, 1998, 1999
 module Parser ( parse ) where
 
 import HsSyn
-import HsPragmas
 import HsTypes         ( mkHsTupCon )
 import HsPat            ( InPat(..) )