Newsgroups: comp.sys.transputer
From: des@pact.srf.ac.uk (David Shepherd)
Reply-To: des@inmos.co.uk
Subject: Re: Occam Question
Organization: INMOS Architecture Group
Date: Tue, 25 Oct 1994 11:46:24 GMT
Message-ID: <Cy88pC.CwM@info.bris.ac.uk>

Manfred Sever (mse@wolverine.utias.utoronto.ca) wrote:
:   [10]INT samples :
:   []BYTE data RETYPES [samples FROM 0 FOR 10] :

: What happens is that the array `samples' gets
: filled by a `CHAN OF []INT' since it is an array
: of INTs.

: I need to send this data out on a `CHAN OF []BYTE',
: hence the necessity of the RETYPES command.

: The only way to get the above code to compile and
: run is to disable usage checking with the `A'
: compiler option.

??? I think the problem is that you put the RETYPES
immediately after the declaration. The RETYPES declaration
gives a new name to samples and thus removes samples
from the scope.

Instead move the RETYPES to where you output the data - remember
in occam declarations can go virtually anywhere.

[10]INT samples :
SEQ
  -- read in arrays of ints from in.chan into samples
  in.chan ? samples
  ...  process samples or whatever
  -- retype samples into array of bytes and output to out.chan
  []BYTE data RETYPES [samples FROM 0 FOR 10] :
  out.chan ! data


--
--------------------------------------------------------------------------
david shepherd: des@inmos.co.uk                     tel: 0454-616616 x 638
                inmos ltd, 1000 aztec west, almondsbury, bristol, bs12 4sq
		"I  am  not  a  nut      ---      I  am  a  human  being."

