Work on parameter passing

This commit is contained in:
jez 2009-08-19 10:41:03 +01:00
commit ef984c7245
10 changed files with 32 additions and 17 deletions

View file

@ -28,8 +28,9 @@ vs9\*.user
*.lib *.lib
*.bsc *.bsc
lib lib
arabica-2008-july *.tar.gz
arabica-2008-july.* *.tar.bz2
*.zip
vs9/mangle.sln vs9/mangle.sln
*.stackdump *.stackdump
*.lnk *.lnk

View file

@ -178,6 +178,7 @@ void ExecutionContext::unpassParam(const std::string& name)
void ExecutionContext::declareParam(const DOM::Node<std::string>& node, const Variable_declaration& param) void ExecutionContext::declareParam(const DOM::Node<std::string>& node, const Variable_declaration& param)
{ {
if(!stack_.findPassedParam(param.name()))
stack_.declareParam(VariableClosure::create(param, node, *this)); stack_.declareParam(VariableClosure::create(param, node, *this));
} // declareParam } // declareParam

View file

@ -12,7 +12,7 @@ class Param : public Variable_impl
{ {
public: public:
Param(const std::string& name, Param(const std::string& name,
Arabica::XPath::XPathExpressionPtr<std::string> select, const Arabica::XPath::XPathExpressionPtr<std::string>& select,
const Precedence& precedence) : const Precedence& precedence) :
Variable_impl(name, select, precedence) Variable_impl(name, select, precedence)
{ {

View file

@ -12,7 +12,7 @@ class Variable : public Variable_impl
{ {
public: public:
Variable(const std::string& name, Variable(const std::string& name,
Arabica::XPath::XPathExpressionPtr<std::string> select, const Arabica::XPath::XPathExpressionPtr<std::string>& select,
const Precedence precedence) : const Precedence precedence) :
Variable_impl(name, select, precedence) Variable_impl(name, select, precedence)
{ {

View file

@ -15,7 +15,7 @@ class Variable_impl : public ItemContainer, public Variable_declaration
{ {
protected: protected:
Variable_impl(const std::string& name, Variable_impl(const std::string& name,
Arabica::XPath::XPathExpressionPtr<std::string> select, const Arabica::XPath::XPathExpressionPtr<std::string>& select,
const Precedence& precedence) : const Precedence& precedence) :
name_(name), name_(name),
select_(select), select_(select),

View file

@ -89,14 +89,19 @@ public:
params_.back().erase(name); params_.back().erase(name);
} // unpassParam } // unpassParam
void declareParam(Variable_instance_ptr param) bool findPassedParam(const std::string& name)
{ {
ScopeStack::reverse_iterator p = params_.rbegin()+1; ScopeStack::reverse_iterator p = params_.rbegin()+1;
Scope::iterator i = p->find(param->name()); Scope::iterator i = p->find(name);
if(i == p->end()) if(i == p->end())
declareVariable(param); return false;
else
declareVariable(i->second); declareVariable(i->second);
return true;
} // findPassedParam
void declareParam(Variable_instance_ptr param)
{
declareVariable(param);
} // declareParam } // declareParam
void declareVariable(Variable_instance_ptr var) void declareVariable(Variable_instance_ptr var)

View file

@ -12,7 +12,7 @@ class WithParam : public Variable_impl
{ {
public: public:
WithParam(const std::string& name, WithParam(const std::string& name,
Arabica::XPath::XPathExpressionPtr<std::string> select, const Arabica::XPath::XPathExpressionPtr<std::string>& select,
const Precedence& precedence) : const Precedence& precedence) :
Variable_impl(name, select, precedence) Variable_impl(name, select, precedence)
{ {

View file

@ -21,8 +21,12 @@ output combining (partially done for cdata-section-elements)
Performance Performance
variable pool variable pool
string pool? string pool?
use underlying_impl in XPath axis walker use underlying_impl in XPath axis walker - DONE
use underlying_impl in XPath functions use underlying_impl in XPath functions - DONE
short circuit evaluation in functions short circuit evaluation in functions
only convert to full NodeSet at boundary only convert to full NodeSet at boundary - DONE
use a proxy to return propagate values out of functions use a proxy to return propagate values out of functions
params - avoid creating closure for xsl:param if the param has been passed - DONE
- if running, resolve variable immediately, don't bother to create closure
- when declaring variable, don't create closure/resolve if higher-precedence variable already exists
- bin variable_instance_pointer, think I can pass by value

View file

@ -454,6 +454,10 @@
</Filter> </Filter>
</Filter> </Filter>
</Filter> </Filter>
<File
RelativePath="..\tests\XSLT\TO-DO"
>
</File>
</Files> </Files>
<Globals> <Globals>
</Globals> </Globals>

View file

@ -1244,7 +1244,7 @@
> >
<Tool <Tool
Name="VCCustomBuildTool" Name="VCCustomBuildTool"
CommandLine="cl /TC /EP -D USE_MSXML ..\vs7\ArabicaConfig.S &gt; ..\include\SAX\ArabicaConfig.hpp&#x0D;&#x0A;" CommandLine="cl /TC /EP -D USE_EXPAT ..\vs7\ArabicaConfig.S &gt; ..\include\SAX\ArabicaConfig.hpp&#x0D;&#x0A;"
Outputs="..\include\SAX\ArabicaConfig.hpp" Outputs="..\include\SAX\ArabicaConfig.hpp"
/> />
</FileConfiguration> </FileConfiguration>