Added a command-line option to print out the module directory

This commit is contained in:
Neil Brown 2009-04-04 12:30:09 +00:00
parent cfcf50297f
commit d595b73f28

View File

@ -49,6 +49,7 @@ import ParseOccam
import ParseRain import ParseRain
import Pass import Pass
import PassList import PassList
import Paths
import PreprocessOccam import PreprocessOccam
import PrettyShow import PrettyShow
import ShowCode import ShowCode
@ -73,6 +74,7 @@ optionsNoWarnings =
, Option [] ["run-indent"] (NoArg $ optRunIndent) "run indent on source before compilation (will full mode)" , Option [] ["run-indent"] (NoArg $ optRunIndent) "run indent on source before compilation (will full mode)"
, Option [] ["frontend"] (ReqArg optFrontend "FRONTEND") "language frontend (options: occam, rain)" , Option [] ["frontend"] (ReqArg optFrontend "FRONTEND") "language frontend (options: occam, rain)"
, Option [] ["mode"] (ReqArg optMode "MODE") "select mode (options: flowgraph, lex, html, parse, compile, post-c, full)" , Option [] ["mode"] (ReqArg optMode "MODE") "select mode (options: flowgraph, lex, html, parse, compile, post-c, full)"
, Option [] ["module-path"] (NoArg $ optPrintPath tockModuleDir) "print module path"
, Option ['c'] ["no-main"] (NoArg optNoMain) "file has no main process; do not link either" , Option ['c'] ["no-main"] (NoArg optNoMain) "file has no main process; do not link either"
, Option ['o'] ["output"] (ReqArg optOutput "FILE") "output file (default \"-\")" , Option ['o'] ["output"] (ReqArg optOutput "FILE") "output file (default \"-\")"
, Option [] ["sanity-check"] (ReqArg optSanityCheck "SETTING") "internal sanity check (options: on, off)" , Option [] ["sanity-check"] (ReqArg optSanityCheck "SETTING") "internal sanity check (options: on, off)"
@ -156,6 +158,9 @@ optStackSize s ps = return $ ps { csUnknownStackSize = read s }
optOutput :: String -> OptFunc optOutput :: String -> OptFunc
optOutput s ps = return $ ps { csOutputFile = s } optOutput s ps = return $ ps { csOutputFile = s }
optPrintPath :: String -> OptFunc
optPrintPath path _ = printString path
optPrintHelp :: OptFunc optPrintHelp :: OptFunc
optPrintHelp _ = printString $ usageInfo "Usage: tock [OPTION...] SOURCEFILE" optionsNoWarnings optPrintHelp _ = printString $ usageInfo "Usage: tock [OPTION...] SOURCEFILE" optionsNoWarnings