gfc generation to incomplete modules

This commit is contained in:
aarne
2005-02-10 09:43:33 +00:00
parent cb6449c50a
commit 4b46c310ce
4 changed files with 13 additions and 9 deletions

View File

@@ -27,10 +27,10 @@ import qualified Modules as M
type OptSpec = [Integer] --- type OptSpec = [Integer] ---
doOptFactor :: OptSpec doOptFactor :: OptSpec -> Bool
doOptFactor opt = elem 2 opt doOptFactor opt = elem 2 opt
doOptValues :: OptSpec doOptValues :: OptSpec -> Bool
doOptValues opt = elem 3 opt doOptValues opt = elem 3 opt
shareOpt :: OptSpec shareOpt :: OptSpec

View File

@@ -282,22 +282,25 @@ generateModuleCode opts path minfo@(name,info) = do
"none" -> minfo0 -- no optimization "none" -> minfo0 -- no optimization
_ -> shareModule shareOpt minfo0 -- sharing; default _ -> 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 case info of
ModMod m | emitsGFR m && emit && nomulti -> do 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) ioeIO $ writeFile file out >> putStr (" wrote file" +++ file)
_ -> return () _ -> return ()
(file,out) <- do (file,out) <- do
code <- return $ MkGFC.prCanonModInfo minfo' code <- return $ MkGFC.prCanonModInfo minfo'
return (gfcFile pname, code) return (gfcFile pname, code)
if isCompilable info && emit && nomulti if emit && nomulti ---- && isCompilable info
then ioeIO (writeFile file out) >> ioeIOIf (putStr (" wrote file" +++ file)) then ioeIO (writeFile file out) >> ioeIOIf (putStr (" wrote file" +++ file))
else ioeIOIf $ putStrFlush $ "no need to save module" +++ prt name else ioeIOIf $ putStrFlush $ "no need to save module" +++ prt name
return minfo' return minfo'
where where
ioeIOIf = if oElem beSilent opts then (const (return ())) else ioeIO 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) ---- isModRes m || (isModCnc m && mstatus m == MSIncomplete)
isCompilable mi = case mi of isCompilable mi = case mi of
ModMod m -> not $ isModCnc m && mstatus m == MSIncomplete ModMod m -> not $ isModCnc m && mstatus m == MSIncomplete

View File

@@ -52,7 +52,7 @@ redModInfo (c,info) = do
let isIncompl = not $ isCompleteModule m let isIncompl = not $ isCompleteModule m
(e,os) <- if isIncompl then return ([],[]) else redExtOpen m ---- (e,os) <- if isIncompl then return ([],[]) else redExtOpen m ----
flags <- mapM redFlag $ flags m flags <- mapM redFlag $ flags m
(a,mt) <- case mtype m of (a,mt0) <- case mtype m of
MTConcrete a -> do MTConcrete a -> do
a' <- redIdent a a' <- redIdent a
return (a', MTConcrete a') return (a', MTConcrete a')
@@ -62,8 +62,9 @@ redModInfo (c,info) = do
MTInstance _ -> return (c',MTResource) --- c' not needed MTInstance _ -> return (c',MTResource) --- c' not needed
MTTransfer x y -> return (c',MTTransfer (om x) (om y)) --- 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 let js = if isIncompl then NT else jments m
mt = mt0 ---- if isIncompl then MTResource else mt0
defss <- mapM (redInfo a) $ tree2list $ js defss <- mapM (redInfo a) $ tree2list $ js
defs <- return $ sorted2tree $ concat defss -- sorted, but reduced defs <- return $ sorted2tree $ concat defss -- sorted, but reduced

View File

@@ -9,7 +9,7 @@
-- > CVS $Author $ -- > CVS $Author $
-- > CVS $Revision $ -- > CVS $Revision $
-- --
-- (Description of the module) -- Decide what files to read as function of dependencies and time stamps.
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
module ReadFiles module ReadFiles