+ -- Dunno if the above comment is still meaningful now. JRS 001024.
+
+ do let filenm = dopt_OutName dflags
+ stub_names <- outputForeignStubs dflags c_code h_code
+ case dopt_HscLang dflags of
+ HscInterpreted -> return stub_names
+ HscAsm -> outputAsm dflags filenm flat_abstractC
+ >> return stub_names
+ HscC -> outputC dflags filenm flat_abstractC
+ >> return stub_names
+ HscJava -> outputJava dflags filenm mod_name tycons core_binds
+ >> return stub_names
+
+doOutput :: String -> (Handle -> IO ()) -> IO ()
+doOutput filenm io_action
+ = (do handle <- openFile filenm WriteMode
+ io_action handle
+ hClose handle)
+ `catch` (\err -> pprPanic "Failed to open or write code output file"
+ (text filenm))
+\end{code}
+
+
+%************************************************************************
+%* *
+\subsection{C}
+%* *
+%************************************************************************
+
+\begin{code}
+outputC dflags filenm flat_absC
+ = do dumpIfSet_dyn dflags Opt_D_dump_realC "Real C" (dumpRealC flat_absC)
+ doOutput filenm (\ h -> writeRealC h flat_absC)
+\end{code}
+
+
+%************************************************************************
+%* *
+\subsection{Assembler}
+%* *
+%************************************************************************
+
+\begin{code}
+outputAsm dflags filenm flat_absC
+