From 374b9f5b4cd059a7b4b28ef2f3bbc18e96d276c9 Mon Sep 17 00:00:00 2001 From: sewardj Date: Thu, 26 Oct 2000 16:51:44 +0000 Subject: [PATCH] [project @ 2000-10-26 16:51:44 by sewardj] Final changes to get it to compile. --- ghc/compiler/ghci/CompManager.lhs | 9 ++++++++- ghc/compiler/main/CmdLineOpts.lhs | 17 +++++++++++++---- ghc/compiler/main/DriverState.hs | 4 +--- ghc/compiler/main/Main.hs | 6 ++++-- ghc/compiler/parser/Parser.y | 3 +-- 5 files changed, 27 insertions(+), 12 deletions(-) diff --git a/ghc/compiler/ghci/CompManager.lhs b/ghc/compiler/ghci/CompManager.lhs index dc03339..f3bedc6 100644 --- a/ghc/compiler/ghci/CompManager.lhs +++ b/ghc/compiler/ghci/CompManager.lhs @@ -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} diff --git a/ghc/compiler/main/CmdLineOpts.lhs b/ghc/compiler/main/CmdLineOpts.lhs index ab25539..a678e34 100644 --- a/ghc/compiler/main/CmdLineOpts.lhs +++ b/ghc/compiler/main/CmdLineOpts.lhs @@ -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] diff --git a/ghc/compiler/main/DriverState.hs b/ghc/compiler/main/DriverState.hs index 49476af..f3299af 100644 --- a/ghc/compiler/main/DriverState.hs +++ b/ghc/compiler/main/DriverState.hs @@ -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) diff --git a/ghc/compiler/main/Main.hs b/ghc/compiler/main/Main.hs index bc5d04b..e3e58f0 100644 --- a/ghc/compiler/main/Main.hs +++ b/ghc/compiler/main/Main.hs @@ -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: diff --git a/ghc/compiler/parser/Parser.y b/ghc/compiler/parser/Parser.y index 7cf5dd2..6e7fbf6 100644 --- a/ghc/compiler/parser/Parser.y +++ b/ghc/compiler/parser/Parser.y @@ -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(..) ) -- 1.7.10.4