module Language.Drasil.Code.Imperative.GOOL.LanguageRenderer.LanguagePolymorphic (
doxConfig, readMe, makefile, noRunIfLib, doxDocConfig,
docIfEnabled
) where
import Text.PrettyPrint.HughesPJ (Doc)
import Drasil.GOOL (ProgData)
import Language.Drasil.Choices (Comments, ImplementationType(..), Verbosity)
import Language.Drasil.Code.Imperative.Doxygen.Import (makeDoxConfig)
import Language.Drasil.Code.Imperative.Build.AST (BuildConfig, Runnable,
DocConfig, doxygenDocConfig)
import Language.Drasil.Code.Imperative.Build.Import (makeBuild)
import Language.Drasil.Code.FileNames (doxConfigName, makefileName, readMeName)
import Language.Drasil.Code.Imperative.GOOL.ClassInterface (
AuxiliarySym(auxHelperDoc), auxFromData, SoftwareDossierState)
import Language.Drasil.Code.FileData (FileAndContents)
import Language.Drasil.Code.Imperative.README (ReadMeInfo(..), makeReadMe)
doxConfig :: (AuxiliarySym r, Applicative r) => r Doc -> String ->
SoftwareDossierState -> Verbosity -> r FileAndContents
doxConfig :: forall (r :: * -> *).
(AuxiliarySym r, Applicative r) =>
r Doc
-> String -> SoftwareDossierState -> Verbosity -> r FileAndContents
doxConfig r Doc
opt String
pName SoftwareDossierState
s Verbosity
v = String -> Doc -> r FileAndContents
forall (r :: * -> *).
Applicative r =>
String -> Doc -> r FileAndContents
auxFromData String
doxConfigName (String -> SoftwareDossierState -> Doc -> Verbosity -> Doc
makeDoxConfig String
pName SoftwareDossierState
s
(r Doc -> Doc
forall (r :: * -> *). AuxiliarySym r => r Doc -> Doc
auxHelperDoc r Doc
opt) Verbosity
v)
readMe :: (Applicative r) => ReadMeInfo -> r FileAndContents
readMe :: forall (r :: * -> *).
Applicative r =>
ReadMeInfo -> r FileAndContents
readMe ReadMeInfo
rmi= String -> Doc -> r FileAndContents
forall (r :: * -> *).
Applicative r =>
String -> Doc -> r FileAndContents
auxFromData String
readMeName (ReadMeInfo -> Doc
makeReadMe ReadMeInfo
rmi)
makefile :: (Applicative r) => Maybe BuildConfig -> Maybe Runnable ->
Maybe DocConfig -> SoftwareDossierState -> ProgData -> r FileAndContents
makefile :: forall (r :: * -> *).
Applicative r =>
Maybe BuildConfig
-> Maybe Runnable
-> Maybe DocConfig
-> SoftwareDossierState
-> ProgData
-> r FileAndContents
makefile Maybe BuildConfig
bc Maybe Runnable
r Maybe DocConfig
d SoftwareDossierState
s ProgData
p = String -> Doc -> r FileAndContents
forall (r :: * -> *).
Applicative r =>
String -> Doc -> r FileAndContents
auxFromData String
makefileName (Maybe DocConfig
-> Maybe BuildConfig
-> Maybe Runnable
-> SoftwareDossierState
-> ProgData
-> Doc
makeBuild Maybe DocConfig
d Maybe BuildConfig
bc Maybe Runnable
r SoftwareDossierState
s ProgData
p)
noRunIfLib :: ImplementationType -> Maybe Runnable -> Maybe Runnable
noRunIfLib :: ImplementationType -> Maybe Runnable -> Maybe Runnable
noRunIfLib ImplementationType
Library Maybe Runnable
_ = Maybe Runnable
forall a. Maybe a
Nothing
noRunIfLib ImplementationType
Program Maybe Runnable
r = Maybe Runnable
r
doxDocConfig :: DocConfig
doxDocConfig :: DocConfig
doxDocConfig = String -> DocConfig
doxygenDocConfig String
doxConfigName
docIfEnabled :: [Comments] -> DocConfig -> Maybe DocConfig
docIfEnabled :: [Comments] -> DocConfig -> Maybe DocConfig
docIfEnabled [] DocConfig
_ = Maybe DocConfig
forall a. Maybe a
Nothing
docIfEnabled [Comments]
_ DocConfig
d = DocConfig -> Maybe DocConfig
forall a. a -> Maybe a
Just DocConfig
d