summaryrefslogtreecommitdiff
path: root/src/GF
diff options
context:
space:
mode:
Diffstat (limited to 'src/GF')
-rw-r--r--src/GF/Infra/ReadFiles.hs11
-rw-r--r--src/GF/Shell/HelpFile.hs3
-rw-r--r--src/GF/Shell/ShellCommands.hs2
3 files changed, 10 insertions, 6 deletions
diff --git a/src/GF/Infra/ReadFiles.hs b/src/GF/Infra/ReadFiles.hs
index 538af5b8f..bb0d5e630 100644
--- a/src/GF/Infra/ReadFiles.hs
+++ b/src/GF/Infra/ReadFiles.hs
@@ -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]
diff --git a/src/GF/Shell/HelpFile.hs b/src/GF/Shell/HelpFile.hs
index 5764e9f14..ecb8c5bc4 100644
--- a/src/GF/Shell/HelpFile.hs
+++ b/src/GF/Shell/HelpFile.hs
@@ -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 " ++
diff --git a/src/GF/Shell/ShellCommands.hs b/src/GF/Shell/ShellCommands.hs
index 7d10ef882..9918e5225 100644
--- a/src/GF/Shell/ShellCommands.hs
+++ b/src/GF/Shell/ShellCommands.hs
@@ -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