diff options
| author | bjorn <bjorn@bringert.net> | 2008-05-28 15:10:36 +0000 |
|---|---|---|
| committer | bjorn <bjorn@bringert.net> | 2008-05-28 15:10:36 +0000 |
| commit | 3fd1f5652a3af22e90a040a821d244a91a3553a0 (patch) | |
| tree | 15225df670e1fb1c55f4a9eb1ca45eae7952061f /src-3.0/GF/Compile/ReadFiles.hs | |
| parent | 1bc74749aa7a9ec6ecfced68c0cdf38f43c7f9ef (diff) | |
Switch to new options handling.
This changes lots of stuff, let me know if it broke anything.
Comments:
- We use a local hacked version of GetOpt that allows long forms of commands to start with a single dash. This breaks other parts of GetOpt. For example, arguments to short options now require a =, and does not allo pace after the option character.
- The new command parsing is currently only used for the program command line, pragmas and the arguments for the 'i' shell command.
- I made a quick hack for the options for showTerm, which currently makes it impossible to use the print style flags for cc. This will be replaced by a facility for parsing command-specific options.
- The verbosity handling is broken in some places. I will fix that in a later patch.
Diffstat (limited to 'src-3.0/GF/Compile/ReadFiles.hs')
| -rw-r--r-- | src-3.0/GF/Compile/ReadFiles.hs | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src-3.0/GF/Compile/ReadFiles.hs b/src-3.0/GF/Compile/ReadFiles.hs index f1f94c105..cd2faec15 100644 --- a/src-3.0/GF/Compile/ReadFiles.hs +++ b/src-3.0/GF/Compile/ReadFiles.hs @@ -19,8 +19,9 @@ ----------------------------------------------------------------------------- module GF.Compile.ReadFiles - ( getAllFiles,ModName,ModEnv,getOptionsFromFile,importsOfModule, - gfoFile,gfFile,isGFO ) where + ( getAllFiles,ModName,ModEnv,importsOfModule, + gfoFile,gfFile,isGFO, + getOptionsFromFile) where import GF.Infra.UseIO import GF.Infra.Option @@ -48,9 +49,7 @@ getAllFiles :: Options -> [InitPath] -> ModEnv -> FileName -> IOE [FullPath] getAllFiles opts ps env file = do -- read module headers from all files recursively ds <- liftM reverse $ get [] [] (justModuleName file) - if oElem beVerbose opts - then ioeIO $ putStrLn $ "all modules:" +++ show [name | (name,_,_,_,_) <- ds] - else return () + ioeIO $ putIfVerb opts $ "all modules:" +++ show [name | (name,_,_,_,_) <- ds] return $ paths ds where -- construct list of paths to read @@ -135,8 +134,8 @@ selectFormat opts mtenv mtgf mtgfo = (_,_, Nothing) -> (CSRead,Nothing) -- source does not exist _ -> (CSComp,Nothing) where - fromComp = oElem isCompiled opts -- i -gfo - fromSrc = oElem fromSource opts + fromComp = flag optRecomp opts == NeverRecomp + fromSrc = flag optRecomp opts == AlwaysRecomp -- internal module dep information @@ -188,8 +187,9 @@ importsOfModule (MModule _ typ body) = modType typ (modBody body []) -- | options can be passed to the compiler by comments in @--#@, in the main file -getOptionsFromFile :: FilePath -> IO Options +getOptionsFromFile :: FilePath -> IOE Options getOptionsFromFile file = do - s <- readFileIfStrict file + s <- ioeIO $ readFileIfStrict file let ls = filter (BS.isPrefixOf (BS.pack "--#")) $ BS.lines s - return $ fst $ getOptions "-" $ map (BS.unpack . BS.unwords . BS.words . BS.drop 3) ls + fs = map (BS.unpack . BS.unwords . BS.words . BS.drop 3) ls + ioeErr $ liftM moduleOptions $ parseModuleOptions fs |
