@@ -16,21 +16,18 @@ import Paths_idris
17import Util.System
17import Util.System
19−data Opts = Opts { really :: Bool,
20− inputs :: [FilePath],
19+data Opts = Opts { inputs :: [FilePath],
21 interface :: Bool,
20 interface :: Bool,
22 output :: FilePath }
21 output :: FilePath }
24showUsage = do putStrLn "A code generator which is intended to be called by the compiler, not by a user."
23showUsage = do putStrLn "A code generator which is intended to be called by the compiler, not by a user."
25− putStrLn "To call the code generator manually, pass the --yes-really option.\n"
26− putStrLn "Usage: idris-codegen-c [--yes-really] <ibc-files> [-o <output-file>]"
24+ putStrLn "Usage: idris-codegen-c <ibc-files> [-o <output-file>]"
27 exitWith ExitSuccess
25 exitWith ExitSuccess
29getOpts :: IO Opts
27getOpts :: IO Opts
30getOpts = do xs <- getArgs
28getOpts = do xs <- getArgs
31− return $ process (Opts False [] False "a.out") xs
29+ return $ process (Opts [] False "a.out") xs
33− process opts ("--yes-really":xs) = process (opts { really = True }) xs
34 process opts ("-o":o:xs) = process (opts { output = o }) xs
31 process opts ("-o":o:xs) = process (opts { output = o }) xs
35 process opts ("--interface":xs) = process (opts { interface = True }) xs
32 process opts ("--interface":xs) = process (opts { interface = True }) xs
36 process opts (x:xs) = process (opts { inputs = x:inputs opts }) xs
33 process opts (x:xs) = process (opts { inputs = x:inputs opts }) xs
@@ -50,8 +47,4 @@ main :: IO ()
50main = do opts <- getOpts
47main = do opts <- getOpts
51 if (null (inputs opts))
48 if (null (inputs opts))
52 then showUsage
49 then showUsage
53− else if (not $ really opts)
54− then do putStrLn "This code generator is intended to be called by the Idris compiler. \
55− \Please pass Idris the '--codegen' flag to choose a backend."
57− else runMain (c_main opts)
50+ else runMain (c_main opts)