aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordavve <davve@dtek.chalmers.se>2006-09-16 00:16:29 +0000
committerdavve <davve@dtek.chalmers.se>2006-09-16 00:16:29 +0000
commita0e7455dfc08c06f19be0181c2db1daa6796d0ff (patch)
treee134e546625b06b9f90e695be03cdb0404a69844 /src
parent9894f2a1e113f6448c15cba1fd5664070bf72af2 (diff)
Comments only
Diffstat (limited to 'src')
-rw-r--r--src/Main.hs18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/Main.hs b/src/Main.hs
index cd406294..bea0dc5c 100644
--- a/src/Main.hs
+++ b/src/Main.hs
@@ -65,22 +65,38 @@ type CheckedMod = (Module, FullyCheckedMod, FilePath)
main :: IO ()
main = do
+
+ -- first, get the GHC library dir (-B option)
args <- getArgs
(libDir, rest) <- getLibDir args
+
+ -- find out which flag mode we are in
let (isGHCMode, rest') = parseModeFlag rest
+
+ -- initialize GHC
(session, dynflags) <- startGHC libDir
+ -- parse GHC flags given to the program
(dynflags', rest'') <- if isGHCMode
then parseGHCFlags_GHCMode dynflags rest'
else parseGHCFlags_HaddockMode dynflags rest'
+ setSessionDynFlags session dynflags'
+ -- parse Haddock specific flags
(flags, fileArgs) <- parseHaddockOpts rest''
- setSessionDynFlags session dynflags'
+ -- try to sort and check the input files using the GHC API
modules <- sortAndCheckModules session dynflags' fileArgs
+ -- create a PackageData for each external package in the session
+ -- using the GHC API. The PackageData contains an html path,
+ -- a doc env and a list of module names.
packages <- getPackages session dynflags'
+
+ -- update the html references (module -> html file mapping)
updateHTMLXRefs packages
+
+ -- combine the doc envs of the external packages into one
let env = packagesDocEnv packages
-- TODO: continue to break up the run function into parts