org.apache.bsf.engines.javascript
Class FnOrScript

java.lang.Object
  |
  +--org.apache.bsf.engines.javascript.FnOrScript

public class FnOrScript
extends java.lang.Object

This class represents a function or script, that is, a piece of a document that is provided to the JavaScript engine for evaluation, execution, or simply compilation. A FnOrScript represents a range of lines or characters in its document. For now, Rhino only supports ranges of lines, really, but the code for offsets is there anyway. Warning: Offsets have never been quite tested yet... A FnOrScript has compilation units. When Rhino compiles a function or a script, even in interpreted mode where the compilation is done to JavaScript bytecode, it calls back its debugger with different compilation units; see Debugger::handleCompilationDone method on the RhinoEngineDebugger class. A FnOrScript also keeps track of the known breakpoints in its range of lines or characters. It makes sure that they are propagated to the underlying Rhino engine (i.e. set) as well as unpropagated (i.e. unset).


Field Summary
protected  java.util.Vector m_breakpoints
           
protected  DocumentCell m_cell
           
protected  int m_charCount
           
protected  int m_column
           
protected  java.util.Hashtable m_functionMap
           
protected  int m_lineCount
           
protected  boolean m_lineDefined
           
protected  int m_offset
           
protected  org.mozilla.javascript.Script m_script
           
protected  int m_startLine
           
protected  java.lang.StringBuffer m_text
           
protected  java.util.Vector m_units
           
 
Constructor Summary
FnOrScript(DocumentCell cell)
           
 
Method Summary
 BreakPoint addBreakpoint(BreakPoint bp)
           
 void addCompilationUnit(org.mozilla.javascript.Context cx, org.mozilla.javascript.debug.DebuggableScript dbgScript, java.lang.StringBuffer source)
           
 void compile(org.mozilla.javascript.Context cx, org.mozilla.javascript.Scriptable global)
           
protected  BreakPoint createBreakpoint(BreakPoint bp)
           
 BreakPoint findBreakpointAtLine(int lineno)
           
 BreakPoint findBreakpointAtOffset(int offset)
           
 int getCharCount()
           
 int getColumn()
           
 DocumentCell getDocument()
           
 int getFirstLine()
           
 java.lang.StringBuffer getFnOrScriptAsStringBuffer()
           
 int getLineCount()
           
 int getOffset()
           
 org.mozilla.javascript.Script getScript()
           
 BreakPoint removeBreakpoint(int bpid)
           
 void specifyLinesPos(java.io.Reader reader, int startLine, int column)
           
 void specifyRange(java.io.Reader reader, int offset)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_cell

protected DocumentCell m_cell

m_lineDefined

protected boolean m_lineDefined

m_startLine

protected int m_startLine

m_lineCount

protected int m_lineCount

m_column

protected int m_column

m_offset

protected int m_offset

m_charCount

protected int m_charCount

m_breakpoints

protected java.util.Vector m_breakpoints

m_text

protected java.lang.StringBuffer m_text

m_units

protected java.util.Vector m_units

m_script

protected org.mozilla.javascript.Script m_script

m_functionMap

protected java.util.Hashtable m_functionMap
Constructor Detail

FnOrScript

public FnOrScript(DocumentCell cell)
Method Detail

addBreakpoint

public BreakPoint addBreakpoint(BreakPoint bp)

removeBreakpoint

public BreakPoint removeBreakpoint(int bpid)

createBreakpoint

protected BreakPoint createBreakpoint(BreakPoint bp)

findBreakpointAtLine

public BreakPoint findBreakpointAtLine(int lineno)
                                throws BSFException
BSFException

findBreakpointAtOffset

public BreakPoint findBreakpointAtOffset(int offset)
                                  throws BSFException
BSFException

getCharCount

public int getCharCount()
                 throws BSFException
BSFException

getDocument

public DocumentCell getDocument()

getFirstLine

public int getFirstLine()
                 throws BSFException
BSFException

getColumn

public int getColumn()
              throws BSFException
BSFException

getFnOrScriptAsStringBuffer

public java.lang.StringBuffer getFnOrScriptAsStringBuffer()

getLineCount

public int getLineCount()
                 throws BSFException
BSFException

getOffset

public int getOffset()
              throws BSFException
BSFException

specifyLinesPos

public void specifyLinesPos(java.io.Reader reader,
                            int startLine,
                            int column)
                     throws BSFException,
                            java.io.IOException
BSFException
java.io.IOException

specifyRange

public void specifyRange(java.io.Reader reader,
                         int offset)
                  throws BSFException,
                         java.io.IOException
BSFException
java.io.IOException

addCompilationUnit

public void addCompilationUnit(org.mozilla.javascript.Context cx,
                               org.mozilla.javascript.debug.DebuggableScript dbgScript,
                               java.lang.StringBuffer source)

compile

public void compile(org.mozilla.javascript.Context cx,
                    org.mozilla.javascript.Scriptable global)
             throws BSFException,
                    java.io.IOException
BSFException
java.io.IOException

getScript

public org.mozilla.javascript.Script getScript()