Next: Methods that return multiarrays
Up: Basic translation
Previous: Translating variable declarations
Contents
Index
Translating method declarations
There are two cases to consider. The case where the result of the
method is not a multiarray, and the case where the result is
a multiarray. First we consider the case where the result
is not a multiarray.
The general scheme is illustrated in Figure
A.14. This scheme is modified
in trivial ways if the method has a void result, or involves other
modifiers (they are copied to the translated code).
The macro TRANS_PARAMS evaluates to a list of formal parameters.
We will define it in terms the simpler macro TRANS_PARAM
which operates on a single formal parameter declaration:
Now, if is not a multiarray type, we have
Otherwise, if has the form
(where as usual is a Java type and as usual
each term
is a single hyphen, , or
a single asterisk, *, and the term
is a string
of zero or more bracket pairs, [])
then the macro TRANS_PARAM is defined by
where
, , ..., ,
and
are new formal
parameter names that may be obtained from using the prescription
given in Figure A.13 (for examplethese
are local names so the exact prescription is unimportant).
The macro DIMENSION_TYPE is defined in section
A.4.2.
In other words, each multiarray parameter is split into
parameters.
If, for example, a class in the source program has a method:
the translated class can be assumed to have the method:
The last parameter added by the translator will hold the value
of the active process group (APG) in effect at the point of
invocation of the method.
Figure A.15:
Translation of declaration of method returning a multiarray.
SOURCE:
TRANSLATION:
where:

Subsections
Next: Methods that return multiarrays
Up: Basic translation
Previous: Translating variable declarations
Contents
Index
Bryan Carpenter
20030415