diff options
| author | bjorn <bjorn@bringert.net> | 2008-10-16 10:12:57 +0000 |
|---|---|---|
| committer | bjorn <bjorn@bringert.net> | 2008-10-16 10:12:57 +0000 |
| commit | 8726886298e6b233d66c9ae1a211c13decf6a405 (patch) | |
| tree | 192140719354aa7ba8a46e0b4004891a1be26878 /src | |
| parent | d1633b98d01233ad6ddf16105955ea9ea79be336 (diff) | |
A bit more verbosity when combining PGF files. Use putPointE when writing output files.
Diffstat (limited to 'src')
| -rw-r--r-- | src/GF/Infra/UseIO.hs | 4 | ||||
| -rw-r--r-- | src/GFC.hs | 12 |
2 files changed, 9 insertions, 7 deletions
diff --git a/src/GF/Infra/UseIO.hs b/src/GF/Infra/UseIO.hs index 00b956708..0ca8d7456 100644 --- a/src/GF/Infra/UseIO.hs +++ b/src/GF/Infra/UseIO.hs @@ -26,6 +26,7 @@ import System.IO.Error import System.Environment import System.Exit import System.CPUTime +import Text.Printf import Control.Monad import Control.Exception(evaluate) import qualified Data.ByteString.Char8 as BS @@ -239,7 +240,8 @@ putPointE v opts msg act = do t2 <- ioeIO $ getCPUTime if flag optShowCPUTime opts - then putStrLnE (" " ++ show ((t2 - t1) `div` 1000000000) ++ " msec") + then do let msec = (t2 - t1) `div` 1000000000 + putStrLnE (printf " %5d msec" msec) else when (verbAtLeast opts v) $ putStrLnE "" return a diff --git a/src/GFC.hs b/src/GFC.hs index 62a57ba0c..ef6968da3 100644 --- a/src/GFC.hs +++ b/src/GFC.hs @@ -51,9 +51,10 @@ compileCFFiles opts fs = unionPGFFiles :: Options -> [FilePath] -> IOE () unionPGFFiles opts fs = - do pgfs <- ioeIO $ mapM readPGF fs + do pgfs <- mapM readPGFVerbose fs let pgf = foldl1 unionPGF pgfs writeOutputs opts pgf + where readPGFVerbose f = putPointE Normal opts ("Reading " ++ f ++ "...") $ ioeIO $ readPGF f writeOutputs :: Options -> PGF -> IOE () writeOutputs opts pgf = @@ -66,9 +67,8 @@ writeOutput opts file str = do let path = case flag optOutputDir opts of Nothing -> file Just dir -> dir </> file - writeOutputFile path str + writeOutputFile opts path str -writeOutputFile :: FilePath -> String -> IOE () -writeOutputFile outfile output = ioeIO $ - do writeFile outfile output - putStrLn $ "wrote file " ++ outfile +writeOutputFile :: Options -> FilePath -> String -> IOE () +writeOutputFile opts outfile output = + do putPointE Normal opts ("Writing " ++ outfile ++ "...") $ ioeIO $ writeFile outfile output |
