on master help sign in
Remove --yes-really
b19d03cNiklas Larsson
codegen/idris-codegen-c/Main.hs+4−11
@@ -16,21 +16,18 @@ import Paths_idris
16
16
17import Util.System
17import Util.System
18
18
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 }
23
22
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
28
26
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
32 where
30 where
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."
56− exitWith ExitSuccess
57− else runMain (c_main opts)
50+ else runMain (c_main opts)
codegen/idris-codegen-javascript/Main.hs+5−11
@@ -13,21 +13,19 @@ import System.Exit
13
13
14import Paths_idris
14import Paths_idris
15
15
16−data Opts = Opts { really :: Bool
16+data Opts = Opts {
17− , inputs :: [FilePath]
17+ inputs :: [FilePath]
18 , output :: FilePath
18 , output :: FilePath
19 }
19 }
20
20
21showUsage = do putStrLn "A code generator which is intended to be called by the compiler, not by a user."
21showUsage = do putStrLn "A code generator which is intended to be called by the compiler, not by a user."
22− putStrLn "To call the code generator manually, pass the --yes-really option.\n"
23− putStrLn "Usage: idris-codegen-c [--yes-really] <ibc-files> [-o <output-file>]"
22+ putStrLn "Usage: idris-codegen-javascript <ibc-files> [-o <output-file>]"
24 exitWith ExitSuccess
23 exitWith ExitSuccess
25
24
26getOpts :: IO Opts
25getOpts :: IO Opts
27getOpts = do xs <- getArgs
26getOpts = do xs <- getArgs
28− return $ process (Opts False [] "main.js") xs
27+ return $ process (Opts [] "main.js") xs
29 where
28 where
30− process opts ("--yes-really":xs) = process (opts { really = True }) xs
31 process opts ("-o":o:xs) = process (opts { output = o }) xs
29 process opts ("-o":o:xs) = process (opts { output = o }) xs
32 process opts (x:xs) = process (opts { inputs = x:inputs opts }) xs
30 process opts (x:xs) = process (opts { inputs = x:inputs opts }) xs
33 process opts [] = opts
31 process opts [] = opts
@@ -43,8 +41,4 @@ main :: IO ()
43main = do opts <- getOpts
41main = do opts <- getOpts
44 if (null (inputs opts))
42 if (null (inputs opts))
45 then showUsage
43 then showUsage
46− else if (not $ really opts)
47− then do putStrLn "This code generator is intended to be called by the Idris compiler. \
48− \Please pass Idris the '--codegen' flag to choose a backend."
49− exitWith ExitSuccess
50− else runMain (jsMain opts)
44+ else runMain (jsMain opts)
codegen/idris-codegen-node/Main.hs+4−11
@@ -13,21 +13,18 @@ import System.Exit
13
13
14import Paths_idris
14import Paths_idris
15
15
16−data Opts = Opts { really :: Bool
17− , inputs :: [FilePath]
16+data Opts = Opts { inputs :: [FilePath]
18 , output :: FilePath
17 , output :: FilePath
19 }
18 }
20
19
21showUsage = do putStrLn "A code generator which is intended to be called by the compiler, not by a user."
20showUsage = do putStrLn "A code generator which is intended to be called by the compiler, not by a user."
22− putStrLn "To call the code generator manually, pass the --yes-really option.\n"
23− putStrLn "Usage: idris-codegen-c [--yes-really] <ibc-files> [-o <output-file>]"
21+ putStrLn "Usage: idris-codegen-node <ibc-files> [-o <output-file>]"
24 exitWith ExitSuccess
22 exitWith ExitSuccess
25
23
26getOpts :: IO Opts
24getOpts :: IO Opts
27getOpts = do xs <- getArgs
25getOpts = do xs <- getArgs
28− return $ process (Opts False [] "main.js") xs
26+ return $ process (Opts [] "main.js") xs
29 where
27 where
30− process opts ("--yes-really":xs) = process (opts { really = True }) xs
31 process opts ("-o":o:xs) = process (opts { output = o }) xs
28 process opts ("-o":o:xs) = process (opts { output = o }) xs
32 process opts (x:xs) = process (opts { inputs = x:inputs opts }) xs
29 process opts (x:xs) = process (opts { inputs = x:inputs opts }) xs
33 process opts [] = opts
30 process opts [] = opts
@@ -43,8 +40,4 @@ main :: IO ()
43main = do opts <- getOpts
40main = do opts <- getOpts
44 if (null (inputs opts))
41 if (null (inputs opts))
45 then showUsage
42 then showUsage
46− else if (not $ really opts)
47− then do putStrLn "This code generator is intended to be called by the Idris compiler. \
48− \Please pass Idris the '--codegen' flag to choose a backend."
49− exitWith ExitSuccess
50− else runMain (jsMain opts)
43+ else runMain (jsMain opts)
src/IRTS/Compiler.hs+1−1
@@ -125,7 +125,7 @@ generate codegen mainmod ir
125 Via "c" -> codegenC ir
125 Via "c" -> codegenC ir
126 -- Any external code generator
126 -- Any external code generator
127 Via cg -> do let cmd = "idris-codegen-" ++ cg
127 Via cg -> do let cmd = "idris-codegen-" ++ cg
128− args = ["--yes-really", mainmod, "-o", outputFile ir] ++ compilerFlags ir
128+ args = [mainmod, "-o", outputFile ir] ++ compilerFlags ir
129 exit <- rawSystem cmd args
129 exit <- rawSystem cmd args
130 when (exit /= ExitSuccess) $
130 when (exit /= ExitSuccess) $
131 putStrLn ("FAILURE: " ++ show cmd ++ " " ++ show args)
131 putStrLn ("FAILURE: " ++ show cmd ++ " " ++ show args)