\ignore{ \begin{code} module JavaGen (javaGen) where import Brianweb.Java (writeClass,c_this) import Brianweb.Text.PrettyPrint.Outputable as BTPO (ppr,render) import GCodeUtils (localAllocator,tailCallify,qualify) import StgToGCode (transModule) import GCodeToJava (buildModule) import CostCentre (CollectedCCs) import DynFlags (DynFlag(..),DynFlags(..)) import ErrUtils (dumpIfSet_dyn) import HscTypes (ForeignStubs(..), HpcInfo) import Id (Id) import Module as M (Module, ModLocation(..)) import Outputable as O (ppr,text,vcat) import StgSyn (StgBinding) import TyCon (TyCon) import Util (splitFilename, joinFileExt) \end{code} } \begin{code} javaGen :: DynFlags -> M.Module -> ModLocation -> [TyCon] -> ForeignStubs -> [M.Module] -> CollectedCCs -> [(StgBinding,[(Id,[Id])])] -> HpcInfo -> IO () javaGen dflags this_mod mod_loc data_tycons _ _ _ binds _ = do let gm = tailCallify (transModule this_mod data_tycons [b|(b,_)<-binds]) dumpIfSet_dyn dflags Opt_D_dump_gcode "GCode" (O.ppr gm) let cs = buildModule (qualify (localAllocator gm)) (ml_hs_file mod_loc) -- FEATURE: Write a Brianweb.Text.PrettyPrint.Outputable -> GHC Outputable converter dumpIfSet_dyn dflags Opt_D_dump_jvm "JVM Bytecode" (vcat (map (O.text.render.BTPO.ppr) cs)) mapM_ outputClass cs where outputClass c = writeClass c (joinFileExt (base++extra) suf) where (base,suf) = splitFilename (hscOutName dflags) (_,extra) = break (=='$') (c_this c) \end{code}