-- Generated the files.
genFiles filename = do
   file <- readFile filename
   let cases = lines file
       infos = [i | Just i <- map getInfo cases]
       infosP = filter (\(Info _ _ t) -> not t) infos
       infosS = filter (\(Info _ _ t) ->     t) infos
       header_hs   = concat $ map (++"\n") headerHS
       header_test = concat $ map (++"\n") headerTest
       header_c    = concat $ map (++"\n") headerC
       hs_codeP   = concat $ map stuffHS infosP
       hs_codeS   = concat $ map stuffHS infosS
       test_codeP = genTests  $ map (\(Info n _ _) -> n) infosP
       test_codeS = genTestsS $ map (\(Info n _ _) -> n) infosS
       c_code     = concat $ map stuffC  infos
   writeFile "MemoryCSpec.hs" (header_test ++ test_codeP ++ wrapInIfdefs test_codeS)
   writeFile "TestCases.hs"   (header_hs   ++ hs_codeP   ++ wrapInIfdefs hs_codeS)
   writeFile "cbits/TestCases.c"  (header_c ++ c_code)

-- Default usage
genFiles filename = do
   file <- readFile filename
   let cases = lines file
       infos = [i | Just i <- map getInfo cases]
       infosP = filter (\(Info _ _ t) -> not t) infos
       infosS = filter (\(Info _ _ t) ->     t) infos
       header_hs   = concat $ map (++"\n") headerHS
       header_test = concat $ map (++"\n") headerTest
       header_c    = concat $ map (++"\n") headerC
       hs_codeP   = concat $ map stuffHS infosP
       hs_codeS   = concat $ map stuffHS infosS
       test_codeP = genTests  $ map (\(Info n _ _) -> n) infosP
       test_codeS = genTestsS $ map (\(Info n _ _) -> n) infosS
       c_code     = concat $ map stuffC  infos
   writeFile "MemoryCSpec.hs" (header_test ++ test_codeP ++ wrapInIfdefs test_codeS)
   writeFile "TestCases.hs"   (header_hs   ++ hs_codeP   ++ wrapInIfdefs hs_codeS)
   writeFile "cbits/TestCases.c"  (header_c ++ c_code)

-- Default usage
genFiles filename = do
   file <- readFile filename
   let cases = lines file
       infos = [i | Just i <- map getInfo cases]
       infosP = filter (\(Info _ _ t) -> not t) infos
       infosS = filter (\(Info _ _ t) ->     t) infos
       header_hs   = concat $ map (++"\n") headerHS
       header_test = concat $ map (++"\n") headerTest
       header_c    = concat $ map (++"\n") headerC
       hs_codeP   = concat $ map stuffHS infosP
       hs_codeS   = concat $ map stuffHS infosS
       test_codeP = genTests  $ map (\(Info n _ _) -> n) infosP
       test_codeS = genTestsS $ map (\(Info n _ _) -> n) infosS
       c_code     = concat $ map stuffC  infos
   writeFile "MemoryCSpec.hs" (header_test ++ test_codeP ++ wrapInIfdefs test_codeS)
   writeFile "TestCases.hs"   (header_hs   ++ hs_codeP   ++ wrapInIfdefs hs_codeS)
   writeFile "cbits/TestCases.c"  (header_c ++ c_code)

-- Default usage