Variable-Sized Messages



next up previous contents index
Next: Communication Examples Up: The Fortran M Previous: RECEIVE

Variable-Sized Messages

     

Array dimensions in a port declaration can include variables declared in the port declaration (as long as they appear to the left of the array declaration), parameters, and arguments to the process or subroutine in which the declaration occurs. (However, the symbol ``*'' cannot be used to specify an assumed size.) Variables declared within a port declaration have scope local to that declaration.

If an array dimension in a port declaration includes variables declared in the port declaration, then that port can be used to communicate arrays of different sizes. For example, the following code fragment sends a message comprising the integer num followed by num real values.

      outport (integer n, real x(n)) po
      integer num
      real a(maxsize)
      ...
      send(po) num, a

The following code fragment receives both the value num and num real values.

      inport (integer n, real x(n)) pi
      integer num
      real b(maxsize)
      ...
      receive(pi) num, b



Steve Tuecke
Tue Aug 30 12:20:34 CDT 1994