| Method from org.apache.bsf.engines.javascript.DocumentCell Detail: |
public void addBreakpointAtLine(int brkptId,
int lineno) {
Enumeration e;
FnOrScript fnOrScript;
BreakPoint bp = new BreakPoint(this, brkptId);
bp.setLineNo(lineno);
// Propagate the breakpoint at document level
// to the level of already known function or
// scripts. It will propagate it down to the
// known compilation units.
e = m_fnOrScripts.elements();
while (e.hasMoreElements()) {
fnOrScript = (FnOrScript) e.nextElement();
try {
if (fnOrScript.contains(bp)) {
fnOrScript.addBreakpoint(bp);
return;
}
} catch (BSFException ex) {
}
}
m_breakpoints.addElement(bp);
}
Add a breakpoint.
Two cases exist.
If a function or a script (FnOrScript) is known for
the given line number, the breakpoint will be remembered
by that FnOrScript.
Otherwise, the breakpoint is memorized at the document
level until a function or script is known, that is,
compiled in our engine. |
public void addBreakpointAtOffset(int brkptId,
int offset) {
Enumeration e;
FnOrScript fnOrScript;
BreakPoint bp = new BreakPoint(this, brkptId);
bp.setOffset(offset);
e = m_fnOrScripts.elements();
while (e.hasMoreElements()) {
fnOrScript = (FnOrScript) e.nextElement();
try {
if (fnOrScript.contains(bp)) {
fnOrScript.addBreakpoint(bp);
return;
}
} catch (BSFException ex) {
}
}
m_breakpoints.addElement(bp);
}
Same as above, except the breakpoint is specified
at an character offset rather than a line number. |
public BreakPoint findBreakpointAtLine(int lineno) throws BSFException {
Enumeration e;
BreakPoint bp;
FnOrScript fnOrScript;
e = m_fnOrScripts.elements();
while (e.hasMoreElements()) {
fnOrScript = (FnOrScript) e.nextElement();
bp = fnOrScript.findBreakpointAtLine(lineno);
if (bp != null)
return bp;
}
return null;
}
|
public BreakPoint findBreakpointAtOffset(int offset) throws BSFException {
Enumeration e;
BreakPoint bp;
FnOrScript fnOrScript;
e = m_fnOrScripts.elements();
while (e.hasMoreElements()) {
fnOrScript = (FnOrScript) e.nextElement();
bp = fnOrScript.findBreakpointAtOffset(offset);
if (bp != null)
return bp;
}
return null;
}
|
public FnOrScript findFnOrScript(int startLine,
int column) {
Enumeration e;
FnOrScript fnOrScript;
e = m_fnOrScripts.elements();
while (e.hasMoreElements()) {
fnOrScript = (FnOrScript) e.nextElement();
if (fnOrScript.m_startLine == startLine)
if (fnOrScript.m_column == column)
return fnOrScript;
}
return null;
}
|
public FnOrScript findFnOrScriptContaining(int line) {
Enumeration e;
FnOrScript fnOrScript;
e = m_fnOrScripts.elements();
while (e.hasMoreElements()) {
fnOrScript = (FnOrScript) e.nextElement();
if (fnOrScript.m_startLine < = line &&
(fnOrScript.m_startLine + fnOrScript.m_lineCount) >= line)
return fnOrScript;
}
return null;
}
|
public Enumeration fnOrScripts() {
return m_fnOrScripts.elements();
}
|
public boolean getEntryExit() {
return m_entryexit;
}
|
public FnOrScript getLastFnOrScript() {
return m_lastFnOrScript;
}
|
public String getName() {
return m_docName;
}
|
public FnOrScript registerFnOrScriptLines(Reader reader,
int startLine,
int column) throws BSFException {
FnOrScript fnOrScript;
Enumeration e;
// first, search if we already have the script or function.
e = m_fnOrScripts.elements();
while (e.hasMoreElements()) {
fnOrScript = (FnOrScript) e.nextElement();
if (fnOrScript.getFirstLine() == startLine)
if (fnOrScript.getColumn() == column)
return fnOrScript;
}
try {
fnOrScript = new FnOrScript(this);
m_fnOrScripts.addElement(fnOrScript);
fnOrScript.specifyLinesPos(reader, startLine, column);
this.attachBreakpoints(fnOrScript);
} catch (IOException ex) {
throw new BSFException(
BSFException.REASON_EXECUTION_ERROR,
"while registering script or function.",
ex);
}
return fnOrScript;
}
|
public FnOrScript registerFnOrScriptLines(String source,
int startLine,
int column) throws BSFException {
Reader reader = new StringReader(source);
return registerFnOrScriptLines(reader, startLine, column);
}
|
public FnOrScript registerFnOrScriptRange(Reader reader,
int offset) throws BSFException {
FnOrScript fnOrScript;
try {
fnOrScript = new FnOrScript(this);
m_fnOrScripts.addElement(fnOrScript);
fnOrScript.specifyRange(reader, offset);
this.attachBreakpoints(fnOrScript);
} catch (IOException ex) {
throw new BSFException(
BSFException.REASON_EXECUTION_ERROR,
"while registering script or function.",
ex);
}
return fnOrScript;
}
|
public FnOrScript registerFnOrScriptRange(String source,
int offset) throws BSFException {
Reader reader = new StringReader(source);
return registerFnOrScriptRange(reader, offset);
}
|
public BreakPoint removeBreakpoint(int brkptId) {
Enumeration e;
BreakPoint bp=null;
FnOrScript fnOrScript;
// search for the breakpoint to remove
// at the document level first.
e = m_breakpoints.elements();
while (e.hasMoreElements()) {
bp = (BreakPoint) e.nextElement();
if (bp.getId()==brkptId) {
// we found it, just drop it
// and return.
m_breakpoints.removeElement(bp);
return bp;
}
}
// the breakpoint has not been found at
// the document level. It must have been
// propagated at a FnOrScript level.
e = m_fnOrScripts.elements();
while (e.hasMoreElements()) {
fnOrScript = (FnOrScript) e.nextElement();
bp = fnOrScript.removeBreakpoint(brkptId);
if (null!=bp) break;
}
return bp;
}
Removing a breakpoint.
Two cases, a breakpoint is only remembered at
the document level, it has not been propagated
to a function or script (FnOrScript). Then, just
drop it.
Second case, the breakpoint has been propagated,
then scan the FnOrScript objects and ask them
to drop the breakpoint.
Note: only one will have it, see addBreakpoint... |
public void setEntryExit(boolean on_value) {
m_entryexit = on_value;
}
|
public void setLastFnOrScript(FnOrScript fnos) {
m_lastFnOrScript = fnos;
}
|