You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by db...@apache.org on 2001/05/10 20:05:37 UTC
cvs commit: xml-xalan/c/src/XSLT VariablesStack.cpp VariablesStack.hpp
dbertoni 01/05/10 11:05:37
Modified: c/src/XSLT VariablesStack.cpp VariablesStack.hpp
Log:
Fix for bug 1682/1702.
Revision Changes Path
1.15 +31 -57 xml-xalan/c/src/XSLT/VariablesStack.cpp
Index: VariablesStack.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/VariablesStack.cpp,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- VariablesStack.cpp 2001/03/29 22:19:47 1.14
+++ VariablesStack.cpp 2001/05/10 18:05:32 1.15
@@ -75,7 +75,6 @@
m_stack(),
m_globalStackFrameIndex(-1),
m_globalStackFrameMarked(false),
- m_forceGlobalOnlySearch(false),
m_currentStackFrameIndex(0)
{
m_stack.reserve(eDefaultStackSize);
@@ -358,31 +357,6 @@
-class SetAndRestoreForceGlobalSearch
-{
-public:
-
- SetAndRestoreForceGlobalSearch(VariablesStack& variablesStack) :
- m_variablesStack(variablesStack),
- m_savedForceSearch(variablesStack.m_forceGlobalOnlySearch)
- {
- variablesStack.m_forceGlobalOnlySearch = true;
- }
-
- ~SetAndRestoreForceGlobalSearch()
- {
- m_variablesStack.m_forceGlobalOnlySearch = m_savedForceSearch;
- }
-
-private:
-
- VariablesStack& m_variablesStack;
-
- const bool m_savedForceSearch;
-};
-
-
-
const XObjectPtr
VariablesStack::findXObject(
const QName& name,
@@ -424,8 +398,11 @@
{
XalanNode* const doc = executionContext.getRootDocument();
assert(doc != 0);
+
+ // We need to set up a stack frame for the variable's execution...
+ typedef StylesheetExecutionContext::PushAndPopContextMarker PushAndPopContextMarker;
- SetAndRestoreForceGlobalSearch theGuard(*this);
+ const PushAndPopContextMarker theContextMarkerPushPop(executionContext);
theNewValue = var->getValue(executionContext, doc);
assert(theNewValue.null() == false);
@@ -449,49 +426,46 @@
{
StackEntry* theResult = 0;
- if (m_forceGlobalOnlySearch == false)
+ const unsigned int nElems = getCurrentStackFrameIndex();
+
+ // There is guaranteed to be a context marker at
+ // the bottom of the stack, so i should stop at
+ // 1.
+ for(unsigned int i = nElems - 1; i > 0; --i)
{
- const unsigned int nElems = getCurrentStackFrameIndex();
+ StackEntry& theEntry = m_stack[i];
- // There is guaranteed to be a context marker at
- // the bottom of the stack, so i should stop at
- // 1.
- for(unsigned int i = nElems - 1; i > 0; --i)
- {
- StackEntry& theEntry = m_stack[i];
+ const StackEntry::eType theType = theEntry.getType();
- const StackEntry::eType theType = theEntry.getType();
+ if(theType == StackEntry::eVariable ||
+ theType == StackEntry::eActiveParam)
+ {
+ assert(theEntry.getName() != 0);
- if(theType == StackEntry::eVariable ||
- theType == StackEntry::eActiveParam)
+ if(theEntry.getName()->equals(qname))
{
- assert(theEntry.getName() != 0);
+ theResult = &theEntry;
- if(theEntry.getName()->equals(qname))
- {
- theResult = &theEntry;
-
- break;
- }
+ break;
}
- else if (theType == StackEntry::eParam)
+ }
+ else if (theType == StackEntry::eParam)
+ {
+ if (fIsParam == true)
{
- if (fIsParam == true)
+ if(theEntry.getName()->equals(qname))
{
- if(theEntry.getName()->equals(qname))
- {
- theEntry.activate();
+ theEntry.activate();
- theResult = &theEntry;
+ theResult = &theEntry;
- break;
- }
+ break;
}
- }
- else if(theType == StackEntry::eContextMarker)
- {
- break;
}
+ }
+ else if(theType == StackEntry::eContextMarker)
+ {
+ break;
}
}
1.11 +0 -2 xml-xalan/c/src/XSLT/VariablesStack.hpp
Index: VariablesStack.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/VariablesStack.hpp,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- VariablesStack.hpp 2001/04/10 22:51:18 1.10
+++ VariablesStack.hpp 2001/05/10 18:05:33 1.11
@@ -558,8 +558,6 @@
bool m_globalStackFrameMarked;
- bool m_forceGlobalOnlySearch;
-
/**
* This is the top of the stack frame from where a search
* for a variable or param should take place. It may not
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-cvs-help@xml.apache.org