Article View: comp.sys.transputer
Article #2265Re: Splitting up channel comms
From: paszkows
Date: Wed, 02 Nov 1988 13:09
Date: Wed, 02 Nov 1988 13:09
54 lines
1842 bytes
1842 bytes
In article <675@prlhp1.prl.philips.co.uk> paszkows@prlhp1.UUCP () writes:
>
>
> chan.out ! lint1
> chan.out ! lint2
>
>
> SEQ
> chan.in ? byte1
> chan.in ? int1
> chan.in ? int2
> chan.in ? byte2
> chan.in ? int3
>
>
Having posed the problem, I have managed to solve it myself. Read on for the
solution.
Occam 2 reference manual states that with a PROTOCOL OF ANY, the data sent
is mapped into its constituent bytes, and output as an array.
Input on this channel inputs the array of bytes and converts ( by retyping
conversion ) the value to the type of the receiving variable.
I am not convinced that the last statement holds true ( opinions ? ) as I
had to do the retyping manually.
Anyway, on input channel, read the data into a BYTE array of length equal to
that of the sent data as shown below.
-- retype the bytes into required format.
BYTE byte1 RETYPES inword[5]
BYTE byte1 RETYPES inword[0] :
INT16 inta RETYPES [inword FROM 0 FOR 2 ]
INT16 intb RETYPES [inword FROM 3 FOR 2 ]
INT16 intc RETYPES [inword FROM 6 FOR 2 ]
INT32 int1, int2 : -- the data being sent.
CHAN OF ANY channel.a :
SEQ
PAR
SEQ
channel.a ! int1
channel.a ! int2
SEQ
channel.a ? [ inword FROM 0 FOR 4 ] -- receive 4 bytes making up int1
channel.a ? [ inword FROM 4 FOR 4 ] -- receive 4 bytes making up int2
Technical Details
Message-ID:
<683@prlhp1.prl.philips.co.uk>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!attcan!uunet!mcvax!ukc!stc!idec!prlhp1!paszkowsReferences:
<675@prlhp1.prl.philips.co.uk>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!attcan!uunet!mcvax!ukc!stc!idec!prlhp1!paszkows From: paszkows@prlhp1.prl.philips.co.uk (paszkows) Newsgroups: comp.sys.transputer Subject: Re: Splitting up channel comms Message-ID: <683@prlhp1.prl.philips.co.uk> Date: 2 Nov 88 13:09:50 GMT References: <675@prlhp1.prl.philips.co.uk> Reply-To: paszkows@prlhp1.UUCP () Organization: Philips Research Laboratories, Redhill, UK Lines: 54