CO538 Anonymous Questions and Answers Keyword Index |
This page provides a keyword index to questions and answers. Clicking on a keyword will take you to a page containing all questions and answers for that keyword, grouped by year.
To submit a question, use the anonymous questions page. You may find the keyword index and/or top-level index useful for locating past questions and answers.
Keyword reference for multiplex
2000 |
I am attempting to plex together multiple channels into one. Each channel uses a tagged protocol, STATUS, that I have defined. I have found a working solution:
PROC plex ([]CHAN OF STATUS in, CHAN OF STATUS out) WHILE TRUE ALT i = 0 FOR SIZE in in[i] ? CASE INT v: sitting; v out ! sitting; v thinking; out ! thinking ... same for all the other variants
However, I am not happy with this, since I am just switching based on what's in the protocol, and just outputting it in every case. What I want to be able to do is something like:
PROC plex ([]CHAN OF STATUS in, CHAN OF STATUS out) WHILE TRUE ALT i = 0 FOR SIZE in STATUS s: in[i] ? s out ! s :
All my attempts at this have failed, usually resulting in:
Error-oc-myq7.occ(117)- Name STATUS is not a TYPE.
Can you point me at the right syntax for this? Thanks.
Your question is a very good one. I'm afraid that occam2.1 has no syntax to express your perfectly reasonable request! This problem occurs when writing many standard components for handling variant (CASE) protocols - buffers, message routers as well as multiplexors and de-mutiplexors. The proposed, but so far unimplemented, occam3 language enabled the declaration of UNION data-types, that would mostly solve this problem. The draft occam3 language specification can be found on:
http://wotug.ukc.ac.uk/parallel/occam/documentation/
for those interested (1.4 MBytes postscript). Summer or group project anyone?
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 Unported License. |