module UHC.Light.Compiler.EHC.FileSuffMp
( FileSuffMp, emptyFileSuffMp, mkFileSuffMpHs
, fileSuffMpHsNoSuff )
where
import qualified UHC.Light.Compiler.Config as Cfg
import UHC.Light.Compiler.Base.Target
import UHC.Light.Compiler.EHC.Common

{-# LINE 26 "src/ehc/EHC/FileSuffMp.chs" #-}
type FileSuffMp =
  [( FileSuffix				-- suffix
   , FileSuffInitState
   , Bool					-- visible from commandline
   )]

emptyFileSuffMp :: FileSuffMp
emptyFileSuffMp = []

-- | Allowed suffixes, order is significant.
mkFileSuffMpHs :: EHCOpts -> FileSuffMp
mkFileSuffMpHs opts
  = [ ( Just "hs"  , (ECUS_Haskell HSStart, ASTType_HS, ASTFileContent_Text, ASTFileUse_Src), True )
    , ( Just "lhs" , (ECUS_Haskell LHSStart, ASTType_HS, ASTFileContent_LitText, ASTFileUse_Src), True )
    , ( Just "eh"  , (ECUS_Eh EHStart, ASTType_EH, ASTFileContent_Text, ASTFileUse_Src), True )
    , ( Just "hi"  , (ECUS_Haskell HIStart, ASTType_HI, ASTFileContent_Binary, ASTFileUse_Cache), False )
    , ( Just Cfg.suffixDotlessBinaryCoreRun , (ECUS_CoreRun CRRStartBinary, ASTType_CoreRun, ASTFileContent_Binary, ASTFileUse_Src), True )
    , ( Just Cfg.suffixDotlessInputOutputTextualCore, (ECUS_Core CRStartText, ASTType_Core, ASTFileContent_Text, ASTFileUse_Src), True   )
    , ( Just Cfg.suffixDotlessInputOutputBinaryCore , (ECUS_Core CRStartBinary, ASTType_Core, ASTFileContent_Binary, ASTFileUse_Src), True )
    , ( Just Cfg.suffixDotlessBinaryCore , (ECUS_Core CRStartBinary, ASTType_Core, ASTFileContent_Binary, ASTFileUse_Src), False )
    ]
    ++ (if targetIsOnUnixAndOrC (ehcOptTarget opts)
        then [ ( Just "c"   , (ECUS_C CStart, ASTType_C, ASTFileContent_Text, ASTFileUse_Src), True )
             , ( Just "o"   , (ECUS_O OStart, ASTType_O, ASTFileContent_Binary, ASTFileUse_Src), True )
             ]
        else []
       )

{-# LINE 72 "src/ehc/EHC/FileSuffMp.chs" #-}
-- Suffix map for empty suffix, defaults to .hs
fileSuffMpHsNoSuff :: FileSuffMp
fileSuffMpHsNoSuff
  = [ ( Nothing  , (ECUS_Haskell HSStart, ASTType_HS, ASTFileContent_Text, ASTFileUse_Src), False )
    ]