From 19484ec72e63272310a0c596c5283b3802641c9c Mon Sep 17 00:00:00 2001 From: Adam Sampson Date: Mon, 9 Jun 2008 12:36:26 +0000 Subject: [PATCH] Show channel attributes in occam code. --- common/ShowCode.hs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/common/ShowCode.hs b/common/ShowCode.hs index 48f836c..94f9f02 100644 --- a/common/ShowCode.hs +++ b/common/ShowCode.hs @@ -249,7 +249,20 @@ instance ShowOccam A.Type where A.Dimension n -> tell ["["] >> showOccamM n >> tell ["]"] A.UnknownDimension -> tell ["[]"] | d <- ds] - showOccamM (A.Chan _ _ t) = tell ["CHAN "] >> showOccamM t + showOccamM (A.Chan dir ca t) + = tell [shared, "CHAN", direction, " "] >> showOccamM t + where + shared + = case (A.caWritingShared ca, A.caReadingShared ca) of + (False, False) -> "" + (True, False) -> "SHARED! " + (False, True) -> "SHARED? " + (True, True) -> "SHARED " + direction + = case dir of + A.DirInput -> "?" + A.DirOutput -> "!" + A.DirUnknown -> "" showOccamM (A.Counted ct et) = showOccamM ct >> tell ["::"] >> showOccamM et showOccamM (A.Port t) = tell ["PORT "] >> showOccamM t showOccamM (A.UserDataType n) = showName n >> helper "{data type}"