~ubuntu-branches/ubuntu/warty/happy/warty

« back to all changes in this revision

Viewing changes to glafp-utils/nofib-analyse/CmdLine.hs

  • Committer: Bazaar Package Importer
  • Author(s): Ian Lynagh (wibble)
  • Date: 2004-04-03 15:51:47 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20040403155147-47pwz4txfls12i4q
Tags: 1.13-0tarball-5
Fix pragmas (missing #) in Parser.hs as recent GHCs were barfing.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
-----------------------------------------------------------------------------
 
2
-- CmdLine.hs
 
3
 
 
4
-- (c) Simon Marlow 1999
 
5
-----------------------------------------------------------------------------
 
6
 
 
7
module CmdLine where
 
8
 
 
9
import GetOpt
 
10
import System
 
11
import IOExts
 
12
 
 
13
-----------------------------------------------------------------------------
 
14
-- Command line arguments
 
15
 
 
16
args = unsafePerformIO getArgs
 
17
(flags, other_args, cmdline_errors) = getOpt Permute argInfo args 
 
18
 
 
19
default_tooquick_threshold = 0.2 {- secs -} :: Float
 
20
tooquick_threshold
 
21
 = case [ i | OptIgnoreSmallTimes i <- flags ] of
 
22
        [] -> default_tooquick_threshold
 
23
        (i:_) -> i
 
24
 
 
25
devs   = OptDeviations   `elem` flags
 
26
nodevs = OptNoDeviations `elem` flags
 
27
 
 
28
default_title = "NoFib Results"
 
29
reportTitle = case [ t | OptTitle t <- flags ] of
 
30
        []    -> default_title
 
31
        (t:_) -> t
 
32
 
 
33
data CLIFlags
 
34
  = OptASCIIOutput
 
35
  | OptHTMLOutput
 
36
  | OptIgnoreSmallTimes Float
 
37
  | OptDeviations
 
38
  | OptNoDeviations
 
39
  | OptTitle String
 
40
  | OptHelp
 
41
  deriving Eq
 
42
 
 
43
argInfo :: [ OptDescr CLIFlags ]
 
44
argInfo = 
 
45
  [ Option ['?'] ["help"]    (NoArg OptHelp)        
 
46
        "Display this message"
 
47
  , Option ['a'] ["ascii"]   (NoArg OptASCIIOutput) 
 
48
        "Produce ASCII output (default)"
 
49
  , Option ['h'] ["html"]    (NoArg OptHTMLOutput)  
 
50
        "Produce HTML output"
 
51
  , Option ['i'] ["ignore"]  (ReqArg (OptIgnoreSmallTimes . read) "secs")
 
52
        "Ignore runtimes smaller than <secs>"
 
53
  , Option ['d'] ["deviations"] (NoArg OptDeviations)
 
54
        "Display deviations (default)"
 
55
  , Option ['n'] ["nodeviations"] (NoArg OptNoDeviations)
 
56
        "Hide deviations"
 
57
  , Option ['t'] ["title"] (ReqArg OptTitle "title")
 
58
        "Specify report title"
 
59
  ]
 
60