Methods Summary |
---|
public void | clearLocalSlots(int start, int len)Use this to clear the variables in a section of the stack. This is
used to clear the parameter section of the stack, so that default param
values can tell if they've already been set. It is important to note that
this function has a 1K limitation.
start += _currentFrameBottom;
System.arraycopy(m_nulls, 0, _stackFrames, start, len);
|
public synchronized java.lang.Object | clone()Returns a clone of this variable stack.
VariableStack vs = (VariableStack) super.clone();
// I *think* I can get away with a shallow clone here?
vs._stackFrames = (XObject[]) _stackFrames.clone();
vs._links = (int[]) _links.clone();
return vs;
|
public com.sun.org.apache.xpath.internal.objects.XObject | elementAt(int i)Get the element at the given index, regardless of stackframe.
return _stackFrames[i];
|
public com.sun.org.apache.xpath.internal.objects.XObject | getGlobalVariable(com.sun.org.apache.xpath.internal.XPathContext xctxt, int index)Get a global variable or parameter from the global stack frame.
XObject val = _stackFrames[index];
// Lazy execution of variables.
if (val.getType() == XObject.CLASS_UNRESOLVEDVARIABLE)
return (_stackFrames[index] = val.execute(xctxt));
return val;
|
public com.sun.org.apache.xpath.internal.objects.XObject | getGlobalVariable(com.sun.org.apache.xpath.internal.XPathContext xctxt, int index, boolean destructiveOK)Get a global variable or parameter from the global stack frame.
XObject val = _stackFrames[index];
// Lazy execution of variables.
if (val.getType() == XObject.CLASS_UNRESOLVEDVARIABLE)
return (_stackFrames[index] = val.execute(xctxt));
return destructiveOK ? val : val.getFresh();
|
public com.sun.org.apache.xpath.internal.objects.XObject | getLocalVariable(com.sun.org.apache.xpath.internal.XPathContext xctxt, int index)Get a local variable or parameter in the current stack frame.
index += _currentFrameBottom;
XObject val = _stackFrames[index];
if(null == val)
throw new TransformerException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_VARIABLE_ACCESSED_BEFORE_BIND, null),
xctxt.getSAXLocator());
// "Variable accessed before it is bound!", xctxt.getSAXLocator());
// Lazy execution of variables.
if (val.getType() == XObject.CLASS_UNRESOLVEDVARIABLE)
return (_stackFrames[index] = val.execute(xctxt));
return val;
|
public com.sun.org.apache.xpath.internal.objects.XObject | getLocalVariable(int index, int frame)Get a local variable or parameter in the current stack frame.
index += frame;
XObject val = _stackFrames[index];
return val;
|
public com.sun.org.apache.xpath.internal.objects.XObject | getLocalVariable(com.sun.org.apache.xpath.internal.XPathContext xctxt, int index, boolean destructiveOK)Get a local variable or parameter in the current stack frame.
index += _currentFrameBottom;
XObject val = _stackFrames[index];
if(null == val)
throw new TransformerException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_VARIABLE_ACCESSED_BEFORE_BIND, null),
xctxt.getSAXLocator());
// "Variable accessed before it is bound!", xctxt.getSAXLocator());
// Lazy execution of variables.
if (val.getType() == XObject.CLASS_UNRESOLVEDVARIABLE)
return (_stackFrames[index] = val.execute(xctxt));
return destructiveOK ? val : val.getFresh();
|
public int | getStackFrame()Get the position from where the search should start,
which is either the searchStart property, or the top
of the stack if that value is -1.
return _currentFrameBottom;
|
public com.sun.org.apache.xpath.internal.objects.XObject | getVariableOrParam(com.sun.org.apache.xpath.internal.XPathContext xctxt, com.sun.org.apache.xml.internal.utils.QName qname)Get a variable based on it's qualified name.
This is for external use only.
// <<<<<<< TIGER SPECIFIC CHANGE >>>>>>>>>
// As we are not supporting Xalan interpretive we are taking away the functionality
// dependent on XSLT interpretive Transformer. Only way supported is to use XSLTC
// and the execution path needed for supporting standard XPath API defined by
// JAXP 1.3 . This method is overridden in XPath implementation to support
// standard XPath functionality with xpath package of Xalan
throw new javax.xml.transform.TransformerException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_VAR_NOT_RESOLVABLE, new Object[]{qname.toString()})); //"Variable not resolvable: " + qname);
|
public boolean | isLocalSet(int index)Tell if a local variable has been set or not.
return (_stackFrames[index + _currentFrameBottom] != null);
|
public int | link(int size)Allocates memory (called a stackframe) on the stack; used to store
local variables and parameter arguments.
I use the link/unlink concept because of distant
Motorola 68000 assembler memories.
_currentFrameBottom = _frameTop;
_frameTop += size;
if (_frameTop >= _stackFrames.length)
{
XObject newsf[] = new XObject[_stackFrames.length + XPathContext.RECURSIONLIMIT + size];
System.arraycopy(_stackFrames, 0, newsf, 0, _stackFrames.length);
_stackFrames = newsf;
}
if (_linksTop + 1 >= _links.length)
{
int newlinks[] = new int[_links.length + (CLEARLIMITATION * 2)];
System.arraycopy(_links, 0, newlinks, 0, _links.length);
_links = newlinks;
}
_links[_linksTop++] = _currentFrameBottom;
return _currentFrameBottom;
|
public void | reset()Reset the stack to a start position.
_frameTop = 0;
_linksTop = 0;
// Adding one here to the stack of frame positions will allow us always
// to look one under without having to check if we're at zero.
// (As long as the caller doesn't screw up link/unlink.)
_links[_linksTop++] = 0;
_stackFrames = new XObject[_stackFrames.length];
|
public void | setGlobalVariable(int index, com.sun.org.apache.xpath.internal.objects.XObject val)Set a global variable or parameter in the global stack frame.
_stackFrames[index] = val;
|
public void | setLocalVariable(int index, com.sun.org.apache.xpath.internal.objects.XObject val)Set a local variable or parameter in the current stack frame.
_stackFrames[index + _currentFrameBottom] = val;
|
public void | setLocalVariable(int index, com.sun.org.apache.xpath.internal.objects.XObject val, int stackFrame)Set a local variable or parameter in the specified stack frame.
_stackFrames[index + stackFrame] = val;
|
public void | setStackFrame(int sf)Set the current stack frame.
_currentFrameBottom = sf;
|
public int | size()Get size of the stack.
return _frameTop;
|
public void | unlink(int currentFrame)Free up the stack frame that was last allocated with
{@link link(int size)}.
_frameTop = _links[--_linksTop];
_currentFrameBottom = currentFrame;
|
public void | unlink()Free up the stack frame that was last allocated with
{@link link(int size)}.
_frameTop = _links[--_linksTop];
_currentFrameBottom = _links[_linksTop - 1];
|