[use CFF file layout for ho files
John Meacham <john@repetae.net>**20070829015348] hunk ./Ho/Build.hs 23
+import qualified Data.ByteString.Base as L
hunk ./Ho/Build.hs 54
+import Support.CFF
hunk ./Ho/Build.hs 64
+
+--
+-- Ho File Format
+--
+-- ho files are standard CFF format files (PNG-like) as described in the Support.CFF modules.
+--
+-- the CFF magic for the files is the string "JHC"
+--
+-- JHDR - header info, contains a list of modules contained and dependencies that need to be checked to read the file
+-- LIBR - only present if this is a library, contains library metainfo
+-- TCIN - type checking information
+-- CORE - compiled core and associated data
+-- GRIN - compiled grin code
+--
+--
+
+cff_magic = chunkType "JHC"
+cff_jhdr  = chunkType "JHDR"
+cff_core  = chunkType "CORE"
+
hunk ./Ho/Build.hs 312
-    c <- L.hGetContents fh
-    let (m1,hh,ho) = decode (decompress c)
-    when (m1 /= magic) (putErrDie $ "Bad ho file magic1:" <+> fn)
+    (ct,mp) <- lazyReadCFF fh
+    True <- return $ ct == cff_magic
+    [rhh] <- Map.lookup cff_jhdr mp
+    [rho] <- Map.lookup cff_core mp
+    let hh = decode (decompress $ L.LPS [rhh])
+    let ho = decode (decompress $ L.LPS [rho])
+
+--    c <- L.hGetContents fh
+--    let (m1,hh,ho) = decode (decompress c)
+--    when (m1 /= magic) (putErrDie $ "Bad ho file magic1:" <+> fn)
hunk ./Ho/Build.hs 362
-            L.hPut fh (compress $ encode (magic,header,theho))
+            lazyWriteCFF fh cff_magic [(cff_jhdr, compress $ encode header),(cff_core, compress $ encode theho)]