11import System.Environment
19data Opts = Opts { really :: Bool,
24showUsage = 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>]"
30getOpts = do xs <- getArgs
31 return $ process (Opts False [] 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
35 process opts ("--interface":xs) = process (opts { interface = True }) xs
36 process opts (x:xs) = process (opts { inputs = x:inputs opts }) xs
37 process opts [] = opts
39c_main :: Opts -> Idris ()
40c_main opts = do runIO setupBundledCC
42 loadInputs (inputs opts) Nothing
43 mainProg <- if interface opts
44 then liftM Just elabMain
46 ir <- compile (Via "c") (output opts) mainProg
50main = do opts <- getOpts
51 if (null (inputs opts))
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)
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list