definition:
|
options :: [OptDescr (ICOptions -> ICOptions)]
options =
[ Option "h?" ["help"]
(NoArg (\opts -> opts { optHelp = True }))
"print help and exit"
, Option "q" ["quiet"]
(NoArg (\opts -> opts { optVerb = 0 }))
"run quietly (no output, only exit code)"
, Option "v" ["verbosity"]
(OptArg (maybe (checkVerb 2) (safeReadNat checkVerb)) "<n>")
"verbosity level:\n0: quiet (same as `-q')\n1: show status messages (default)\n2: show generated program (same as `-v')\n3: show all details"
, Option "o" ["output"]
(ReqArg (\s opts -> opts { optOutput = s }) "<f>")
("output file for ICurry program (or '-')\n(otherwise: store in " ++
currySubdir ++ "/MOD.icy)\nor PDF containing term graphs (with option '-g')")
, Option "m" ["main"]
(ReqArg (\s opts -> opts { optMain = s }) "<f>")
"name of the main function to be interpreted\n(otherwise the ICurry program is stored)"
, Option "g" ["graph"]
(OptArg (maybe (checkGraph 1) (safeReadNat checkGraph)) "<n>")
("level to visualize term graph during execution:\n" ++
"0: do not show term graph\n" ++
"1: show term graph (same as `-g`)\n (requires 'dot' and '" ++
viewer ++ "')\n" ++
"2: show full term graph\n3: show full graph with node IDs")
, Option "" ["viewer"]
(ReqArg (\s opts -> opts { optViewPDF = s }) "<c>")
("command to view PDF files (default: '" ++ viewer ++ "')")
, Option "i" ["interactive"]
(NoArg (\opts -> opts { optInteractive = True }))
"interactive execution (ask after each step/result)"
, Option "" ["nolifting"]
(NoArg (\opts -> opts { optLift = False }))
"do not lift nested case/let expressions"
, Option "" ["optvardecls"]
(NoArg (\opts -> opts { optVarDecls = True }))
"do not generate variable declarations when\nvariables are introduced by assignments"
, Option "" ["graphxml"]
(OptArg (\s opts -> opts { optTermGraph = True
, optXMLOutput = (fromMaybe "icurryGraph" s) })
"<f>")
"store XML representation of term graphs\nfor each computation step in file <f>.xml"
, Option "" ["graphsvg"]
(OptArg (\s opts -> opts { optTermGraph = True
, optGraphOutput = (fromMaybe "icurryGraphs" s) })
"<d>")
"store SVG representations of term graphs\nfor each computation step in directory <d>"
, Option "" ["treesvg"]
(OptArg (\s opts -> opts { optTermGraph = True
, optTreeOutput = (fromMaybe "icurryTree" s) })
"<d>")
"store SVG representations of term graphs as trees\nfor each computation step in directory <d>"
, Option "" ["shownodeids"]
(NoArg (\opts -> opts { optShowNodeIDs = True }))
"show NodeIDs in visualized graphs"
, Option "" ["maxdepth"]
(ReqArg (safeReadNat checkDepth) "<n>")
"max depth for tree visualization, default is 10"
, Option "" ["maxsteps"]
(ReqArg (safeReadNat checkMaxSteps) "<n>")
"max number of computation steps, default is 100"
]
where
viewer = optViewPDF defaultICOptions
safeReadNat opttrans s opts = case readNat s of
[(n,"")] -> opttrans n opts
_ -> error "Illegal number argument (try `-h' for help)"
checkVerb n opts = if n>=0 && n<4
then opts { optVerb = n }
else error "Illegal verbosity level (try `-h' for help)"
checkGraph n opts = if n>=0 && n<4
then opts { optShowGraph = n }
else error "Illegal graph level (try `-h' for help)"
checkDepth n opts = if n>=0
then opts { optTreeDepth = n }
else error "Illegal max depth (try `-h' for help)"
checkMaxSteps n opts = if n>0
then opts { optMaxSteps = n }
else error "Illegal max steps (try `-h' for help)"
|