Matthias Brantner has proposed merging 
lp:~zorba-coders/zorba/feature-pragma_no_copy into lp:zorba.

Requested reviews:
  Matthias Brantner (matthias-brantner)

For more details, see:
https://code.launchpad.net/~zorba-coders/zorba/feature-pragma_no_copy/+merge/112816

pragma for preventing copying of nodes in functions that insert into collections

For example

 declare namespace ext = "http://www.zorba-xquery.com/extensions";;

 (# ext:no-copy #) {
   dml:insert-nodes-last(xs:QName("local:foo"), $node)
 };
-- 
https://code.launchpad.net/~zorba-coders/zorba/feature-pragma_no_copy/+merge/112816
Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'src/compiler/api/compilercb.h'
--- src/compiler/api/compilercb.h	2012-06-28 04:14:03 +0000
+++ src/compiler/api/compilercb.h	2012-06-29 17:23:20 +0000
@@ -29,6 +29,7 @@
 // without having the definition of static_context availble.
 # include "context/static_context.h"
 #endif
+#include "compiler/expression/pragma.h"
 
 #include "zorbaserialization/class_serializer.h"
 
@@ -157,6 +158,9 @@
 
   typedef std::map<csize, static_context_t> SctxMap;
 
+  typedef std::multimap<expr*, pragma_t> PragmaMap;
+  typedef PragmaMap::const_iterator      PragmaMapIter;
+
 public:  
   XQueryDiagnostics       * theXQueryDiagnostics;
 
@@ -186,6 +190,8 @@
 
   config                    theConfig;
 
+  PragmaMap                 thePragmas;
+
 public:
   SERIALIZABLE_CLASS(CompilerCB);
   CompilerCB(::zorba::serialization::Archiver& ar);

=== modified file 'src/compiler/expression/CMakeLists.txt'
--- src/compiler/expression/CMakeLists.txt	2012-06-28 04:14:03 +0000
+++ src/compiler/expression/CMakeLists.txt	2012-06-29 17:23:20 +0000
@@ -26,7 +26,8 @@
     fo_expr.cpp
     script_exprs.cpp
     update_exprs.cpp
-    function_item_expr.cpp)
+    function_item_expr.cpp
+    pragma.cpp)
 
 IF (NOT ZORBA_NO_FULL_TEXT)
   LIST(APPEND EXPRESSION_SRCS

=== modified file 'src/compiler/expression/expr.cpp'
--- src/compiler/expression/expr.cpp	2012-06-28 04:14:03 +0000
+++ src/compiler/expression/expr.cpp	2012-06-29 17:23:20 +0000
@@ -955,14 +955,6 @@
 /*******************************************************************************
 
 ********************************************************************************/
-pragma::pragma(store::Item_t name, std::string const& content)
-  :
-  theQName(name),
-  theContent(content)
-{
-}
-
-
 extension_expr::extension_expr(
     static_context* sctx,
     const QueryLoc& loc)

=== modified file 'src/compiler/expression/expr.h'
--- src/compiler/expression/expr.h	2012-06-28 04:14:03 +0000
+++ src/compiler/expression/expr.h	2012-06-29 17:23:20 +0000
@@ -29,6 +29,7 @@
 #include "functions/signature.h"
 
 #include "compiler/expression/var_expr.h"
+#include "compiler/expression/pragma.h"
 
 #include "context/static_context.h"
 #include "context/namespace_context.h"
@@ -765,22 +766,6 @@
 /***************************************************************************//**
 
 ********************************************************************************/
-class pragma : public SimpleRCObject
-{
-  friend class expr;
-
-public:
-  store::Item_t theQName;
-  std::string theContent;
-
-public:
-  pragma(store::Item_t name, std::string const& content);
-};
-
-
-/***************************************************************************//**
-
-********************************************************************************/
 class extension_expr : public expr 
 {
   friend class ExprIterator;

=== modified file 'src/compiler/expression/expr_base.cpp'
--- src/compiler/expression/expr_base.cpp	2012-06-28 04:14:03 +0000
+++ src/compiler/expression/expr_base.cpp	2012-06-29 17:23:20 +0000
@@ -541,6 +541,30 @@
 
 
 /*******************************************************************************
+
+********************************************************************************/
+BoolAnnotationValue expr::getContainsPragma() const
+{
+  return (BoolAnnotationValue)
+         ((theFlags1 & CONTAINS_PRAGMA_MASK) >> CONTAINS_PRAGMA);
+}
+
+
+void expr::setContainsPragma(BoolAnnotationValue v)
+{
+  theFlags1 &= ~CONTAINS_PRAGMA_MASK;
+  theFlags1 |= (v << CONTAINS_PRAGMA);
+}
+
+
+bool expr::containsPragma() const
+{
+  BoolAnnotationValue v = getContainsPragma();
+  return (v == ANNOTATION_TRUE || v == ANNOTATION_TRUE_FIXED);
+}
+
+
+/*******************************************************************************
   This annotation tells whether the expr must produce nodes that belong to 
   "standalone" trees or not. A tree is standalone if it does not contain 
   references to other trees. Such references are created when the optimizer 

=== modified file 'src/compiler/expression/expr_base.h'
--- src/compiler/expression/expr_base.h	2012-06-28 04:14:03 +0000
+++ src/compiler/expression/expr_base.h	2012-06-29 17:23:20 +0000
@@ -151,7 +151,8 @@
     CONTAINS_RECURSIVE_CALL = 12,
     PROPAGATES_INPUT_NODES  = 14,
     WILL_BE_SERIALIZED      = 16,
-    MUST_COPY_NODES         = 18
+    MUST_COPY_NODES         = 18,
+    CONTAINS_PRAGMA         = 20
   } Annotationkey;
 
   typedef enum
@@ -165,7 +166,8 @@
     CONTAINS_RECURSIVE_CALL_MASK  = 0x3000,
     PROPAGATES_INPUT_NODES_MASK   = 0xC000,
     WILL_BE_SERIALIZED_MASK       = 0x30000,
-    MUST_COPY_NODES_MASK          = 0xC0000
+    MUST_COPY_NODES_MASK          = 0xC0000,
+    CONTAINS_PRAGMA_MASK          = 0x300000
   } AnnotationMask;
 
 
@@ -316,6 +318,13 @@
 
   bool willBeSerialized() const;
 
+  // Annotation : containsPragma
+  BoolAnnotationValue getContainsPragma() const;
+
+  void setContainsPragma(BoolAnnotationValue v);
+
+  bool containsPragma() const;
+
   // Annotation : free vars
   const FreeVars& getFreeVars() const { return theFreeVars; }
 

=== added file 'src/compiler/expression/pragma.cpp'
--- src/compiler/expression/pragma.cpp	1970-01-01 00:00:00 +0000
+++ src/compiler/expression/pragma.cpp	2012-06-29 17:23:20 +0000
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2006-2012 The FLWOR Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include "pragma.h"
+#include "zorbatypes/rchandle.h"
+#include "store/api/item.h"
+
+namespace zorba 
+{
+
+/*******************************************************************************
+
+*******************************************************************************/
+pragma::pragma(const store::Item_t& name, zstring const& content)
+  :
+  theQName(name),
+  theContent(content)
+{
+}
+
+pragma::~pragma()
+{
+}
+
+}

=== added file 'src/compiler/expression/pragma.h'
--- src/compiler/expression/pragma.h	1970-01-01 00:00:00 +0000
+++ src/compiler/expression/pragma.h	2012-06-29 17:23:20 +0000
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2006-2012 The FLWOR Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#pragma once
+#ifndef ZORBA_COMPILER_PRAGMA_H
+#define ZORBA_COMPILER_PRAGMA_H
+
+#include "zorbatypes/rchandle.h"
+#include "store/api/item.h"
+
+namespace zorba 
+{
+
+/***************************************************************************//**
+
+********************************************************************************/
+class pragma : public SimpleRCObject
+{
+  friend class expr;
+
+public:
+  store::Item_t theQName;
+  zstring       theContent;
+
+public:
+  pragma(const store::Item_t& name, zstring const& content);
+
+  ~pragma();
+};
+
+typedef rchandle<pragma> pragma_t;
+
+} /* namespace zorba */
+
+#endif

=== modified file 'src/compiler/parsetree/parsenodes.cpp'
--- src/compiler/parsetree/parsenodes.cpp	2012-06-28 04:14:03 +0000
+++ src/compiler/parsetree/parsenodes.cpp	2012-06-29 17:23:20 +0000
@@ -2807,8 +2807,8 @@
 void ExtensionExpr::accept( parsenode_visitor &v ) const
 {
   BEGIN_VISITOR();
+  ACCEPT (expr_);
   ACCEPT (pragmas_);
-  ACCEPT (expr_);
   END_VISITOR();
 }
 

=== modified file 'src/compiler/translator/translator.cpp'
--- src/compiler/translator/translator.cpp	2012-06-28 04:14:03 +0000
+++ src/compiler/translator/translator.cpp	2012-06-29 17:23:20 +0000
@@ -56,6 +56,7 @@
 #include "compiler/expression/flwor_expr.h"
 #include "compiler/expression/path_expr.h"
 #include "compiler/expression/function_item_expr.h"
+#include "compiler/expression/pragma.h"
 #include "compiler/rewriter/framework/rewriter_context.h"
 #include "compiler/rewriter/framework/rewriter.h"
 #include "compiler/xqddf/value_index.h"
@@ -8261,12 +8262,21 @@
 {
   TRACE_VISIT_OUT();
 
-  // may raise XPST0081
-  if (!v.get_name()->is_eqname())
+  store::Item_t lQName;
+  expand_no_default_qname(lQName, v.get_name(), v.get_name()->get_location());
+
+  if (lQName->getPrefix().empty() && lQName->getNamespace().empty())
+    RAISE_ERROR(err::XPST0081, loc, ERROR_PARAMS(lQName->getStringValue()));
+
+  if (lQName->getNamespace() == ZORBA_EXTENSIONS_NS)
   {
-    zstring ns;
-    theSctx->lookup_ns(ns, v.get_name()->get_prefix(), loc);
+    pragma_t lPragma = new pragma(lQName, v.get_pragma_lit());
+    expr_t lExpr = top_nodestack();
+
+    theCCB->thePragmas.insert(std::make_pair(lExpr.getp(), lPragma));
+    lExpr->setContainsPragma(ANNOTATION_TRUE);
   }
+
 }
 
 

=== modified file 'src/functions/func_collections_impl.cpp'
--- src/functions/func_collections_impl.cpp	2012-06-28 04:14:03 +0000
+++ src/functions/func_collections_impl.cpp	2012-06-29 17:23:20 +0000
@@ -19,6 +19,9 @@
 #include "runtime/collections/collections.h"
 
 #include "compiler/expression/expr_consts.h"
+#include "compiler/expression/expr_base.h"
+#include "compiler/expression/pragma.h"
+#include "compiler/api/compilercb.h"
 
 namespace zorba
 {
@@ -26,6 +29,26 @@
 /*******************************************************************************
 
 ********************************************************************************/
+bool
+mustCopyNodes(CompilerCB* ccb, expr& e)
+{
+  if (e.containsPragma())
+  {
+    CompilerCB::PragmaMapIter lIter = ccb->thePragmas.find(&e);
+    while (lIter != ccb->thePragmas.end())
+    {
+      if (lIter->second->theQName->getLocalName() == "no-copy")
+        return true;
+      ++lIter;
+    }
+  }
+  return false;
+}
+
+
+/*******************************************************************************
+
+********************************************************************************/
 PlanIter_t static_collections_dml_collection::codegen(
   CompilerCB*,
   static_context* sctx,
@@ -103,7 +126,7 @@
 
 ********************************************************************************/
 PlanIter_t static_collections_dml_insert_nodes::codegen(
-    CompilerCB*,
+    CompilerCB* cb,
     static_context* sctx,
     const QueryLoc& loc,
     std::vector<PlanIter_t>& argv,
@@ -114,7 +137,9 @@
   bool const dynamic =
     ns == static_context::ZORBA_STORE_DYNAMIC_COLLECTIONS_DML_FN_NS;
 
-  return new ZorbaInsertNodesIterator(sctx, loc, argv, dynamic);
+  bool const copy = mustCopyNodes(cb, ann);
+
+  return new ZorbaInsertNodesIterator(sctx, loc, argv, dynamic, copy);
 }
 
 
@@ -122,7 +147,7 @@
 
 ********************************************************************************/
 PlanIter_t static_collections_dml_insert_nodes_first::codegen(
-    CompilerCB*,
+    CompilerCB* cb,
     static_context* sctx,
     const QueryLoc& loc,
     std::vector<PlanIter_t>& argv,
@@ -133,7 +158,9 @@
   bool const dynamic =
     ns == static_context::ZORBA_STORE_DYNAMIC_COLLECTIONS_DML_FN_NS;
 
-  return new ZorbaInsertNodesFirstIterator(sctx, loc, argv, dynamic);
+  bool const copy = mustCopyNodes(cb, ann);
+
+  return new ZorbaInsertNodesFirstIterator(sctx, loc, argv, dynamic, copy);
 }
 
 
@@ -141,7 +168,7 @@
 
 ********************************************************************************/
 PlanIter_t static_collections_dml_insert_nodes_last::codegen(
-    CompilerCB*,
+    CompilerCB* cb,
     static_context* sctx,
     const QueryLoc& loc,
     std::vector<PlanIter_t>& argv,
@@ -152,7 +179,9 @@
   bool const dynamic =
     ns == static_context::ZORBA_STORE_DYNAMIC_COLLECTIONS_DML_FN_NS;
 
-  return new ZorbaInsertNodesLastIterator(sctx, loc, argv, dynamic);
+  bool const copy = mustCopyNodes(cb, ann);
+
+  return new ZorbaInsertNodesLastIterator(sctx, loc, argv, dynamic, copy);
 }
 
 
@@ -160,7 +189,7 @@
 
 ********************************************************************************/
 PlanIter_t static_collections_dml_insert_nodes_before::codegen(
-    CompilerCB*,
+    CompilerCB* cb,
     static_context* sctx,
     const QueryLoc& loc,
     std::vector<PlanIter_t>& argv,
@@ -171,7 +200,9 @@
   bool const dynamic =
     ns == static_context::ZORBA_STORE_DYNAMIC_COLLECTIONS_DML_FN_NS;
 
-  return new ZorbaInsertNodesBeforeIterator(sctx, loc, argv, dynamic);
+  bool const copy = mustCopyNodes(cb, ann);
+
+  return new ZorbaInsertNodesBeforeIterator(sctx, loc, argv, dynamic, copy);
 }
 
 
@@ -179,7 +210,7 @@
 
 ********************************************************************************/
 PlanIter_t static_collections_dml_insert_nodes_after::codegen(
-    CompilerCB*,
+    CompilerCB* cb,
     static_context* sctx,
     const QueryLoc& loc,
     std::vector<PlanIter_t>& argv,
@@ -190,7 +221,9 @@
   bool const dynamic =
     ns == static_context::ZORBA_STORE_DYNAMIC_COLLECTIONS_DML_FN_NS;
 
-  return new ZorbaInsertNodesAfterIterator(sctx, loc, argv, dynamic);
+  bool const copy = mustCopyNodes(cb, ann);
+
+  return new ZorbaInsertNodesAfterIterator(sctx, loc, argv, dynamic, copy);
 }
 
 
@@ -198,7 +231,7 @@
 
 ********************************************************************************/
 PlanIter_t static_collections_dml_apply_insert_nodes::codegen(
-    CompilerCB*,
+    CompilerCB* cb,
     static_context* sctx,
     const QueryLoc& loc,
     std::vector<PlanIter_t>& argv,
@@ -209,7 +242,9 @@
   bool const dynamic =
     ns == static_context::ZORBA_STORE_DYNAMIC_COLLECTIONS_DML_FN_NS;
 
-  return new ZorbaApplyInsertNodesIterator(sctx, loc, argv, dynamic);
+  bool const copy = mustCopyNodes(cb, ann);
+
+  return new ZorbaApplyInsertNodesIterator(sctx, loc, argv, dynamic, copy);
 }
 
 
@@ -225,7 +260,7 @@
 
 ********************************************************************************/
 PlanIter_t static_collections_dml_apply_insert_nodes_first::codegen(
-    CompilerCB*,
+    CompilerCB* cb,
     static_context* sctx,
     const QueryLoc& loc,
     std::vector<PlanIter_t>& argv,
@@ -236,7 +271,9 @@
   bool const dynamic =
     ns == static_context::ZORBA_STORE_DYNAMIC_COLLECTIONS_DML_FN_NS;
 
-  return new ZorbaApplyInsertNodesFirstIterator(sctx, loc, argv, dynamic);
+  bool const copy = mustCopyNodes(cb, ann);
+
+  return new ZorbaApplyInsertNodesFirstIterator(sctx, loc, argv, dynamic, copy);
 }
 
 
@@ -252,7 +289,7 @@
 
 ********************************************************************************/
 PlanIter_t static_collections_dml_apply_insert_nodes_last::codegen(
-    CompilerCB*,
+    CompilerCB* cb,
     static_context* sctx,
     const QueryLoc& loc,
     std::vector<PlanIter_t>& argv,
@@ -263,7 +300,9 @@
   bool const dynamic = 
     ns == static_context::ZORBA_STORE_DYNAMIC_COLLECTIONS_DML_FN_NS;
 
-  return new ZorbaApplyInsertNodesLastIterator(sctx, loc, argv, dynamic);
+  bool const copy = mustCopyNodes(cb, ann);
+
+  return new ZorbaApplyInsertNodesLastIterator(sctx, loc, argv, dynamic, copy);
 }
 
 
@@ -279,7 +318,7 @@
 
 ********************************************************************************/
 PlanIter_t static_collections_dml_apply_insert_nodes_before::codegen(
-  CompilerCB*,
+  CompilerCB* cb,
   static_context* sctx,
   const QueryLoc& loc,
   std::vector<PlanIter_t>& argv,
@@ -290,7 +329,9 @@
   bool const dynamic = 
     ns == static_context::ZORBA_STORE_DYNAMIC_COLLECTIONS_DML_FN_NS;
 
-  return new ZorbaApplyInsertNodesBeforeIterator(sctx, loc, argv, dynamic);
+  bool const copy = mustCopyNodes(cb, ann);
+
+  return new ZorbaApplyInsertNodesBeforeIterator(sctx, loc, argv, dynamic, copy);
 }
 
 
@@ -307,7 +348,7 @@
 
 ********************************************************************************/
 PlanIter_t static_collections_dml_apply_insert_nodes_after::codegen(
-  CompilerCB*,
+  CompilerCB* cb,
   static_context* sctx,
   const QueryLoc& loc,
   std::vector<PlanIter_t>& argv,
@@ -318,7 +359,9 @@
   bool const dynamic =
     ns == static_context::ZORBA_STORE_DYNAMIC_COLLECTIONS_DML_FN_NS;
 
-  return new ZorbaApplyInsertNodesAfterIterator(sctx, loc, argv, dynamic);
+  bool const copy = mustCopyNodes(cb, ann);
+
+  return new ZorbaApplyInsertNodesAfterIterator(sctx, loc, argv, dynamic, copy);
 }
 
 

=== modified file 'src/runtime/collections/collections_base.h'
--- src/runtime/collections/collections_base.h	2012-06-28 04:14:03 +0000
+++ src/runtime/collections/collections_base.h	2012-06-29 17:23:20 +0000
@@ -59,6 +59,7 @@
 {
 protected:
   bool theIsDynamic;
+  bool theMustCopyInput;
 
 protected:
 
@@ -103,8 +104,9 @@
 
     getCopyMode(lCopyMode, this->theSctx);
 
-    lCopyMode.theDoCopy = ! 
-    this->theChildren[this->theChildren.size()-1]->isConstructor();
+    lCopyMode.theDoCopy =
+      this->theChildren[this->theChildren.size()-1]->isConstructor() ||
+      !theMustCopyInput;
 
     while (this->consumeNext(node,
                              this->theChildren[this->theChildren.size()-1].getp(),
@@ -144,10 +146,12 @@
       static_context* sctx,
       const QueryLoc& loc,
       std::vector<PlanIter_t>& children,
-      bool isDynamic)
+      bool isDynamic,
+      bool mustCopyNodes)
     :
     NaryBaseIterator<Iter, State>(sctx, loc, children),
-    theIsDynamic(isDynamic)
+    theIsDynamic(isDynamic),
+    theMustCopyInput(mustCopyNodes)
   {
   }
 

=== modified file 'src/runtime/collections/pregenerated/collections.h'
--- src/runtime/collections/pregenerated/collections.h	2012-06-29 13:25:20 +0000
+++ src/runtime/collections/pregenerated/collections.h	2012-06-29 17:23:20 +0000
@@ -379,9 +379,10 @@
     static_context* sctx,
     const QueryLoc& loc,
     std::vector<PlanIter_t>& children,
-    bool isDynamic)
+    bool isDynamic,
+    bool mustCopyNodes)
     : 
-    ZorbaCollectionIteratorHelper<ZorbaInsertNodesIterator, PlanIteratorState>(sctx, loc, children, isDynamic)
+    ZorbaCollectionIteratorHelper<ZorbaInsertNodesIterator, PlanIteratorState>(sctx, loc, children, isDynamic, mustCopyNodes)
   {}
 
   virtual ~ZorbaInsertNodesIterator();
@@ -414,9 +415,10 @@
     static_context* sctx,
     const QueryLoc& loc,
     std::vector<PlanIter_t>& children,
-    bool isDynamic)
+    bool isDynamic,
+    bool mustCopyNodes)
     : 
-    ZorbaCollectionIteratorHelper<ZorbaInsertNodesFirstIterator, PlanIteratorState>(sctx, loc, children, isDynamic)
+    ZorbaCollectionIteratorHelper<ZorbaInsertNodesFirstIterator, PlanIteratorState>(sctx, loc, children, isDynamic, mustCopyNodes)
   {}
 
   virtual ~ZorbaInsertNodesFirstIterator();
@@ -449,9 +451,10 @@
     static_context* sctx,
     const QueryLoc& loc,
     std::vector<PlanIter_t>& children,
-    bool isDynamic)
+    bool isDynamic,
+    bool mustCopyNodes)
     : 
-    ZorbaCollectionIteratorHelper<ZorbaInsertNodesLastIterator, PlanIteratorState>(sctx, loc, children, isDynamic)
+    ZorbaCollectionIteratorHelper<ZorbaInsertNodesLastIterator, PlanIteratorState>(sctx, loc, children, isDynamic, mustCopyNodes)
   {}
 
   virtual ~ZorbaInsertNodesLastIterator();
@@ -484,9 +487,10 @@
     static_context* sctx,
     const QueryLoc& loc,
     std::vector<PlanIter_t>& children,
-    bool isDynamic)
+    bool isDynamic,
+    bool mustCopyNodes)
     : 
-    ZorbaCollectionIteratorHelper<ZorbaInsertNodesBeforeIterator, PlanIteratorState>(sctx, loc, children, isDynamic)
+    ZorbaCollectionIteratorHelper<ZorbaInsertNodesBeforeIterator, PlanIteratorState>(sctx, loc, children, isDynamic, mustCopyNodes)
   {}
 
   virtual ~ZorbaInsertNodesBeforeIterator();
@@ -521,9 +525,10 @@
     static_context* sctx,
     const QueryLoc& loc,
     std::vector<PlanIter_t>& children,
-    bool isDynamic)
+    bool isDynamic,
+    bool mustCopyNodes)
     : 
-    ZorbaCollectionIteratorHelper<ZorbaInsertNodesAfterIterator, PlanIteratorState>(sctx, loc, children, isDynamic),
+    ZorbaCollectionIteratorHelper<ZorbaInsertNodesAfterIterator, PlanIteratorState>(sctx, loc, children, isDynamic, mustCopyNodes),
     theIsDynamic(isDynamic)
   {}
 
@@ -571,9 +576,10 @@
     static_context* sctx,
     const QueryLoc& loc,
     std::vector<PlanIter_t>& children,
-    bool isDynamic)
+    bool isDynamic,
+    bool mustCopyNodes)
     : 
-    ZorbaCollectionIteratorHelper<ZorbaApplyInsertNodesIterator, ZorbaApplyInsertNodesIteratorState>(sctx, loc, children, isDynamic)
+    ZorbaCollectionIteratorHelper<ZorbaApplyInsertNodesIterator, ZorbaApplyInsertNodesIteratorState>(sctx, loc, children, isDynamic, mustCopyNodes)
   {}
 
   virtual ~ZorbaApplyInsertNodesIterator();
@@ -620,9 +626,10 @@
     static_context* sctx,
     const QueryLoc& loc,
     std::vector<PlanIter_t>& children,
-    bool isDynamic)
+    bool isDynamic,
+    bool mustCopyNodes)
     : 
-    ZorbaCollectionIteratorHelper<ZorbaApplyInsertNodesFirstIterator, ZorbaApplyInsertNodesFirstIteratorState>(sctx, loc, children, isDynamic)
+    ZorbaCollectionIteratorHelper<ZorbaApplyInsertNodesFirstIterator, ZorbaApplyInsertNodesFirstIteratorState>(sctx, loc, children, isDynamic, mustCopyNodes)
   {}
 
   virtual ~ZorbaApplyInsertNodesFirstIterator();
@@ -669,9 +676,10 @@
     static_context* sctx,
     const QueryLoc& loc,
     std::vector<PlanIter_t>& children,
-    bool isDynamic)
+    bool isDynamic,
+    bool mustCopyNodes)
     : 
-    ZorbaCollectionIteratorHelper<ZorbaApplyInsertNodesLastIterator, ZorbaApplyInsertNodesLastIteratorState>(sctx, loc, children, isDynamic)
+    ZorbaCollectionIteratorHelper<ZorbaApplyInsertNodesLastIterator, ZorbaApplyInsertNodesLastIteratorState>(sctx, loc, children, isDynamic, mustCopyNodes)
   {}
 
   virtual ~ZorbaApplyInsertNodesLastIterator();
@@ -718,9 +726,10 @@
     static_context* sctx,
     const QueryLoc& loc,
     std::vector<PlanIter_t>& children,
-    bool isDynamic)
+    bool isDynamic,
+    bool mustCopyNodes)
     : 
-    ZorbaCollectionIteratorHelper<ZorbaApplyInsertNodesBeforeIterator, ZorbaApplyInsertNodesBeforeIteratorState>(sctx, loc, children, isDynamic)
+    ZorbaCollectionIteratorHelper<ZorbaApplyInsertNodesBeforeIterator, ZorbaApplyInsertNodesBeforeIteratorState>(sctx, loc, children, isDynamic, mustCopyNodes)
   {}
 
   virtual ~ZorbaApplyInsertNodesBeforeIterator();
@@ -767,9 +776,10 @@
     static_context* sctx,
     const QueryLoc& loc,
     std::vector<PlanIter_t>& children,
-    bool isDynamic)
+    bool isDynamic,
+    bool mustCopyNodes)
     : 
-    ZorbaCollectionIteratorHelper<ZorbaApplyInsertNodesAfterIterator, ZorbaApplyInsertNodesAfterIteratorState>(sctx, loc, children, isDynamic)
+    ZorbaCollectionIteratorHelper<ZorbaApplyInsertNodesAfterIterator, ZorbaApplyInsertNodesAfterIteratorState>(sctx, loc, children, isDynamic, mustCopyNodes)
   {}
 
   virtual ~ZorbaApplyInsertNodesAfterIterator();

=== modified file 'src/runtime/spec/collections/collections.xml'
--- src/runtime/spec/collections/collections.xml	2012-06-29 13:25:20 +0000
+++ src/runtime/spec/collections/collections.xml	2012-06-29 17:23:20 +0000
@@ -402,6 +402,7 @@
 
     <zorba:constructor>
       <zorba:parameter type="bool" name="isDynamic" base="true"/>
+      <zorba:parameter type="bool" name="mustCopyNodes" base="true"/>
     </zorba:constructor>
 
     <zorba:method const="true" name="getCollection" 
@@ -460,6 +461,7 @@
 
     <zorba:constructor>
       <zorba:parameter type="bool" name="isDynamic" base="true"/>
+      <zorba:parameter type="bool" name="mustCopyNodes" base="true"/>
     </zorba:constructor>
 
     <zorba:method const="true" name="getCollection" 
@@ -517,6 +519,7 @@
 
     <zorba:constructor>
       <zorba:parameter type="bool" name="isDynamic" base="true"/>
+      <zorba:parameter type="bool" name="mustCopyNodes" base="true"/>
     </zorba:constructor>
 
     <zorba:method const="true" name="getCollection" 
@@ -578,6 +581,7 @@
 
     <zorba:constructor>
       <zorba:parameter type="bool" name="isDynamic" base="true"/>
+      <zorba:parameter type="bool" name="mustCopyNodes" base="true"/>
     </zorba:constructor>
 
     <zorba:method const="true" name="getCollection" 
@@ -639,6 +643,7 @@
 
     <zorba:constructor>
       <zorba:parameter type="bool" name="isDynamic" base="true"/>
+      <zorba:parameter type="bool" name="mustCopyNodes" base="true"/>
     </zorba:constructor>
 
     <zorba:member type="bool" name="theIsDynamic"/>
@@ -695,6 +700,7 @@
 
     <zorba:constructor>
       <zorba:parameter type="bool" name="isDynamic" base="true"/>
+      <zorba:parameter type="bool" name="mustCopyNodes" base="true"/>
     </zorba:constructor>
 
     <zorba:method const="true" name="getCollection" 
@@ -762,6 +768,7 @@
 
     <zorba:constructor>
       <zorba:parameter type="bool" name="isDynamic" base="true"/>
+      <zorba:parameter type="bool" name="mustCopyNodes" base="true"/>
     </zorba:constructor>
 
     <zorba:method const="true" name="getCollection" 
@@ -829,6 +836,7 @@
 
     <zorba:constructor>
       <zorba:parameter type="bool" name="isDynamic" base="true"/>
+      <zorba:parameter type="bool" name="mustCopyNodes" base="true"/>
     </zorba:constructor>
 
     <zorba:method const="true" name="getCollection" 
@@ -900,6 +908,7 @@
 
     <zorba:constructor>
       <zorba:parameter type="bool" name="isDynamic" base="true"/>
+      <zorba:parameter type="bool" name="mustCopyNodes" base="true"/>
     </zorba:constructor>
 
     <zorba:method const="true" name="getCollection" 
@@ -971,6 +980,7 @@
 
     <zorba:constructor>
       <zorba:parameter type="bool" name="isDynamic" base="true"/>
+      <zorba:parameter type="bool" name="mustCopyNodes" base="true"/>
     </zorba:constructor>
 
     <zorba:method const="true" name="getCollection" 

=== modified file 'src/zorbamisc/ns_consts.h'
--- src/zorbamisc/ns_consts.h	2012-06-28 04:14:03 +0000
+++ src/zorbamisc/ns_consts.h	2012-06-29 17:23:20 +0000
@@ -56,6 +56,7 @@
 #define ZORBA_FEATURES_NS       ZORBA_NS "features"
 #define ZORBA_ANNOTATIONS_NS    ZORBA_NS "annotations"
 #define ZORBA_COLLATION_NS_BASE ZORBA_NS "collations/"
+#define ZORBA_EXTENSIONS_NS     ZORBA_NS "extensions"
 
 // TODO these probably should not be in "ns_consts"
 #define ZORBA_OPTION_ENABLE_DTD "enable-dtd"

-- 
Mailing list: https://launchpad.net/~zorba-coders
Post to     : zorba-coders@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zorba-coders
More help   : https://help.launchpad.net/ListHelp

Reply via email to