From db940c9b78f090b211c18b32abb84e9737215768 Mon Sep 17 00:00:00 2001 From: jez Date: Tue, 18 Aug 2009 20:42:37 +0100 Subject: [PATCH 1/6] Pass select by const ref not by value --- include/XSLT/impl/xslt_param.hpp | 2 +- include/XSLT/impl/xslt_variable.hpp | 2 +- include/XSLT/impl/xslt_variable_impl.hpp | 2 +- include/XSLT/impl/xslt_with_param.hpp | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/XSLT/impl/xslt_param.hpp b/include/XSLT/impl/xslt_param.hpp index 9fa9b2c3..4ad8c756 100644 --- a/include/XSLT/impl/xslt_param.hpp +++ b/include/XSLT/impl/xslt_param.hpp @@ -12,7 +12,7 @@ class Param : public Variable_impl { public: Param(const std::string& name, - Arabica::XPath::XPathExpressionPtr select, + const Arabica::XPath::XPathExpressionPtr& select, const Precedence& precedence) : Variable_impl(name, select, precedence) { diff --git a/include/XSLT/impl/xslt_variable.hpp b/include/XSLT/impl/xslt_variable.hpp index 1a3f375d..133022e6 100644 --- a/include/XSLT/impl/xslt_variable.hpp +++ b/include/XSLT/impl/xslt_variable.hpp @@ -12,7 +12,7 @@ class Variable : public Variable_impl { public: Variable(const std::string& name, - Arabica::XPath::XPathExpressionPtr select, + const Arabica::XPath::XPathExpressionPtr& select, const Precedence precedence) : Variable_impl(name, select, precedence) { diff --git a/include/XSLT/impl/xslt_variable_impl.hpp b/include/XSLT/impl/xslt_variable_impl.hpp index de4ef080..a2a6ef60 100644 --- a/include/XSLT/impl/xslt_variable_impl.hpp +++ b/include/XSLT/impl/xslt_variable_impl.hpp @@ -15,7 +15,7 @@ class Variable_impl : public ItemContainer, public Variable_declaration { protected: Variable_impl(const std::string& name, - Arabica::XPath::XPathExpressionPtr select, + const Arabica::XPath::XPathExpressionPtr& select, const Precedence& precedence) : name_(name), select_(select), diff --git a/include/XSLT/impl/xslt_with_param.hpp b/include/XSLT/impl/xslt_with_param.hpp index 9c7a6e4d..924f935b 100644 --- a/include/XSLT/impl/xslt_with_param.hpp +++ b/include/XSLT/impl/xslt_with_param.hpp @@ -12,7 +12,7 @@ class WithParam : public Variable_impl { public: WithParam(const std::string& name, - Arabica::XPath::XPathExpressionPtr select, + const Arabica::XPath::XPathExpressionPtr& select, const Precedence& precedence) : Variable_impl(name, select, precedence) { From 584502ec16e6696dde0b7fc2e777f1b99952d922 Mon Sep 17 00:00:00 2001 From: jez Date: Tue, 18 Aug 2009 21:13:44 +0100 Subject: [PATCH 2/6] Added some more ideas for variable and parameter passing --- tests/XSLT/TO-DO | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/tests/XSLT/TO-DO b/tests/XSLT/TO-DO index 2ff38a3a..30e94d50 100644 --- a/tests/XSLT/TO-DO +++ b/tests/XSLT/TO-DO @@ -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 \ No newline at end of file + 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 \ No newline at end of file From 85ceddec6ebe27dcc2925a9125a3cff885e51d03 Mon Sep 17 00:00:00 2001 From: jez Date: Tue, 18 Aug 2009 21:14:39 +0100 Subject: [PATCH 3/6] Added TO-DO list --- vs9/example_XSLT_Mangle.vcproj | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/vs9/example_XSLT_Mangle.vcproj b/vs9/example_XSLT_Mangle.vcproj index 039800b1..7657cbf3 100644 --- a/vs9/example_XSLT_Mangle.vcproj +++ b/vs9/example_XSLT_Mangle.vcproj @@ -454,6 +454,10 @@ + + From 2ea1ab89717d31559a6c5fc70198c611dccd2b8d Mon Sep 17 00:00:00 2001 From: jez Date: Tue, 18 Aug 2009 21:15:01 +0100 Subject: [PATCH 4/6] Reverted to libexpat --- vs9/lib_arabica.vcproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vs9/lib_arabica.vcproj b/vs9/lib_arabica.vcproj index f4b56d57..2c046e27 100644 --- a/vs9/lib_arabica.vcproj +++ b/vs9/lib_arabica.vcproj @@ -1244,7 +1244,7 @@ > From 29f73f285b971487e71d224696ba64f33ed7ce20 Mon Sep 17 00:00:00 2001 From: jez Date: Tue, 18 Aug 2009 21:16:12 +0100 Subject: [PATCH 5/6] When declaring a parameter, only create a new variable closure if a parameter hasn't been passed. --- include/XSLT/impl/xslt_execution_context.hpp | 3 ++- include/XSLT/impl/xslt_variable_stack.hpp | 15 ++++++++++----- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/include/XSLT/impl/xslt_execution_context.hpp b/include/XSLT/impl/xslt_execution_context.hpp index 95a530ee..a6e4e432 100755 --- a/include/XSLT/impl/xslt_execution_context.hpp +++ b/include/XSLT/impl/xslt_execution_context.hpp @@ -178,7 +178,8 @@ void ExecutionContext::unpassParam(const std::string& name) void ExecutionContext::declareParam(const DOM::Node& 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& node, const Variable_declaration& variable) diff --git a/include/XSLT/impl/xslt_variable_stack.hpp b/include/XSLT/impl/xslt_variable_stack.hpp index fbe2d570..24dc6634 100755 --- a/include/XSLT/impl/xslt_variable_stack.hpp +++ b/include/XSLT/impl/xslt_variable_stack.hpp @@ -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) From b912c0d732f11f6fbd78ad33734f7fe8cf0b6484 Mon Sep 17 00:00:00 2001 From: jez Date: Tue, 18 Aug 2009 21:18:40 +0100 Subject: [PATCH 6/6] ignore package files --- .bzrignore | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.bzrignore b/.bzrignore index 4be526c7..3f7c0898 100644 --- a/.bzrignore +++ b/.bzrignore @@ -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