2 % (c) The University of Glasgow, 2000
4 \section[CmTypes]{Types for the compilation manager}
8 Unlinked(..), isObject, nameOfObject, isInterpretable,
9 Linkable(..), isObjectLinkable,
10 ModSummary(..), ms_allimps, name_of_summary, pprSummaryTime
18 import Time ( ClockTime )
25 | BCOs [UnlinkedBCO] ItblEnv -- bunch of interpretable bindings, +
26 -- a mapping from DataCons to their itbls
28 instance Outputable Unlinked where
29 ppr (DotO path) = text "DotO" <+> text path
30 ppr (DotA path) = text "DotA" <+> text path
31 ppr (DotDLL path) = text "DotDLL" <+> text path
32 ppr (BCOs bcos _) = text "BCOs" <+> ppr bcos
34 isObject (DotO _) = True
35 isObject (DotA _) = True
36 isObject (DotDLL _) = True
39 nameOfObject (DotO fn) = fn
40 nameOfObject (DotA fn) = fn
41 nameOfObject (DotDLL fn) = fn
43 isInterpretable (BCOs _ _) = True
44 isInterpretable _ = False
47 linkableTime :: ClockTime,
48 linkableModName :: ModuleName,
49 linkableUnlinked :: [Unlinked]
52 isObjectLinkable :: Linkable -> Bool
53 isObjectLinkable l = all isObject (linkableUnlinked l)
55 instance Outputable Linkable where
56 ppr (LM when_made mod_nm unlinkeds)
57 = (text "LinkableM" <+> parens (text (show when_made)) <+> ppr mod_nm)
58 $$ nest 3 (ppr unlinkeds)
60 -- The ModuleLocation contains both the original source filename and the
61 -- filename of the cleaned-up source file after all preprocessing has been
62 -- done. The point is that the summariser will have to cpp/unlit/whatever
63 -- all files anyway, and there's no point in doing this twice -- just
64 -- park the result in a temp file, put the name of it in the location,
65 -- and let @compile@ read from that file on the way back up.
68 ms_mod :: Module, -- name, package
69 ms_location :: ModuleLocation, -- location
70 ms_srcimps :: [ModuleName], -- source imports
71 ms_imps :: [ModuleName], -- non-source imports
72 ms_hs_date :: ClockTime -- timestamp of summarised file
75 -- ToDo: shouldn't ms_srcimps and ms_imps be [Module]? --SDM
77 instance Outputable ModSummary where
79 = sep [text "ModSummary {",
80 nest 3 (sep [text "ms_hs_date = " <> text (show (ms_hs_date ms)),
81 text "ms_mod =" <+> ppr (ms_mod ms) <> comma,
82 text "ms_imps =" <+> ppr (ms_imps ms),
83 text "ms_srcimps =" <+> ppr (ms_srcimps ms)]),
88 = text "ms_hs_date = " <> parens (text (show (ms_hs_date ms)))
91 = ms_srcimps ms ++ ms_imps ms
93 name_of_summary :: ModSummary -> ModuleName
94 name_of_summary = moduleName . ms_mod