X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=utils%2Fnofib-analyse%2FCmdLine.hs;h=3861a30daed396e1ce153dc3ebee4d1b43edc4dd;hb=c1500e4888be2341c0b6e6897f494766c86feba0;hp=6e920f8c6017129681d2abe36a718418f38b03f6;hpb=0065d5ab628975892cea1ec7303f968c3338cbe1;p=ghc-hetmet.git diff --git a/utils/nofib-analyse/CmdLine.hs b/utils/nofib-analyse/CmdLine.hs index 6e920f8..3861a30 100644 --- a/utils/nofib-analyse/CmdLine.hs +++ b/utils/nofib-analyse/CmdLine.hs @@ -4,7 +4,13 @@ -- (c) Simon Marlow 2005 ----------------------------------------------------------------------------- -module CmdLine where +module CmdLine + ( + flags, other_args, cmdline_errors, + devs, nodevs, tooquick_threshold, reportTitle, + CLIFlags(..), usage, + ) + where import System.Console.GetOpt import System.Environment ( getArgs ) @@ -13,18 +19,26 @@ import System.IO.Unsafe ( unsafePerformIO ) ----------------------------------------------------------------------------- -- Command line arguments +args :: [String] args = unsafePerformIO getArgs + +flags :: [CLIFlags] +other_args :: [String] +cmdline_errors :: [String] (flags, other_args, cmdline_errors) = getOpt Permute argInfo args -default_tooquick_threshold = 0.2 {- secs -} :: Float +default_tooquick_threshold, tooquick_threshold :: Float +default_tooquick_threshold = 0.2 {- secs -} tooquick_threshold = case [ i | OptIgnoreSmallTimes i <- flags ] of [] -> default_tooquick_threshold (i:_) -> i +devs, nodevs :: Bool devs = OptDeviations `elem` flags nodevs = OptNoDeviations `elem` flags +default_title, reportTitle :: String default_title = "NoFib Results" reportTitle = case [ t | OptTitle t <- flags ] of [] -> default_title @@ -43,6 +57,12 @@ data CLIFlags | OptHelp deriving Eq +usageHeader :: String +usageHeader = "usage: nofib-analyse [OPTION...] ..." + +usage :: String +usage = usageInfo usageHeader argInfo + argInfo :: [ OptDescr CLIFlags ] argInfo = [ Option ['?'] ["help"] (NoArg OptHelp)