next up previous contents index
Next: Translation of return statement Up: Translating method invocations Previous: Translating method invocations   Contents   Index


Methods that return multiarrays

The scheme for translating a multiarray-valued method invocation is illustrated in Figure A.32.

The macro TRANS_ID encodes the dimension signature of the returned array and is defined in section A.4.2. The macro TRANS_ARGS was defined earlier in this section.

The macro TRANS_DIM is defined as

\begin{displaymath}
\begin{minipage}[t]{\linewidth}\begin{tabbing}
$\mbox{\it TR...
...d d$\verb$.dimensions [$$r$\verb$]$
\end{tabbing}\end{minipage}\end{displaymath}

if the $r$th dimension of the result is distributed, or

\begin{displaymath}
\begin{minipage}[t]{\linewidth}\begin{tabbing}
$\mbox{\it TR...
...$$d$\verb$.dimensions [$$r$\verb$]$
\end{tabbing}\end{minipage}\end{displaymath}

if the $r$th dimension is sequential.

[Also need to support invocation as a statement expression, with source:

\begin{displaymath}
\begin{minipage}[t]{\linewidth}\begin{tabbing}
$e_{\mbox{\sm...
...\ldots$\verb$, $$e_{N-1}$\verb$) ;$
\end{tabbing}\end{minipage}\end{displaymath}

and translation:

\begin{displaymath}
\begin{minipage}[t]{\linewidth}\begin{tabbing}
${\bf T}\left...
...S}(e_0, \ldots, e_{N-1})$\verb$) ;$
\end{tabbing}\end{minipage}\end{displaymath}

]

Figure A.33: Translation of return statement in array-valued method.
SOURCE:

\begin{displaymath}
\verb$return $a\verb$ ;$
\end{displaymath}

TRANSLATION:


\begin{displaymath}
\begin{minipage}[t]{\linewidth}\begin{tabbing}
$d$\verb$.bas...
...all dat}}\left[{a}\right]$\verb$ ;$
\end{tabbing}\end{minipage}\end{displaymath}

where:

\begin{displaymath}
\begin{array}{l}
\par\mbox{$a$ is the array-valued result e...
...passed as first argument of the translated method.}
\end{array}\end{displaymath}


next up previous contents index
Next: Translation of return statement Up: Translating method invocations Previous: Translating method invocations   Contents   Index
Bryan Carpenter 2003-04-15