-- T_GenChannel.tex
--
-- To test the declaration and use of generic channels and channels that 
-- synchronize on multiple values.
-- GUI for these types of channels have not been implemented yet.
--------------------------------------------------------------------------------

\begin{zed}
  Colour ::= blue | red | green | yellow
\end{zed}  

\begin{zed}
  Weekend ::= saturday | sunday
\end{zed}  

\begin{zed}
  Angel ::= A | N | G | E | L
\end{zed}  

\begin{circus}
  \circchannel scIn: Colour \cross Weekend; scOut: Weekend \cross Colour; sc: Angel \cross Colour; simple: Colour
\end{circus}

\begin{circus}
  \circchannel [X, Y] g : Angel \cross X \cross Y; [X] gIn: X \cross X; [Y] gOut: Angel \cross Y
\end{circus}  

\begin{circus}  
    \circprocess GenChannelP \circdef \circbegin
\end{circus}

    \begin{circusaction}
        SyncChannel \circdef 
            simple.red \then
            sc.A.blue \then 
            scIn.blue?saturday \then
            scOut.sunday!yellow \then
            \Skip
    \end{circusaction}     

    \begin{circusaction}
        Gen \circdef g[Colour, Weekend].A.red.saturday \then 
            g[Weekend, Colour].N.sunday.green \then
            g[Angel, Angel].A.N.G \then
            \Skip
    \end{circusaction}

    \begin{circusaction}
        GenInOut \circdef 
            gIn[Colour].blue?red \then 
                gIn[Weekend].saturday?sunday \then
                    gOut[Angel].A!N \then
                        gOut[Colour].A!green \then
                            \Skip
    \end{circusaction}

    :: Maybe it is not necessary to differentiate Input and AltingInput channels
    :: anymore
    begin{circus}
        ExtChoice \circdef 
            (gIn[Colour].blue?red \then Skip)
            \extchoice
            (scIn.blue?saturday \then Skip)
            \extchoice
            (sc.A.blue \then Skip)
    \end{circus}

\begin{circusaction}      
      \circspot \Skip
\end{circusaction}

\begin{circus}
\circend
\end{circus}
