Article View: comp.sys.transputer
Article #2326OCCAM Array of CHAN with variant protocol bug?
From: Sanjay Jain
Date: Fri, 25 Nov 1988 01:24
Date: Fri, 25 Nov 1988 01:24
80 lines
2854 bytes
2854 bytes
Dear Mailing List :
I have just started programming in OCCAM, and had problems using arrays of
channels with variant protocols. I am submitting 2 programs with this posting.
In both if these, I define a variant protocol and then proceed to use it. The
only difference between the two programs is that the first program uses the
channel x, and the other uses x[1]. I would have expected both of these programs
to work, but only the first one does.
If it is relevant :I am using the transputer development system provided by INMOS.
I would be very grateful, if someone on the net could tell me what is wrong with
what I am doing, or if this is a bug in the OCCAM compiler.
thanx
sanjay
--------------------------------------------------------------------------------
Program One
--------------------------------------------------------------------------------
PROC ins.sort(CHAN OF ANY kbd, scrn)
#USE "\tdsiolib\userio.tsr"
PROTOCOL Messages
CASE
a; INT
b
:
CHAN OF Messages x :
INT l,tmp :
SEQ
PAR
SEQ
x ! a; 1
x ! b
SEQ
x ? CASE
a; tmp
SKIP
x ? CASE
b
SKIP
INT any:
SEQ
write.full.string(scrn, "hit any key to continue")
newline(scrn)
read.char(kbd,any)
:
--------------------------------------------------------------------------------
Program Two
--------------------------------------------------------------------------------
PROC ins.sort(CHAN OF ANY kbd, scrn)
#USE "\tdsiolib\userio.tsr"
PROTOCOL Messages
CASE
a; INT
b
:
[2]CHAN OF Messages x :
INT l,tmp :
SEQ
PAR
SEQ
x[1] ! a; 1
x[1] ! b
SEQ
x[1] ? CASE
a; tmp
SKIP
x[1] ? CASE
b
SKIP
INT any:
SEQ
write.full.string(scrn, "hit any key to continue")
newline(scrn)
read.char(kbd,any)
:
--------------------------------------------------------------------------------
Sanjay Jain
E Mail : sanjay@cs.ucla.edu US Mail: 11805 Idaho Ave #2
Phone : (213) 826 4950 Los Angeles CA 90025
--------------------------------------------------------------------------------
Technical Details
Message-ID:
<8811250124.AA20926@maui.cs.ucla.edu>Path:
arc1-ca.pugleaf.net!utzoo!attcan!uunet!husc6!cmcl2!rutgers!apple!bionet!agate!ucbvax!CS.UCLA.EDU!sanjayShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!husc6!cmcl2!rutgers!apple!bionet!agate!ucbvax!CS.UCLA.EDU!sanjay From: sanjay@CS.UCLA.EDU (Sanjay Jain) Newsgroups: comp.sys.transputer Subject: OCCAM Array of CHAN with variant protocol bug? Message-ID: <8811250124.AA20926@maui.cs.ucla.edu> Date: 25 Nov 88 01:24:47 GMT Sender: daemon@ucbvax.BERKELEY.EDU Organization: The Internet Lines: 80