{-# OPTIONS -#include "Linker.h" -#include "SchedAPI.h" #-}
-----------------------------------------------------------------------------
--- $Id: InteractiveUI.hs,v 1.111 2002/01/28 12:01:12 simonmar Exp $
+-- $Id: InteractiveUI.hs,v 1.116 2002/02/28 10:15:47 simonmar Exp $
--
-- GHC Interactive User Interface
--
import Id ( isRecordSelector, recordSelectorFieldLabel,
isDataConWrapId, isDataConId, idName )
import Class ( className )
-import TyCon ( tyConName, tyConClass_maybe, isPrimTyCon )
+import TyCon ( tyConName, tyConClass_maybe, isPrimTyCon, DataConDetails(..) )
import FieldLabel ( fieldLabelTyCon )
import SrcLoc ( isGoodSrcLoc )
import Module ( moduleName )
import Char
import Monad
-import PrelGHC ( unsafeCoerce# )
+import GlaExts ( unsafeCoerce# )
+
import Foreign ( nullPtr )
import CString ( peekCString )
_ -> panic "interactiveUI:buffering"
(cmstate, maybe_hval)
- <- cmCompileExpr cmstate dflags "IO.hFlush PrelHandle.stderr"
+ <- cmCompileExpr cmstate dflags "IO.hFlush IO.stderr"
case maybe_hval of
Just hval -> writeIORef flush_stderr (unsafeCoerce# hval :: IO ())
_ -> panic "interactiveUI:stderr"
(cmstate, maybe_hval)
- <- cmCompileExpr cmstate dflags "IO.hFlush PrelHandle.stdout"
+ <- cmCompileExpr cmstate dflags "IO.hFlush IO.stdout"
case maybe_hval of
Just hval -> writeIORef flush_stdout (unsafeCoerce# hval :: IO ())
_ -> panic "interactiveUI:stdout"
+ -- We don't want the cmd line to buffer any input that might be
+ -- intended for the program, so unbuffer stdin.
+ hSetBuffering stdin NoBuffering
+
-- initial context is just the Prelude
cmstate <- cmSetContext cmstate dflags [] ["Prelude"]
checkPerms :: String -> IO Bool
checkPerms name =
- handle (\_ -> return False) $ do
+ DriverUtil.handle (\_ -> return False) $ do
#ifdef mingw32_TARGET_OS
doesFileExist name
#else
thingDecl thing@(ATyCon t) =
let rn_decl = ifaceTyThing thing in
case rn_decl of
- TyData { tcdCons = cons } ->
- rn_decl{ tcdCons = filter conIsVisible cons }
+ TyData { tcdCons = DataCons cons } ->
+ rn_decl{ tcdCons = DataCons (filter conIsVisible cons) }
other -> other
where
conIsVisible (ConDecl n _ _ _ _ _) = n `elem` thing_names
looksLikeModuleName [] = False
looksLikeModuleName (c:cs) = isUpper c && all isAlphaNumEx cs
-isAlphaNumEx c = isAlphaNum c || c == '_'
+isAlphaNumEx c = isAlphaNum c || c == '_' || c == '.'
maybePutStr dflags s | verbosity dflags > 0 = putStr s
| otherwise = return ()