Commit 124db0ba authored by Björn Peemöller 's avatar Björn Peemöller
Browse files

Additional verbosity level to fix ticket #7

parent b84b50fc
......@@ -17,10 +17,12 @@ import Curry.Base.Position (Position)
import CompilerOpts (Options (optVerbosity), Verbosity (..))
info :: Options -> String -> IO ()
info opts msg = unless (optVerbosity opts == Quiet) (putStrLn msg)
info opts msg = unless (optVerbosity opts < VerbInfo)
(putStrLn $ msg ++ " ...")
status :: Options -> String -> IO ()
status opts msg = info opts (msg ++ " ...")
status opts msg = unless (optVerbosity opts < VerbStatus)
(putStrLn $ msg ++ " ...")
-- |Print an error message on 'stderr'
putErrLn :: String -> IO ()
......
......@@ -51,7 +51,7 @@ defaultOptions = Options
{ optHelp = False
, optVersion = False
, optHtml = False
, optVerbosity = Verbose
, optVerbosity = VerbStatus
, optForce = False
, optImportPaths = []
, optOutput = Nothing
......@@ -76,14 +76,17 @@ data TargetType
-- |Data type representing the verbosity level
data Verbosity
= Quiet
| Verbose
deriving Eq
= VerbQuiet -- ^ be queit
| VerbStatus -- ^ show status of compilation
| VerbInfo -- ^ show also additional info
deriving (Eq, Ord)
-- |Classifies a number as a 'Verbosity'
classifyVerbosity :: String -> Verbosity
classifyVerbosity "0" = Quiet
classifyVerbosity _ = Verbose
classifyVerbosity :: String -> Verbosity -> Verbosity
classifyVerbosity "0" _ = VerbQuiet
classifyVerbosity "1" _ = VerbStatus
classifyVerbosity "2" _ = VerbInfo
classifyVerbosity _ v = v
-- |Data type for representing code dumps
data DumpLevel
......@@ -137,10 +140,10 @@ options =
"generate html code"
, Option "v" ["verbosity"]
(ReqArg (\ arg opts -> opts { optVerbosity =
classifyVerbosity arg }) "<n>")
classifyVerbosity arg $ optVerbosity opts}) "<n>")
"set verbosity level to <n>"
, Option "" ["no-verb"]
(NoArg (\ opts -> opts { optVerbosity = Quiet } ))
(NoArg (\ opts -> opts { optVerbosity = VerbQuiet } ))
"set verbosity level to quiet"
-- compilation
, Option "f" ["force"]
......
......@@ -25,7 +25,7 @@ import Curry.Files.Filenames
import Curry.Files.PathUtils ( dropExtension, doesModuleExist, lookupCurryFile
, getModuleModTime, tryGetModuleModTime)
import Base.Messages (status, abortWith)
import Base.Messages (info, status, abortWith)
import CompilerOpts (Options (..), TargetType (..))
import CurryDeps (Source (..), flatDeps)
......@@ -70,7 +70,7 @@ makeCurry opts srcs targetFile = mapM_ (compile . snd) srcs where
status opts $ "compiling " ++ f
compileModule (opts { optTargetTypes = [FlatCurry], optDumps = [] }) f
skipFile f = status opts $ "skipping " ++ f
skipFile f = info opts $ "skipping " ++ f
generateFile f = do
status opts $ "generating " ++ head (destNames f)
......
......@@ -106,7 +106,7 @@ makeInterfaces paths fn mdl = do
mkOpts :: [FilePath] -> Options
mkOpts paths = defaultOptions
{ optImportPaths = paths
, optVerbosity = Quiet
, optVerbosity = VerbQuiet
, optWarn = False
, optTargetTypes = [AbstractCurry]
}
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