Merge lp:~zorba-coders/zorba/bug-1058398 into lp:zorba

Proposed by Matthias Brantner
Status: Merged
Approved by: Paul J. Lucas
Approved revision: 11644
Merged at revision: 11648
Proposed branch: lp:~zorba-coders/zorba/bug-1058398
Merge into: lp:zorba
Diff against target: 1436 lines (+1101/-20)
30 files modified
ChangeLog (+1/-0)
modules/CMakeLists.txt (+1/-0)
modules/sequence/CMakeLists.txt (+18/-0)
modules/sequence/sequence.xq (+75/-0)
src/context/static_context.cpp (+5/-0)
src/context/static_context.h (+1/-0)
src/functions/library.cpp (+2/-0)
src/functions/pregenerated/func_seq.cpp (+110/-0)
src/functions/pregenerated/func_seq.h (+94/-0)
src/functions/pregenerated/function_enum.h (+3/-0)
src/runtime/CMakeLists.txt (+1/-0)
src/runtime/pregenerated/iterator_enum.h (+3/-0)
src/runtime/seq/CMakeLists.txt (+19/-0)
src/runtime/seq/pregenerated/seq.cpp (+159/-0)
src/runtime/seq/pregenerated/seq.h (+173/-0)
src/runtime/seq/seq_impl.cpp (+145/-0)
src/runtime/seq/seq_util.h (+64/-0)
src/runtime/spec/mappings.xml (+24/-19)
src/runtime/spec/seq/seq.xml (+65/-0)
src/runtime/visitors/pregenerated/planiter_visitor.h (+15/-0)
src/runtime/visitors/pregenerated/printer_visitor.cpp (+43/-0)
src/runtime/visitors/pregenerated/printer_visitor.h (+9/-0)
src/util/stl_util.h (+1/-1)
src/zorbautils/specializations.h (+46/-0)
test/rbkt/ExpQueryResults/zorba/seq/seq-value-except-01.xml.res (+1/-0)
test/rbkt/ExpQueryResults/zorba/seq/seq-value-intersect-01.xml.res (+1/-0)
test/rbkt/ExpQueryResults/zorba/seq/seq-value-union-01.xml.res (+1/-0)
test/rbkt/Queries/zorba/seq/seq-value-except-01.xq (+7/-0)
test/rbkt/Queries/zorba/seq/seq-value-intersect-01.xq (+7/-0)
test/rbkt/Queries/zorba/seq/seq-value-union-01.xq (+7/-0)
To merge this branch: bzr merge lp:~zorba-coders/zorba/bug-1058398
Reviewer Review Type Date Requested Status
Matthias Brantner Approve
Paul J. Lucas Approve
Review via email: mp+187965@code.launchpad.net

Commit message

Added core C++ implementation of functx functions having the same name.

Description of the change

Added core C++ implementation of functx functions having the same name.

To post a comment you must log in.
Revision history for this message
Matthias Brantner (matthias-brantner) wrote :

documentation in "Performs TODO"

review: Needs Fixing
Revision history for this message
Paul J. Lucas (paul-lucas) wrote :

Why did you create a MP for this? As you saw from my e-mail, the performance isn't significantly better as-is.

That said, it might be possible to improve it by, for instance, caching the casting results; but that would take more investigation.

lp:~zorba-coders/zorba/bug-1058398 updated
11642. By Paul J. Lucas

Merge from trunk.

11643. By Paul J. Lucas

Merge from trunk.

11644. By Paul J. Lucas

Clean-up; renaming.

Revision history for this message
Paul J. Lucas (paul-lucas) :
review: Approve
Revision history for this message
Matthias Brantner (matthias-brantner) :
review: Approve
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

Validation queue starting for the following merge proposals:
https://code.launchpad.net/~zorba-coders/zorba/bug-1058398/+merge/187965

Progress dashboard at http://jenkins.lambda.nu/view/ValidationQueue

Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

Validation queue succeeded - proposal merged!

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'ChangeLog'
--- ChangeLog 2013-10-01 00:52:37 +0000
+++ ChangeLog 2013-10-01 23:33:38 +0000
@@ -54,6 +54,7 @@
54 * Fixed bug #1190261 (relative paths bug in file module)54 * Fixed bug #1190261 (relative paths bug in file module)
55 * Fixed bug #1189798 (Update core module "errors")55 * Fixed bug #1189798 (Update core module "errors")
56 * Fixed bug #1187537 (Eliminate (or at least reduce) use of MAX_PATH)56 * Fixed bug #1187537 (Eliminate (or at least reduce) use of MAX_PATH)
57 * Fixed bug #1058398 (set-based sequence operations)
57 * Fixed bug #1180220 (Consolidate redundant path/file public APIs)58 * Fixed bug #1180220 (Consolidate redundant path/file public APIs)
58 * Fixed bug #1158052 (createBase64Binary() API too subtle)59 * Fixed bug #1158052 (createBase64Binary() API too subtle)
59 * Fixed bug #1103115 (Timezone units as hours are wrong)60 * Fixed bug #1103115 (Timezone units as hours are wrong)
6061
=== modified file 'modules/CMakeLists.txt'
--- modules/CMakeLists.txt 2013-10-01 03:34:33 +0000
+++ modules/CMakeLists.txt 2013-10-01 23:33:38 +0000
@@ -22,6 +22,7 @@
22ADD_SUBDIRECTORY(org)22ADD_SUBDIRECTORY(org)
23ADD_SUBDIRECTORY(schema)23ADD_SUBDIRECTORY(schema)
24ADD_SUBDIRECTORY(sctx)24ADD_SUBDIRECTORY(sctx)
25ADD_SUBDIRECTORY(sequence)
25ADD_SUBDIRECTORY(store)26ADD_SUBDIRECTORY(store)
26ADD_SUBDIRECTORY(structured-items)27ADD_SUBDIRECTORY(structured-items)
27ADD_SUBDIRECTORY(w3c)28ADD_SUBDIRECTORY(w3c)
2829
=== added directory 'modules/sequence'
=== added file 'modules/sequence/CMakeLists.txt'
--- modules/sequence/CMakeLists.txt 1970-01-01 00:00:00 +0000
+++ modules/sequence/CMakeLists.txt 2013-10-01 23:33:38 +0000
@@ -0,0 +1,18 @@
1# Copyright 2013 The FLWOR Foundation.
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15DECLARE_ZORBA_MODULE(FILE sequence.xq VERSION 1.0
16 URI "http://zorba.io/modules/sequence")
17
18# vim:set et sw=2 ts=2:
019
=== added file 'modules/sequence/sequence.xq'
--- modules/sequence/sequence.xq 1970-01-01 00:00:00 +0000
+++ modules/sequence/sequence.xq 2013-10-01 23:33:38 +0000
@@ -0,0 +1,75 @@
1xquery version "3.0";
2
3(:
4 : Copyright 2006-2013 The FLWOR Foundation.
5 :
6 : Licensed under the Apache License, Version 2.0 (the "License");
7 : you may not use this file except in compliance with the License.
8 : You may obtain a copy of the License at
9 :
10 : http://www.apache.org/licenses/LICENSE-2.0
11 :
12 : Unless required by applicable law or agreed to in writing, software
13 : distributed under the License is distributed on an "AS IS" BASIS,
14 : WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 : See the License for the specific language governing permissions and
16 : limitations under the License.
17 :)
18
19(:===========================================================================:)
20
21(:~
22 : This module provides an XQuery API to perform set operations on sequences.
23 :
24 : @author Paul J. Lucas
25 : @project Zorba/Sequence
26 :)
27
28module namespace seq = "http://zorba.io/modules/sequence";
29
30declare namespace ver = "http://zorba.io/options/versioning";
31declare option ver:module-version "1.0";
32
33(:===========================================================================:)
34
35(:~
36 : Performs a set intersection of two sequences of atomic items based on their
37 : values.
38 :
39 : @param $seq1 The first sequence.
40 : @param $seq2 The second sequence.
41 : @return a sequence containing only items from <code>$seq1</code> that are
42 : also in <code>$seq2</code>.
43 :)
44declare function seq:value-intersect( $seq1 as xs:anyAtomicType*,
45 $seq2 as xs:anyAtomicType* )
46 as xs:anyAtomicType* external;
47
48(:~
49 : Performs a set union of two sequences of atomic items based on their values.
50 :
51 : @param $seq1 The first sequence.
52 : @param $seq2 The second sequence.
53 : @return a sequence containing all items from <code>$seq1</code>
54 : and <code>seq2$</code> but without duplicates.
55 :)
56declare function seq:value-union( $seq1 as xs:anyAtomicType*,
57 $seq2 as xs:anyAtomicType* )
58 as xs:anyAtomicType* external;
59
60(:~
61 : Filters the first sequence of atomic items such that they are not in the
62 : second sequence based on their values.
63 :
64 : @param $seq1 The first sequence.
65 : @param $seq2 The second sequence.
66 : @return a sequence only containing items from <code>$seq1</code>
67 : that are not in <code>$seq2</code>.
68 :)
69declare function seq:value-except( $seq1 as xs:anyAtomicType*,
70 $seq2 as xs:anyAtomicType* )
71 as xs:anyAtomicType* external;
72
73(:===========================================================================:)
74
75(: vim:set et sw=2 ts=2: :)
076
=== modified file 'src/context/static_context.cpp'
--- src/context/static_context.cpp 2013-10-01 03:34:33 +0000
+++ src/context/static_context.cpp 2013-10-01 23:33:38 +0000
@@ -450,6 +450,10 @@
450"http://www.zorba-xquery.com/zorba/scripting";450"http://www.zorba-xquery.com/zorba/scripting";
451451
452const char*452const char*
453static_context::ZORBA_SEQ_FN_NS =
454"http://zorba.io/modules/sequence";
455
456const char*
453static_context::ZORBA_STRING_FN_NS =457static_context::ZORBA_STRING_FN_NS =
454"http://zorba.io/modules/string";458"http://zorba.io/modules/string";
455459
@@ -563,6 +567,7 @@
563 ns == ZORBA_FETCH_FN_NS ||567 ns == ZORBA_FETCH_FN_NS ||
564 ns == ZORBA_NODE_FN_NS ||568 ns == ZORBA_NODE_FN_NS ||
565 ns == ZORBA_ITEM_FN_NS ||569 ns == ZORBA_ITEM_FN_NS ||
570 ns == ZORBA_SEQ_FN_NS ||
566 ns == ZORBA_UTIL_FN_NS ||571 ns == ZORBA_UTIL_FN_NS ||
567#ifndef ZORBA_NO_FULL_TEXT572#ifndef ZORBA_NO_FULL_TEXT
568 ns == ZORBA_FULL_TEXT_FN_NS ||573 ns == ZORBA_FULL_TEXT_FN_NS ||
569574
=== modified file 'src/context/static_context.h'
--- src/context/static_context.h 2013-10-01 00:52:37 +0000
+++ src/context/static_context.h 2013-10-01 23:33:38 +0000
@@ -539,6 +539,7 @@
539 static const char* JSONIQ_FN_NS;539 static const char* JSONIQ_FN_NS;
540540
541 static const char* ZORBA_SCHEMA_FN_NS;541 static const char* ZORBA_SCHEMA_FN_NS;
542 static const char* ZORBA_SEQ_FN_NS;
542 static const char* ZORBA_XQDOC_FN_NS;543 static const char* ZORBA_XQDOC_FN_NS;
543 static const char* ZORBA_RANDOM_FN_NS;544 static const char* ZORBA_RANDOM_FN_NS;
544 static const char* ZORBA_SCTX_FN_NS;545 static const char* ZORBA_SCTX_FN_NS;
545546
=== modified file 'src/functions/library.cpp'
--- src/functions/library.cpp 2013-09-17 23:05:29 +0000
+++ src/functions/library.cpp 2013-10-01 23:33:38 +0000
@@ -67,6 +67,7 @@
67#include "functions/func_reflection.h"67#include "functions/func_reflection.h"
68#include "functions/func_schema.h"68#include "functions/func_schema.h"
69#include "functions/func_sctx.h"69#include "functions/func_sctx.h"
70#include "functions/func_seq.h"
70#include "functions/func_sequences.h"71#include "functions/func_sequences.h"
71#include "functions/func_sequences_impl.h"72#include "functions/func_sequences_impl.h"
72#include "functions/func_strings.h"73#include "functions/func_strings.h"
@@ -143,6 +144,7 @@
143 populate_context_random(sctx);144 populate_context_random(sctx);
144 populate_context_schema(sctx);145 populate_context_schema(sctx);
145 populate_context_sctx(sctx);146 populate_context_sctx(sctx);
147 populate_context_seq(sctx);
146 populate_context_strings(sctx);148 populate_context_strings(sctx);
147 populate_context_strings_impl(sctx);149 populate_context_strings_impl(sctx);
148 populate_context_uris(sctx);150 populate_context_uris(sctx);
149151
=== added file 'src/functions/pregenerated/func_seq.cpp'
--- src/functions/pregenerated/func_seq.cpp 1970-01-01 00:00:00 +0000
+++ src/functions/pregenerated/func_seq.cpp 2013-10-01 23:33:38 +0000
@@ -0,0 +1,110 @@
1/*
2 * Copyright 2006-2012 The FLWOR Foundation.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17// ******************************************
18// * *
19// * THIS IS A GENERATED FILE. DO NOT EDIT! *
20// * SEE .xml FILE WITH SAME NAME *
21// * *
22// ******************************************
23
24
25#include "stdafx.h"
26#include "runtime/seq/seq.h"
27#include "functions/func_seq.h"
28
29
30namespace zorba{
31
32
33
34PlanIter_t fn_zorba_seq_value_intersect::codegen(
35 CompilerCB*,
36 static_context* sctx,
37 const QueryLoc& loc,
38 std::vector<PlanIter_t>& argv,
39 expr& ann) const
40{
41 return new SeqValueIntersectIterator(sctx, loc, argv);
42}
43
44PlanIter_t fn_zorba_seq_value_union::codegen(
45 CompilerCB*,
46 static_context* sctx,
47 const QueryLoc& loc,
48 std::vector<PlanIter_t>& argv,
49 expr& ann) const
50{
51 return new SeqValueUnionIterator(sctx, loc, argv);
52}
53
54PlanIter_t fn_zorba_seq_value_except::codegen(
55 CompilerCB*,
56 static_context* sctx,
57 const QueryLoc& loc,
58 std::vector<PlanIter_t>& argv,
59 expr& ann) const
60{
61 return new SeqValueExceptIterator(sctx, loc, argv);
62}
63
64void populate_context_seq(static_context* sctx)
65{
66
67
68 {
69 DECL_WITH_KIND(sctx, fn_zorba_seq_value_intersect,
70 (createQName("http://zorba.io/modules/sequence","","value-intersect"),
71 GENV_TYPESYSTEM.ANY_ATOMIC_TYPE_STAR,
72 GENV_TYPESYSTEM.ANY_ATOMIC_TYPE_STAR,
73 GENV_TYPESYSTEM.ANY_ATOMIC_TYPE_STAR),
74 FunctionConsts::FN_ZORBA_SEQ_VALUE_INTERSECT_2);
75
76 }
77
78
79
80
81 {
82 DECL_WITH_KIND(sctx, fn_zorba_seq_value_union,
83 (createQName("http://zorba.io/modules/sequence","","value-union"),
84 GENV_TYPESYSTEM.ANY_ATOMIC_TYPE_STAR,
85 GENV_TYPESYSTEM.ANY_ATOMIC_TYPE_STAR,
86 GENV_TYPESYSTEM.ANY_ATOMIC_TYPE_STAR),
87 FunctionConsts::FN_ZORBA_SEQ_VALUE_UNION_2);
88
89 }
90
91
92
93
94 {
95 DECL_WITH_KIND(sctx, fn_zorba_seq_value_except,
96 (createQName("http://zorba.io/modules/sequence","","value-except"),
97 GENV_TYPESYSTEM.ANY_ATOMIC_TYPE_STAR,
98 GENV_TYPESYSTEM.ANY_ATOMIC_TYPE_STAR,
99 GENV_TYPESYSTEM.ANY_ATOMIC_TYPE_STAR),
100 FunctionConsts::FN_ZORBA_SEQ_VALUE_EXCEPT_2);
101
102 }
103
104}
105
106
107}
108
109
110
0111
=== added file 'src/functions/pregenerated/func_seq.h'
--- src/functions/pregenerated/func_seq.h 1970-01-01 00:00:00 +0000
+++ src/functions/pregenerated/func_seq.h 2013-10-01 23:33:38 +0000
@@ -0,0 +1,94 @@
1/*
2 * Copyright 2006-2012 The FLWOR Foundation.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17// ******************************************
18// * *
19// * THIS IS A GENERATED FILE. DO NOT EDIT! *
20// * SEE .xml FILE WITH SAME NAME *
21// * *
22// ******************************************
23
24
25#ifndef ZORBA_FUNCTIONS_SEQ_H
26#define ZORBA_FUNCTIONS_SEQ_H
27
28
29#include "common/shared_types.h"
30#include "functions/function_impl.h"
31
32
33namespace zorba {
34
35
36void populate_context_seq(static_context* sctx);
37
38
39
40
41//fn-zorba-seq:value-intersect
42class fn_zorba_seq_value_intersect : public function
43{
44public:
45 fn_zorba_seq_value_intersect(const signature& sig, FunctionConsts::FunctionKind kind)
46 :
47 function(sig, kind)
48 {
49
50 }
51
52 CODEGEN_DECL();
53};
54
55
56//fn-zorba-seq:value-union
57class fn_zorba_seq_value_union : public function
58{
59public:
60 fn_zorba_seq_value_union(const signature& sig, FunctionConsts::FunctionKind kind)
61 :
62 function(sig, kind)
63 {
64
65 }
66
67 CODEGEN_DECL();
68};
69
70
71//fn-zorba-seq:value-except
72class fn_zorba_seq_value_except : public function
73{
74public:
75 fn_zorba_seq_value_except(const signature& sig, FunctionConsts::FunctionKind kind)
76 :
77 function(sig, kind)
78 {
79
80 }
81
82 CODEGEN_DECL();
83};
84
85
86} //namespace zorba
87
88
89#endif
90/*
91 * Local variables:
92 * mode: c++
93 * End:
94 */
095
=== modified file 'src/functions/pregenerated/function_enum.h'
--- src/functions/pregenerated/function_enum.h 2013-10-01 03:25:43 +0000
+++ src/functions/pregenerated/function_enum.h 2013-10-01 23:33:38 +0000
@@ -394,6 +394,9 @@
394 FN_ZORBA_SCTX_STATICALLY_KNOWN_NAMESPACE_BINDING_1,394 FN_ZORBA_SCTX_STATICALLY_KNOWN_NAMESPACE_BINDING_1,
395 FN_ZORBA_SCTX_STATICALLY_KNOWN_NAMESPACES_0,395 FN_ZORBA_SCTX_STATICALLY_KNOWN_NAMESPACES_0,
396 FN_ZORBA_SCTX_XPATH10_COMPATIBILITY_MODE_0,396 FN_ZORBA_SCTX_XPATH10_COMPATIBILITY_MODE_0,
397 FN_ZORBA_SEQ_VALUE_INTERSECT_2,
398 FN_ZORBA_SEQ_VALUE_UNION_2,
399 FN_ZORBA_SEQ_VALUE_EXCEPT_2,
397 OP_CONCATENATE_N,400 OP_CONCATENATE_N,
398 FN_INDEX_OF_2,401 FN_INDEX_OF_2,
399 FN_INDEX_OF_3,402 FN_INDEX_OF_3,
400403
=== modified file 'src/runtime/CMakeLists.txt'
--- src/runtime/CMakeLists.txt 2013-10-01 00:52:37 +0000
+++ src/runtime/CMakeLists.txt 2013-10-01 23:33:38 +0000
@@ -153,6 +153,7 @@
153)153)
154154
155ADD_SRC_SUBFOLDER(RUNTIME_SRCS csv CSV_SRCS)155ADD_SRC_SUBFOLDER(RUNTIME_SRCS csv CSV_SRCS)
156ADD_SRC_SUBFOLDER(RUNTIME_SRCS seq SEQ_SRCS)
156157
157IF(NOT ZORBA_NO_FULL_TEXT)158IF(NOT ZORBA_NO_FULL_TEXT)
158 ADD_SRC_SUBFOLDER(RUNTIME_SRCS full_text FULLTEXT_SRCS)159 ADD_SRC_SUBFOLDER(RUNTIME_SRCS full_text FULLTEXT_SRCS)
159160
=== modified file 'src/runtime/pregenerated/iterator_enum.h'
--- src/runtime/pregenerated/iterator_enum.h 2013-10-01 03:25:43 +0000
+++ src/runtime/pregenerated/iterator_enum.h 2013-10-01 23:33:38 +0000
@@ -290,6 +290,9 @@
290 TYPE_SctxStaticallyKnownNamespaceBindingIterator,290 TYPE_SctxStaticallyKnownNamespaceBindingIterator,
291 TYPE_SctxStaticallyKnownNamespacesIterator,291 TYPE_SctxStaticallyKnownNamespacesIterator,
292 TYPE_SctxXPath10CompatModeIterator,292 TYPE_SctxXPath10CompatModeIterator,
293 TYPE_SeqValueIntersectIterator,
294 TYPE_SeqValueUnionIterator,
295 TYPE_SeqValueExceptIterator,
293 TYPE_FnConcatIterator,296 TYPE_FnConcatIterator,
294 TYPE_FnIndexOfIterator,297 TYPE_FnIndexOfIterator,
295 TYPE_FnEmptyIterator,298 TYPE_FnEmptyIterator,
296299
=== added directory 'src/runtime/seq'
=== added file 'src/runtime/seq/CMakeLists.txt'
--- src/runtime/seq/CMakeLists.txt 1970-01-01 00:00:00 +0000
+++ src/runtime/seq/CMakeLists.txt 2013-10-01 23:33:38 +0000
@@ -0,0 +1,19 @@
1# Copyright 2006-2013 The FLWOR Foundation.
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15SET(SEQ_SRCS
16 seq_impl.cpp
17 )
18
19# vim:set et sw=2 ts=2:
020
=== added directory 'src/runtime/seq/pregenerated'
=== added file 'src/runtime/seq/pregenerated/seq.cpp'
--- src/runtime/seq/pregenerated/seq.cpp 1970-01-01 00:00:00 +0000
+++ src/runtime/seq/pregenerated/seq.cpp 2013-10-01 23:33:38 +0000
@@ -0,0 +1,159 @@
1/*
2 * Copyright 2006-2012 The FLWOR Foundation.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17// ******************************************
18// * *
19// * THIS IS A GENERATED FILE. DO NOT EDIT! *
20// * SEE .xml FILE WITH SAME NAME *
21// * *
22// ******************************************
23
24#include "stdafx.h"
25#include "zorbatypes/rchandle.h"
26#include "zorbatypes/zstring.h"
27#include "runtime/visitors/planiter_visitor.h"
28#include "runtime/seq/seq.h"
29#include "system/globalenv.h"
30
31
32#include "store/api/iterator.h"
33
34namespace zorba {
35
36// <SeqValueIntersectIterator>
37SERIALIZABLE_CLASS_VERSIONS(SeqValueIntersectIterator)
38
39void SeqValueIntersectIterator::serialize(::zorba::serialization::Archiver& ar)
40{
41 serialize_baseclass(ar,
42 (NaryBaseIterator<SeqValueIntersectIterator, SeqValueIntersectIteratorState>*)this);
43}
44
45
46void SeqValueIntersectIterator::accept(PlanIterVisitor& v) const
47{
48 v.beginVisit(*this);
49
50 std::vector<PlanIter_t>::const_iterator lIter = theChildren.begin();
51 std::vector<PlanIter_t>::const_iterator lEnd = theChildren.end();
52 for ( ; lIter != lEnd; ++lIter ){
53 (*lIter)->accept(v);
54 }
55
56 v.endVisit(*this);
57}
58
59SeqValueIntersectIterator::~SeqValueIntersectIterator() {}
60
61SeqValueIntersectIteratorState::SeqValueIntersectIteratorState() {}
62
63SeqValueIntersectIteratorState::~SeqValueIntersectIteratorState() {}
64
65
66void SeqValueIntersectIteratorState::init(PlanState& planState) {
67 PlanIteratorState::init(planState);
68}
69
70void SeqValueIntersectIteratorState::reset(PlanState& planState) {
71 PlanIteratorState::reset(planState);
72}
73// </SeqValueIntersectIterator>
74
75
76// <SeqValueUnionIterator>
77SERIALIZABLE_CLASS_VERSIONS(SeqValueUnionIterator)
78
79void SeqValueUnionIterator::serialize(::zorba::serialization::Archiver& ar)
80{
81 serialize_baseclass(ar,
82 (NaryBaseIterator<SeqValueUnionIterator, SeqValueUnionIteratorState>*)this);
83}
84
85
86void SeqValueUnionIterator::accept(PlanIterVisitor& v) const
87{
88 v.beginVisit(*this);
89
90 std::vector<PlanIter_t>::const_iterator lIter = theChildren.begin();
91 std::vector<PlanIter_t>::const_iterator lEnd = theChildren.end();
92 for ( ; lIter != lEnd; ++lIter ){
93 (*lIter)->accept(v);
94 }
95
96 v.endVisit(*this);
97}
98
99SeqValueUnionIterator::~SeqValueUnionIterator() {}
100
101SeqValueUnionIteratorState::SeqValueUnionIteratorState() {}
102
103SeqValueUnionIteratorState::~SeqValueUnionIteratorState() {}
104
105
106void SeqValueUnionIteratorState::init(PlanState& planState) {
107 PlanIteratorState::init(planState);
108}
109
110void SeqValueUnionIteratorState::reset(PlanState& planState) {
111 PlanIteratorState::reset(planState);
112}
113// </SeqValueUnionIterator>
114
115
116// <SeqValueExceptIterator>
117SERIALIZABLE_CLASS_VERSIONS(SeqValueExceptIterator)
118
119void SeqValueExceptIterator::serialize(::zorba::serialization::Archiver& ar)
120{
121 serialize_baseclass(ar,
122 (NaryBaseIterator<SeqValueExceptIterator, SeqValueExceptIteratorState>*)this);
123}
124
125
126void SeqValueExceptIterator::accept(PlanIterVisitor& v) const
127{
128 v.beginVisit(*this);
129
130 std::vector<PlanIter_t>::const_iterator lIter = theChildren.begin();
131 std::vector<PlanIter_t>::const_iterator lEnd = theChildren.end();
132 for ( ; lIter != lEnd; ++lIter ){
133 (*lIter)->accept(v);
134 }
135
136 v.endVisit(*this);
137}
138
139SeqValueExceptIterator::~SeqValueExceptIterator() {}
140
141SeqValueExceptIteratorState::SeqValueExceptIteratorState() {}
142
143SeqValueExceptIteratorState::~SeqValueExceptIteratorState() {}
144
145
146void SeqValueExceptIteratorState::init(PlanState& planState) {
147 PlanIteratorState::init(planState);
148}
149
150void SeqValueExceptIteratorState::reset(PlanState& planState) {
151 PlanIteratorState::reset(planState);
152}
153// </SeqValueExceptIterator>
154
155
156
157}
158
159
0160
=== added file 'src/runtime/seq/pregenerated/seq.h'
--- src/runtime/seq/pregenerated/seq.h 1970-01-01 00:00:00 +0000
+++ src/runtime/seq/pregenerated/seq.h 2013-10-01 23:33:38 +0000
@@ -0,0 +1,173 @@
1/*
2 * Copyright 2006-2012 The FLWOR Foundation.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17// ******************************************
18// * *
19// * THIS IS A GENERATED FILE. DO NOT EDIT! *
20// * SEE .xml FILE WITH SAME NAME *
21// * *
22// ******************************************
23#ifndef ZORBA_RUNTIME_SEQ_SEQ_H
24#define ZORBA_RUNTIME_SEQ_SEQ_H
25
26
27#include "common/shared_types.h"
28
29
30
31#include "runtime/base/narybase.h"
32#include "runtime/seq/seq_util.h"
33
34
35namespace zorba {
36
37/**
38 *
39 * Author:
40 */
41class SeqValueIntersectIteratorState : public PlanIteratorState
42{
43public:
44 Item_set_type* set_[2]; //
45
46 SeqValueIntersectIteratorState();
47
48 ~SeqValueIntersectIteratorState();
49
50 void init(PlanState&);
51 void reset(PlanState&);
52};
53
54class SeqValueIntersectIterator : public NaryBaseIterator<SeqValueIntersectIterator, SeqValueIntersectIteratorState>
55{
56public:
57 SERIALIZABLE_CLASS(SeqValueIntersectIterator);
58
59 SERIALIZABLE_CLASS_CONSTRUCTOR2T(SeqValueIntersectIterator,
60 NaryBaseIterator<SeqValueIntersectIterator, SeqValueIntersectIteratorState>);
61
62 void serialize( ::zorba::serialization::Archiver& ar);
63
64 SeqValueIntersectIterator(
65 static_context* sctx,
66 const QueryLoc& loc,
67 std::vector<PlanIter_t>& children)
68 :
69 NaryBaseIterator<SeqValueIntersectIterator, SeqValueIntersectIteratorState>(sctx, loc, children)
70 {}
71
72 virtual ~SeqValueIntersectIterator();
73
74 void accept(PlanIterVisitor& v) const;
75
76 bool nextImpl(store::Item_t& result, PlanState& aPlanState) const;
77};
78
79
80/**
81 *
82 * Author:
83 */
84class SeqValueUnionIteratorState : public PlanIteratorState
85{
86public:
87 int child_; //
88 Item_set_type* set_; //
89
90 SeqValueUnionIteratorState();
91
92 ~SeqValueUnionIteratorState();
93
94 void init(PlanState&);
95 void reset(PlanState&);
96};
97
98class SeqValueUnionIterator : public NaryBaseIterator<SeqValueUnionIterator, SeqValueUnionIteratorState>
99{
100public:
101 SERIALIZABLE_CLASS(SeqValueUnionIterator);
102
103 SERIALIZABLE_CLASS_CONSTRUCTOR2T(SeqValueUnionIterator,
104 NaryBaseIterator<SeqValueUnionIterator, SeqValueUnionIteratorState>);
105
106 void serialize( ::zorba::serialization::Archiver& ar);
107
108 SeqValueUnionIterator(
109 static_context* sctx,
110 const QueryLoc& loc,
111 std::vector<PlanIter_t>& children)
112 :
113 NaryBaseIterator<SeqValueUnionIterator, SeqValueUnionIteratorState>(sctx, loc, children)
114 {}
115
116 virtual ~SeqValueUnionIterator();
117
118 void accept(PlanIterVisitor& v) const;
119
120 bool nextImpl(store::Item_t& result, PlanState& aPlanState) const;
121};
122
123
124/**
125 *
126 * Author:
127 */
128class SeqValueExceptIteratorState : public PlanIteratorState
129{
130public:
131 Item_set_type* set_; //
132
133 SeqValueExceptIteratorState();
134
135 ~SeqValueExceptIteratorState();
136
137 void init(PlanState&);
138 void reset(PlanState&);
139};
140
141class SeqValueExceptIterator : public NaryBaseIterator<SeqValueExceptIterator, SeqValueExceptIteratorState>
142{
143public:
144 SERIALIZABLE_CLASS(SeqValueExceptIterator);
145
146 SERIALIZABLE_CLASS_CONSTRUCTOR2T(SeqValueExceptIterator,
147 NaryBaseIterator<SeqValueExceptIterator, SeqValueExceptIteratorState>);
148
149 void serialize( ::zorba::serialization::Archiver& ar);
150
151 SeqValueExceptIterator(
152 static_context* sctx,
153 const QueryLoc& loc,
154 std::vector<PlanIter_t>& children)
155 :
156 NaryBaseIterator<SeqValueExceptIterator, SeqValueExceptIteratorState>(sctx, loc, children)
157 {}
158
159 virtual ~SeqValueExceptIterator();
160
161 void accept(PlanIterVisitor& v) const;
162
163 bool nextImpl(store::Item_t& result, PlanState& aPlanState) const;
164};
165
166
167}
168#endif
169/*
170 * Local variables:
171 * mode: c++
172 * End:
173 */
0174
=== added file 'src/runtime/seq/seq_impl.cpp'
--- src/runtime/seq/seq_impl.cpp 1970-01-01 00:00:00 +0000
+++ src/runtime/seq/seq_impl.cpp 2013-10-01 23:33:38 +0000
@@ -0,0 +1,145 @@
1/*
2 * Copyright 2006-2013 The FLWOR Foundation.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#include "stdafx.h"
18
19#include <zorba/config.h>
20#include <zorba/internal/cxx_util.h>
21
22#include "context/dynamic_context.h"
23#include "context/static_context.h"
24#include "runtime/seq/seq.h"
25#include "runtime/seq/seq_util.h"
26#include "types/typemanager.h"
27#include "util/stl_util.h"
28
29using namespace std;
30
31namespace zorba {
32
33///////////////////////////////////////////////////////////////////////////////
34
35inline Item_set_type* new_Item_set( TypeManager const *tm, long tz,
36 XQPCollator *coll, QueryLoc const &loc ) {
37 return new Item_set_type(
38 ztd::prime_rehash_policy::default_bucket_count,
39 Item_set_type::hasher(),
40 Item_value_equal( tm, tz, coll, loc )
41 );
42}
43
44static void delete_Item_set( Item_set_type *set ) {
45 MUTATE_EACH( Item_set_type, i, *set )
46 (*i)->removeReference();
47 delete set;
48}
49
50///////////////////////////////////////////////////////////////////////////////
51
52bool SeqValueIntersectIterator::nextImpl( store::Item_t &result,
53 PlanState &plan_state ) const {
54 XQPCollator *const coll = theSctx->get_default_collator( loc );
55 store::Item_t item;
56 TypeManager *const tm = getTypeManager();
57 long tz;
58
59 SeqValueIntersectIteratorState *state;
60 DEFAULT_STACK_INIT( SeqValueIntersectIteratorState, state, plan_state );
61
62 tz = plan_state.theLocalDynCtx->get_implicit_timezone();
63
64 state->set_[0] = new_Item_set( tm, tz, coll, loc );
65 state->set_[1] = new_Item_set( tm, tz, coll, loc );
66
67 while ( consumeNext( item, theChildren[0], plan_state ) )
68 if ( state->set_[0]->insert( item.getp() ).second )
69 item->addReference();
70
71 while ( consumeNext( item, theChildren[1], plan_state ) )
72 if ( ztd::contains( *state->set_[0], item.getp() ) &&
73 state->set_[1]->insert( item.getp() ).second ) {
74 item->addReference();
75 result = item;
76 STACK_PUSH( true, state );
77 }
78
79 delete_Item_set( state->set_[0] );
80 delete_Item_set( state->set_[1] );
81 STACK_END( state );
82}
83
84///////////////////////////////////////////////////////////////////////////////
85
86bool SeqValueUnionIterator::nextImpl( store::Item_t &result,
87 PlanState &plan_state ) const {
88 XQPCollator *const coll = theSctx->get_default_collator( loc );
89 store::Item_t item;
90 TypeManager *const tm = getTypeManager();
91 long tz;
92
93 SeqValueUnionIteratorState *state;
94 DEFAULT_STACK_INIT( SeqValueUnionIteratorState, state, plan_state );
95
96 tz = plan_state.theLocalDynCtx->get_implicit_timezone();
97 state->set_ = new_Item_set( tm, tz, coll, loc );
98
99 for ( state->child_ = 0; state->child_ < 2; ++state->child_ )
100 while ( consumeNext( item, theChildren[ state->child_ ], plan_state ) )
101 if ( state->set_->insert( item.getp() ).second ) {
102 item->addReference();
103 result = item;
104 STACK_PUSH( true, state );
105 }
106
107 delete_Item_set( state->set_ );
108 STACK_END( state );
109}
110
111///////////////////////////////////////////////////////////////////////////////
112
113bool SeqValueExceptIterator::nextImpl( store::Item_t &result,
114 PlanState &plan_state ) const {
115 XQPCollator *const coll = theSctx->get_default_collator( loc );
116 store::Item_t item;
117 TypeManager *const tm = getTypeManager();
118 long tz;
119
120 SeqValueExceptIteratorState *state;
121 DEFAULT_STACK_INIT( SeqValueExceptIteratorState, state, plan_state );
122
123 tz = plan_state.theLocalDynCtx->get_implicit_timezone();
124 state->set_ = new_Item_set( tm, tz, coll, loc );
125
126 while ( consumeNext( item, theChildren[1], plan_state ) )
127 if ( state->set_->insert( item.getp() ).second )
128 item->addReference();
129
130 while ( consumeNext( item, theChildren[0], plan_state ) )
131 if ( state->set_->insert( item.getp() ).second ) {
132 item->addReference();
133 result = item;
134 STACK_PUSH( true, state );
135 }
136
137 delete_Item_set( state->set_ );
138 STACK_END( state );
139}
140
141///////////////////////////////////////////////////////////////////////////////
142
143} // namespace zorba
144
145/* vim:set et sw=2 ts=2: */
0146
=== added file 'src/runtime/seq/seq_util.h'
--- src/runtime/seq/seq_util.h 1970-01-01 00:00:00 +0000
+++ src/runtime/seq/seq_util.h 2013-10-01 23:33:38 +0000
@@ -0,0 +1,64 @@
1/*
2 * Copyright 2006-2013 The FLWOR Foundation.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#ifndef ZORBA_SEQ_UTIL_H
18#define ZORBA_SEQ_UTIL_H
19
20#include <functional>
21
22#include "runtime/booleans/BooleanImpl.h"
23#include "util/hash/hash.h"
24#include "util/unordered_set.h"
25#include "zorbautils/specializations.h"
26
27namespace zorba {
28
29class TypeManager;
30class XQPCollator;
31
32///////////////////////////////////////////////////////////////////////////////
33
34struct Item_value_equal : std::binary_function<store::Item*,store::Item*,bool> {
35 Item_value_equal( TypeManager const *tm, long tz, XQPCollator *coll,
36 QueryLoc const &loc ) :
37 tm_( tm ),
38 tz_( tz ),
39 coll_( coll ),
40 loc_( loc )
41 {
42 }
43
44 bool operator()( store::Item *i, store::Item *j ) const {
45 store::Item_t it( i ), jt( j );
46 return CompareIterator::valueEqual( loc_, it, jt, tm_, tz_, coll_ );
47 }
48
49private:
50 TypeManager const *const tm_;
51 long const tz_;
52 XQPCollator *const coll_;
53 QueryLoc const loc_;
54};
55
56typedef std::unordered_set<store::Item*,ztd::hash<store::Item*>,Item_value_equal
57 > Item_set_type;
58
59///////////////////////////////////////////////////////////////////////////////
60
61} // namespace zorba
62
63#endif /* ZORBA_SEQ_UTIL_H */
64/* vim:set et sw=2 ts=2: */
065
=== modified file 'src/runtime/spec/mappings.xml'
--- src/runtime/spec/mappings.xml 2013-10-01 03:34:33 +0000
+++ src/runtime/spec/mappings.xml 2013-10-01 23:33:38 +0000
@@ -23,10 +23,10 @@
23 <zorba:namespace uri="http://zorba.io/modules/reference"23 <zorba:namespace uri="http://zorba.io/modules/reference"
24 define="ZORBA_REF_FN_NS"24 define="ZORBA_REF_FN_NS"
25 prefix="fn-reference"/>25 prefix="fn-reference"/>
26 26
27 <zorba:namespace uri="http://zorba.io/modules/node-position"27 <zorba:namespace uri="http://zorba.io/modules/node-position"
28 define="ZORBA_NODEPOS_FN_NS"28 define="ZORBA_NODEPOS_FN_NS"
29 prefix="fn-zorba-pos"/> 29 prefix="fn-zorba-pos"/>
3030
31 <zorba:namespace uri="http://zorba.io/modules/schema"31 <zorba:namespace uri="http://zorba.io/modules/schema"
32 define="ZORBA_SCHEMA_FN_NS"32 define="ZORBA_SCHEMA_FN_NS"
@@ -86,12 +86,12 @@
86 define="ZORBA_DATETIME_FN_NS"86 define="ZORBA_DATETIME_FN_NS"
87 prefix="fn-zorba-dateTime"/>87 prefix="fn-zorba-dateTime"/>
8888
89 <zorba:namespace uri="http://www.zorba-xquery.com/modules/xqdoc" 89 <zorba:namespace uri="http://www.zorba-xquery.com/modules/xqdoc"
90 define="ZORBA_XQDOC_FN_NS" 90 define="ZORBA_XQDOC_FN_NS"
91 prefix="fn-zorba-xqdoc"/>91 prefix="fn-zorba-xqdoc"/>
9292
93 <zorba:namespace uri="http://zorba.io/modules/random" 93 <zorba:namespace uri="http://zorba.io/modules/random"
94 define="ZORBA_RANDOM_FN_NS" 94 define="ZORBA_RANDOM_FN_NS"
95 prefix="fn-zorba-random"/>95 prefix="fn-zorba-random"/>
9696
97 <zorba:namespace uri="http://zorba.io/modules/sctx"97 <zorba:namespace uri="http://zorba.io/modules/sctx"
@@ -99,7 +99,7 @@
99 prefix="fn-zorba-sctx"/>99 prefix="fn-zorba-sctx"/>
100100
101 <zorba:namespace uri="http://www.zorba-xquery.com/modules/reflection"101 <zorba:namespace uri="http://www.zorba-xquery.com/modules/reflection"
102 define="ZORBA_REFLECTION_FN_NS" 102 define="ZORBA_REFLECTION_FN_NS"
103 prefix="fn-zorba-reflection"/>103 prefix="fn-zorba-reflection"/>
104104
105 <zorba:namespace uri="http://zorba.io/util-functions"105 <zorba:namespace uri="http://zorba.io/util-functions"
@@ -107,35 +107,39 @@
107 prefix="fn-zorba-util"/>107 prefix="fn-zorba-util"/>
108108
109 <zorba:namespace uri="http://zorba.io/modules/string"109 <zorba:namespace uri="http://zorba.io/modules/string"
110 define="ZORBA_STRING_FN_NS" 110 define="ZORBA_STRING_FN_NS"
111 prefix="fn-zorba-string"/>111 prefix="fn-zorba-string"/>
112112
113 <zorba:namespace uri="http://www.zorba-xquery.com/modules/uri"113 <zorba:namespace uri="http://www.zorba-xquery.com/modules/uri"
114 define="ZORBA_URI_FN_NS" 114 define="ZORBA_URI_FN_NS"
115 prefix="fn-zorba-uri"/>115 prefix="fn-zorba-uri"/>
116116
117 <zorba:namespace uri="http://zorba.io/modules/json-csv"117 <zorba:namespace uri="http://zorba.io/modules/json-csv"
118 define="ZORBA_JSON_CSV_FN_NS" 118 define="ZORBA_JSON_CSV_FN_NS"
119 prefix="fn-zorba-csv"/>119 prefix="fn-zorba-csv"/>
120120
121 <zorba:namespace uri="http://zorba.io/modules/json-xml"121 <zorba:namespace uri="http://zorba.io/modules/json-xml"
122 define="ZORBA_JSON_XML_FN_NS" 122 define="ZORBA_JSON_XML_FN_NS"
123 prefix="fn-zorba-json"/>123 prefix="fn-zorba-json"/>
124124
125 <zorba:namespace uri="http://www.zorba-xquery.com/modules/fetch"125 <zorba:namespace uri="http://www.zorba-xquery.com/modules/fetch"
126 define="ZORBA_FETCH_FN_NS" 126 define="ZORBA_FETCH_FN_NS"
127 prefix="fn-zorba-fetch"/>127 prefix="fn-zorba-fetch"/>
128128
129 <zorba:namespace uri="http://zorba.io/modules/node"129 <zorba:namespace uri="http://zorba.io/modules/node"
130 define="ZORBA_NODE_FN_NS" 130 define="ZORBA_NODE_FN_NS"
131 prefix="fn-zorba-node"/>131 prefix="fn-zorba-node"/>
132132
133 <zorba:namespace uri="http://zorba.io/modules/item"133 <zorba:namespace uri="http://zorba.io/modules/item"
134 define="ZORBA_ITEM_FN_NS" 134 define="ZORBA_ITEM_FN_NS"
135 prefix="fn-zorba-item"/>135 prefix="fn-zorba-item"/>
136 136
137 <zorba:namespace uri="http://zorba.io/modules/sequence"
138 define="ZORBA_SEQ_FN_NS"
139 prefix="fn-zorba-seq"/>
140
137 <zorba:namespace uri="http://zorba.io/modules/xml"141 <zorba:namespace uri="http://zorba.io/modules/xml"
138 define="ZORBA_XML_FN_NS" 142 define="ZORBA_XML_FN_NS"
139 prefix="fn-zorba-xml"/>143 prefix="fn-zorba-xml"/>
140144
141 <zorba:namespace uri="http://zorba.io/internal/xquery-ops"145 <zorba:namespace uri="http://zorba.io/internal/xquery-ops"
@@ -214,7 +218,7 @@
214218
215 <zorba:type zorbaType="ANY_URI">xs:anyURI</zorba:type>219 <zorba:type zorbaType="ANY_URI">xs:anyURI</zorba:type>
216 <zorba:type zorbaType="QNAME">xs:QName</zorba:type>220 <zorba:type zorbaType="QNAME">xs:QName</zorba:type>
217 <zorba:type zorbaType="NOTATION">xs:NOTATION</zorba:type> 221 <zorba:type zorbaType="NOTATION">xs:NOTATION</zorba:type>
218 <zorba:type zorbaType="ANY_FUNCTION">function()</zorba:type>222 <zorba:type zorbaType="ANY_FUNCTION">function()</zorba:type>
219 <zorba:type zorbaType="STRUCTURED_ITEM">structured-item()</zorba:type>223 <zorba:type zorbaType="STRUCTURED_ITEM">structured-item()</zorba:type>
220 <zorba:type zorbaType="JSON_ITEM">json-item()</zorba:type>224 <zorba:type zorbaType="JSON_ITEM">json-item()</zorba:type>
@@ -235,3 +239,4 @@
235 -->239 -->
236240
237</zorba:mappings>241</zorba:mappings>
242<!-- vim:set et sw=2 ts=2: -->
238243
=== added directory 'src/runtime/spec/seq'
=== added file 'src/runtime/spec/seq/seq.xml'
--- src/runtime/spec/seq/seq.xml 1970-01-01 00:00:00 +0000
+++ src/runtime/spec/seq/seq.xml 2013-10-01 23:33:38 +0000
@@ -0,0 +1,65 @@
1<?xml version="1.0" encoding="UTF-8"?>
2
3<zorba:iterators
4 xmlns:zorba="http://www.zorba-xquery.com"
5 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
6 xsi:schemaLocation="http://www.zorba-xquery.com ../runtime.xsd">
7
8<zorba:header>
9 <zorba:include form="Quoted">runtime/seq/seq_util.h</zorba:include>
10</zorba:header>
11
12<zorba:source>
13 <zorba:include form="Quoted">store/api/iterator.h</zorba:include>
14</zorba:source>
15
16<!--========================================================================-->
17
18<zorba:iterator name="SeqValueIntersectIterator" arity="nary">
19 <zorba:function>
20 <zorba:signature localname="value-intersect" prefix="fn-zorba-seq">
21 <zorba:param>xs:anyAtomicType*</zorba:param>
22 <zorba:param>xs:anyAtomicType*</zorba:param>
23 <zorba:output>xs:anyAtomicType*</zorba:output>
24 </zorba:signature>
25 </zorba:function>
26 <zorba:state>
27 <zorba:member type="Item_set_type*" name="set_[2]"/>
28 </zorba:state>
29</zorba:iterator>
30
31<!--========================================================================-->
32
33<zorba:iterator name="SeqValueUnionIterator" arity="nary">
34 <zorba:function>
35 <zorba:signature localname="value-union" prefix="fn-zorba-seq">
36 <zorba:param>xs:anyAtomicType*</zorba:param>
37 <zorba:param>xs:anyAtomicType*</zorba:param>
38 <zorba:output>xs:anyAtomicType*</zorba:output>
39 </zorba:signature>
40 </zorba:function>
41 <zorba:state>
42 <zorba:member type="int" name="child_"/>
43 <zorba:member type="Item_set_type*" name="set_"/>
44 </zorba:state>
45</zorba:iterator>
46
47<!--========================================================================-->
48
49<zorba:iterator name="SeqValueExceptIterator" arity="nary">
50 <zorba:function>
51 <zorba:signature localname="value-except" prefix="fn-zorba-seq">
52 <zorba:param>xs:anyAtomicType*</zorba:param>
53 <zorba:param>xs:anyAtomicType*</zorba:param>
54 <zorba:output>xs:anyAtomicType*</zorba:output>
55 </zorba:signature>
56 </zorba:function>
57 <zorba:state>
58 <zorba:member type="Item_set_type*" name="set_"/>
59 </zorba:state>
60</zorba:iterator>
61
62<!--========================================================================-->
63
64</zorba:iterators>
65<!-- vim:set et sw=2 ts=2: -->
066
=== modified file 'src/runtime/visitors/pregenerated/planiter_visitor.h'
--- src/runtime/visitors/pregenerated/planiter_visitor.h 2013-10-01 03:25:43 +0000
+++ src/runtime/visitors/pregenerated/planiter_visitor.h 2013-10-01 23:33:38 +0000
@@ -587,6 +587,12 @@
587587
588 class SctxXPath10CompatModeIterator;588 class SctxXPath10CompatModeIterator;
589589
590 class SeqValueIntersectIterator;
591
592 class SeqValueUnionIterator;
593
594 class SeqValueExceptIterator;
595
590 class FnConcatIterator;596 class FnConcatIterator;
591597
592 class FnIndexOfIterator;598 class FnIndexOfIterator;
@@ -1592,6 +1598,15 @@
1592 virtual void beginVisit ( const SctxXPath10CompatModeIterator& ) = 0;1598 virtual void beginVisit ( const SctxXPath10CompatModeIterator& ) = 0;
1593 virtual void endVisit ( const SctxXPath10CompatModeIterator& ) = 0;1599 virtual void endVisit ( const SctxXPath10CompatModeIterator& ) = 0;
15941600
1601 virtual void beginVisit ( const SeqValueIntersectIterator& ) = 0;
1602 virtual void endVisit ( const SeqValueIntersectIterator& ) = 0;
1603
1604 virtual void beginVisit ( const SeqValueUnionIterator& ) = 0;
1605 virtual void endVisit ( const SeqValueUnionIterator& ) = 0;
1606
1607 virtual void beginVisit ( const SeqValueExceptIterator& ) = 0;
1608 virtual void endVisit ( const SeqValueExceptIterator& ) = 0;
1609
1595 virtual void beginVisit ( const FnConcatIterator& ) = 0;1610 virtual void beginVisit ( const FnConcatIterator& ) = 0;
1596 virtual void endVisit ( const FnConcatIterator& ) = 0;1611 virtual void endVisit ( const FnConcatIterator& ) = 0;
15971612
15981613
=== modified file 'src/runtime/visitors/pregenerated/printer_visitor.cpp'
--- src/runtime/visitors/pregenerated/printer_visitor.cpp 2013-10-01 03:25:43 +0000
+++ src/runtime/visitors/pregenerated/printer_visitor.cpp 2013-10-01 23:33:38 +0000
@@ -67,6 +67,7 @@
67#include "runtime/reference/reference.h"67#include "runtime/reference/reference.h"
68#include "runtime/schema/schema.h"68#include "runtime/schema/schema.h"
69#include "runtime/sctx/sctx.h"69#include "runtime/sctx/sctx.h"
70#include "runtime/seq/seq.h"
70#include "runtime/sequences/sequences.h"71#include "runtime/sequences/sequences.h"
71#include "runtime/store/documents.h"72#include "runtime/store/documents.h"
72#include "runtime/store/maps.h"73#include "runtime/store/maps.h"
@@ -3776,6 +3777,48 @@
3776// </SctxXPath10CompatModeIterator>3777// </SctxXPath10CompatModeIterator>
37773778
37783779
3780// <SeqValueIntersectIterator>
3781void PrinterVisitor::beginVisit ( const SeqValueIntersectIterator& a) {
3782 thePrinter.startBeginVisit("SeqValueIntersectIterator", ++theId);
3783 printCommons( &a, theId );
3784 thePrinter.endBeginVisit( theId );
3785}
3786
3787void PrinterVisitor::endVisit ( const SeqValueIntersectIterator& ) {
3788 thePrinter.startEndVisit();
3789 thePrinter.endEndVisit();
3790}
3791// </SeqValueIntersectIterator>
3792
3793
3794// <SeqValueUnionIterator>
3795void PrinterVisitor::beginVisit ( const SeqValueUnionIterator& a) {
3796 thePrinter.startBeginVisit("SeqValueUnionIterator", ++theId);
3797 printCommons( &a, theId );
3798 thePrinter.endBeginVisit( theId );
3799}
3800
3801void PrinterVisitor::endVisit ( const SeqValueUnionIterator& ) {
3802 thePrinter.startEndVisit();
3803 thePrinter.endEndVisit();
3804}
3805// </SeqValueUnionIterator>
3806
3807
3808// <SeqValueExceptIterator>
3809void PrinterVisitor::beginVisit ( const SeqValueExceptIterator& a) {
3810 thePrinter.startBeginVisit("SeqValueExceptIterator", ++theId);
3811 printCommons( &a, theId );
3812 thePrinter.endBeginVisit( theId );
3813}
3814
3815void PrinterVisitor::endVisit ( const SeqValueExceptIterator& ) {
3816 thePrinter.startEndVisit();
3817 thePrinter.endEndVisit();
3818}
3819// </SeqValueExceptIterator>
3820
3821
3779// <FnConcatIterator>3822// <FnConcatIterator>
3780void PrinterVisitor::beginVisit ( const FnConcatIterator& a) {3823void PrinterVisitor::beginVisit ( const FnConcatIterator& a) {
3781 thePrinter.startBeginVisit("FnConcatIterator", ++theId);3824 thePrinter.startBeginVisit("FnConcatIterator", ++theId);
37823825
=== modified file 'src/runtime/visitors/pregenerated/printer_visitor.h'
--- src/runtime/visitors/pregenerated/printer_visitor.h 2013-10-01 03:25:43 +0000
+++ src/runtime/visitors/pregenerated/printer_visitor.h 2013-10-01 23:33:38 +0000
@@ -891,6 +891,15 @@
891 void beginVisit( const SctxXPath10CompatModeIterator& );891 void beginVisit( const SctxXPath10CompatModeIterator& );
892 void endVisit ( const SctxXPath10CompatModeIterator& );892 void endVisit ( const SctxXPath10CompatModeIterator& );
893893
894 void beginVisit( const SeqValueIntersectIterator& );
895 void endVisit ( const SeqValueIntersectIterator& );
896
897 void beginVisit( const SeqValueUnionIterator& );
898 void endVisit ( const SeqValueUnionIterator& );
899
900 void beginVisit( const SeqValueExceptIterator& );
901 void endVisit ( const SeqValueExceptIterator& );
902
894 void beginVisit( const FnConcatIterator& );903 void beginVisit( const FnConcatIterator& );
895 void endVisit ( const FnConcatIterator& );904 void endVisit ( const FnConcatIterator& );
896905
897906
=== modified file 'src/util/stl_util.h'
--- src/util/stl_util.h 2013-08-23 11:15:04 +0000
+++ src/util/stl_util.h 2013-10-01 23:33:38 +0000
@@ -102,7 +102,7 @@
102};102};
103103
104/**104/**
105 * Specialization of std::equal_to for C strings.105 * Specialization of ztd::equal_to for C strings.
106 */106 */
107template<>107template<>
108struct equal_to<char const*> :108struct equal_to<char const*> :
109109
=== added file 'src/zorbautils/specializations.h'
--- src/zorbautils/specializations.h 1970-01-01 00:00:00 +0000
+++ src/zorbautils/specializations.h 2013-10-01 23:33:38 +0000
@@ -0,0 +1,46 @@
1/*
2 * Copyright 2006-2013 The FLWOR Foundation.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#ifndef ZORBA_SPECIALIZATIONS_H
18#define ZORBA_SPECIALIZATIONS_H
19
20#include "store/api/item.h"
21#include "util/hash/hash.h"
22
23namespace zorba {
24namespace ztd {
25
26///////////////////////////////////////////////////////////////////////////////
27
28/** Specialization for <code>store::Item*</code>. */
29template<> inline
30size_t hash<store::Item*>::operator()( store::Item *item ) const {
31 return item->hash();
32}
33
34/** Specialization for <code>store::Item const*</code>. */
35template<> inline
36size_t hash<store::Item const*>::operator()( store::Item const *item ) const {
37 return item->hash();
38}
39
40///////////////////////////////////////////////////////////////////////////////
41
42} // namespace ztd
43} // namespace zorba
44
45#endif /* ZORBA_SPECIALIZATIONS_H */
46/* vim:set et sw=2 ts=2: */
047
=== added directory 'test/rbkt/ExpQueryResults/zorba/seq'
=== added file 'test/rbkt/ExpQueryResults/zorba/seq/seq-value-except-01.xml.res'
--- test/rbkt/ExpQueryResults/zorba/seq/seq-value-except-01.xml.res 1970-01-01 00:00:00 +0000
+++ test/rbkt/ExpQueryResults/zorba/seq/seq-value-except-01.xml.res 2013-10-01 23:33:38 +0000
@@ -0,0 +1,1 @@
11
02
=== added file 'test/rbkt/ExpQueryResults/zorba/seq/seq-value-intersect-01.xml.res'
--- test/rbkt/ExpQueryResults/zorba/seq/seq-value-intersect-01.xml.res 1970-01-01 00:00:00 +0000
+++ test/rbkt/ExpQueryResults/zorba/seq/seq-value-intersect-01.xml.res 2013-10-01 23:33:38 +0000
@@ -0,0 +1,1 @@
12 3
02
=== added file 'test/rbkt/ExpQueryResults/zorba/seq/seq-value-union-01.xml.res'
--- test/rbkt/ExpQueryResults/zorba/seq/seq-value-union-01.xml.res 1970-01-01 00:00:00 +0000
+++ test/rbkt/ExpQueryResults/zorba/seq/seq-value-union-01.xml.res 2013-10-01 23:33:38 +0000
@@ -0,0 +1,1 @@
11 2 3 4
02
=== added directory 'test/rbkt/Queries/zorba/seq'
=== added file 'test/rbkt/Queries/zorba/seq/seq-value-except-01.xq'
--- test/rbkt/Queries/zorba/seq/seq-value-except-01.xq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/seq/seq-value-except-01.xq 2013-10-01 23:33:38 +0000
@@ -0,0 +1,7 @@
1import module namespace seq = "http://zorba.io/modules/sequence";
2
3let $s1 := (1, 1, 2, 3)
4let $s2 := (2, 3, 3, 4, 4)
5return seq:value-except( $s1, $s2 )
6
7(: vim:set et sw=2 ts=2: :)
08
=== added file 'test/rbkt/Queries/zorba/seq/seq-value-intersect-01.xq'
--- test/rbkt/Queries/zorba/seq/seq-value-intersect-01.xq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/seq/seq-value-intersect-01.xq 2013-10-01 23:33:38 +0000
@@ -0,0 +1,7 @@
1import module namespace seq = "http://zorba.io/modules/sequence";
2
3let $s1 := (1, 1, 2, 3)
4let $s2 := (2, 3, 3, 4, 4)
5return seq:value-intersect( $s1, $s2 )
6
7(: vim:set et sw=2 ts=2: :)
08
=== added file 'test/rbkt/Queries/zorba/seq/seq-value-union-01.xq'
--- test/rbkt/Queries/zorba/seq/seq-value-union-01.xq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/seq/seq-value-union-01.xq 2013-10-01 23:33:38 +0000
@@ -0,0 +1,7 @@
1import module namespace seq = "http://zorba.io/modules/sequence";
2
3let $s1 := (1, 1, 2, 3)
4let $s2 := (2, 3, 3, 4, 4)
5return seq:value-union( $s1, $s2 )
6
7(: vim:set et sw=2 ts=2: :)

Subscribers

People subscribed via source and target branches