|
definition: |
execIProg :: IOptions -> IProg -> String -> IO ([TG.State])
execIProg opts (IProg _ _ _ ifuns) f = do
let (g,ni) = addNode (FuncNode f []) emptyGraph
pdfmain = optOutput (icOptions opts)
opts1 = if null pdfmain
then opts
else opts { icOptions = (icOptions opts) { optShowGraph = 0 }
, stepNum = 1 }
when (withGraph opts1 > 0) $
viewDot (Just $ optViewPDF (icOptions opts)) 0
(graphToDot g [] (withGraph opts1 > 2) (withGraph opts1 > 1))
let allfuns = ifuns ++ standardFuncs
unless (arityOf f allfuns == 0) $
error $ "Main function '" ++ f ++ "' has non-zero arity!"
(opts2,states) <- runWith opts1 (initState allfuns g ni) []
unless (null pdfmain) $ do
-- Concatenate all step PDFs into on PDF:
let pdffiles = map (\i -> "ICURRYDOT" ++ show i ++ ".pdf")
[1 .. stepNum opts2]
system $ unwords $ "pdftk" : pdffiles ++ ["cat", "output", pdfmain]
system $ unwords $ "/bin/rm -f" : pdffiles
putStrLn $ "PDFs of all steps written to '" ++ pdfmain ++ "'."
return states
where
checkMainFunc ifs f = do
let IFunction _ ar _ _ _ = funcOf f ifs
unless (ar == 0) $ error $ "Function '" ++ f ++ "' has non-zero arity!"
|
|
demand: |
argument 2 |
|
deterministic: |
deterministic operation |
|
documentation: |
An interpreter for ICurry programs. Executes a program with a main function where the name is provided as a string. It also prints intermediate steps, PDFs, etc. accordding to the options. |
|
failfree: |
<FAILING> |
|
indeterministic: |
referentially transparent operation |
|
infix: |
no fixity defined |
|
iotype: |
{(_,{IProg},_) |-> _}
|
|
name: |
execIProg |
|
precedence: |
no precedence defined |
|
result-values: |
_ |
|
signature: |
IOptions -> ICurry.Types.IProg -> String -> Prelude.IO [TermGraph.XML.State] |
|
solution-complete: |
operation might suspend on free variables |
|
terminating: |
possibly non-terminating |
|
totally-defined: |
possibly non-reducible on same data term |