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
*.bsc
lib
arabica-2008-july
arabica-2008-july.*
*.tar.gz
*.tar.bz2
*.zip
vs9/mangle.sln
*.stackdump
*.lnk

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -21,8 +21,12 @@ output combining (partially done for cdata-section-elements)
Performance
variable pool
string pool?
use underlying_impl in XPath axis walker
use underlying_impl in XPath functions
use underlying_impl in XPath axis walker - DONE
use underlying_impl in XPath functions - DONE
short circuit evaluation in functions
only convert to full NodeSet at boundary
use a proxy to return propagate values out of functions
only convert to full NodeSet at boundary - DONE
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>
<File
RelativePath="..\tests\XSLT\TO-DO"
>
</File>
</Files>
<Globals>
</Globals>

View file

@ -1244,7 +1244,7 @@
>
<Tool
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"
/>
</FileConfiguration>