Newsgroups: comp.sys.transputer
From: wgd@ukc.ac.uk (Warren Day)
Subject: An occam query
Organization: University of Kent at Canterbury, UK.
Date: Tue, 14 Jun 94 10:42:56 GMT
Message-ID: <9443@eagle.ukc.ac.uk>

Hi,

Does anyone have any light to throw on this problem of automated type
measurement in occam?

I'm trying to write something like,

[]BYTE packet
  ...
  INT value RETYPES [packet FROM 0 FOR bytes.in.an(INT) ]:
  value := expr

I've tried,

  INT value RETYPES [packet FROM 0 FOR (SIZE INT) ]:
  value := expr

but the compiler complains,

Error 2017:13 Monadic operator INT and operand not in parentheses

and from playing around it is complaining about the second INT on the line
not the first (weird!).

Has anyone got a much cleaner way to do this, and a way that get through the
compiler.  I would prefer to have something automatic that the compiler can
look at and work out,

  INT value RETYPES [packet FROM 0 FOR relative.size(INT, BYTE) ]:
  value := expr

and not just an anonymous constant such as,

  VAL bytes.in.an.int IS 4:
  INT value RETYPES [packet FROM 0 FOR bytes.in.an.int ]:
  value := expr

Thanks for any thoughts.

Smiles,
--
Warren
		Pause for a moment,
			and consider mans humanity towards his fellow man.

