X-Git-Url: https://git.stderr.nl/gitweb?a=blobdiff_plain;f=TranslatorTypes.hs;h=e16c12ea3a6fa1678f76c7521c3d684dd84d5775;hb=3ed479f405a79b401f3f1e88a7a4a735ce62d5d6;hp=733e65938bf84c20470de758e657be345e0fd990;hpb=8325780f83f31cc3520029912d0797704d058d7e;p=matthijs%2Fmaster-project%2Fc%CE%BBash.git diff --git a/TranslatorTypes.hs b/TranslatorTypes.hs index 733e659..e16c12e 100644 --- a/TranslatorTypes.hs +++ b/TranslatorTypes.hs @@ -5,15 +5,17 @@ module TranslatorTypes where import qualified Control.Monad.State as State +import qualified HscTypes import Flatten type FuncMap = [(HsFunction, (FlatFunction))] data VHDLSession = VHDLSession { + coreMod :: HscTypes.CoreModule, -- The current module nameCount :: Int, -- A counter that can be used to generate unique names funcs :: FuncMap -- A map from HsFunction to FlatFunction, HWFunction, VHDL Entity and Architecture -} deriving (Show) +} -- Add the function to the session addFunc :: HsFunction -> FlatFunction -> VHDLState () @@ -21,6 +23,9 @@ addFunc hsfunc flatfunc = do fs <- State.gets funcs -- Get the funcs element from the session State.modify (\x -> x {funcs = (hsfunc, flatfunc) : fs }) -- Prepend name and f +getModule :: VHDLState HscTypes.CoreModule +getModule = State.gets coreMod -- Get the coreMod element from the session + type VHDLState = State.State VHDLSession -- Makes the given name unique by appending a unique number.