🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: comp.sys.transputer
1 messages
1 total messages Started by Sanjay Jain Fri, 25 Nov 1988 01:24
OCCAM Array of CHAN with variant protocol bug?
#2326
Author: Sanjay Jain
Date: Fri, 25 Nov 1988 01:24
80 lines
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
--------------------------------------------------------------------------------
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads