2 % (c) The University of Glasgow, 2000
4 \section[CmTypes]{Types for the compilation manager}
8 Unlinked(..), isObject, nameOfObject, isInterpretable,
9 Linkable(..), linkableTime,
10 ModSummary(..), ms_allimps, name_of_summary, pprSummaryTime
19 import Time ( ClockTime )
26 | BCOs [UnlinkedBCO] ItblEnv -- bunch of interpretable bindings, +
27 -- a mapping from DataCons to their itbls
29 instance Outputable Unlinked where
30 ppr (DotO path) = text "DotO" <+> text path
31 ppr (DotA path) = text "DotA" <+> text path
32 ppr (DotDLL path) = text "DotDLL" <+> text path
33 ppr (BCOs bcos _) = text "BCOs" <+> vcat (map ppr bcos)
35 isObject (DotO _) = True
36 isObject (DotA _) = True
37 isObject (DotDLL _) = True
40 nameOfObject (DotO fn) = fn
41 nameOfObject (DotA fn) = fn
42 nameOfObject (DotDLL fn) = fn
44 isInterpretable (BCOs _ _) = True
45 isInterpretable _ = False
48 = LM ClockTime ModuleName [Unlinked]
51 instance Outputable Linkable where
52 ppr (LM when_made mod_nm unlinkeds)
53 = text "LinkableM" <+> parens (text (show when_made)) <+> ppr mod_nm
56 = text "LinkableP" <+> ptext package_nm
58 linkableTime (LM when_made mod_nm unlinkeds) = when_made
59 linkableTime (LP package_nm) = panic "linkableTime"
62 -- The ModuleLocation contains both the original source filename and the
63 -- filename of the cleaned-up source file after all preprocessing has been
64 -- done. The point is that the summariser will have to cpp/unlit/whatever
65 -- all files anyway, and there's no point in doing this twice -- just
66 -- park the result in a temp file, put the name of it in the location,
67 -- and let @compile@ read from that file on the way back up.
70 ms_mod :: Module, -- name, package
71 ms_location :: ModuleLocation, -- location
72 ms_srcimps :: [ModuleName], -- source imports
73 ms_imps :: [ModuleName], -- non-source imports
74 ms_hs_date :: Maybe ClockTime -- timestamp of summarised
75 -- file, if home && source
78 instance Outputable ModSummary where
80 = sep [text "ModSummary {",
81 nest 3 (sep [text "ms_hs_date = " <> text (show (ms_hs_date ms)),
82 text "ms_mod =" <+> ppr (ms_mod ms) <> comma,
83 text "ms_imps =" <+> ppr (ms_imps ms),
84 text "ms_srcimps =" <+> ppr (ms_srcimps ms)]),
89 = text "ms_hs_date = " <> parens (text (show (ms_hs_date ms)))
92 = ms_srcimps ms ++ ms_imps ms
94 name_of_summary :: ModSummary -> ModuleName
95 name_of_summary = moduleName . ms_mod