com.caucho.quercus.gen
Class PhpWriter

java.lang.Object
  extended by java.io.Writer
      extended by com.caucho.java.JavaWriter
          extended by com.caucho.java.gen.JavaWriterWrapper
              extended by com.caucho.quercus.gen.PhpWriter
All Implemented Interfaces:
java.io.Closeable, java.io.Flushable, java.lang.Appendable
Direct Known Subclasses:
ProPhpWriter

public class PhpWriter
extends JavaWriterWrapper

Writer which gathers additional info.


Field Summary
protected  java.util.HashMap<java.lang.String,java.lang.String> _charArrayMap
           
protected  java.util.HashMap<java.lang.String,java.lang.String> _classIdMap
           
protected  java.util.ArrayList<InterpretedClassDef> _classList
           
protected  java.util.HashMap<java.lang.String,java.lang.String> _constIdMap
           
protected  java.util.HashMap<java.lang.String,java.lang.String> _eregiMap
           
protected  java.util.HashMap<java.lang.String,java.lang.String> _eregMap
           
protected  java.util.HashMap<Expr[],java.lang.String> _exprArrayMap
           
protected  java.util.HashMap<Expr,java.lang.String> _exprMap
           
protected  java.util.HashMap<java.lang.String,java.lang.String> _functionIdMap
           
protected  java.util.HashMap<java.lang.String,java.lang.Integer> _localMap
           
protected  java.util.HashMap<QuercusModule,java.lang.String> _moduleMap
           
protected  QuercusProgram _program
           
protected  java.util.HashMap<java.lang.String,java.lang.String> _regexpArrayMap
           
protected  java.util.HashMap<java.lang.String,java.lang.String> _regexpMap
           
protected  java.util.ArrayList<java.lang.String> _regexpWrapperList
           
protected  java.util.ArrayList<java.lang.String> _staticVarList
           
protected  java.util.HashMap<StringValue,java.lang.String> _stringValueMap
           
protected  java.util.HashMap<Value,java.lang.String> _valueMap
           
 
Fields inherited from class java.io.Writer
lock
 
Constructor Summary
PhpWriter(JavaWriter writer, QuercusProgram program, java.lang.String className)
           
 
Method Summary
 java.lang.String addCharArray(java.lang.String string)
          Adds an expression
 void addClass(InterpretedClassDef cl)
          Adds a constant value.
 java.lang.String addClassId(java.lang.String name)
          Adds a class id
 java.lang.String addConstantId(java.lang.String name)
          Adds a const id
 java.lang.String addEreg(java.lang.String literalVar)
          Adds a regexp
 java.lang.String addEregi(java.lang.String literalVar)
          Adds a regexp
 java.lang.String addExpr(Expr expr)
          Adds an expression
 java.lang.String addExprArray(Expr[] exprArray)
          Adds an expression
 java.lang.String addFunctionId(java.lang.String name)
          Adds a function id
 java.lang.String addLocal(StringValue name, int index)
          Adds a constant value.
 java.lang.String addModule(QuercusModule module)
          Adds a module
 java.lang.String addRegexp(java.lang.String literalVar)
          Adds a regexp
 java.lang.String addRegexpArray(java.lang.String literalVar)
          Adds a regexp
 java.lang.String addRegexpWrapper()
          Adds a regexp
 java.lang.String addStringValue(StringValue string)
          Adds an expression
 void addSymbolMap(java.lang.String compilationName, FunctionInfo info)
           
 java.lang.String addValue(Value value)
          Adds a constant value.
 java.lang.String createStaticVar()
          Returns a static variable name.
 void generateCoda()
          Generates the tail.
 java.lang.String getClassName()
           
 java.lang.String getCurrentClassName()
           
 int getLocal(java.lang.String symName)
          Adds a constant value.
 QuercusContext getPhp()
          Returns the engine.
 QuercusProgram getProgram()
          Returns the program
 boolean isMethod()
           
 boolean isProfile()
          True when compiling in profile mode.
 void print(Value value)
          Prints a contstant.
 void printIntern(StringValue value)
          Prints a contstant.
 java.lang.String printString(java.lang.String string)
           
 java.lang.String printString(StringValue string)
           
 void setCurrentClassName(java.lang.String name)
           
 void setProfile(boolean isProfile)
          True when compiling in profile mode.
 
Methods inherited from class com.caucho.java.gen.JavaWriterWrapper
errorMessage, generateId, getDestLine, getLineMap, getWriteStream, popDepth, print, print, print, print, print, print, printClass, printIndent, printJavaChar, printJavaString, printJavaTypeToObject, printJavaTypeToObject, println, println, println, println, println, println, println, printQuotedJavaString, pushDepth, setLineMap, setLocation
 
Methods inherited from class com.caucho.java.JavaWriter
close, escapeJavaString, flush, generateSmap, printType, printVarType, setPreferLast, write
 
Methods inherited from class java.io.Writer
append, append, append, write, write, write, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_program

protected QuercusProgram _program

_valueMap

protected java.util.HashMap<Value,java.lang.String> _valueMap

_exprMap

protected java.util.HashMap<Expr,java.lang.String> _exprMap

_exprArrayMap

protected java.util.HashMap<Expr[],java.lang.String> _exprArrayMap

_moduleMap

protected java.util.HashMap<QuercusModule,java.lang.String> _moduleMap

_classList

protected java.util.ArrayList<InterpretedClassDef> _classList

_stringValueMap

protected java.util.HashMap<StringValue,java.lang.String> _stringValueMap

_charArrayMap

protected java.util.HashMap<java.lang.String,java.lang.String> _charArrayMap

_functionIdMap

protected java.util.HashMap<java.lang.String,java.lang.String> _functionIdMap

_classIdMap

protected java.util.HashMap<java.lang.String,java.lang.String> _classIdMap

_constIdMap

protected java.util.HashMap<java.lang.String,java.lang.String> _constIdMap

_localMap

protected java.util.HashMap<java.lang.String,java.lang.Integer> _localMap

_regexpMap

protected java.util.HashMap<java.lang.String,java.lang.String> _regexpMap

_regexpWrapperList

protected java.util.ArrayList<java.lang.String> _regexpWrapperList

_regexpArrayMap

protected java.util.HashMap<java.lang.String,java.lang.String> _regexpArrayMap

_eregMap

protected java.util.HashMap<java.lang.String,java.lang.String> _eregMap

_eregiMap

protected java.util.HashMap<java.lang.String,java.lang.String> _eregiMap

_staticVarList

protected java.util.ArrayList<java.lang.String> _staticVarList
Constructor Detail

PhpWriter

public PhpWriter(JavaWriter writer,
                 QuercusProgram program,
                 java.lang.String className)
Method Detail

getPhp

public QuercusContext getPhp()
Returns the engine.


getProgram

public QuercusProgram getProgram()
Returns the program


getClassName

public java.lang.String getClassName()

getCurrentClassName

public java.lang.String getCurrentClassName()

setCurrentClassName

public void setCurrentClassName(java.lang.String name)

isMethod

public boolean isMethod()

isProfile

public boolean isProfile()
True when compiling in profile mode.


setProfile

public void setProfile(boolean isProfile)
True when compiling in profile mode.


print

public void print(Value value)
           throws java.io.IOException
Prints a contstant.

Throws:
java.io.IOException

printIntern

public void printIntern(StringValue value)
                 throws java.io.IOException
Prints a contstant.

Throws:
java.io.IOException

addValue

public java.lang.String addValue(Value value)
Adds a constant value.

Returns:
the generated id for the value

addRegexp

public java.lang.String addRegexp(java.lang.String literalVar)
Adds a regexp

Returns:
the generated id for the value

addRegexpWrapper

public java.lang.String addRegexpWrapper()
Adds a regexp

Returns:
the generated id for the value

addRegexpArray

public java.lang.String addRegexpArray(java.lang.String literalVar)
Adds a regexp

Returns:
the generated id for the value

addEreg

public java.lang.String addEreg(java.lang.String literalVar)
Adds a regexp

Returns:
the generated id for the value

addEregi

public java.lang.String addEregi(java.lang.String literalVar)
Adds a regexp

Returns:
the generated id for the value

addLocal

public java.lang.String addLocal(StringValue name,
                                 int index)
Adds a constant value.

Returns:
the generated id for the value

getLocal

public int getLocal(java.lang.String symName)
Adds a constant value.

Returns:
the generated id for the value

addClass

public void addClass(InterpretedClassDef cl)
Adds a constant value.


addExpr

public java.lang.String addExpr(Expr expr)
Adds an expression

Returns:
the generated id for the expression

addExprArray

public java.lang.String addExprArray(Expr[] exprArray)
Adds an expression

Returns:
the generated id for the expression

addSymbolMap

public void addSymbolMap(java.lang.String compilationName,
                         FunctionInfo info)
                  throws java.io.IOException
Throws:
java.io.IOException

addModule

public java.lang.String addModule(QuercusModule module)
Adds a module

Returns:
the generated id for the expression

createStaticVar

public java.lang.String createStaticVar()
Returns a static variable name.


addFunctionId

public java.lang.String addFunctionId(java.lang.String name)
Adds a function id


addClassId

public java.lang.String addClassId(java.lang.String name)
Adds a class id


addConstantId

public java.lang.String addConstantId(java.lang.String name)
Adds a const id


printString

public java.lang.String printString(java.lang.String string)
                             throws java.io.IOException
Throws:
java.io.IOException

printString

public java.lang.String printString(StringValue string)
                             throws java.io.IOException
Throws:
java.io.IOException

addStringValue

public java.lang.String addStringValue(StringValue string)
Adds an expression

Returns:
the generated id for the expression

addCharArray

public java.lang.String addCharArray(java.lang.String string)
Adds an expression

Returns:
the generated id for the expression

generateCoda

public void generateCoda()
                  throws java.io.IOException
Generates the tail.

Throws:
java.io.IOException