Changed the TLP and PrettyShow modules to use CSMR instead of CSM
This commit is contained in:
parent
c56cc6022a
commit
035c526bef
|
@ -35,9 +35,9 @@ data TLPChannel = TLPIn | TLPOut | TLPError
|
||||||
|
|
||||||
-- | Get the name of the TLP and the channels it uses.
|
-- | Get the name of the TLP and the channels it uses.
|
||||||
-- Fail if the process isn't using a valid interface.
|
-- Fail if the process isn't using a valid interface.
|
||||||
tlpInterface :: (CSM m, Die m) => m ( A.Name, [(A.Direction, TLPChannel)] )
|
tlpInterface :: (CSMR m, Die m) => m ( A.Name, [(A.Direction, TLPChannel)] )
|
||||||
tlpInterface
|
tlpInterface
|
||||||
= do ps <- get
|
= do ps <- getCompState
|
||||||
when (null $ csMainLocals ps) (dieReport (Nothing,"No main process found"))
|
when (null $ csMainLocals ps) (dieReport (Nothing,"No main process found"))
|
||||||
let mainName = snd $ head $ csMainLocals ps
|
let mainName = snd $ head $ csMainLocals ps
|
||||||
st <- specTypeOfName mainName
|
st <- specTypeOfName mainName
|
||||||
|
@ -48,7 +48,7 @@ tlpInterface
|
||||||
when ((nub (map snd chans)) /= (map snd chans)) $ dieP (findMeta mainName) "Channels used more than once in TLP"
|
when ((nub (map snd chans)) /= (map snd chans)) $ dieP (findMeta mainName) "Channels used more than once in TLP"
|
||||||
return (mainName, chans)
|
return (mainName, chans)
|
||||||
where
|
where
|
||||||
tlpChannel :: (CSM m, Die m) => Meta -> A.Formal -> m (A.Direction, TLPChannel)
|
tlpChannel :: (CSMR m, Die m) => Meta -> A.Formal -> m (A.Direction, TLPChannel)
|
||||||
tlpChannel m (A.Formal _ (A.Chan dir _ _) n)
|
tlpChannel m (A.Formal _ (A.Chan dir _ _) n)
|
||||||
= do def <- lookupName n
|
= do def <- lookupName n
|
||||||
let origN = A.ndOrigName def
|
let origN = A.ndOrigName def
|
||||||
|
|
|
@ -38,7 +38,7 @@ import qualified Data.Set as Set
|
||||||
import Text.PrettyPrint.HughesPJ
|
import Text.PrettyPrint.HughesPJ
|
||||||
|
|
||||||
import qualified AST as A
|
import qualified AST as A
|
||||||
import CompState
|
import CompState hiding (CSM) -- everything here is read-only
|
||||||
import Metadata
|
import Metadata
|
||||||
import Pattern
|
import Pattern
|
||||||
import ShowCode
|
import ShowCode
|
||||||
|
@ -153,8 +153,8 @@ doAny extFunc = extFunc (
|
||||||
pshow :: Data a => a -> String
|
pshow :: Data a => a -> String
|
||||||
pshow x = render $ doAny id x
|
pshow x = render $ doAny id x
|
||||||
|
|
||||||
pshowCode :: (Data a, CSM m) => a -> m String
|
pshowCode :: (Data a, CSMR m) => a -> m String
|
||||||
pshowCode c = do st <- get
|
pshowCode c = do st <- getCompState
|
||||||
case csFrontend st of
|
case csFrontend st of
|
||||||
FrontendOccam -> return $ render $ (extOccam $ doAny extOccam) c
|
FrontendOccam -> return $ render $ (extOccam $ doAny extOccam) c
|
||||||
FrontendRain -> return $ render $ (extRain $ doAny extRain) c
|
FrontendRain -> return $ render $ (extRain $ doAny extRain) c
|
||||||
|
|
Loading…
Reference in New Issue
Block a user