icurryOnModule :: ICOptions -> String -> IO ()
icurryOnModule opts modname = do
checkExecutables opts
iprog <- icCompile opts modname
let imain = optMain opts
if null imain
then
if optOutput opts == "-"
then putStrLn (showTerm iprog)
else do
icyname <- if null (optOutput opts) then iCurryFilePath modname
else return $ optOutput opts
writeICurryFile icyname iprog
printStatus opts $ "ICurry program written to '" ++ icyname ++ "'"
else do
printStatus opts $ "Executing main function '" ++ imain ++ "'..."
let iopts1 = defOpts { icOptions = opts }
iopts2 = if optShowGraph opts > 0 then iopts1 { waitTime = 1 }
else iopts1
states <- execIProg iopts2 iprog imain
let xmlgraphs = states2XmlGraphs states
when (optTermGraph opts && (not $ null $ optXMLOutput opts)) $
writeXmlFile (((++ ".xml") . optXMLOutput) opts) xmlgraphs
when (optTermGraph opts && (not $ null $ optGraphOutput opts)) $ do
createDirectoryIfMissing True (optGraphOutput opts)
graphs2Svgs (optShowNodeIDs opts)
(graphSvg Nothing)
((optGraphOutput opts) ++ "/img")
states
when (optTermGraph opts && (not $ null $ optTreeOutput opts)) $ do
createDirectoryIfMissing True (optTreeOutput opts)
graphs2Svgs (optShowNodeIDs opts)
(treeSvg (optTreeDepth opts) Nothing)
((optTreeOutput opts) ++ "/img")
states
|