[project @ 2002-02-11 08:20:38 by chak]
[ghc-hetmet.git] / ghc / compiler / main / ErrUtils.lhs
index a262bd6..c8beedd 100644 (file)
@@ -12,6 +12,7 @@ module ErrUtils (
 
        printErrorsAndWarnings, pprBagOfErrors, pprBagOfWarnings,
 
+       printError,
        ghcExit,
        doIfSet, doIfSet_dyn, 
        dumpIfSet, dumpIfSet_core, dumpIfSet_dyn, dumpIfSet_dyn_or, 
@@ -26,8 +27,9 @@ import Util           ( sortLt )
 import Outputable
 import CmdLineOpts     ( DynFlags(..), DynFlag(..), dopt )
 
+import List             ( replicate )
 import System          ( ExitCode(..), exitWith )
-import IO              ( hPutStr, stderr )
+import IO              ( hPutStr, hPutStrLn, stderr, stdout )
 \end{code}
 
 \begin{code}
@@ -69,6 +71,10 @@ dontAddErrLoc msg = (noSrcLoc, msg)
 
 \end{code}
 
+\begin{code}
+printError :: String -> IO ()
+printError str = hPutStrLn stderr str
+\end{code}
 
 \begin{code}
 type Messages = (Bag WarnMsg, Bag ErrMsg)
@@ -140,8 +146,12 @@ dumpIfSet_core dflags flag hdr doc
 
 dumpIfSet_dyn :: DynFlags -> DynFlag -> String -> SDoc -> IO ()
 dumpIfSet_dyn dflags flag hdr doc
-  | dopt flag dflags || verbosity dflags >= 4 = printDump (dump hdr doc)
-  | otherwise                                 = return ()
+  | dopt flag dflags || verbosity dflags >= 4 
+  = if   flag `elem` [Opt_D_dump_stix, Opt_D_dump_asm]
+    then printForC stdout (dump hdr doc)
+    else printDump (dump hdr doc)
+  | otherwise
+  = return ()
 
 dumpIfSet_dyn_or :: DynFlags -> [DynFlag] -> String -> SDoc -> IO ()
 dumpIfSet_dyn_or dflags flags hdr doc
@@ -156,5 +166,5 @@ dump hdr doc
           doc,
           text ""]
      where 
-        line = text (take 20 (repeat '='))
+        line = text (replicate 20 '=')
 \end{code}