<commit_before>-----------------------------------------------------------------------------
--
-- Module      :  Main
-- Copyright   :  (c) 2011 <NAME>
-- License     :  BSD-style (see the file /LICENSE)
--
-- Maintainer  :
-- Stability   :
-- Portability :
--
-- |
--
-----------------------------------------------------------------------------

module Main (
    main
) where


import Language.Haskell.Exts.Pretty
import Code.Generating.Utils

import Code.Generating.Package

import Spec
import Spec.Parsing(parseSpecs, parseReuses)

import Code.Raw
import Code.Module(replaceCallConv)

main :: IO ()
main = procNew



procNew :: IO ()
procNew = do
    let especP  = "enumext.spec"
        fspecP  = "gl.spec"
        tmspecP = "gl.tm"
        rfuncP  = "reusefuncs"
    erawSpec <- parseSpecs especP fspecP tmspecP
    case erawSpec of
        Left e -> print e
        Right rawSpec -> do
            reuses <- readFile rfuncP >>= return . parseReuses
            writeFile "temp.output" $ show reuses
            let reuses' = either (\ e-> error $ "Parsing the reuses faild with" ++ show e) id reuses
                modules = makeRaw $ filterEmpty . addReuses reuses' $ rawSpec
                pmodule mn m =
                    let msc = replaceCallConv "CALLCONV" $ prettyPrint m
                    in  safeWriteFile ("output/" ++ moduleNameToPath mn ++ ".hs") msc
            processModules' pmodule modules
                >> safeWriteFile "output/modulesE.txt" (unlines .
                    map (\n -> "      " ++ moduleNameToName n ++ ",") . fst $ listModules modules)
                >> safeWriteFile "output/modulesI.txt" (unlines .
                    map (\n -> "      " ++ moduleNameToName n ++ ",") . snd $ listModules modules)<commit_msg>Remove the useless temp.output file generation.<commit_after>-----------------------------------------------------------------------------
--
-- Module      :  Main
-- Copyright   :  (c) 2011 <NAME>
-- License     :  BSD-style (see the file /LICENSE)
--
-- Maintainer  :
-- Stability   :
-- Portability :
--
-- |
--
-----------------------------------------------------------------------------

module Main (
    main
) where


import Language.Haskell.Exts.Pretty
import Code.Generating.Utils

import Code.Generating.Package

import Spec
import Spec.Parsing(parseSpecs, parseReuses)

import Code.Raw
import Code.Module(replaceCallConv)

main :: IO ()
main = procNew

procNew :: IO ()
procNew = do
    let especP  = "enumext.spec"
        fspecP  = "gl.spec"
        tmspecP = "gl.tm"
        rfuncP  = "reusefuncs"
    erawSpec <- parseSpecs especP fspecP tmspecP
    case erawSpec of
        Left e -> print e
        Right rawSpec -> do
            reuses <- readFile rfuncP >>= return . parseReuses
            let reuses' = either (\ e-> error $ "Parsing the reuses faild with" ++ show e) id reuses
                modules = makeRaw $ filterEmpty . addReuses reuses' $ rawSpec
                pmodule mn m =
                    let msc = replaceCallConv "CALLCONV" $ prettyPrint m
                    in  safeWriteFile ("output/" ++ moduleNameToPath mn ++ ".hs") msc
            processModules' pmodule modules
                >> safeWriteFile "output/modulesE.txt" (unlines .
                    map (\n -> "      " ++ moduleNameToName n ++ ",") . fst $ listModules modules)
                >> safeWriteFile "output/modulesI.txt" (unlines .
                    map (\n -> "      " ++ moduleNameToName n ++ ",") . snd $ listModules modules)
{'fraction_non_alphanumeric': 0.19167142042213348, 'fraction_numerical': 0.0022818026240730175, 'mean_word_length': 1.4978632478632479, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 27, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4170633', 'n_tokens_mistral': 1003, 'n_tokens_neox': 971, 'n_words': 270}