scale.clef.decl
Class RoutineDecl

java.lang.Object
  |
  +--scale.common.Root
        |
        +--scale.clef.Node
              |
              +--scale.clef.decl.Declaration
                    |
                    +--scale.clef.decl.RoutineDecl
All Implemented Interfaces:
AnnotationInterface, DisplayNode, java.io.Serializable
Direct Known Subclasses:
FriendDecl, MethodDecl, MethodReferenceDecl, ProcedureDecl

public abstract class RoutineDecl
extends Declaration

This is the base class representing all routine declarations.

$Id: RoutineDecl.java,v 1.39 2002/01/03 21:42:45 burrill Exp $

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

See Also:
Serialized Form

Fields inherited from class scale.clef.decl.Declaration
accessibilities, cAuto, cExtern, cFile, cGlobal, cLocal, cMemory, cPrivate, cProtected, cPublic, cRegister, residencies, visibilitys
 
Fields inherited from interface scale.common.DisplayNode
ANNO, CLEF, DD, DEFUSE, DOM, EXPR, MAYUSE, TYPE
 
Constructor Summary
protected RoutineDecl(java.lang.String name, ProcedureType pt)
           
protected RoutineDecl(java.lang.String name, ProcedureType pt, Statement body)
          Create a routine with the specified name and type.
 
Method Summary
protected  Vector createChildren()
          Create the list of children for the node - each node that has children must implement this method.
protected  void finalize()
          Keep the count of instances up-to-date.
 Statement getBody()
           
 VariableDecl getFtnResultVar()
          Return the declared function result variable (if any).
 ProcedureType getSignature()
          Return this routine's type
 boolean isMain()
          Return true if the declaration is Main somewhere in the Clef AST or has a body.
 boolean isReferenced()
          Return true if the declaration is referenced somewhere in the Clef AST or has a body.
 boolean isSpecification()
          Return true if this is a specification of the routine.
static int number()
          Return the current number of instances of this class.
 void setBody(Statement b)
           
 void setFtnResultVar(VariableDecl ftnResultVar)
          Declare the function result variable.
 void setMain()
          Indicates that this procedure is the main procedure.
 void setReferenced()
          Specify that the routine is referenced somewhere in the Clef AST.
 void setSignature(ProcedureType s)
           
 void setSpecification(boolean s)
           
 void setUsesVaStart()
          Specify that the routine is referenced somewhere in the Clef AST.
 java.lang.String toStringSpecial()
          Return any special information of a node that is not a child or annotation.
 boolean usesVaStart()
          Return true if the declaration is referenced somewhere in the Clef AST or has a body.
 void visit(Predicate p)
          The visit() method is used to implement a visit 'pattern'.
 
Methods inherited from class scale.clef.decl.Declaration
accessibility, addressTaken, DDname, getConstantValue, getCoreType, getDecl, getDisplayColorHint, getDisplayShapeHint, getDisplayText, getName, getParent, getScope, getScopeNode, getTag, getType, hashCode, inMemory, isFtnResultVar, isGlobal, isPure, isTemporary, isVariable, isVirtual, residency, setAccessibility, setAddressTaken, setChildParent, setName, setParent, setResidency, setScope, setTag, setType, setVisibility, visibility
 
Methods inherited from class scale.clef.Node
getChildren, setAnnotationLevel, setReportLevel, toString, toString, toStringChildren
 
Methods inherited from class scale.common.Root
addAnnotation, allAnnotations, allMatchingAnnotations, getAnnotation, getDisplayName, getDisplayString, getNodeCount, getNodeID, hasAnnotation, hasEqualAnnotation, removeAnnotation, removeAnnotations, toStringAnnotations, toStringClass
 
Methods inherited from class java.lang.Object
clone, equals, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RoutineDecl

protected RoutineDecl(java.lang.String name,
                      ProcedureType pt,
                      Statement body)
Create a routine with the specified name and type.
Parameters:
name - is the method name
pt - is the method type
body - is the method body

RoutineDecl

protected RoutineDecl(java.lang.String name,
                      ProcedureType pt)
Method Detail

finalize

protected void finalize()
                 throws java.lang.Throwable
Keep the count of instances up-to-date.
Overrides:
finalize in class Declaration
Throws:
java.lang.Throwable - [needs description]

number

public static int number()
Return the current number of instances of this class.

isReferenced

public boolean isReferenced()
Return true if the declaration is referenced somewhere in the Clef AST or has a body.
Overrides:
isReferenced in class Declaration
Following copied from class: scale.clef.decl.Declaration
See Also:
VariableDecl, RoutineDecl

setReferenced

public void setReferenced()
Specify that the routine is referenced somewhere in the Clef AST.
Overrides:
setReferenced in class Declaration
Following copied from class: scale.clef.decl.Declaration
See Also:
VariableDecl, RoutineDecl

usesVaStart

public boolean usesVaStart()
Return true if the declaration is referenced somewhere in the Clef AST or has a body.

setUsesVaStart

public void setUsesVaStart()
Specify that the routine is referenced somewhere in the Clef AST.

isMain

public boolean isMain()
Return true if the declaration is Main somewhere in the Clef AST or has a body.

setMain

public void setMain()
Indicates that this procedure is the main procedure. This marks the main procedure in the C sense.

getFtnResultVar

public VariableDecl getFtnResultVar()
Return the declared function result variable (if any).

setFtnResultVar

public void setFtnResultVar(VariableDecl ftnResultVar)
Declare the function result variable.

toStringSpecial

public java.lang.String toStringSpecial()
Description copied from class: Root
Return any special information of a node that is not a child or annotation. This method is meant to be overridden by nodes that need to provide special output.
Overrides:
toStringSpecial in class Declaration

visit

public void visit(Predicate p)
Description copied from class: Node
The visit() method is used to implement a visit 'pattern'.
Overrides:
visit in class Declaration

getSignature

public ProcedureType getSignature()
Return this routine's type

setSignature

public void setSignature(ProcedureType s)

isSpecification

public final boolean isSpecification()
Return true if this is a specification of the routine.

setSpecification

public final void setSpecification(boolean s)

setBody

public final void setBody(Statement b)

getBody

public final Statement getBody()

createChildren

protected Vector createChildren()
Description copied from class: Node
Create the list of children for the node - each node that has children must implement this method. However, use getChildren() to actually get the children.
Overrides:
createChildren in class Node
Following copied from class: scale.clef.Node
Returns:
the list of children