[comp.sys.transputer] How to send a variant protocol over a link?

U06A@CBEBDA3T.BITNET (Stefan Friedli) (03/17/88)

I hope someone can help with the following problem:

For a program I currently develop, it would be a nice and elegant
way to have a variant protocol on a physical link. As this is
not supported by the configuring language (only CHAN OF ANY is
allowed for links), I looked for (and found) a solution: declare
the links as CHAN OF ANY, pass it as an actual parameter to some
procedure that has as the corresponding formal parameter a channel
of a variant protocol.

Problem: This works fine (and does what it's supposed to do!!!)...
on the compiler in d700C. The new compiler in d700D rejects this
way of parameter passing and according to a note of INMOS (Writing
occam programs to minimise future changes, June 24, 1987, paragraph
2: Protocols), this restriction will be kept in future releases.

Anyone out there to help?

Thanks. Stef.

sfbt@its63b.ed.ac.uk (S Tett) (03/20/88)

In article <8803171831.AA04508@tcgould.TN.CORNELL.EDU> U06A@CBEBDA3T.BITNET (Stefan Friedli) writes:
>>
>I hope someone can help with the following problem:
>
>For a program I currently develop, it would be a nice and elegant
>way to have a variant protocol on a physical link. As this is
>not supported by the configuring language (only CHAN OF ANY is
>allowed for links), I looked for (and found) a solution: declare
>the links as CHAN OF ANY, pass it as an actual parameter to some
>procedure that has as the corresponding formal parameter a channel
>of a variant protocol.

The way to solve this little problem without recourse to hacking is
to declare a buffer.(I'll give an example for an output link)

PROC buffer(CHAN OF PROTOCOL ..... in,CHAN OF ANY out)
-- out is the output CHAN to the hard link
  INT var1,var2,var3......:
  WHILE TRUE
    SEQ
      in ? var1;var2;var3 -- assuming protocol is INT;INT;INT
      out ! var1;var2;var3
:

Simon

Meteorology Dept/Physics Dept Concurrent "Super"-Computer User

mrh@camcon.uucp (Mark Hughes) (03/29/88)

From article <8803171831.AA04508@tcgould.TN.CORNELL.EDU>, by U06A@CBEBDA3T.BITNET (Stefan Friedli):
> 
> For a program I currently develop, it would be a nice and elegant
> way to have a variant protocol on a physical link. As this is

I can't try this and feel it sounds too simple, but...

it should be possible to instert a dummy process between the physical link
and your "variant protocal channel". This process would have two paramters,
one a channel supporting your variant protocol and the other a CHAN OF ANY,
"placed at" the physical link. The process's sole function is to relay
information between the variant protocal channel and the link. It's a bodge,
but simple enough not to be too unpleasant. I hope it works!
-- 
-------------------  UUCP:    mrh@camcon.uucp  / ..uunet!mcvax!ukc!camcon!mrh
|   Mark Hughes   |  Telex:   265871 ref:MAG70076
|(Compware . CCL) |  BT Gold: 72:MAG70076
-------------------  Teleph:  Cambridge (UK) (0)223-358855