the -gfc option

This commit is contained in:
aarne
2006-02-23 09:58:59 +00:00
parent 97485761cb
commit c5666fabdd
4 changed files with 12 additions and 7 deletions

View File

@@ -62,7 +62,7 @@ getAllFiles opts ps env file = do
else do
ds2 <- ioeIO $ mapM (selectFormat env) pds1
ds2 <- ioeIO $ mapM (selectFormat opts env) pds1
let ds4 = needCompile opts (map fst ds0) ds2
return ds4
@@ -80,15 +80,19 @@ data CompStatus =
-- for gfc, we also return ModTime to cope with earlier compilation of libs
selectFormat :: ModEnv -> (InitPath,ModName) ->
selectFormat :: Options -> ModEnv -> (InitPath,ModName) ->
IO (ModName,(InitPath,(CompStatus,Maybe ModTime)))
selectFormat env (p,f) = do
selectFormat opts env (p,f) = do
let pf = prefixPathName p f
let mtenv = lookup f env -- Nothing if f is not in env
let rtenv = lookup (resModName f) env
let fromComp = oElem isCompiled opts -- i -gfc
mtgfc <- getModTime $ gfcFile pf
mtgf <- getModTime $ gfFile pf
let stat = case (rtenv,mtenv,mtgfc,mtgf) of
(_,Just tenv,_,_) | fromComp -> (CSEnv, Just tenv)
(_,_,Just tgfc,_) | fromComp -> (CSRead,Just tgfc)
(Just tenv,_,_,Just tgf) | laterModTime tenv tgf -> (CSEnvR,Just tenv)
(_,Just tenv,_,Just tgf) | laterModTime tenv tgf -> (CSEnv, Just tenv)
(_,_,Just tgfc,Just tgf) | laterModTime tgfc tgf -> (CSRead,Just tgfc)
@@ -96,7 +100,6 @@ selectFormat env (p,f) = do
_ -> (CSComp,Nothing)
return $ (f, (p,stat))
needCompile :: Options ->
[ModuleHeader] ->
[(ModName,(InitPath,(CompStatus,Maybe ModTime)))] -> [FullPath]

View File

@@ -56,7 +56,8 @@ txtHelpFile =
"\n -old old: parse in GF<2.0 format (not necessary)" ++
"\n -v verbose: give lots of messages " ++
"\n -s silent: don't give error messages" ++
"\n -src source: ignore precompiled gfc and gfr files" ++
"\n -src from source: ignore precompiled gfc and gfr files" ++
"\n -gfc from gfc: use compiled modules whenever they exist" ++
"\n -retain retain operations: read resource modules (needed in comm cc) " ++
"\n -nocf don't build context-free grammar (thus no parser)" ++
"\n -nocheckcirc don't eliminate circular rules from CF " ++

View File

@@ -169,7 +169,7 @@ optionsOfCommand co = case co of
CSetFlag -> both "utf8 table struct record all multi"
"cat lang lexer parser number depth rawtrees unlexer optimize path conversion printer"
CImport _ -> both "old v s src retain nocf nocheckcirc cflexer noemit o ex prob"
CImport _ -> both "old v s src gfc retain nocf nocheckcirc cflexer noemit o ex prob"
"abs cnc res path optimize conversion cat probs noparse"
CRemoveLanguage _ -> none
CEmptyState -> none

View File

@@ -27,7 +27,8 @@ i, import: i File
-old old: parse in GF<2.0 format (not necessary)
-v verbose: give lots of messages
-s silent: don't give error messages
-src source: ignore precompiled gfc and gfr files
-src from source: ignore precompiled gfc and gfr files
-gfc from gfc: use compiled modules whenever they exist
-retain retain operations: read resource modules (needed in comm cc)
-nocf don't build context-free grammar (thus no parser)
-nocheckcirc don't eliminate circular rules from CF