\begin{code}
module HscMain (
- HscResult(..), hscMain, newHscEnv, hscBufferFrontEnd
+ HscResult(..), hscMain, newHscEnv, hscCmmFile, hscBufferFrontEnd
#ifdef GHCI
, hscStmt, hscTcExpr, hscKcType, hscThing,
, compileExpr
import Type ( Type )
import PrelNames ( iNTERACTIVE )
import StringBuffer ( stringToStringBuffer )
-import SrcLoc ( noSrcLoc, Located(..) )
+import SrcLoc ( SrcLoc, noSrcLoc, Located(..) )
import Kind ( Kind )
import Var ( Id )
import CoreLint ( lintUnfolding )
import Name ( Name, NamedThing(..) )
import SimplStg ( stg2stg )
import CodeGen ( codeGen )
+import CmmParse ( parseCmmFile )
import CodeOutput ( codeOutput )
import CmdLineOpts
}
+hscCmmFile :: DynFlags -> FilePath -> IO Bool
+hscCmmFile dflags filename = do
+ maybe_cmm <- parseCmmFile dflags filename
+ case maybe_cmm of
+ Nothing -> return False
+ Just cmm -> do
+ codeOutput dflags no_mod NoStubs noDependencies [cmm]
+ return True
+ where
+ no_mod = panic "hscCmmFile: no_mod"
+
+
myParseModule dflags src_filename
= do -------------------------- Parser ----------------
showPass dflags "Parser"
:: HscEnv
-> InteractiveContext -- Context for compiling
-> String -- The identifier
- -> IO [(IfaceDecl, Fixity)]
+ -> IO [(IfaceDecl, Fixity, SrcLoc)]
hscThing hsc_env ic str
= do maybe_rdr_name <- hscParseIdentifier (hsc_dflags hsc_env) str