Commit 5eef44c8 by Zachary Yedidia Committed by Zachary Snow

Add file output write mode

parent c0cb401a
......@@ -26,6 +26,7 @@ data Exclude
data Write
= Stdout
| Adjacent
| File
deriving (Show, Typeable, Data, Eq)
instance Default Write where
......@@ -66,7 +67,8 @@ defaultJob = Job
, verbose = nam "verbose" &= help "Retain certain conversion artifacts"
, write = nam_ "write" &= name "w" &= typ "MODE"
&= help ("How to write output; default is 'stdout'; use 'adjacent' to"
++ " create a .v file next to each input")
++ " create a .v file next to each input; use 'file' to create a"
++ " sv2v_output.v file")
}
&= program "sv2v"
&= summary ("sv2v " ++ version)
......
......@@ -64,6 +64,9 @@ writeOutput _ [] [] =
hPutStrLn stderr "Warning: No input files specified (try `sv2v --help`)"
writeOutput Stdout _ asts =
hPrint stdout $ concat asts
writeOutput File _ asts =
writeFile f $ show $ concat asts
where f = "sv2v_output.v"
writeOutput Adjacent inPaths asts = do
outPaths <- mapM rewritePath inPaths
badPaths <- filterM doesFileExist outPaths
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment