[project @ 2000-10-27 14:22:34 by sewardj]
authorsewardj <unknown>
Fri, 27 Oct 2000 14:22:34 +0000 (14:22 +0000)
committersewardj <unknown>
Fri, 27 Oct 2000 14:22:34 +0000 (14:22 +0000)
Final mods to make it compile with 4.08.1.  You don't get an interpreter
like that, tho.

ghc/compiler/ghci/CmLink.lhs
ghc/compiler/ghci/CompManager.lhs
ghc/compiler/stgSyn/StgInterp.lhs
ghc/compiler/utils/Digraph.lhs
ghc/compiler/utils/Util.lhs

index 70a5f42..3ec42dd 100644 (file)
@@ -13,14 +13,14 @@ module CmLink ( Linkable(..),  Unlinked(..),
 where
 
 import StgInterp       ( linkIModules, ClosureEnv, ItblEnv )
-
+import Linker          ( loadObj, resolveObjs )
 import CmStaticInfo    ( PackageConfigInfo )
 import Module          ( ModuleName, PackageName )
 import InterpSyn       ( UnlinkedIBind, HValue, binder )
 import Module          ( Module )
 import Outputable      ( SDoc )
 import FiniteMap       ( emptyFM )
-import Digraph         ( SCC(..) )
+import Digraph         ( SCC(..), flattenSCC )
 import Outputable
 import Panic           ( panic )
 
@@ -89,8 +89,23 @@ link :: PackageConfigInfo
      -> PersistentLinkerState 
      -> IO LinkResult
 
+#ifndef GHCI_NOTYET
+--link = panic "CmLink.link: not implemented"
+link pci groups pls1
+   = do putStrLn "Hello from the Linker!"
+        putStrLn (showSDoc (vcat (map ppLinkableSCC groups)))
+        putStrLn "Bye-bye from the Linker!"
+        return (LinkOK pls1)
+
+ppLinkableSCC :: SCC Linkable -> SDoc
+ppLinkableSCC = ppr . flattenSCC
+
+#else
+
+
 link pci [] pls = return (LinkOK pls)
-link pci (group:groups) pls = do
+link pci (groupSCC:groups) pls = do
+   let group = flattenSCC groupSCC
    -- the group is either all objects or all interpretable, for now
    if all isObject group
        then do mapM loadObj [ file | DotO file <- group ]
@@ -106,6 +121,8 @@ link pci (group:groups) pls = do
                                   itbl_env=new_itbl_env})
     else
        return (LinkErrs pls (ptext SLIT("linker: group must contain all objects or all interpreted modules")))
+#endif
+
 
 modname_of_linkable (LM nm _) = nm
 modname_of_linkable (LP _)    = panic "modname_of_linkable: package"
index f3bedc6..d68a7a0 100644 (file)
@@ -285,12 +285,6 @@ simple_transitive_closure graph set
          else simple_transitive_closure graph set2
 
 
-flattenSCCs :: [SCC a] -> [a]
-flattenSCCs = concatMap flatten
-
-flatten (AcyclicSCC v) = [v]
-flatten (CyclicSCC vs) = vs
-
 -- For each module in mods_to_group, extract the relevant linkable
 -- out of UI, and arrange these linkables in SCCs as defined by modGraph.
 -- All this is so that we can pass SCCified Linkable groups to the
index 8e98946..3f7ad4b 100644 (file)
@@ -31,9 +31,14 @@ module StgInterp (
 
 #if __GLASGOW_HASKELL__ <= 408
 
-import Panic ( panic )
-type ItblEnv = ()
-type ClosureEnv = ()
+import Panic           ( panic )
+import RdrName                 ( RdrName )
+import PrelAddr        ( Addr )
+import FiniteMap       ( FiniteMap )
+import InterpSyn       ( HValue )
+
+type ItblEnv    = FiniteMap RdrName Addr
+type ClosureEnv = FiniteMap RdrName HValue
 linkIModules   = panic "StgInterp.linkIModules: this hsc was not built with an interpreter"
 stgToInterpSyn = panic "StgInterp.linkIModules: this hsc was not built with an interpreter"
 
index f09d465..df34dde 100644 (file)
@@ -2,7 +2,7 @@
 module Digraph(
 
        -- At present the only one with a "nice" external interface
-       stronglyConnComp, stronglyConnCompR, SCC(..),
+       stronglyConnComp, stronglyConnCompR, SCC(..), flattenSCC, flattenSCCs,
 
        Graph, Vertex, 
        graphFromEdges, buildG, transposeG, reverseE, outdegree, indegree,
@@ -56,6 +56,14 @@ import List
 data SCC vertex = AcyclicSCC vertex
                | CyclicSCC  [vertex]
 
+flattenSCCs :: [SCC a] -> [a]
+flattenSCCs = concatMap flattenSCC
+
+flattenSCC (AcyclicSCC v) = [v]
+flattenSCC (CyclicSCC vs) = vs
+\end{code}
+
+\begin{code}
 stronglyConnComp
        :: Ord key
        => [(node, key, [key])]         -- The graph; its ok for the
index 54066f6..471089d 100644 (file)
@@ -53,7 +53,7 @@ module Util (
 #endif
 
        , global
-       , myProcessID
+       , myGetProcessID
 
 #if __GLASGOW_HASKELL__ <= 408
        , catchJust
@@ -724,10 +724,10 @@ throwTo   = raiseInThread
 #endif
 
 #ifdef mingw32_TARGET_OS
-foreign import "_getpid" myProcessID :: IO Int 
+foreign import "_getpid" myGetProcessID :: IO Int 
 #else
-myProcessID :: IO Int
-myProcessID = do hPutStrLn stderr "Warning:myProcessID"
-                 return 12345
+myGetProcessID :: IO Int
+myGetProcessID = do hPutStrLn stderr "Warning:faking process ID in myGetProcessID"
+                    return 12345
 #endif
 \end{code}