com.caucho.quercus.program
Class FunctionGenerator

java.lang.Object
  extended by com.caucho.quercus.program.FunctionGenerator

public abstract class FunctionGenerator
extends java.lang.Object

Represents a function


Constructor Summary
protected FunctionGenerator()
           
protected FunctionGenerator(Location location)
           
 
Method Summary
 void analyze(QuercusProgram program)
          Analyzes the function.
 void analyzeArguments(Expr[] args, AnalyzeInfo info)
          Analyzes the arguments for read-only and reference.
 boolean canGenerateCall(Expr[] args)
          Returns true if the function can generate the call directly.
 void generate(PhpWriter out)
          Generates the code for the class component.
abstract  void generate(PhpWriter out, ExprGenerator funExpr, Expr[] args)
          Generates code to calluate the expression.
 void generateBoolean(PhpWriter out, ExprGenerator funExpr, Expr[] args)
          Generates code to calluate as a boolean expression.
 void generateCopy(PhpWriter out, ExprGenerator funExpr, Expr[] args)
          Generates code to calluate as a double expression.
 void generateDouble(PhpWriter out, ExprGenerator funExpr, Expr[] args)
          Generates code to calluate as a double expression.
 void generateInit(PhpWriter out)
          Generates the code for the initialization component.
 void generateLong(PhpWriter out, ExprGenerator funExpr, Expr[] args)
          Generates code to calluate as a long expression.
 void generateRef(PhpWriter out, ExprGenerator funExpr, Expr[] args)
          Generates code to calluate the expression.
 void generateString(PhpWriter out, ExprGenerator funExpr, Expr[] args)
          Generates code to calluate as a string expression.
 void generateTop(PhpWriter out, ExprGenerator funExpr, Expr[] args)
          Generates code to calluate as a top-level expression.
 Arg[] getArgs()
          Returns the args.
 Location getLocation()
           
 java.lang.String getName()
           
 boolean isAbstract()
          Returns true for an abstract function.
 boolean isBoolean()
          Returns true for a boolean function.
 boolean isCallReplacesSymbolTable()
          Returns true if the function uses/modifies the local symbol table
 boolean isCallUsesSymbolTable()
          Returns true if the function uses/modifies the local symbol table
 boolean isCallUsesVariableArgs()
          Returns true if the function uses variable args.
 boolean isDouble()
          Returns true for a double function.
 boolean isGlobal()
          Returns true for a global function.
 boolean isLong()
          Returns true for a long function.
 boolean isReturnsReference()
          True for a returns reference.
 boolean isString()
          Returns true for a string function.
 boolean isVoidReturn()
          True if the return type is void.
 void setGlobal(boolean isGlobal)
          Returns true for a global function.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FunctionGenerator

protected FunctionGenerator()

FunctionGenerator

protected FunctionGenerator(Location location)
Method Detail

getName

public java.lang.String getName()

isGlobal

public final boolean isGlobal()
Returns true for a global function.


isAbstract

public boolean isAbstract()
Returns true for an abstract function.


getLocation

public final Location getLocation()

setGlobal

public final void setGlobal(boolean isGlobal)
Returns true for a global function.


isBoolean

public boolean isBoolean()
Returns true for a boolean function.


isString

public boolean isString()
Returns true for a string function.


isLong

public boolean isLong()
Returns true for a long function.


isDouble

public boolean isDouble()
Returns true for a double function.


isCallUsesVariableArgs

public boolean isCallUsesVariableArgs()
Returns true if the function uses variable args.


isCallUsesSymbolTable

public boolean isCallUsesSymbolTable()
Returns true if the function uses/modifies the local symbol table


isCallReplacesSymbolTable

public boolean isCallReplacesSymbolTable()
Returns true if the function uses/modifies the local symbol table


isReturnsReference

public boolean isReturnsReference()
True for a returns reference.


isVoidReturn

public boolean isVoidReturn()
True if the return type is void.


getArgs

public Arg[] getArgs()
Returns the args.


analyze

public void analyze(QuercusProgram program)
Analyzes the function.


analyzeArguments

public void analyzeArguments(Expr[] args,
                             AnalyzeInfo info)
Analyzes the arguments for read-only and reference.


canGenerateCall

public boolean canGenerateCall(Expr[] args)
Returns true if the function can generate the call directly.


generate

public abstract void generate(PhpWriter out,
                              ExprGenerator funExpr,
                              Expr[] args)
                       throws java.io.IOException
Generates code to calluate the expression.

Parameters:
out - the writer to the Java source code.
Throws:
java.io.IOException

generateRef

public void generateRef(PhpWriter out,
                        ExprGenerator funExpr,
                        Expr[] args)
                 throws java.io.IOException
Generates code to calluate the expression.

Parameters:
out - the writer to the Java source code.
Throws:
java.io.IOException

generateTop

public void generateTop(PhpWriter out,
                        ExprGenerator funExpr,
                        Expr[] args)
                 throws java.io.IOException
Generates code to calluate as a top-level expression.

Parameters:
out - the writer to the Java source code.
Throws:
java.io.IOException

generateBoolean

public void generateBoolean(PhpWriter out,
                            ExprGenerator funExpr,
                            Expr[] args)
                     throws java.io.IOException
Generates code to calluate as a boolean expression.

Parameters:
out - the writer to the Java source code.
Throws:
java.io.IOException

generateString

public void generateString(PhpWriter out,
                           ExprGenerator funExpr,
                           Expr[] args)
                    throws java.io.IOException
Generates code to calluate as a string expression.

Parameters:
out - the writer to the Java source code.
Throws:
java.io.IOException

generateLong

public void generateLong(PhpWriter out,
                         ExprGenerator funExpr,
                         Expr[] args)
                  throws java.io.IOException
Generates code to calluate as a long expression.

Parameters:
out - the writer to the Java source code.
Throws:
java.io.IOException

generateDouble

public void generateDouble(PhpWriter out,
                           ExprGenerator funExpr,
                           Expr[] args)
                    throws java.io.IOException
Generates code to calluate as a double expression.

Parameters:
out - the writer to the Java source code.
Throws:
java.io.IOException

generateCopy

public void generateCopy(PhpWriter out,
                         ExprGenerator funExpr,
                         Expr[] args)
                  throws java.io.IOException
Generates code to calluate as a double expression.

Parameters:
out - the writer to the Java source code.
Throws:
java.io.IOException

generate

public void generate(PhpWriter out)
              throws java.io.IOException
Generates the code for the class component.

Parameters:
out - the writer to the output stream.
Throws:
java.io.IOException

generateInit

public void generateInit(PhpWriter out)
                  throws java.io.IOException
Generates the code for the initialization component.

Parameters:
out - the writer to the output stream.
Throws:
java.io.IOException