
New patches:

[bump version number
John Meacham <john@repetae.net>**20090825010311
 Ignore-this: ad2fb7b94f9544ed2a47d8c9b9cde19f
] hunk ./configure.ac 1
-AC_INIT([jhc],[0.7.1])
+AC_INIT([jhc],[0.7.2])
 AC_CONFIG_SRCDIR(src/Main.hs)
 AC_CONFIG_MACRO_DIR(ac-macros)
 AC_CONFIG_AUX_DIR(ac-macros)
[clean up SourceCode data type
John Meacham <john@repetae.net>**20090825012723
 Ignore-this: 368d9f1973cabacf01d0b9d4f01b11d0
] hunk ./src/Ho/Build.hs 1
+{-# LANGUAGE RecordWildCards #-}
 module Ho.Build (
     module Ho.Type,
     dumpHoFile,
hunk ./src/Ho/Build.hs 184
             putErrLn $ "Skipping file" <+> fn <+> "because it's module declaration of" <+> show m <+> "does not equal the expected" <+> show m'
             killMod
         _ -> do
-            let sc (Right mod) = SourceParsed hash ds mod fn mho
-                sc (Left lbs) = SourceRaw hash ds m lbs fn mho
+            let sc (Right mod) = SourceParsed sinfo mod
+                sc (Left lbs) = SourceRaw sinfo lbs
+                sinfo = SI { sourceHash = hash, sourceDeps = ds, sourceFP = fn, sourceHoName = mho, sourceModName = m }
             modifyIORef done_ref (modEncountered_u $ Map.insert m (Found (sc mod)))
             fn' <- shortenPath fn
             mho' <- shortenPath mho
hunk ./src/Ho/Build.hs 225
     = CompHo HoHeader HoIDeps Ho
     | CompSources [SourceCode]
     | CompTCed ((HoTcInfo,TiData,[(HoHash,HsModule)],[String]))
+    | CompProcessed [SourceCode]
     | CompDummy
     | CompLibrary Ho Library
 
hunk ./src/Ho/Build.hs 232
 instance Show CompUnit where
     showsPrec _ cu = shows $ providesModules cu
 
+data SourceInfo = SI {
+    sourceHash :: SourceHash,
+    sourceDeps :: [Module],
+    sourceFP :: FilePath,
+    sourceModName :: Module,
+    sourceHoName :: FilePath
+    }
+
 data SourceCode
hunk ./src/Ho/Build.hs 241
-    = SourceParsed { sourceHash :: SourceHash, sourceDeps :: [Module]
-                   , sourceModule :: HsModule, sourceFP :: FilePath, sourceHoName :: FilePath }
-    | SourceRaw    { sourceHash :: SourceHash, sourceDeps :: [Module]
-                   , sourceModName :: Module, sourceLBS :: LBS.ByteString, sourceFP :: FilePath, sourceHoName :: FilePath }
+    = SourceParsed     { sourceInfo :: !SourceInfo, sourceModule :: HsModule }
+    | SourceRaw        { sourceInfo :: !SourceInfo, sourceLBS :: LBS.ByteString }
+    | SourceProcessed  { sourceInfo :: !SourceInfo, sourceLBS :: LBS.ByteString }
+
 
hunk ./src/Ho/Build.hs 246
-sourceIdent SourceParsed { sourceModule = m } = show $ hsModuleName m
-sourceIdent SourceRaw { sourceModName = fp } = show fp
+sourceIdent sp = show . sourceModName $ sourceInfo sp
 
 class ProvidesModules a where
     providesModules :: a -> [Module]
hunk ./src/Ho/Build.hs 271
     providesModules (CompTcCollected _ cu) = providesModules cu
 
 instance ProvidesModules SourceCode where
-    providesModules SourceParsed { sourceModule = mod } = [hsModuleName mod]
-    providesModules SourceRaw    { sourceModName = n } = [n]
+    providesModules sp = [sourceModName (sourceInfo sp)]
 
 
 -- | this walks the loaded modules and ho files, discarding out of
hunk ./src/Ho/Build.hs 288
 toCompUnitGraph done roots = do
     let fs m = map inject $ maybe (error $ "can't find deps for: " ++ show m) snd (Map.lookup m (knownSourceMap done))
         fs' m (Library _ libr _ _) = fromMaybe (error $ "can't find deps for: " ++ show m) (Map.lookup m (hoModuleDeps libr))
-        foundMods = [ ((m,Left (sourceHash sc)),fs (sourceHash sc)) | (m,Found sc) <- Map.toList (modEncountered done)]
+        foundMods = [ ((m,Left (sourceHash $ sourceInfo sc)),fs (sourceHash $ sourceInfo sc)) | (m,Found sc) <- Map.toList (modEncountered done)]
         foundMods' = Map.elems $ Map.fromList [ (mg,((mg,Right lib),fs' mg lib)) | (_,ModLibrary _ mg lib) <- Map.toList (modEncountered done)]
         fullModMap = Map.unions (map libModMap $ Map.elems (loadedLibraries done))
         inject m = Map.findWithDefault m m fullModMap
hunk ./src/Ho/Build.hs 295
         gr = G.newGraph  (foundMods ++ foundMods') (fst . fst) snd
         gr' = G.sccGroups gr
         phomap = Map.fromListWith (++) (concat [  [ (m,[hh]) | (m,_) <- hoDepends idep ] | (hh,(_,_,idep,_)) <- Map.toList (hosEncountered done)])
-        sources = Map.fromList [ (m,sourceHash sc) | (m,Found sc) <- Map.toList (modEncountered done)]
+        sources = Map.fromList [ (m,sourceHash $ sourceInfo sc) | (m,Found sc) <- Map.toList (modEncountered done)]
 
    -- mapM_ (putErrLn . show) $ [ (x,y) | ((x,_),y) <- foundMods ++ foundMods' ]
 
hunk ./src/Ho/Build.hs 529
                         return ctc'
                     CompSources sc -> do
                         modules <- forM sc $ \x -> case x of
-                            SourceParsed { sourceHash = h,sourceModule = mod } -> return (h,mod)
-                            SourceRaw { sourceHash = h,sourceLBS = lbs, sourceFP = fp } -> do
-                                mod <- parseHsSource fp lbs
-                                return (h,mod)
+                            SourceParsed { sourceInfo = SI { .. }, .. } -> return (sourceHash,sourceModule)
+                            SourceRaw { sourceInfo = SI { .. }, .. } -> do
+                                mod <- parseHsSource sourceFP sourceLBS
+                                return (sourceHash,mod)
                         showProgress (snds modules)
                         (htc,tidata) <- doModules' ctc (snds modules)
                         let ctc' = htc `mappend` ctc
hunk ./src/Ho/Build.hs 536
-                        writeIORef ref (CompTcCollected ctc' (CompTCed ((htc,tidata,modules,map sourceHoName sc))))
+                        writeIORef ref (CompTcCollected ctc' (CompTCed ((htc,tidata,modules,map (sourceHoName . sourceInfo) sc))))
                         return ctc'
         showProgress ms = printModProgress fmtLen maxModules tickProgress ms
         fmtLen = ceiling (logBase 10 (fromIntegral maxModules+1) :: Double) :: Int
[add --annotate-source option to spit out annotated, preprocessed source code for use by other tools
John Meacham <john@repetae.net>**20090825030331
 Ignore-this: ca1455f77508744f6f0d90c01c6113dc
] hunk ./src/Ho/Build.hs 174
     (mod,m,ds) <- case mlookup hash (knownSourceMap done) of
         Just (m,ds) -> do return (Left lbs,m,ds)
         Nothing -> do
-            hmod <- parseHsSource fn lbs
+            (hmod,_) <- parseHsSource fn lbs
             let m = hsModuleName hmod
                 ds = hsModuleRequires hmod
             writeIORef done_ref (knownSourceMap_u (Map.insert hash (m,ds)) done)
hunk ./src/Ho/Build.hs 178
-            return (Right hmod,m,ds)
+            case optAnnotate options of
+                Just _ -> return (Left lbs,m,ds)
+                _ -> return (Right hmod,m,ds)
     case mm of
         Just m' | m /= m' -> do
             putErrLn $ "Skipping file" <+> fn <+> "because it's module declaration of" <+> show m <+> "does not equal the expected" <+> show m'
hunk ./src/Ho/Build.hs 227
     = CompHo HoHeader HoIDeps Ho
     | CompSources [SourceCode]
     | CompTCed ((HoTcInfo,TiData,[(HoHash,HsModule)],[String]))
-    | CompProcessed [SourceCode]
     | CompDummy
     | CompLibrary Ho Library
 
hunk ./src/Ho/Build.hs 244
 data SourceCode
     = SourceParsed     { sourceInfo :: !SourceInfo, sourceModule :: HsModule }
     | SourceRaw        { sourceInfo :: !SourceInfo, sourceLBS :: LBS.ByteString }
-    | SourceProcessed  { sourceInfo :: !SourceInfo, sourceLBS :: LBS.ByteString }
 
 
 sourceIdent sp = show . sourceModName $ sourceInfo sp
hunk ./src/Ho/Build.hs 394
     performGC
     putProgressLn "Typechecking..."
     typeCheckGraph cnode
+    if isJust (optAnnotate options) then exitSuccess else do
     performGC
     putProgressLn "Compiling..."
     cho <- compileCompNode ifunc func ksm cnode
hunk ./src/Ho/Build.hs 529
                         writeIORef ref (CompTcCollected ctc' lu)
                         return ctc'
                     CompSources sc -> do
+                        let mods = sort $ map (sourceModName . sourceInfo) sc
                         modules <- forM sc $ \x -> case x of
hunk ./src/Ho/Build.hs 531
-                            SourceParsed { sourceInfo = SI { .. }, .. } -> return (sourceHash,sourceModule)
+                            SourceParsed { sourceInfo = SI { .. }, .. } -> return (sourceHash,sourceModule, error "SourceParsed in AnnotateSource")
                             SourceRaw { sourceInfo = SI { .. }, .. } -> do
hunk ./src/Ho/Build.hs 533
-                                mod <- parseHsSource sourceFP sourceLBS
-                                return (sourceHash,mod)
-                        showProgress (snds modules)
-                        (htc,tidata) <- doModules' ctc (snds modules)
+                                (mod,lbs') <- parseHsSource sourceFP sourceLBS
+                                case optAnnotate options of
+                                    Just fp -> do
+                                        let ann = LBSU.fromString $ unlines [
+                                                "{- --ANNOTATE--", 
+                                                "Module: " ++ show sourceModName, 
+                                                "Deps: " ++ show (sort sourceDeps), 
+                                                "Siblings: " ++ show mods,
+                                                "-}"]
+                                        LBS.writeFile (fp ++ "/" ++ show (hsModuleName mod) ++ ".hs") (ann `LBS.append` lbs')
+                                    _ -> return ()
+                                return (sourceHash,mod,lbs')
+                        showProgress (map snd3 modules)
+                        (htc,tidata) <- doModules' ctc (map snd3 modules)
                         let ctc' = htc `mappend` ctc
hunk ./src/Ho/Build.hs 548
-                        writeIORef ref (CompTcCollected ctc' (CompTCed ((htc,tidata,modules,map (sourceHoName . sourceInfo) sc))))
+                        writeIORef ref (CompTcCollected ctc' (CompTCed ((htc,tidata,[ (x,y) | (x,y,_) <- modules],map (sourceHoName . sourceInfo) sc))))
                         return ctc'
         showProgress ms = printModProgress fmtLen maxModules tickProgress ms
         fmtLen = ceiling (logBase 10 (fromIntegral maxModules+1) :: Double) :: Int
hunk ./src/Ho/Build.hs 672
     return lbs'
 
 
-parseHsSource :: String -> LBS.ByteString -> IO HsModule
+parseHsSource :: String -> LBS.ByteString -> IO (HsModule,LBS.ByteString)
 parseHsSource fn lbs = do
     lbs' <- preprocess fn lbs
     let s = LBSU.toString lbs'
hunk ./src/Ho/Build.hs 686
         putStrLn s'
     fn <- shortenPath fn
     case runParserWithMode (parseModeOptions $ collectFileOpts fn s) { parseFilename = fn } parse  s'  of
-                      ParseOk ws e -> processErrors ws >> return e
+                      ParseOk ws e -> processErrors ws >> return (e,LBSU.fromString s')
                       ParseFailed sl err -> putErrDie $ show sl ++ ": " ++ err
 
 
hunk ./src/Options.hs 135
 
 -}
 
-data Mode = BuildHl String  -- ^ Build the specified hl-file given a description file.
-          | Interactive     -- ^ Run interactively.
-          | Version         -- ^ Print version and die.
-          | VersionCtx      -- ^ Print version context and die.
-          | ShowHelp        -- ^ Show help message and die.
-          | ShowConfig      -- ^ Show configuration info.
-          | CompileHo       -- ^ Compile ho
-          | CompileHoGrin   -- ^ Compile ho and grin
-          | CompileExe      -- ^ Compile executable
-          | ShowHo String   -- ^ Show ho-file.
-          | ListLibraries   -- ^ List libraries
-          | PrintHscOptions -- ^ Print options for hsc2hs
-          | Preprocess      -- ^ Filter through preprocessor
+data Mode = BuildHl FilePath         -- ^ Build the specified hl-file given a description file.
+          | Interactive              -- ^ Run interactively.
+          | Version                  -- ^ Print version and die.
+          | VersionCtx               -- ^ Print version context and die.
+          | ShowHelp                 -- ^ Show help message and die.
+          | ShowConfig               -- ^ Show configuration info.
+          | CompileHo                -- ^ Compile ho
+          | CompileHoGrin            -- ^ Compile ho and grin
+          | CompileExe               -- ^ Compile executable
+          | ShowHo String            -- ^ Show ho-file.
+          | ListLibraries            -- ^ List libraries
+          | PrintHscOptions          -- ^ Print options for hsc2hs
+          | Preprocess               -- ^ Filter through preprocessor
             deriving(Eq)
 
 
hunk ./src/Options.hs 164
     optHlPath      ::  [String],  -- ^ Path to look for libraries.
     optIncs        ::  [String],
     optDefs        ::  [String],
+    optAnnotate    ::  Maybe FilePath,
     optHoDir       ::  Maybe FilePath,
     optHoCache     ::  Maybe FilePath,
     optArgs        ::  [String],
hunk ./src/Options.hs 192
     optDebug       = False,
     optCross       = False,
     optIncdirs     = initialIncludes,
+    optAnnotate    = Nothing,
     optHls         = [],
     optHlPath      = initialLibIncludes,
     optIncs        = [],
hunk ./src/Options.hs 253
     , Option ['p'] []            (ReqArg (\d -> optHls_u (++ [d])) "file.hl") "Load given haskell library .hl file"
     , Option ['L'] []            (ReqArg (optHlPath_u . idu) "path")   "Look for haskell libraries in the given directory"
     , Option []    ["build-hl"]  (ReqArg (optMode_s . BuildHl) "file.cabal") "Build hakell library from given library description file"
+    , Option []    ["annotate-source"]  (ReqArg (optAnnotate_s . Just) "<dir>") "Write preprocessed and annotated source code to the directory specified"
     , Option []    ["interactive"] (NoArg  (optMode_s Interactive))    "run interactivly"
     , Option []    ["ignore-ho"]   (NoArg  (optIgnoreHo_s True))       "Ignore existing haskell object files"
     , Option []    ["nowrite-ho"]  (NoArg  (optNoWriteHo_s True))      "Do not write new haskell object files"
[fix typo in manual, gcc should be cc
John Meacham <john@repetae.net>**20090825053425
 Ignore-this: 21e74c9892afe995bf7c240f1bea60b4
] hunk ./src/Options.hs 85
 An example describing how to cross compile for windows is as follows:
 
     [win32]
-    gcc=i386-mingw32-gcc
+    cc=i386-mingw32-gcc
     cflags+=-mwindows -mno-cygwin
     executable_extension=.exe
     merge=i686
hunk ./src/Options.hs 123
 _byteorder_               one of *le* or *be* for little or big endian
 _gc_                      what garbage collector to use. It should be one of *static* or *boehm*.
 _cflags_                  options to pass to the c compiler
-_cflags\_debug_            options to pass to the c compiler only when debugging is enabled
-_cflags\_nodebug_          options to pass to the c compiler only when debugging is disabled
+_cflags\_debug_           options to pass to the c compiler only when debugging is enabled
+_cflags\_nodebug_         options to pass to the c compiler only when debugging is disabled
 _profile_                 whether to include profiling code in the generated executable
 _autoload_                what haskell libraries to autoload, seperated by commas.
hunk ./src/Options.hs 127
-_executable\_extension_    specifies an extension that should be appended to executable files, (i.e. .EXE on windows)
+_executable\_extension_   specifies an extension that should be appended to executable files, (i.e. .EXE on windows)
 _merge_                   a special option that merges the contents of another configuration target into the currrent one.
 _bits_                    the number of bits a pointer contains on this architecture
hunk ./src/Options.hs 130
-_bits\_max_                the number of bits in the largest integral type. should be the number of bits in the 'intmax_t' C type.
+_bits\_max_               the number of bits in the largest integral type. should be the number of bits in the 'intmax_t' C type.
 _arch_                    what to pass to gcc as the architecture
 
 -}
[show output of --list-libraries in YAML format.
John Meacham <john@repetae.net>**20090826022745
 Ignore-this: c752ccdde9a382715dce04664bdfe076
] hunk ./src/Ho/Library.hs 104
 
 listLibraries :: IO ()
 listLibraries = do
-    putStrLn "Search path:"
-    mapM_ putStrLn (optHlPath options)
-    putStrLn "Libraries found:"
+    putStrLn "SearchPath:"
+    mapM_ (putStrLn . (" - " ++)) (optHlPath options)
+    putStrLn "Libraries:"
     (_,byhashes) <- fetchAllLibraries
     let nameComp a b = compare (libName a) (libName b)
hunk ./src/Ho/Library.hs 109
-    forM_ (sortBy nameComp $ Map.elems byhashes) $ \ lib -> putStrLn (libName lib)
+    forM_ (sortBy nameComp $ Map.elems byhashes) $ \ lib -> do
+        putStrLn " -"
+        let f n v = putStrLn ("  " ++ n ++ ": " ++ v)
+        f "Name" (libName lib)
+        f "Hash" (show $ libHash lib)
+--        f "Modules" (show $ libModules lib)
 
 
 

Context:

[TAG 0.7.1
John Meacham <john@repetae.net>**20090823012212
 Ignore-this: 769be545980024022f0e9acf81dbdcc2
] 
Patch bundle hash:
61d3aa3e8182de84d4448768a799ba1fcdbccd0d
