summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoraarne <unknown>2005-02-10 09:43:33 +0000
committeraarne <unknown>2005-02-10 09:43:33 +0000
commitd676355271f360861b8462c4b788202ddd605b6d (patch)
treef2735c1123373f1ee8f9ccf2f0d9d24f01b1165c
parent9afbd25b64607e68fe6275fb6b743159001ca984 (diff)
gfc generation to incomplete modules
-rw-r--r--src/GF/Compile/BackOpt.hs4
-rw-r--r--src/GF/Compile/Compile.hs11
-rw-r--r--src/GF/Compile/GrammarToCanon.hs5
-rw-r--r--src/GF/Infra/ReadFiles.hs2
4 files changed, 13 insertions, 9 deletions
diff --git a/src/GF/Compile/BackOpt.hs b/src/GF/Compile/BackOpt.hs
index 1c030f8e1..64068e93b 100644
--- a/src/GF/Compile/BackOpt.hs
+++ b/src/GF/Compile/BackOpt.hs
@@ -27,10 +27,10 @@ import qualified Modules as M
type OptSpec = [Integer] ---
-doOptFactor :: OptSpec
+doOptFactor :: OptSpec -> Bool
doOptFactor opt = elem 2 opt
-doOptValues :: OptSpec
+doOptValues :: OptSpec -> Bool
doOptValues opt = elem 3 opt
shareOpt :: OptSpec
diff --git a/src/GF/Compile/Compile.hs b/src/GF/Compile/Compile.hs
index c1d33ed8e..f555de440 100644
--- a/src/GF/Compile/Compile.hs
+++ b/src/GF/Compile/Compile.hs
@@ -282,22 +282,25 @@ generateModuleCode opts path minfo@(name,info) = do
"none" -> minfo0 -- no optimization
_ -> shareModule shareOpt minfo0 -- sharing; default
- -- for resource, also emit gfr
+ -- for resource, also emit gfr.
+ --- Also for incomplete, to create timestamped gfc/gfr files
case info of
ModMod m | emitsGFR m && emit && nomulti -> do
- let (file,out) = (gfrFile pname, prGrammar (MGrammar [minfo]))
+ let rminfo = if isCompilable info then minfo
+ else (name,emptyModInfo)
+ let (file,out) = (gfrFile pname, prGrammar (MGrammar [rminfo]))
ioeIO $ writeFile file out >> putStr (" wrote file" +++ file)
_ -> return ()
(file,out) <- do
code <- return $ MkGFC.prCanonModInfo minfo'
return (gfcFile pname, code)
- if isCompilable info && emit && nomulti
+ if emit && nomulti ---- && isCompilable info
then ioeIO (writeFile file out) >> ioeIOIf (putStr (" wrote file" +++ file))
else ioeIOIf $ putStrFlush $ "no need to save module" +++ prt name
return minfo'
where
ioeIOIf = if oElem beSilent opts then (const (return ())) else ioeIO
- emitsGFR m = isModRes m && isCompilable info
+ emitsGFR m = isModRes m ---- && isCompilable info
---- isModRes m || (isModCnc m && mstatus m == MSIncomplete)
isCompilable mi = case mi of
ModMod m -> not $ isModCnc m && mstatus m == MSIncomplete
diff --git a/src/GF/Compile/GrammarToCanon.hs b/src/GF/Compile/GrammarToCanon.hs
index 08542ec16..2b3e31250 100644
--- a/src/GF/Compile/GrammarToCanon.hs
+++ b/src/GF/Compile/GrammarToCanon.hs
@@ -52,7 +52,7 @@ redModInfo (c,info) = do
let isIncompl = not $ isCompleteModule m
(e,os) <- if isIncompl then return ([],[]) else redExtOpen m ----
flags <- mapM redFlag $ flags m
- (a,mt) <- case mtype m of
+ (a,mt0) <- case mtype m of
MTConcrete a -> do
a' <- redIdent a
return (a', MTConcrete a')
@@ -62,8 +62,9 @@ redModInfo (c,info) = do
MTInstance _ -> return (c',MTResource) --- c' not needed
MTTransfer x y -> return (c',MTTransfer (om x) (om y)) --- c' not needed
- ---- this generates empty GFC. Better: none
+ --- this generates empty GFC reosurce for interface and incomplete
let js = if isIncompl then NT else jments m
+ mt = mt0 ---- if isIncompl then MTResource else mt0
defss <- mapM (redInfo a) $ tree2list $ js
defs <- return $ sorted2tree $ concat defss -- sorted, but reduced
diff --git a/src/GF/Infra/ReadFiles.hs b/src/GF/Infra/ReadFiles.hs
index 65b52e602..380c0cfb5 100644
--- a/src/GF/Infra/ReadFiles.hs
+++ b/src/GF/Infra/ReadFiles.hs
@@ -9,7 +9,7 @@
-- > CVS $Author $
-- > CVS $Revision $
--
--- (Description of the module)
+-- Decide what files to read as function of dependencies and time stamps.
-----------------------------------------------------------------------------
module ReadFiles