scale.frontend.fortran
Class ImpliedDo

java.lang.Object
  extended by scale.frontend.fortran.ImpliedDo

public class ImpliedDo
extends java.lang.Object

This class is used to process the Fortran implied-do constructs.

$Id: ImpliedDo.java,v 1.12 2007-10-04 19:58:13 burrill Exp $

Copyright 2008 by the Scale Compiler Group,
Department of Computer Science
University of Massachusetts,
Amherst MA. 01003, USA
All Rights Reserved.


Constructor Summary
ImpliedDo(F95 f95, int lineno)
           
 
Method Summary
 void add(Expression exp)
          Add an expression to be iterated over.
 void add(ImpliedDo id)
          Add another implied-do to be iterated over.
 void addData(Literal value, long repeat)
          Record a data item for use in DATA statements.
 DoLoopStmt genImpliedDoLoop(int callback, F95 f95)
          Generate the implied do loops and return the outer-most DO statement.
 boolean initVariables(boolean allowEqVars)
          Initialize the variables collected with the data collected.
 void set(VariableDecl indexVar, Expression init, Expression limit, Expression step)
          Specify the implied do loop.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ImpliedDo

public ImpliedDo(F95 f95,
                 int lineno)
Parameters:
f95 - is the parser
lineno - is the source line number causing this implied do
Method Detail

add

public void add(Expression exp)
Add an expression to be iterated over. It is usually a SubscriptValueOp instance.


add

public void add(ImpliedDo id)
Add another implied-do to be iterated over. This occurs when two index variables are required as in ((A(I,J),1,10),1,5).


set

public void set(VariableDecl indexVar,
                Expression init,
                Expression limit,
                Expression step)
         throws InvalidException
Specify the implied do loop.

Parameters:
indexVar - is the iteration variable
init - is the initial value for the iteration variable
limit - is the end value for the iteration variable
step - is the increment
Throws:
InvalidException

addData

public void addData(Literal value,
                    long repeat)
Record a data item for use in DATA statements.


initVariables

public boolean initVariables(boolean allowEqVars)
Initialize the variables collected with the data collected.

Returns:
false if an error was encountered

genImpliedDoLoop

public DoLoopStmt genImpliedDoLoop(int callback,
                                   F95 f95)
                            throws InvalidException
Generate the implied do loops and return the outer-most DO statement. This method does a call back to the F95 class for each variable referenced.

Throws:
InvalidException
See Also:
F95.callback(int, scale.clef.expr.Expression, scale.clef.stmt.BlockStmt)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object