remove the ITBL_SIZE constants which were wrong, but fortunately unused
[ghc-hetmet.git] / compiler / ghci / GhciMonad.hs
index e536841..eaea844 100644 (file)
@@ -1,3 +1,11 @@
+-----------------------------------------------------------------------------
+--
+-- Monadery code used in InteractiveUI
+--
+-- (c) The GHC Team 2005-2006
+--
+-----------------------------------------------------------------------------
+
 module GhciMonad where
 
 #include "HsVersions.h"
@@ -8,6 +16,7 @@ import Breakpoints
 import Outputable
 import Panic hiding (showException)
 import Util
+import DynFlags
 
 import Numeric
 import Control.Exception as Exception
@@ -124,6 +133,8 @@ showForUser doc = do
 
 data InfSessionException = 
              StopChildSession -- A child session requests to be stopped
+           | StopParentSession -- A child session requests to be stopped 
+                               -- AND that the parent session quits after that
            | ChildSessionStopped String  -- A child session has stopped
   deriving Typeable
 
@@ -195,8 +206,14 @@ flush_cmd = command_sequence [flush_buffer "stdout", flush_buffer "stderr"]
 
 initInterpBuffering :: GHC.Session -> IO ()
 initInterpBuffering session
- = do maybe_hval <- GHC.compileExpr session no_buf_cmd
-       
+ = do -- we don't want to be fooled by any modules lying around in the current
+      -- directory when we compile these code fragments, so set the import
+      -- path to be empty while we compile them.
+      dflags <- GHC.getSessionDynFlags session
+      GHC.setSessionDynFlags session dflags{importPaths=[]}
+
+      maybe_hval <- GHC.compileExpr session no_buf_cmd
+
       case maybe_hval of
        Just hval -> writeIORef turn_off_buffering (unsafeCoerce# hval :: IO ())
        other     -> panic "interactiveUI:setBuffering"
@@ -206,6 +223,8 @@ initInterpBuffering session
        Just hval -> writeIORef flush_interp (unsafeCoerce# hval :: IO ())
        _         -> panic "interactiveUI:flush"
 
+      GHC.setSessionDynFlags session dflags
+      GHC.workingDirectoryChanged session
       return ()