Merge lp:~zorba-coders/zorba/bug-1058398 into lp:zorba
- bug-1058398
- Merge into trunk
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 | ||||
Related bugs: |
|
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 : | # |
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.
- 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:/
Progress dashboard at http://
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
1 | === modified file 'ChangeLog' | |||
2 | --- ChangeLog 2013-10-01 00:52:37 +0000 | |||
3 | +++ ChangeLog 2013-10-01 23:33:38 +0000 | |||
4 | @@ -54,6 +54,7 @@ | |||
5 | 54 | * Fixed bug #1190261 (relative paths bug in file module) | 54 | * Fixed bug #1190261 (relative paths bug in file module) |
6 | 55 | * Fixed bug #1189798 (Update core module "errors") | 55 | * Fixed bug #1189798 (Update core module "errors") |
7 | 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) |
8 | 57 | * Fixed bug #1058398 (set-based sequence operations) | ||
9 | 57 | * Fixed bug #1180220 (Consolidate redundant path/file public APIs) | 58 | * Fixed bug #1180220 (Consolidate redundant path/file public APIs) |
10 | 58 | * Fixed bug #1158052 (createBase64Binary() API too subtle) | 59 | * Fixed bug #1158052 (createBase64Binary() API too subtle) |
11 | 59 | * Fixed bug #1103115 (Timezone units as hours are wrong) | 60 | * Fixed bug #1103115 (Timezone units as hours are wrong) |
12 | 60 | 61 | ||
13 | === modified file 'modules/CMakeLists.txt' | |||
14 | --- modules/CMakeLists.txt 2013-10-01 03:34:33 +0000 | |||
15 | +++ modules/CMakeLists.txt 2013-10-01 23:33:38 +0000 | |||
16 | @@ -22,6 +22,7 @@ | |||
17 | 22 | ADD_SUBDIRECTORY(org) | 22 | ADD_SUBDIRECTORY(org) |
18 | 23 | ADD_SUBDIRECTORY(schema) | 23 | ADD_SUBDIRECTORY(schema) |
19 | 24 | ADD_SUBDIRECTORY(sctx) | 24 | ADD_SUBDIRECTORY(sctx) |
20 | 25 | ADD_SUBDIRECTORY(sequence) | ||
21 | 25 | ADD_SUBDIRECTORY(store) | 26 | ADD_SUBDIRECTORY(store) |
22 | 26 | ADD_SUBDIRECTORY(structured-items) | 27 | ADD_SUBDIRECTORY(structured-items) |
23 | 27 | ADD_SUBDIRECTORY(w3c) | 28 | ADD_SUBDIRECTORY(w3c) |
24 | 28 | 29 | ||
25 | === added directory 'modules/sequence' | |||
26 | === added file 'modules/sequence/CMakeLists.txt' | |||
27 | --- modules/sequence/CMakeLists.txt 1970-01-01 00:00:00 +0000 | |||
28 | +++ modules/sequence/CMakeLists.txt 2013-10-01 23:33:38 +0000 | |||
29 | @@ -0,0 +1,18 @@ | |||
30 | 1 | # Copyright 2013 The FLWOR Foundation. | ||
31 | 2 | # | ||
32 | 3 | # Licensed under the Apache License, Version 2.0 (the "License"); | ||
33 | 4 | # you may not use this file except in compliance with the License. | ||
34 | 5 | # You may obtain a copy of the License at | ||
35 | 6 | # | ||
36 | 7 | # http://www.apache.org/licenses/LICENSE-2.0 | ||
37 | 8 | # | ||
38 | 9 | # Unless required by applicable law or agreed to in writing, software | ||
39 | 10 | # distributed under the License is distributed on an "AS IS" BASIS, | ||
40 | 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
41 | 12 | # See the License for the specific language governing permissions and | ||
42 | 13 | # limitations under the License. | ||
43 | 14 | |||
44 | 15 | DECLARE_ZORBA_MODULE(FILE sequence.xq VERSION 1.0 | ||
45 | 16 | URI "http://zorba.io/modules/sequence") | ||
46 | 17 | |||
47 | 18 | # vim:set et sw=2 ts=2: | ||
48 | 0 | 19 | ||
49 | === added file 'modules/sequence/sequence.xq' | |||
50 | --- modules/sequence/sequence.xq 1970-01-01 00:00:00 +0000 | |||
51 | +++ modules/sequence/sequence.xq 2013-10-01 23:33:38 +0000 | |||
52 | @@ -0,0 +1,75 @@ | |||
53 | 1 | xquery version "3.0"; | ||
54 | 2 | |||
55 | 3 | (: | ||
56 | 4 | : Copyright 2006-2013 The FLWOR Foundation. | ||
57 | 5 | : | ||
58 | 6 | : Licensed under the Apache License, Version 2.0 (the "License"); | ||
59 | 7 | : you may not use this file except in compliance with the License. | ||
60 | 8 | : You may obtain a copy of the License at | ||
61 | 9 | : | ||
62 | 10 | : http://www.apache.org/licenses/LICENSE-2.0 | ||
63 | 11 | : | ||
64 | 12 | : Unless required by applicable law or agreed to in writing, software | ||
65 | 13 | : distributed under the License is distributed on an "AS IS" BASIS, | ||
66 | 14 | : WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
67 | 15 | : See the License for the specific language governing permissions and | ||
68 | 16 | : limitations under the License. | ||
69 | 17 | :) | ||
70 | 18 | |||
71 | 19 | (:===========================================================================:) | ||
72 | 20 | |||
73 | 21 | (:~ | ||
74 | 22 | : This module provides an XQuery API to perform set operations on sequences. | ||
75 | 23 | : | ||
76 | 24 | : @author Paul J. Lucas | ||
77 | 25 | : @project Zorba/Sequence | ||
78 | 26 | :) | ||
79 | 27 | |||
80 | 28 | module namespace seq = "http://zorba.io/modules/sequence"; | ||
81 | 29 | |||
82 | 30 | declare namespace ver = "http://zorba.io/options/versioning"; | ||
83 | 31 | declare option ver:module-version "1.0"; | ||
84 | 32 | |||
85 | 33 | (:===========================================================================:) | ||
86 | 34 | |||
87 | 35 | (:~ | ||
88 | 36 | : Performs a set intersection of two sequences of atomic items based on their | ||
89 | 37 | : values. | ||
90 | 38 | : | ||
91 | 39 | : @param $seq1 The first sequence. | ||
92 | 40 | : @param $seq2 The second sequence. | ||
93 | 41 | : @return a sequence containing only items from <code>$seq1</code> that are | ||
94 | 42 | : also in <code>$seq2</code>. | ||
95 | 43 | :) | ||
96 | 44 | declare function seq:value-intersect( $seq1 as xs:anyAtomicType*, | ||
97 | 45 | $seq2 as xs:anyAtomicType* ) | ||
98 | 46 | as xs:anyAtomicType* external; | ||
99 | 47 | |||
100 | 48 | (:~ | ||
101 | 49 | : Performs a set union of two sequences of atomic items based on their values. | ||
102 | 50 | : | ||
103 | 51 | : @param $seq1 The first sequence. | ||
104 | 52 | : @param $seq2 The second sequence. | ||
105 | 53 | : @return a sequence containing all items from <code>$seq1</code> | ||
106 | 54 | : and <code>seq2$</code> but without duplicates. | ||
107 | 55 | :) | ||
108 | 56 | declare function seq:value-union( $seq1 as xs:anyAtomicType*, | ||
109 | 57 | $seq2 as xs:anyAtomicType* ) | ||
110 | 58 | as xs:anyAtomicType* external; | ||
111 | 59 | |||
112 | 60 | (:~ | ||
113 | 61 | : Filters the first sequence of atomic items such that they are not in the | ||
114 | 62 | : second sequence based on their values. | ||
115 | 63 | : | ||
116 | 64 | : @param $seq1 The first sequence. | ||
117 | 65 | : @param $seq2 The second sequence. | ||
118 | 66 | : @return a sequence only containing items from <code>$seq1</code> | ||
119 | 67 | : that are not in <code>$seq2</code>. | ||
120 | 68 | :) | ||
121 | 69 | declare function seq:value-except( $seq1 as xs:anyAtomicType*, | ||
122 | 70 | $seq2 as xs:anyAtomicType* ) | ||
123 | 71 | as xs:anyAtomicType* external; | ||
124 | 72 | |||
125 | 73 | (:===========================================================================:) | ||
126 | 74 | |||
127 | 75 | (: vim:set et sw=2 ts=2: :) | ||
128 | 0 | 76 | ||
129 | === modified file 'src/context/static_context.cpp' | |||
130 | --- src/context/static_context.cpp 2013-10-01 03:34:33 +0000 | |||
131 | +++ src/context/static_context.cpp 2013-10-01 23:33:38 +0000 | |||
132 | @@ -450,6 +450,10 @@ | |||
133 | 450 | "http://www.zorba-xquery.com/zorba/scripting"; | 450 | "http://www.zorba-xquery.com/zorba/scripting"; |
134 | 451 | 451 | ||
135 | 452 | const char* | 452 | const char* |
136 | 453 | static_context::ZORBA_SEQ_FN_NS = | ||
137 | 454 | "http://zorba.io/modules/sequence"; | ||
138 | 455 | |||
139 | 456 | const char* | ||
140 | 453 | static_context::ZORBA_STRING_FN_NS = | 457 | static_context::ZORBA_STRING_FN_NS = |
141 | 454 | "http://zorba.io/modules/string"; | 458 | "http://zorba.io/modules/string"; |
142 | 455 | 459 | ||
143 | @@ -563,6 +567,7 @@ | |||
144 | 563 | ns == ZORBA_FETCH_FN_NS || | 567 | ns == ZORBA_FETCH_FN_NS || |
145 | 564 | ns == ZORBA_NODE_FN_NS || | 568 | ns == ZORBA_NODE_FN_NS || |
146 | 565 | ns == ZORBA_ITEM_FN_NS || | 569 | ns == ZORBA_ITEM_FN_NS || |
147 | 570 | ns == ZORBA_SEQ_FN_NS || | ||
148 | 566 | ns == ZORBA_UTIL_FN_NS || | 571 | ns == ZORBA_UTIL_FN_NS || |
149 | 567 | #ifndef ZORBA_NO_FULL_TEXT | 572 | #ifndef ZORBA_NO_FULL_TEXT |
150 | 568 | ns == ZORBA_FULL_TEXT_FN_NS || | 573 | ns == ZORBA_FULL_TEXT_FN_NS || |
151 | 569 | 574 | ||
152 | === modified file 'src/context/static_context.h' | |||
153 | --- src/context/static_context.h 2013-10-01 00:52:37 +0000 | |||
154 | +++ src/context/static_context.h 2013-10-01 23:33:38 +0000 | |||
155 | @@ -539,6 +539,7 @@ | |||
156 | 539 | static const char* JSONIQ_FN_NS; | 539 | static const char* JSONIQ_FN_NS; |
157 | 540 | 540 | ||
158 | 541 | static const char* ZORBA_SCHEMA_FN_NS; | 541 | static const char* ZORBA_SCHEMA_FN_NS; |
159 | 542 | static const char* ZORBA_SEQ_FN_NS; | ||
160 | 542 | static const char* ZORBA_XQDOC_FN_NS; | 543 | static const char* ZORBA_XQDOC_FN_NS; |
161 | 543 | static const char* ZORBA_RANDOM_FN_NS; | 544 | static const char* ZORBA_RANDOM_FN_NS; |
162 | 544 | static const char* ZORBA_SCTX_FN_NS; | 545 | static const char* ZORBA_SCTX_FN_NS; |
163 | 545 | 546 | ||
164 | === modified file 'src/functions/library.cpp' | |||
165 | --- src/functions/library.cpp 2013-09-17 23:05:29 +0000 | |||
166 | +++ src/functions/library.cpp 2013-10-01 23:33:38 +0000 | |||
167 | @@ -67,6 +67,7 @@ | |||
168 | 67 | #include "functions/func_reflection.h" | 67 | #include "functions/func_reflection.h" |
169 | 68 | #include "functions/func_schema.h" | 68 | #include "functions/func_schema.h" |
170 | 69 | #include "functions/func_sctx.h" | 69 | #include "functions/func_sctx.h" |
171 | 70 | #include "functions/func_seq.h" | ||
172 | 70 | #include "functions/func_sequences.h" | 71 | #include "functions/func_sequences.h" |
173 | 71 | #include "functions/func_sequences_impl.h" | 72 | #include "functions/func_sequences_impl.h" |
174 | 72 | #include "functions/func_strings.h" | 73 | #include "functions/func_strings.h" |
175 | @@ -143,6 +144,7 @@ | |||
176 | 143 | populate_context_random(sctx); | 144 | populate_context_random(sctx); |
177 | 144 | populate_context_schema(sctx); | 145 | populate_context_schema(sctx); |
178 | 145 | populate_context_sctx(sctx); | 146 | populate_context_sctx(sctx); |
179 | 147 | populate_context_seq(sctx); | ||
180 | 146 | populate_context_strings(sctx); | 148 | populate_context_strings(sctx); |
181 | 147 | populate_context_strings_impl(sctx); | 149 | populate_context_strings_impl(sctx); |
182 | 148 | populate_context_uris(sctx); | 150 | populate_context_uris(sctx); |
183 | 149 | 151 | ||
184 | === added file 'src/functions/pregenerated/func_seq.cpp' | |||
185 | --- src/functions/pregenerated/func_seq.cpp 1970-01-01 00:00:00 +0000 | |||
186 | +++ src/functions/pregenerated/func_seq.cpp 2013-10-01 23:33:38 +0000 | |||
187 | @@ -0,0 +1,110 @@ | |||
188 | 1 | /* | ||
189 | 2 | * Copyright 2006-2012 The FLWOR Foundation. | ||
190 | 3 | * | ||
191 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); | ||
192 | 5 | * you may not use this file except in compliance with the License. | ||
193 | 6 | * You may obtain a copy of the License at | ||
194 | 7 | * | ||
195 | 8 | * http://www.apache.org/licenses/LICENSE-2.0 | ||
196 | 9 | * | ||
197 | 10 | * Unless required by applicable law or agreed to in writing, software | ||
198 | 11 | * distributed under the License is distributed on an "AS IS" BASIS, | ||
199 | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
200 | 13 | * See the License for the specific language governing permissions and | ||
201 | 14 | * limitations under the License. | ||
202 | 15 | */ | ||
203 | 16 | |||
204 | 17 | // ****************************************** | ||
205 | 18 | // * * | ||
206 | 19 | // * THIS IS A GENERATED FILE. DO NOT EDIT! * | ||
207 | 20 | // * SEE .xml FILE WITH SAME NAME * | ||
208 | 21 | // * * | ||
209 | 22 | // ****************************************** | ||
210 | 23 | |||
211 | 24 | |||
212 | 25 | #include "stdafx.h" | ||
213 | 26 | #include "runtime/seq/seq.h" | ||
214 | 27 | #include "functions/func_seq.h" | ||
215 | 28 | |||
216 | 29 | |||
217 | 30 | namespace zorba{ | ||
218 | 31 | |||
219 | 32 | |||
220 | 33 | |||
221 | 34 | PlanIter_t fn_zorba_seq_value_intersect::codegen( | ||
222 | 35 | CompilerCB*, | ||
223 | 36 | static_context* sctx, | ||
224 | 37 | const QueryLoc& loc, | ||
225 | 38 | std::vector<PlanIter_t>& argv, | ||
226 | 39 | expr& ann) const | ||
227 | 40 | { | ||
228 | 41 | return new SeqValueIntersectIterator(sctx, loc, argv); | ||
229 | 42 | } | ||
230 | 43 | |||
231 | 44 | PlanIter_t fn_zorba_seq_value_union::codegen( | ||
232 | 45 | CompilerCB*, | ||
233 | 46 | static_context* sctx, | ||
234 | 47 | const QueryLoc& loc, | ||
235 | 48 | std::vector<PlanIter_t>& argv, | ||
236 | 49 | expr& ann) const | ||
237 | 50 | { | ||
238 | 51 | return new SeqValueUnionIterator(sctx, loc, argv); | ||
239 | 52 | } | ||
240 | 53 | |||
241 | 54 | PlanIter_t fn_zorba_seq_value_except::codegen( | ||
242 | 55 | CompilerCB*, | ||
243 | 56 | static_context* sctx, | ||
244 | 57 | const QueryLoc& loc, | ||
245 | 58 | std::vector<PlanIter_t>& argv, | ||
246 | 59 | expr& ann) const | ||
247 | 60 | { | ||
248 | 61 | return new SeqValueExceptIterator(sctx, loc, argv); | ||
249 | 62 | } | ||
250 | 63 | |||
251 | 64 | void populate_context_seq(static_context* sctx) | ||
252 | 65 | { | ||
253 | 66 | |||
254 | 67 | |||
255 | 68 | { | ||
256 | 69 | DECL_WITH_KIND(sctx, fn_zorba_seq_value_intersect, | ||
257 | 70 | (createQName("http://zorba.io/modules/sequence","","value-intersect"), | ||
258 | 71 | GENV_TYPESYSTEM.ANY_ATOMIC_TYPE_STAR, | ||
259 | 72 | GENV_TYPESYSTEM.ANY_ATOMIC_TYPE_STAR, | ||
260 | 73 | GENV_TYPESYSTEM.ANY_ATOMIC_TYPE_STAR), | ||
261 | 74 | FunctionConsts::FN_ZORBA_SEQ_VALUE_INTERSECT_2); | ||
262 | 75 | |||
263 | 76 | } | ||
264 | 77 | |||
265 | 78 | |||
266 | 79 | |||
267 | 80 | |||
268 | 81 | { | ||
269 | 82 | DECL_WITH_KIND(sctx, fn_zorba_seq_value_union, | ||
270 | 83 | (createQName("http://zorba.io/modules/sequence","","value-union"), | ||
271 | 84 | GENV_TYPESYSTEM.ANY_ATOMIC_TYPE_STAR, | ||
272 | 85 | GENV_TYPESYSTEM.ANY_ATOMIC_TYPE_STAR, | ||
273 | 86 | GENV_TYPESYSTEM.ANY_ATOMIC_TYPE_STAR), | ||
274 | 87 | FunctionConsts::FN_ZORBA_SEQ_VALUE_UNION_2); | ||
275 | 88 | |||
276 | 89 | } | ||
277 | 90 | |||
278 | 91 | |||
279 | 92 | |||
280 | 93 | |||
281 | 94 | { | ||
282 | 95 | DECL_WITH_KIND(sctx, fn_zorba_seq_value_except, | ||
283 | 96 | (createQName("http://zorba.io/modules/sequence","","value-except"), | ||
284 | 97 | GENV_TYPESYSTEM.ANY_ATOMIC_TYPE_STAR, | ||
285 | 98 | GENV_TYPESYSTEM.ANY_ATOMIC_TYPE_STAR, | ||
286 | 99 | GENV_TYPESYSTEM.ANY_ATOMIC_TYPE_STAR), | ||
287 | 100 | FunctionConsts::FN_ZORBA_SEQ_VALUE_EXCEPT_2); | ||
288 | 101 | |||
289 | 102 | } | ||
290 | 103 | |||
291 | 104 | } | ||
292 | 105 | |||
293 | 106 | |||
294 | 107 | } | ||
295 | 108 | |||
296 | 109 | |||
297 | 110 | |||
298 | 0 | 111 | ||
299 | === added file 'src/functions/pregenerated/func_seq.h' | |||
300 | --- src/functions/pregenerated/func_seq.h 1970-01-01 00:00:00 +0000 | |||
301 | +++ src/functions/pregenerated/func_seq.h 2013-10-01 23:33:38 +0000 | |||
302 | @@ -0,0 +1,94 @@ | |||
303 | 1 | /* | ||
304 | 2 | * Copyright 2006-2012 The FLWOR Foundation. | ||
305 | 3 | * | ||
306 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); | ||
307 | 5 | * you may not use this file except in compliance with the License. | ||
308 | 6 | * You may obtain a copy of the License at | ||
309 | 7 | * | ||
310 | 8 | * http://www.apache.org/licenses/LICENSE-2.0 | ||
311 | 9 | * | ||
312 | 10 | * Unless required by applicable law or agreed to in writing, software | ||
313 | 11 | * distributed under the License is distributed on an "AS IS" BASIS, | ||
314 | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
315 | 13 | * See the License for the specific language governing permissions and | ||
316 | 14 | * limitations under the License. | ||
317 | 15 | */ | ||
318 | 16 | |||
319 | 17 | // ****************************************** | ||
320 | 18 | // * * | ||
321 | 19 | // * THIS IS A GENERATED FILE. DO NOT EDIT! * | ||
322 | 20 | // * SEE .xml FILE WITH SAME NAME * | ||
323 | 21 | // * * | ||
324 | 22 | // ****************************************** | ||
325 | 23 | |||
326 | 24 | |||
327 | 25 | #ifndef ZORBA_FUNCTIONS_SEQ_H | ||
328 | 26 | #define ZORBA_FUNCTIONS_SEQ_H | ||
329 | 27 | |||
330 | 28 | |||
331 | 29 | #include "common/shared_types.h" | ||
332 | 30 | #include "functions/function_impl.h" | ||
333 | 31 | |||
334 | 32 | |||
335 | 33 | namespace zorba { | ||
336 | 34 | |||
337 | 35 | |||
338 | 36 | void populate_context_seq(static_context* sctx); | ||
339 | 37 | |||
340 | 38 | |||
341 | 39 | |||
342 | 40 | |||
343 | 41 | //fn-zorba-seq:value-intersect | ||
344 | 42 | class fn_zorba_seq_value_intersect : public function | ||
345 | 43 | { | ||
346 | 44 | public: | ||
347 | 45 | fn_zorba_seq_value_intersect(const signature& sig, FunctionConsts::FunctionKind kind) | ||
348 | 46 | : | ||
349 | 47 | function(sig, kind) | ||
350 | 48 | { | ||
351 | 49 | |||
352 | 50 | } | ||
353 | 51 | |||
354 | 52 | CODEGEN_DECL(); | ||
355 | 53 | }; | ||
356 | 54 | |||
357 | 55 | |||
358 | 56 | //fn-zorba-seq:value-union | ||
359 | 57 | class fn_zorba_seq_value_union : public function | ||
360 | 58 | { | ||
361 | 59 | public: | ||
362 | 60 | fn_zorba_seq_value_union(const signature& sig, FunctionConsts::FunctionKind kind) | ||
363 | 61 | : | ||
364 | 62 | function(sig, kind) | ||
365 | 63 | { | ||
366 | 64 | |||
367 | 65 | } | ||
368 | 66 | |||
369 | 67 | CODEGEN_DECL(); | ||
370 | 68 | }; | ||
371 | 69 | |||
372 | 70 | |||
373 | 71 | //fn-zorba-seq:value-except | ||
374 | 72 | class fn_zorba_seq_value_except : public function | ||
375 | 73 | { | ||
376 | 74 | public: | ||
377 | 75 | fn_zorba_seq_value_except(const signature& sig, FunctionConsts::FunctionKind kind) | ||
378 | 76 | : | ||
379 | 77 | function(sig, kind) | ||
380 | 78 | { | ||
381 | 79 | |||
382 | 80 | } | ||
383 | 81 | |||
384 | 82 | CODEGEN_DECL(); | ||
385 | 83 | }; | ||
386 | 84 | |||
387 | 85 | |||
388 | 86 | } //namespace zorba | ||
389 | 87 | |||
390 | 88 | |||
391 | 89 | #endif | ||
392 | 90 | /* | ||
393 | 91 | * Local variables: | ||
394 | 92 | * mode: c++ | ||
395 | 93 | * End: | ||
396 | 94 | */ | ||
397 | 0 | 95 | ||
398 | === modified file 'src/functions/pregenerated/function_enum.h' | |||
399 | --- src/functions/pregenerated/function_enum.h 2013-10-01 03:25:43 +0000 | |||
400 | +++ src/functions/pregenerated/function_enum.h 2013-10-01 23:33:38 +0000 | |||
401 | @@ -394,6 +394,9 @@ | |||
402 | 394 | FN_ZORBA_SCTX_STATICALLY_KNOWN_NAMESPACE_BINDING_1, | 394 | FN_ZORBA_SCTX_STATICALLY_KNOWN_NAMESPACE_BINDING_1, |
403 | 395 | FN_ZORBA_SCTX_STATICALLY_KNOWN_NAMESPACES_0, | 395 | FN_ZORBA_SCTX_STATICALLY_KNOWN_NAMESPACES_0, |
404 | 396 | FN_ZORBA_SCTX_XPATH10_COMPATIBILITY_MODE_0, | 396 | FN_ZORBA_SCTX_XPATH10_COMPATIBILITY_MODE_0, |
405 | 397 | FN_ZORBA_SEQ_VALUE_INTERSECT_2, | ||
406 | 398 | FN_ZORBA_SEQ_VALUE_UNION_2, | ||
407 | 399 | FN_ZORBA_SEQ_VALUE_EXCEPT_2, | ||
408 | 397 | OP_CONCATENATE_N, | 400 | OP_CONCATENATE_N, |
409 | 398 | FN_INDEX_OF_2, | 401 | FN_INDEX_OF_2, |
410 | 399 | FN_INDEX_OF_3, | 402 | FN_INDEX_OF_3, |
411 | 400 | 403 | ||
412 | === modified file 'src/runtime/CMakeLists.txt' | |||
413 | --- src/runtime/CMakeLists.txt 2013-10-01 00:52:37 +0000 | |||
414 | +++ src/runtime/CMakeLists.txt 2013-10-01 23:33:38 +0000 | |||
415 | @@ -153,6 +153,7 @@ | |||
416 | 153 | ) | 153 | ) |
417 | 154 | 154 | ||
418 | 155 | ADD_SRC_SUBFOLDER(RUNTIME_SRCS csv CSV_SRCS) | 155 | ADD_SRC_SUBFOLDER(RUNTIME_SRCS csv CSV_SRCS) |
419 | 156 | ADD_SRC_SUBFOLDER(RUNTIME_SRCS seq SEQ_SRCS) | ||
420 | 156 | 157 | ||
421 | 157 | IF(NOT ZORBA_NO_FULL_TEXT) | 158 | IF(NOT ZORBA_NO_FULL_TEXT) |
422 | 158 | ADD_SRC_SUBFOLDER(RUNTIME_SRCS full_text FULLTEXT_SRCS) | 159 | ADD_SRC_SUBFOLDER(RUNTIME_SRCS full_text FULLTEXT_SRCS) |
423 | 159 | 160 | ||
424 | === modified file 'src/runtime/pregenerated/iterator_enum.h' | |||
425 | --- src/runtime/pregenerated/iterator_enum.h 2013-10-01 03:25:43 +0000 | |||
426 | +++ src/runtime/pregenerated/iterator_enum.h 2013-10-01 23:33:38 +0000 | |||
427 | @@ -290,6 +290,9 @@ | |||
428 | 290 | TYPE_SctxStaticallyKnownNamespaceBindingIterator, | 290 | TYPE_SctxStaticallyKnownNamespaceBindingIterator, |
429 | 291 | TYPE_SctxStaticallyKnownNamespacesIterator, | 291 | TYPE_SctxStaticallyKnownNamespacesIterator, |
430 | 292 | TYPE_SctxXPath10CompatModeIterator, | 292 | TYPE_SctxXPath10CompatModeIterator, |
431 | 293 | TYPE_SeqValueIntersectIterator, | ||
432 | 294 | TYPE_SeqValueUnionIterator, | ||
433 | 295 | TYPE_SeqValueExceptIterator, | ||
434 | 293 | TYPE_FnConcatIterator, | 296 | TYPE_FnConcatIterator, |
435 | 294 | TYPE_FnIndexOfIterator, | 297 | TYPE_FnIndexOfIterator, |
436 | 295 | TYPE_FnEmptyIterator, | 298 | TYPE_FnEmptyIterator, |
437 | 296 | 299 | ||
438 | === added directory 'src/runtime/seq' | |||
439 | === added file 'src/runtime/seq/CMakeLists.txt' | |||
440 | --- src/runtime/seq/CMakeLists.txt 1970-01-01 00:00:00 +0000 | |||
441 | +++ src/runtime/seq/CMakeLists.txt 2013-10-01 23:33:38 +0000 | |||
442 | @@ -0,0 +1,19 @@ | |||
443 | 1 | # Copyright 2006-2013 The FLWOR Foundation. | ||
444 | 2 | # | ||
445 | 3 | # Licensed under the Apache License, Version 2.0 (the "License"); | ||
446 | 4 | # you may not use this file except in compliance with the License. | ||
447 | 5 | # You may obtain a copy of the License at | ||
448 | 6 | # | ||
449 | 7 | # http://www.apache.org/licenses/LICENSE-2.0 | ||
450 | 8 | # | ||
451 | 9 | # Unless required by applicable law or agreed to in writing, software | ||
452 | 10 | # distributed under the License is distributed on an "AS IS" BASIS, | ||
453 | 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
454 | 12 | # See the License for the specific language governing permissions and | ||
455 | 13 | # limitations under the License. | ||
456 | 14 | |||
457 | 15 | SET(SEQ_SRCS | ||
458 | 16 | seq_impl.cpp | ||
459 | 17 | ) | ||
460 | 18 | |||
461 | 19 | # vim:set et sw=2 ts=2: | ||
462 | 0 | 20 | ||
463 | === added directory 'src/runtime/seq/pregenerated' | |||
464 | === added file 'src/runtime/seq/pregenerated/seq.cpp' | |||
465 | --- src/runtime/seq/pregenerated/seq.cpp 1970-01-01 00:00:00 +0000 | |||
466 | +++ src/runtime/seq/pregenerated/seq.cpp 2013-10-01 23:33:38 +0000 | |||
467 | @@ -0,0 +1,159 @@ | |||
468 | 1 | /* | ||
469 | 2 | * Copyright 2006-2012 The FLWOR Foundation. | ||
470 | 3 | * | ||
471 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); | ||
472 | 5 | * you may not use this file except in compliance with the License. | ||
473 | 6 | * You may obtain a copy of the License at | ||
474 | 7 | * | ||
475 | 8 | * http://www.apache.org/licenses/LICENSE-2.0 | ||
476 | 9 | * | ||
477 | 10 | * Unless required by applicable law or agreed to in writing, software | ||
478 | 11 | * distributed under the License is distributed on an "AS IS" BASIS, | ||
479 | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
480 | 13 | * See the License for the specific language governing permissions and | ||
481 | 14 | * limitations under the License. | ||
482 | 15 | */ | ||
483 | 16 | |||
484 | 17 | // ****************************************** | ||
485 | 18 | // * * | ||
486 | 19 | // * THIS IS A GENERATED FILE. DO NOT EDIT! * | ||
487 | 20 | // * SEE .xml FILE WITH SAME NAME * | ||
488 | 21 | // * * | ||
489 | 22 | // ****************************************** | ||
490 | 23 | |||
491 | 24 | #include "stdafx.h" | ||
492 | 25 | #include "zorbatypes/rchandle.h" | ||
493 | 26 | #include "zorbatypes/zstring.h" | ||
494 | 27 | #include "runtime/visitors/planiter_visitor.h" | ||
495 | 28 | #include "runtime/seq/seq.h" | ||
496 | 29 | #include "system/globalenv.h" | ||
497 | 30 | |||
498 | 31 | |||
499 | 32 | #include "store/api/iterator.h" | ||
500 | 33 | |||
501 | 34 | namespace zorba { | ||
502 | 35 | |||
503 | 36 | // <SeqValueIntersectIterator> | ||
504 | 37 | SERIALIZABLE_CLASS_VERSIONS(SeqValueIntersectIterator) | ||
505 | 38 | |||
506 | 39 | void SeqValueIntersectIterator::serialize(::zorba::serialization::Archiver& ar) | ||
507 | 40 | { | ||
508 | 41 | serialize_baseclass(ar, | ||
509 | 42 | (NaryBaseIterator<SeqValueIntersectIterator, SeqValueIntersectIteratorState>*)this); | ||
510 | 43 | } | ||
511 | 44 | |||
512 | 45 | |||
513 | 46 | void SeqValueIntersectIterator::accept(PlanIterVisitor& v) const | ||
514 | 47 | { | ||
515 | 48 | v.beginVisit(*this); | ||
516 | 49 | |||
517 | 50 | std::vector<PlanIter_t>::const_iterator lIter = theChildren.begin(); | ||
518 | 51 | std::vector<PlanIter_t>::const_iterator lEnd = theChildren.end(); | ||
519 | 52 | for ( ; lIter != lEnd; ++lIter ){ | ||
520 | 53 | (*lIter)->accept(v); | ||
521 | 54 | } | ||
522 | 55 | |||
523 | 56 | v.endVisit(*this); | ||
524 | 57 | } | ||
525 | 58 | |||
526 | 59 | SeqValueIntersectIterator::~SeqValueIntersectIterator() {} | ||
527 | 60 | |||
528 | 61 | SeqValueIntersectIteratorState::SeqValueIntersectIteratorState() {} | ||
529 | 62 | |||
530 | 63 | SeqValueIntersectIteratorState::~SeqValueIntersectIteratorState() {} | ||
531 | 64 | |||
532 | 65 | |||
533 | 66 | void SeqValueIntersectIteratorState::init(PlanState& planState) { | ||
534 | 67 | PlanIteratorState::init(planState); | ||
535 | 68 | } | ||
536 | 69 | |||
537 | 70 | void SeqValueIntersectIteratorState::reset(PlanState& planState) { | ||
538 | 71 | PlanIteratorState::reset(planState); | ||
539 | 72 | } | ||
540 | 73 | // </SeqValueIntersectIterator> | ||
541 | 74 | |||
542 | 75 | |||
543 | 76 | // <SeqValueUnionIterator> | ||
544 | 77 | SERIALIZABLE_CLASS_VERSIONS(SeqValueUnionIterator) | ||
545 | 78 | |||
546 | 79 | void SeqValueUnionIterator::serialize(::zorba::serialization::Archiver& ar) | ||
547 | 80 | { | ||
548 | 81 | serialize_baseclass(ar, | ||
549 | 82 | (NaryBaseIterator<SeqValueUnionIterator, SeqValueUnionIteratorState>*)this); | ||
550 | 83 | } | ||
551 | 84 | |||
552 | 85 | |||
553 | 86 | void SeqValueUnionIterator::accept(PlanIterVisitor& v) const | ||
554 | 87 | { | ||
555 | 88 | v.beginVisit(*this); | ||
556 | 89 | |||
557 | 90 | std::vector<PlanIter_t>::const_iterator lIter = theChildren.begin(); | ||
558 | 91 | std::vector<PlanIter_t>::const_iterator lEnd = theChildren.end(); | ||
559 | 92 | for ( ; lIter != lEnd; ++lIter ){ | ||
560 | 93 | (*lIter)->accept(v); | ||
561 | 94 | } | ||
562 | 95 | |||
563 | 96 | v.endVisit(*this); | ||
564 | 97 | } | ||
565 | 98 | |||
566 | 99 | SeqValueUnionIterator::~SeqValueUnionIterator() {} | ||
567 | 100 | |||
568 | 101 | SeqValueUnionIteratorState::SeqValueUnionIteratorState() {} | ||
569 | 102 | |||
570 | 103 | SeqValueUnionIteratorState::~SeqValueUnionIteratorState() {} | ||
571 | 104 | |||
572 | 105 | |||
573 | 106 | void SeqValueUnionIteratorState::init(PlanState& planState) { | ||
574 | 107 | PlanIteratorState::init(planState); | ||
575 | 108 | } | ||
576 | 109 | |||
577 | 110 | void SeqValueUnionIteratorState::reset(PlanState& planState) { | ||
578 | 111 | PlanIteratorState::reset(planState); | ||
579 | 112 | } | ||
580 | 113 | // </SeqValueUnionIterator> | ||
581 | 114 | |||
582 | 115 | |||
583 | 116 | // <SeqValueExceptIterator> | ||
584 | 117 | SERIALIZABLE_CLASS_VERSIONS(SeqValueExceptIterator) | ||
585 | 118 | |||
586 | 119 | void SeqValueExceptIterator::serialize(::zorba::serialization::Archiver& ar) | ||
587 | 120 | { | ||
588 | 121 | serialize_baseclass(ar, | ||
589 | 122 | (NaryBaseIterator<SeqValueExceptIterator, SeqValueExceptIteratorState>*)this); | ||
590 | 123 | } | ||
591 | 124 | |||
592 | 125 | |||
593 | 126 | void SeqValueExceptIterator::accept(PlanIterVisitor& v) const | ||
594 | 127 | { | ||
595 | 128 | v.beginVisit(*this); | ||
596 | 129 | |||
597 | 130 | std::vector<PlanIter_t>::const_iterator lIter = theChildren.begin(); | ||
598 | 131 | std::vector<PlanIter_t>::const_iterator lEnd = theChildren.end(); | ||
599 | 132 | for ( ; lIter != lEnd; ++lIter ){ | ||
600 | 133 | (*lIter)->accept(v); | ||
601 | 134 | } | ||
602 | 135 | |||
603 | 136 | v.endVisit(*this); | ||
604 | 137 | } | ||
605 | 138 | |||
606 | 139 | SeqValueExceptIterator::~SeqValueExceptIterator() {} | ||
607 | 140 | |||
608 | 141 | SeqValueExceptIteratorState::SeqValueExceptIteratorState() {} | ||
609 | 142 | |||
610 | 143 | SeqValueExceptIteratorState::~SeqValueExceptIteratorState() {} | ||
611 | 144 | |||
612 | 145 | |||
613 | 146 | void SeqValueExceptIteratorState::init(PlanState& planState) { | ||
614 | 147 | PlanIteratorState::init(planState); | ||
615 | 148 | } | ||
616 | 149 | |||
617 | 150 | void SeqValueExceptIteratorState::reset(PlanState& planState) { | ||
618 | 151 | PlanIteratorState::reset(planState); | ||
619 | 152 | } | ||
620 | 153 | // </SeqValueExceptIterator> | ||
621 | 154 | |||
622 | 155 | |||
623 | 156 | |||
624 | 157 | } | ||
625 | 158 | |||
626 | 159 | |||
627 | 0 | 160 | ||
628 | === added file 'src/runtime/seq/pregenerated/seq.h' | |||
629 | --- src/runtime/seq/pregenerated/seq.h 1970-01-01 00:00:00 +0000 | |||
630 | +++ src/runtime/seq/pregenerated/seq.h 2013-10-01 23:33:38 +0000 | |||
631 | @@ -0,0 +1,173 @@ | |||
632 | 1 | /* | ||
633 | 2 | * Copyright 2006-2012 The FLWOR Foundation. | ||
634 | 3 | * | ||
635 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); | ||
636 | 5 | * you may not use this file except in compliance with the License. | ||
637 | 6 | * You may obtain a copy of the License at | ||
638 | 7 | * | ||
639 | 8 | * http://www.apache.org/licenses/LICENSE-2.0 | ||
640 | 9 | * | ||
641 | 10 | * Unless required by applicable law or agreed to in writing, software | ||
642 | 11 | * distributed under the License is distributed on an "AS IS" BASIS, | ||
643 | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
644 | 13 | * See the License for the specific language governing permissions and | ||
645 | 14 | * limitations under the License. | ||
646 | 15 | */ | ||
647 | 16 | |||
648 | 17 | // ****************************************** | ||
649 | 18 | // * * | ||
650 | 19 | // * THIS IS A GENERATED FILE. DO NOT EDIT! * | ||
651 | 20 | // * SEE .xml FILE WITH SAME NAME * | ||
652 | 21 | // * * | ||
653 | 22 | // ****************************************** | ||
654 | 23 | #ifndef ZORBA_RUNTIME_SEQ_SEQ_H | ||
655 | 24 | #define ZORBA_RUNTIME_SEQ_SEQ_H | ||
656 | 25 | |||
657 | 26 | |||
658 | 27 | #include "common/shared_types.h" | ||
659 | 28 | |||
660 | 29 | |||
661 | 30 | |||
662 | 31 | #include "runtime/base/narybase.h" | ||
663 | 32 | #include "runtime/seq/seq_util.h" | ||
664 | 33 | |||
665 | 34 | |||
666 | 35 | namespace zorba { | ||
667 | 36 | |||
668 | 37 | /** | ||
669 | 38 | * | ||
670 | 39 | * Author: | ||
671 | 40 | */ | ||
672 | 41 | class SeqValueIntersectIteratorState : public PlanIteratorState | ||
673 | 42 | { | ||
674 | 43 | public: | ||
675 | 44 | Item_set_type* set_[2]; // | ||
676 | 45 | |||
677 | 46 | SeqValueIntersectIteratorState(); | ||
678 | 47 | |||
679 | 48 | ~SeqValueIntersectIteratorState(); | ||
680 | 49 | |||
681 | 50 | void init(PlanState&); | ||
682 | 51 | void reset(PlanState&); | ||
683 | 52 | }; | ||
684 | 53 | |||
685 | 54 | class SeqValueIntersectIterator : public NaryBaseIterator<SeqValueIntersectIterator, SeqValueIntersectIteratorState> | ||
686 | 55 | { | ||
687 | 56 | public: | ||
688 | 57 | SERIALIZABLE_CLASS(SeqValueIntersectIterator); | ||
689 | 58 | |||
690 | 59 | SERIALIZABLE_CLASS_CONSTRUCTOR2T(SeqValueIntersectIterator, | ||
691 | 60 | NaryBaseIterator<SeqValueIntersectIterator, SeqValueIntersectIteratorState>); | ||
692 | 61 | |||
693 | 62 | void serialize( ::zorba::serialization::Archiver& ar); | ||
694 | 63 | |||
695 | 64 | SeqValueIntersectIterator( | ||
696 | 65 | static_context* sctx, | ||
697 | 66 | const QueryLoc& loc, | ||
698 | 67 | std::vector<PlanIter_t>& children) | ||
699 | 68 | : | ||
700 | 69 | NaryBaseIterator<SeqValueIntersectIterator, SeqValueIntersectIteratorState>(sctx, loc, children) | ||
701 | 70 | {} | ||
702 | 71 | |||
703 | 72 | virtual ~SeqValueIntersectIterator(); | ||
704 | 73 | |||
705 | 74 | void accept(PlanIterVisitor& v) const; | ||
706 | 75 | |||
707 | 76 | bool nextImpl(store::Item_t& result, PlanState& aPlanState) const; | ||
708 | 77 | }; | ||
709 | 78 | |||
710 | 79 | |||
711 | 80 | /** | ||
712 | 81 | * | ||
713 | 82 | * Author: | ||
714 | 83 | */ | ||
715 | 84 | class SeqValueUnionIteratorState : public PlanIteratorState | ||
716 | 85 | { | ||
717 | 86 | public: | ||
718 | 87 | int child_; // | ||
719 | 88 | Item_set_type* set_; // | ||
720 | 89 | |||
721 | 90 | SeqValueUnionIteratorState(); | ||
722 | 91 | |||
723 | 92 | ~SeqValueUnionIteratorState(); | ||
724 | 93 | |||
725 | 94 | void init(PlanState&); | ||
726 | 95 | void reset(PlanState&); | ||
727 | 96 | }; | ||
728 | 97 | |||
729 | 98 | class SeqValueUnionIterator : public NaryBaseIterator<SeqValueUnionIterator, SeqValueUnionIteratorState> | ||
730 | 99 | { | ||
731 | 100 | public: | ||
732 | 101 | SERIALIZABLE_CLASS(SeqValueUnionIterator); | ||
733 | 102 | |||
734 | 103 | SERIALIZABLE_CLASS_CONSTRUCTOR2T(SeqValueUnionIterator, | ||
735 | 104 | NaryBaseIterator<SeqValueUnionIterator, SeqValueUnionIteratorState>); | ||
736 | 105 | |||
737 | 106 | void serialize( ::zorba::serialization::Archiver& ar); | ||
738 | 107 | |||
739 | 108 | SeqValueUnionIterator( | ||
740 | 109 | static_context* sctx, | ||
741 | 110 | const QueryLoc& loc, | ||
742 | 111 | std::vector<PlanIter_t>& children) | ||
743 | 112 | : | ||
744 | 113 | NaryBaseIterator<SeqValueUnionIterator, SeqValueUnionIteratorState>(sctx, loc, children) | ||
745 | 114 | {} | ||
746 | 115 | |||
747 | 116 | virtual ~SeqValueUnionIterator(); | ||
748 | 117 | |||
749 | 118 | void accept(PlanIterVisitor& v) const; | ||
750 | 119 | |||
751 | 120 | bool nextImpl(store::Item_t& result, PlanState& aPlanState) const; | ||
752 | 121 | }; | ||
753 | 122 | |||
754 | 123 | |||
755 | 124 | /** | ||
756 | 125 | * | ||
757 | 126 | * Author: | ||
758 | 127 | */ | ||
759 | 128 | class SeqValueExceptIteratorState : public PlanIteratorState | ||
760 | 129 | { | ||
761 | 130 | public: | ||
762 | 131 | Item_set_type* set_; // | ||
763 | 132 | |||
764 | 133 | SeqValueExceptIteratorState(); | ||
765 | 134 | |||
766 | 135 | ~SeqValueExceptIteratorState(); | ||
767 | 136 | |||
768 | 137 | void init(PlanState&); | ||
769 | 138 | void reset(PlanState&); | ||
770 | 139 | }; | ||
771 | 140 | |||
772 | 141 | class SeqValueExceptIterator : public NaryBaseIterator<SeqValueExceptIterator, SeqValueExceptIteratorState> | ||
773 | 142 | { | ||
774 | 143 | public: | ||
775 | 144 | SERIALIZABLE_CLASS(SeqValueExceptIterator); | ||
776 | 145 | |||
777 | 146 | SERIALIZABLE_CLASS_CONSTRUCTOR2T(SeqValueExceptIterator, | ||
778 | 147 | NaryBaseIterator<SeqValueExceptIterator, SeqValueExceptIteratorState>); | ||
779 | 148 | |||
780 | 149 | void serialize( ::zorba::serialization::Archiver& ar); | ||
781 | 150 | |||
782 | 151 | SeqValueExceptIterator( | ||
783 | 152 | static_context* sctx, | ||
784 | 153 | const QueryLoc& loc, | ||
785 | 154 | std::vector<PlanIter_t>& children) | ||
786 | 155 | : | ||
787 | 156 | NaryBaseIterator<SeqValueExceptIterator, SeqValueExceptIteratorState>(sctx, loc, children) | ||
788 | 157 | {} | ||
789 | 158 | |||
790 | 159 | virtual ~SeqValueExceptIterator(); | ||
791 | 160 | |||
792 | 161 | void accept(PlanIterVisitor& v) const; | ||
793 | 162 | |||
794 | 163 | bool nextImpl(store::Item_t& result, PlanState& aPlanState) const; | ||
795 | 164 | }; | ||
796 | 165 | |||
797 | 166 | |||
798 | 167 | } | ||
799 | 168 | #endif | ||
800 | 169 | /* | ||
801 | 170 | * Local variables: | ||
802 | 171 | * mode: c++ | ||
803 | 172 | * End: | ||
804 | 173 | */ | ||
805 | 0 | 174 | ||
806 | === added file 'src/runtime/seq/seq_impl.cpp' | |||
807 | --- src/runtime/seq/seq_impl.cpp 1970-01-01 00:00:00 +0000 | |||
808 | +++ src/runtime/seq/seq_impl.cpp 2013-10-01 23:33:38 +0000 | |||
809 | @@ -0,0 +1,145 @@ | |||
810 | 1 | /* | ||
811 | 2 | * Copyright 2006-2013 The FLWOR Foundation. | ||
812 | 3 | * | ||
813 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); | ||
814 | 5 | * you may not use this file except in compliance with the License. | ||
815 | 6 | * You may obtain a copy of the License at | ||
816 | 7 | * | ||
817 | 8 | * http://www.apache.org/licenses/LICENSE-2.0 | ||
818 | 9 | * | ||
819 | 10 | * Unless required by applicable law or agreed to in writing, software | ||
820 | 11 | * distributed under the License is distributed on an "AS IS" BASIS, | ||
821 | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
822 | 13 | * See the License for the specific language governing permissions and | ||
823 | 14 | * limitations under the License. | ||
824 | 15 | */ | ||
825 | 16 | |||
826 | 17 | #include "stdafx.h" | ||
827 | 18 | |||
828 | 19 | #include <zorba/config.h> | ||
829 | 20 | #include <zorba/internal/cxx_util.h> | ||
830 | 21 | |||
831 | 22 | #include "context/dynamic_context.h" | ||
832 | 23 | #include "context/static_context.h" | ||
833 | 24 | #include "runtime/seq/seq.h" | ||
834 | 25 | #include "runtime/seq/seq_util.h" | ||
835 | 26 | #include "types/typemanager.h" | ||
836 | 27 | #include "util/stl_util.h" | ||
837 | 28 | |||
838 | 29 | using namespace std; | ||
839 | 30 | |||
840 | 31 | namespace zorba { | ||
841 | 32 | |||
842 | 33 | /////////////////////////////////////////////////////////////////////////////// | ||
843 | 34 | |||
844 | 35 | inline Item_set_type* new_Item_set( TypeManager const *tm, long tz, | ||
845 | 36 | XQPCollator *coll, QueryLoc const &loc ) { | ||
846 | 37 | return new Item_set_type( | ||
847 | 38 | ztd::prime_rehash_policy::default_bucket_count, | ||
848 | 39 | Item_set_type::hasher(), | ||
849 | 40 | Item_value_equal( tm, tz, coll, loc ) | ||
850 | 41 | ); | ||
851 | 42 | } | ||
852 | 43 | |||
853 | 44 | static void delete_Item_set( Item_set_type *set ) { | ||
854 | 45 | MUTATE_EACH( Item_set_type, i, *set ) | ||
855 | 46 | (*i)->removeReference(); | ||
856 | 47 | delete set; | ||
857 | 48 | } | ||
858 | 49 | |||
859 | 50 | /////////////////////////////////////////////////////////////////////////////// | ||
860 | 51 | |||
861 | 52 | bool SeqValueIntersectIterator::nextImpl( store::Item_t &result, | ||
862 | 53 | PlanState &plan_state ) const { | ||
863 | 54 | XQPCollator *const coll = theSctx->get_default_collator( loc ); | ||
864 | 55 | store::Item_t item; | ||
865 | 56 | TypeManager *const tm = getTypeManager(); | ||
866 | 57 | long tz; | ||
867 | 58 | |||
868 | 59 | SeqValueIntersectIteratorState *state; | ||
869 | 60 | DEFAULT_STACK_INIT( SeqValueIntersectIteratorState, state, plan_state ); | ||
870 | 61 | |||
871 | 62 | tz = plan_state.theLocalDynCtx->get_implicit_timezone(); | ||
872 | 63 | |||
873 | 64 | state->set_[0] = new_Item_set( tm, tz, coll, loc ); | ||
874 | 65 | state->set_[1] = new_Item_set( tm, tz, coll, loc ); | ||
875 | 66 | |||
876 | 67 | while ( consumeNext( item, theChildren[0], plan_state ) ) | ||
877 | 68 | if ( state->set_[0]->insert( item.getp() ).second ) | ||
878 | 69 | item->addReference(); | ||
879 | 70 | |||
880 | 71 | while ( consumeNext( item, theChildren[1], plan_state ) ) | ||
881 | 72 | if ( ztd::contains( *state->set_[0], item.getp() ) && | ||
882 | 73 | state->set_[1]->insert( item.getp() ).second ) { | ||
883 | 74 | item->addReference(); | ||
884 | 75 | result = item; | ||
885 | 76 | STACK_PUSH( true, state ); | ||
886 | 77 | } | ||
887 | 78 | |||
888 | 79 | delete_Item_set( state->set_[0] ); | ||
889 | 80 | delete_Item_set( state->set_[1] ); | ||
890 | 81 | STACK_END( state ); | ||
891 | 82 | } | ||
892 | 83 | |||
893 | 84 | /////////////////////////////////////////////////////////////////////////////// | ||
894 | 85 | |||
895 | 86 | bool SeqValueUnionIterator::nextImpl( store::Item_t &result, | ||
896 | 87 | PlanState &plan_state ) const { | ||
897 | 88 | XQPCollator *const coll = theSctx->get_default_collator( loc ); | ||
898 | 89 | store::Item_t item; | ||
899 | 90 | TypeManager *const tm = getTypeManager(); | ||
900 | 91 | long tz; | ||
901 | 92 | |||
902 | 93 | SeqValueUnionIteratorState *state; | ||
903 | 94 | DEFAULT_STACK_INIT( SeqValueUnionIteratorState, state, plan_state ); | ||
904 | 95 | |||
905 | 96 | tz = plan_state.theLocalDynCtx->get_implicit_timezone(); | ||
906 | 97 | state->set_ = new_Item_set( tm, tz, coll, loc ); | ||
907 | 98 | |||
908 | 99 | for ( state->child_ = 0; state->child_ < 2; ++state->child_ ) | ||
909 | 100 | while ( consumeNext( item, theChildren[ state->child_ ], plan_state ) ) | ||
910 | 101 | if ( state->set_->insert( item.getp() ).second ) { | ||
911 | 102 | item->addReference(); | ||
912 | 103 | result = item; | ||
913 | 104 | STACK_PUSH( true, state ); | ||
914 | 105 | } | ||
915 | 106 | |||
916 | 107 | delete_Item_set( state->set_ ); | ||
917 | 108 | STACK_END( state ); | ||
918 | 109 | } | ||
919 | 110 | |||
920 | 111 | /////////////////////////////////////////////////////////////////////////////// | ||
921 | 112 | |||
922 | 113 | bool SeqValueExceptIterator::nextImpl( store::Item_t &result, | ||
923 | 114 | PlanState &plan_state ) const { | ||
924 | 115 | XQPCollator *const coll = theSctx->get_default_collator( loc ); | ||
925 | 116 | store::Item_t item; | ||
926 | 117 | TypeManager *const tm = getTypeManager(); | ||
927 | 118 | long tz; | ||
928 | 119 | |||
929 | 120 | SeqValueExceptIteratorState *state; | ||
930 | 121 | DEFAULT_STACK_INIT( SeqValueExceptIteratorState, state, plan_state ); | ||
931 | 122 | |||
932 | 123 | tz = plan_state.theLocalDynCtx->get_implicit_timezone(); | ||
933 | 124 | state->set_ = new_Item_set( tm, tz, coll, loc ); | ||
934 | 125 | |||
935 | 126 | while ( consumeNext( item, theChildren[1], plan_state ) ) | ||
936 | 127 | if ( state->set_->insert( item.getp() ).second ) | ||
937 | 128 | item->addReference(); | ||
938 | 129 | |||
939 | 130 | while ( consumeNext( item, theChildren[0], plan_state ) ) | ||
940 | 131 | if ( state->set_->insert( item.getp() ).second ) { | ||
941 | 132 | item->addReference(); | ||
942 | 133 | result = item; | ||
943 | 134 | STACK_PUSH( true, state ); | ||
944 | 135 | } | ||
945 | 136 | |||
946 | 137 | delete_Item_set( state->set_ ); | ||
947 | 138 | STACK_END( state ); | ||
948 | 139 | } | ||
949 | 140 | |||
950 | 141 | /////////////////////////////////////////////////////////////////////////////// | ||
951 | 142 | |||
952 | 143 | } // namespace zorba | ||
953 | 144 | |||
954 | 145 | /* vim:set et sw=2 ts=2: */ | ||
955 | 0 | 146 | ||
956 | === added file 'src/runtime/seq/seq_util.h' | |||
957 | --- src/runtime/seq/seq_util.h 1970-01-01 00:00:00 +0000 | |||
958 | +++ src/runtime/seq/seq_util.h 2013-10-01 23:33:38 +0000 | |||
959 | @@ -0,0 +1,64 @@ | |||
960 | 1 | /* | ||
961 | 2 | * Copyright 2006-2013 The FLWOR Foundation. | ||
962 | 3 | * | ||
963 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); | ||
964 | 5 | * you may not use this file except in compliance with the License. | ||
965 | 6 | * You may obtain a copy of the License at | ||
966 | 7 | * | ||
967 | 8 | * http://www.apache.org/licenses/LICENSE-2.0 | ||
968 | 9 | * | ||
969 | 10 | * Unless required by applicable law or agreed to in writing, software | ||
970 | 11 | * distributed under the License is distributed on an "AS IS" BASIS, | ||
971 | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
972 | 13 | * See the License for the specific language governing permissions and | ||
973 | 14 | * limitations under the License. | ||
974 | 15 | */ | ||
975 | 16 | |||
976 | 17 | #ifndef ZORBA_SEQ_UTIL_H | ||
977 | 18 | #define ZORBA_SEQ_UTIL_H | ||
978 | 19 | |||
979 | 20 | #include <functional> | ||
980 | 21 | |||
981 | 22 | #include "runtime/booleans/BooleanImpl.h" | ||
982 | 23 | #include "util/hash/hash.h" | ||
983 | 24 | #include "util/unordered_set.h" | ||
984 | 25 | #include "zorbautils/specializations.h" | ||
985 | 26 | |||
986 | 27 | namespace zorba { | ||
987 | 28 | |||
988 | 29 | class TypeManager; | ||
989 | 30 | class XQPCollator; | ||
990 | 31 | |||
991 | 32 | /////////////////////////////////////////////////////////////////////////////// | ||
992 | 33 | |||
993 | 34 | struct Item_value_equal : std::binary_function<store::Item*,store::Item*,bool> { | ||
994 | 35 | Item_value_equal( TypeManager const *tm, long tz, XQPCollator *coll, | ||
995 | 36 | QueryLoc const &loc ) : | ||
996 | 37 | tm_( tm ), | ||
997 | 38 | tz_( tz ), | ||
998 | 39 | coll_( coll ), | ||
999 | 40 | loc_( loc ) | ||
1000 | 41 | { | ||
1001 | 42 | } | ||
1002 | 43 | |||
1003 | 44 | bool operator()( store::Item *i, store::Item *j ) const { | ||
1004 | 45 | store::Item_t it( i ), jt( j ); | ||
1005 | 46 | return CompareIterator::valueEqual( loc_, it, jt, tm_, tz_, coll_ ); | ||
1006 | 47 | } | ||
1007 | 48 | |||
1008 | 49 | private: | ||
1009 | 50 | TypeManager const *const tm_; | ||
1010 | 51 | long const tz_; | ||
1011 | 52 | XQPCollator *const coll_; | ||
1012 | 53 | QueryLoc const loc_; | ||
1013 | 54 | }; | ||
1014 | 55 | |||
1015 | 56 | typedef std::unordered_set<store::Item*,ztd::hash<store::Item*>,Item_value_equal | ||
1016 | 57 | > Item_set_type; | ||
1017 | 58 | |||
1018 | 59 | /////////////////////////////////////////////////////////////////////////////// | ||
1019 | 60 | |||
1020 | 61 | } // namespace zorba | ||
1021 | 62 | |||
1022 | 63 | #endif /* ZORBA_SEQ_UTIL_H */ | ||
1023 | 64 | /* vim:set et sw=2 ts=2: */ | ||
1024 | 0 | 65 | ||
1025 | === modified file 'src/runtime/spec/mappings.xml' | |||
1026 | --- src/runtime/spec/mappings.xml 2013-10-01 03:34:33 +0000 | |||
1027 | +++ src/runtime/spec/mappings.xml 2013-10-01 23:33:38 +0000 | |||
1028 | @@ -23,10 +23,10 @@ | |||
1029 | 23 | <zorba:namespace uri="http://zorba.io/modules/reference" | 23 | <zorba:namespace uri="http://zorba.io/modules/reference" |
1030 | 24 | define="ZORBA_REF_FN_NS" | 24 | define="ZORBA_REF_FN_NS" |
1031 | 25 | prefix="fn-reference"/> | 25 | prefix="fn-reference"/> |
1033 | 26 | 26 | ||
1034 | 27 | <zorba:namespace uri="http://zorba.io/modules/node-position" | 27 | <zorba:namespace uri="http://zorba.io/modules/node-position" |
1035 | 28 | define="ZORBA_NODEPOS_FN_NS" | 28 | define="ZORBA_NODEPOS_FN_NS" |
1037 | 29 | prefix="fn-zorba-pos"/> | 29 | prefix="fn-zorba-pos"/> |
1038 | 30 | 30 | ||
1039 | 31 | <zorba:namespace uri="http://zorba.io/modules/schema" | 31 | <zorba:namespace uri="http://zorba.io/modules/schema" |
1040 | 32 | define="ZORBA_SCHEMA_FN_NS" | 32 | define="ZORBA_SCHEMA_FN_NS" |
1041 | @@ -86,12 +86,12 @@ | |||
1042 | 86 | define="ZORBA_DATETIME_FN_NS" | 86 | define="ZORBA_DATETIME_FN_NS" |
1043 | 87 | prefix="fn-zorba-dateTime"/> | 87 | prefix="fn-zorba-dateTime"/> |
1044 | 88 | 88 | ||
1047 | 89 | <zorba:namespace uri="http://www.zorba-xquery.com/modules/xqdoc" | 89 | <zorba:namespace uri="http://www.zorba-xquery.com/modules/xqdoc" |
1048 | 90 | define="ZORBA_XQDOC_FN_NS" | 90 | define="ZORBA_XQDOC_FN_NS" |
1049 | 91 | prefix="fn-zorba-xqdoc"/> | 91 | prefix="fn-zorba-xqdoc"/> |
1050 | 92 | 92 | ||
1053 | 93 | <zorba:namespace uri="http://zorba.io/modules/random" | 93 | <zorba:namespace uri="http://zorba.io/modules/random" |
1054 | 94 | define="ZORBA_RANDOM_FN_NS" | 94 | define="ZORBA_RANDOM_FN_NS" |
1055 | 95 | prefix="fn-zorba-random"/> | 95 | prefix="fn-zorba-random"/> |
1056 | 96 | 96 | ||
1057 | 97 | <zorba:namespace uri="http://zorba.io/modules/sctx" | 97 | <zorba:namespace uri="http://zorba.io/modules/sctx" |
1058 | @@ -99,7 +99,7 @@ | |||
1059 | 99 | prefix="fn-zorba-sctx"/> | 99 | prefix="fn-zorba-sctx"/> |
1060 | 100 | 100 | ||
1061 | 101 | <zorba:namespace uri="http://www.zorba-xquery.com/modules/reflection" | 101 | <zorba:namespace uri="http://www.zorba-xquery.com/modules/reflection" |
1063 | 102 | define="ZORBA_REFLECTION_FN_NS" | 102 | define="ZORBA_REFLECTION_FN_NS" |
1064 | 103 | prefix="fn-zorba-reflection"/> | 103 | prefix="fn-zorba-reflection"/> |
1065 | 104 | 104 | ||
1066 | 105 | <zorba:namespace uri="http://zorba.io/util-functions" | 105 | <zorba:namespace uri="http://zorba.io/util-functions" |
1067 | @@ -107,35 +107,39 @@ | |||
1068 | 107 | prefix="fn-zorba-util"/> | 107 | prefix="fn-zorba-util"/> |
1069 | 108 | 108 | ||
1070 | 109 | <zorba:namespace uri="http://zorba.io/modules/string" | 109 | <zorba:namespace uri="http://zorba.io/modules/string" |
1072 | 110 | define="ZORBA_STRING_FN_NS" | 110 | define="ZORBA_STRING_FN_NS" |
1073 | 111 | prefix="fn-zorba-string"/> | 111 | prefix="fn-zorba-string"/> |
1074 | 112 | 112 | ||
1075 | 113 | <zorba:namespace uri="http://www.zorba-xquery.com/modules/uri" | 113 | <zorba:namespace uri="http://www.zorba-xquery.com/modules/uri" |
1077 | 114 | define="ZORBA_URI_FN_NS" | 114 | define="ZORBA_URI_FN_NS" |
1078 | 115 | prefix="fn-zorba-uri"/> | 115 | prefix="fn-zorba-uri"/> |
1079 | 116 | 116 | ||
1080 | 117 | <zorba:namespace uri="http://zorba.io/modules/json-csv" | 117 | <zorba:namespace uri="http://zorba.io/modules/json-csv" |
1082 | 118 | define="ZORBA_JSON_CSV_FN_NS" | 118 | define="ZORBA_JSON_CSV_FN_NS" |
1083 | 119 | prefix="fn-zorba-csv"/> | 119 | prefix="fn-zorba-csv"/> |
1084 | 120 | 120 | ||
1085 | 121 | <zorba:namespace uri="http://zorba.io/modules/json-xml" | 121 | <zorba:namespace uri="http://zorba.io/modules/json-xml" |
1087 | 122 | define="ZORBA_JSON_XML_FN_NS" | 122 | define="ZORBA_JSON_XML_FN_NS" |
1088 | 123 | prefix="fn-zorba-json"/> | 123 | prefix="fn-zorba-json"/> |
1089 | 124 | 124 | ||
1090 | 125 | <zorba:namespace uri="http://www.zorba-xquery.com/modules/fetch" | 125 | <zorba:namespace uri="http://www.zorba-xquery.com/modules/fetch" |
1092 | 126 | define="ZORBA_FETCH_FN_NS" | 126 | define="ZORBA_FETCH_FN_NS" |
1093 | 127 | prefix="fn-zorba-fetch"/> | 127 | prefix="fn-zorba-fetch"/> |
1094 | 128 | 128 | ||
1097 | 129 | <zorba:namespace uri="http://zorba.io/modules/node" | 129 | <zorba:namespace uri="http://zorba.io/modules/node" |
1098 | 130 | define="ZORBA_NODE_FN_NS" | 130 | define="ZORBA_NODE_FN_NS" |
1099 | 131 | prefix="fn-zorba-node"/> | 131 | prefix="fn-zorba-node"/> |
1100 | 132 | 132 | ||
1103 | 133 | <zorba:namespace uri="http://zorba.io/modules/item" | 133 | <zorba:namespace uri="http://zorba.io/modules/item" |
1104 | 134 | define="ZORBA_ITEM_FN_NS" | 134 | define="ZORBA_ITEM_FN_NS" |
1105 | 135 | prefix="fn-zorba-item"/> | 135 | prefix="fn-zorba-item"/> |
1107 | 136 | 136 | ||
1108 | 137 | <zorba:namespace uri="http://zorba.io/modules/sequence" | ||
1109 | 138 | define="ZORBA_SEQ_FN_NS" | ||
1110 | 139 | prefix="fn-zorba-seq"/> | ||
1111 | 140 | |||
1112 | 137 | <zorba:namespace uri="http://zorba.io/modules/xml" | 141 | <zorba:namespace uri="http://zorba.io/modules/xml" |
1114 | 138 | define="ZORBA_XML_FN_NS" | 142 | define="ZORBA_XML_FN_NS" |
1115 | 139 | prefix="fn-zorba-xml"/> | 143 | prefix="fn-zorba-xml"/> |
1116 | 140 | 144 | ||
1117 | 141 | <zorba:namespace uri="http://zorba.io/internal/xquery-ops" | 145 | <zorba:namespace uri="http://zorba.io/internal/xquery-ops" |
1118 | @@ -214,7 +218,7 @@ | |||
1119 | 214 | 218 | ||
1120 | 215 | <zorba:type zorbaType="ANY_URI">xs:anyURI</zorba:type> | 219 | <zorba:type zorbaType="ANY_URI">xs:anyURI</zorba:type> |
1121 | 216 | <zorba:type zorbaType="QNAME">xs:QName</zorba:type> | 220 | <zorba:type zorbaType="QNAME">xs:QName</zorba:type> |
1123 | 217 | <zorba:type zorbaType="NOTATION">xs:NOTATION</zorba:type> | 221 | <zorba:type zorbaType="NOTATION">xs:NOTATION</zorba:type> |
1124 | 218 | <zorba:type zorbaType="ANY_FUNCTION">function()</zorba:type> | 222 | <zorba:type zorbaType="ANY_FUNCTION">function()</zorba:type> |
1125 | 219 | <zorba:type zorbaType="STRUCTURED_ITEM">structured-item()</zorba:type> | 223 | <zorba:type zorbaType="STRUCTURED_ITEM">structured-item()</zorba:type> |
1126 | 220 | <zorba:type zorbaType="JSON_ITEM">json-item()</zorba:type> | 224 | <zorba:type zorbaType="JSON_ITEM">json-item()</zorba:type> |
1127 | @@ -235,3 +239,4 @@ | |||
1128 | 235 | --> | 239 | --> |
1129 | 236 | 240 | ||
1130 | 237 | </zorba:mappings> | 241 | </zorba:mappings> |
1131 | 242 | <!-- vim:set et sw=2 ts=2: --> | ||
1132 | 238 | 243 | ||
1133 | === added directory 'src/runtime/spec/seq' | |||
1134 | === added file 'src/runtime/spec/seq/seq.xml' | |||
1135 | --- src/runtime/spec/seq/seq.xml 1970-01-01 00:00:00 +0000 | |||
1136 | +++ src/runtime/spec/seq/seq.xml 2013-10-01 23:33:38 +0000 | |||
1137 | @@ -0,0 +1,65 @@ | |||
1138 | 1 | <?xml version="1.0" encoding="UTF-8"?> | ||
1139 | 2 | |||
1140 | 3 | <zorba:iterators | ||
1141 | 4 | xmlns:zorba="http://www.zorba-xquery.com" | ||
1142 | 5 | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
1143 | 6 | xsi:schemaLocation="http://www.zorba-xquery.com ../runtime.xsd"> | ||
1144 | 7 | |||
1145 | 8 | <zorba:header> | ||
1146 | 9 | <zorba:include form="Quoted">runtime/seq/seq_util.h</zorba:include> | ||
1147 | 10 | </zorba:header> | ||
1148 | 11 | |||
1149 | 12 | <zorba:source> | ||
1150 | 13 | <zorba:include form="Quoted">store/api/iterator.h</zorba:include> | ||
1151 | 14 | </zorba:source> | ||
1152 | 15 | |||
1153 | 16 | <!--========================================================================--> | ||
1154 | 17 | |||
1155 | 18 | <zorba:iterator name="SeqValueIntersectIterator" arity="nary"> | ||
1156 | 19 | <zorba:function> | ||
1157 | 20 | <zorba:signature localname="value-intersect" prefix="fn-zorba-seq"> | ||
1158 | 21 | <zorba:param>xs:anyAtomicType*</zorba:param> | ||
1159 | 22 | <zorba:param>xs:anyAtomicType*</zorba:param> | ||
1160 | 23 | <zorba:output>xs:anyAtomicType*</zorba:output> | ||
1161 | 24 | </zorba:signature> | ||
1162 | 25 | </zorba:function> | ||
1163 | 26 | <zorba:state> | ||
1164 | 27 | <zorba:member type="Item_set_type*" name="set_[2]"/> | ||
1165 | 28 | </zorba:state> | ||
1166 | 29 | </zorba:iterator> | ||
1167 | 30 | |||
1168 | 31 | <!--========================================================================--> | ||
1169 | 32 | |||
1170 | 33 | <zorba:iterator name="SeqValueUnionIterator" arity="nary"> | ||
1171 | 34 | <zorba:function> | ||
1172 | 35 | <zorba:signature localname="value-union" prefix="fn-zorba-seq"> | ||
1173 | 36 | <zorba:param>xs:anyAtomicType*</zorba:param> | ||
1174 | 37 | <zorba:param>xs:anyAtomicType*</zorba:param> | ||
1175 | 38 | <zorba:output>xs:anyAtomicType*</zorba:output> | ||
1176 | 39 | </zorba:signature> | ||
1177 | 40 | </zorba:function> | ||
1178 | 41 | <zorba:state> | ||
1179 | 42 | <zorba:member type="int" name="child_"/> | ||
1180 | 43 | <zorba:member type="Item_set_type*" name="set_"/> | ||
1181 | 44 | </zorba:state> | ||
1182 | 45 | </zorba:iterator> | ||
1183 | 46 | |||
1184 | 47 | <!--========================================================================--> | ||
1185 | 48 | |||
1186 | 49 | <zorba:iterator name="SeqValueExceptIterator" arity="nary"> | ||
1187 | 50 | <zorba:function> | ||
1188 | 51 | <zorba:signature localname="value-except" prefix="fn-zorba-seq"> | ||
1189 | 52 | <zorba:param>xs:anyAtomicType*</zorba:param> | ||
1190 | 53 | <zorba:param>xs:anyAtomicType*</zorba:param> | ||
1191 | 54 | <zorba:output>xs:anyAtomicType*</zorba:output> | ||
1192 | 55 | </zorba:signature> | ||
1193 | 56 | </zorba:function> | ||
1194 | 57 | <zorba:state> | ||
1195 | 58 | <zorba:member type="Item_set_type*" name="set_"/> | ||
1196 | 59 | </zorba:state> | ||
1197 | 60 | </zorba:iterator> | ||
1198 | 61 | |||
1199 | 62 | <!--========================================================================--> | ||
1200 | 63 | |||
1201 | 64 | </zorba:iterators> | ||
1202 | 65 | <!-- vim:set et sw=2 ts=2: --> | ||
1203 | 0 | 66 | ||
1204 | === modified file 'src/runtime/visitors/pregenerated/planiter_visitor.h' | |||
1205 | --- src/runtime/visitors/pregenerated/planiter_visitor.h 2013-10-01 03:25:43 +0000 | |||
1206 | +++ src/runtime/visitors/pregenerated/planiter_visitor.h 2013-10-01 23:33:38 +0000 | |||
1207 | @@ -587,6 +587,12 @@ | |||
1208 | 587 | 587 | ||
1209 | 588 | class SctxXPath10CompatModeIterator; | 588 | class SctxXPath10CompatModeIterator; |
1210 | 589 | 589 | ||
1211 | 590 | class SeqValueIntersectIterator; | ||
1212 | 591 | |||
1213 | 592 | class SeqValueUnionIterator; | ||
1214 | 593 | |||
1215 | 594 | class SeqValueExceptIterator; | ||
1216 | 595 | |||
1217 | 590 | class FnConcatIterator; | 596 | class FnConcatIterator; |
1218 | 591 | 597 | ||
1219 | 592 | class FnIndexOfIterator; | 598 | class FnIndexOfIterator; |
1220 | @@ -1592,6 +1598,15 @@ | |||
1221 | 1592 | virtual void beginVisit ( const SctxXPath10CompatModeIterator& ) = 0; | 1598 | virtual void beginVisit ( const SctxXPath10CompatModeIterator& ) = 0; |
1222 | 1593 | virtual void endVisit ( const SctxXPath10CompatModeIterator& ) = 0; | 1599 | virtual void endVisit ( const SctxXPath10CompatModeIterator& ) = 0; |
1223 | 1594 | 1600 | ||
1224 | 1601 | virtual void beginVisit ( const SeqValueIntersectIterator& ) = 0; | ||
1225 | 1602 | virtual void endVisit ( const SeqValueIntersectIterator& ) = 0; | ||
1226 | 1603 | |||
1227 | 1604 | virtual void beginVisit ( const SeqValueUnionIterator& ) = 0; | ||
1228 | 1605 | virtual void endVisit ( const SeqValueUnionIterator& ) = 0; | ||
1229 | 1606 | |||
1230 | 1607 | virtual void beginVisit ( const SeqValueExceptIterator& ) = 0; | ||
1231 | 1608 | virtual void endVisit ( const SeqValueExceptIterator& ) = 0; | ||
1232 | 1609 | |||
1233 | 1595 | virtual void beginVisit ( const FnConcatIterator& ) = 0; | 1610 | virtual void beginVisit ( const FnConcatIterator& ) = 0; |
1234 | 1596 | virtual void endVisit ( const FnConcatIterator& ) = 0; | 1611 | virtual void endVisit ( const FnConcatIterator& ) = 0; |
1235 | 1597 | 1612 | ||
1236 | 1598 | 1613 | ||
1237 | === modified file 'src/runtime/visitors/pregenerated/printer_visitor.cpp' | |||
1238 | --- src/runtime/visitors/pregenerated/printer_visitor.cpp 2013-10-01 03:25:43 +0000 | |||
1239 | +++ src/runtime/visitors/pregenerated/printer_visitor.cpp 2013-10-01 23:33:38 +0000 | |||
1240 | @@ -67,6 +67,7 @@ | |||
1241 | 67 | #include "runtime/reference/reference.h" | 67 | #include "runtime/reference/reference.h" |
1242 | 68 | #include "runtime/schema/schema.h" | 68 | #include "runtime/schema/schema.h" |
1243 | 69 | #include "runtime/sctx/sctx.h" | 69 | #include "runtime/sctx/sctx.h" |
1244 | 70 | #include "runtime/seq/seq.h" | ||
1245 | 70 | #include "runtime/sequences/sequences.h" | 71 | #include "runtime/sequences/sequences.h" |
1246 | 71 | #include "runtime/store/documents.h" | 72 | #include "runtime/store/documents.h" |
1247 | 72 | #include "runtime/store/maps.h" | 73 | #include "runtime/store/maps.h" |
1248 | @@ -3776,6 +3777,48 @@ | |||
1249 | 3776 | // </SctxXPath10CompatModeIterator> | 3777 | // </SctxXPath10CompatModeIterator> |
1250 | 3777 | 3778 | ||
1251 | 3778 | 3779 | ||
1252 | 3780 | // <SeqValueIntersectIterator> | ||
1253 | 3781 | void PrinterVisitor::beginVisit ( const SeqValueIntersectIterator& a) { | ||
1254 | 3782 | thePrinter.startBeginVisit("SeqValueIntersectIterator", ++theId); | ||
1255 | 3783 | printCommons( &a, theId ); | ||
1256 | 3784 | thePrinter.endBeginVisit( theId ); | ||
1257 | 3785 | } | ||
1258 | 3786 | |||
1259 | 3787 | void PrinterVisitor::endVisit ( const SeqValueIntersectIterator& ) { | ||
1260 | 3788 | thePrinter.startEndVisit(); | ||
1261 | 3789 | thePrinter.endEndVisit(); | ||
1262 | 3790 | } | ||
1263 | 3791 | // </SeqValueIntersectIterator> | ||
1264 | 3792 | |||
1265 | 3793 | |||
1266 | 3794 | // <SeqValueUnionIterator> | ||
1267 | 3795 | void PrinterVisitor::beginVisit ( const SeqValueUnionIterator& a) { | ||
1268 | 3796 | thePrinter.startBeginVisit("SeqValueUnionIterator", ++theId); | ||
1269 | 3797 | printCommons( &a, theId ); | ||
1270 | 3798 | thePrinter.endBeginVisit( theId ); | ||
1271 | 3799 | } | ||
1272 | 3800 | |||
1273 | 3801 | void PrinterVisitor::endVisit ( const SeqValueUnionIterator& ) { | ||
1274 | 3802 | thePrinter.startEndVisit(); | ||
1275 | 3803 | thePrinter.endEndVisit(); | ||
1276 | 3804 | } | ||
1277 | 3805 | // </SeqValueUnionIterator> | ||
1278 | 3806 | |||
1279 | 3807 | |||
1280 | 3808 | // <SeqValueExceptIterator> | ||
1281 | 3809 | void PrinterVisitor::beginVisit ( const SeqValueExceptIterator& a) { | ||
1282 | 3810 | thePrinter.startBeginVisit("SeqValueExceptIterator", ++theId); | ||
1283 | 3811 | printCommons( &a, theId ); | ||
1284 | 3812 | thePrinter.endBeginVisit( theId ); | ||
1285 | 3813 | } | ||
1286 | 3814 | |||
1287 | 3815 | void PrinterVisitor::endVisit ( const SeqValueExceptIterator& ) { | ||
1288 | 3816 | thePrinter.startEndVisit(); | ||
1289 | 3817 | thePrinter.endEndVisit(); | ||
1290 | 3818 | } | ||
1291 | 3819 | // </SeqValueExceptIterator> | ||
1292 | 3820 | |||
1293 | 3821 | |||
1294 | 3779 | // <FnConcatIterator> | 3822 | // <FnConcatIterator> |
1295 | 3780 | void PrinterVisitor::beginVisit ( const FnConcatIterator& a) { | 3823 | void PrinterVisitor::beginVisit ( const FnConcatIterator& a) { |
1296 | 3781 | thePrinter.startBeginVisit("FnConcatIterator", ++theId); | 3824 | thePrinter.startBeginVisit("FnConcatIterator", ++theId); |
1297 | 3782 | 3825 | ||
1298 | === modified file 'src/runtime/visitors/pregenerated/printer_visitor.h' | |||
1299 | --- src/runtime/visitors/pregenerated/printer_visitor.h 2013-10-01 03:25:43 +0000 | |||
1300 | +++ src/runtime/visitors/pregenerated/printer_visitor.h 2013-10-01 23:33:38 +0000 | |||
1301 | @@ -891,6 +891,15 @@ | |||
1302 | 891 | void beginVisit( const SctxXPath10CompatModeIterator& ); | 891 | void beginVisit( const SctxXPath10CompatModeIterator& ); |
1303 | 892 | void endVisit ( const SctxXPath10CompatModeIterator& ); | 892 | void endVisit ( const SctxXPath10CompatModeIterator& ); |
1304 | 893 | 893 | ||
1305 | 894 | void beginVisit( const SeqValueIntersectIterator& ); | ||
1306 | 895 | void endVisit ( const SeqValueIntersectIterator& ); | ||
1307 | 896 | |||
1308 | 897 | void beginVisit( const SeqValueUnionIterator& ); | ||
1309 | 898 | void endVisit ( const SeqValueUnionIterator& ); | ||
1310 | 899 | |||
1311 | 900 | void beginVisit( const SeqValueExceptIterator& ); | ||
1312 | 901 | void endVisit ( const SeqValueExceptIterator& ); | ||
1313 | 902 | |||
1314 | 894 | void beginVisit( const FnConcatIterator& ); | 903 | void beginVisit( const FnConcatIterator& ); |
1315 | 895 | void endVisit ( const FnConcatIterator& ); | 904 | void endVisit ( const FnConcatIterator& ); |
1316 | 896 | 905 | ||
1317 | 897 | 906 | ||
1318 | === modified file 'src/util/stl_util.h' | |||
1319 | --- src/util/stl_util.h 2013-08-23 11:15:04 +0000 | |||
1320 | +++ src/util/stl_util.h 2013-10-01 23:33:38 +0000 | |||
1321 | @@ -102,7 +102,7 @@ | |||
1322 | 102 | }; | 102 | }; |
1323 | 103 | 103 | ||
1324 | 104 | /** | 104 | /** |
1326 | 105 | * Specialization of std::equal_to for C strings. | 105 | * Specialization of ztd::equal_to for C strings. |
1327 | 106 | */ | 106 | */ |
1328 | 107 | template<> | 107 | template<> |
1329 | 108 | struct equal_to<char const*> : | 108 | struct equal_to<char const*> : |
1330 | 109 | 109 | ||
1331 | === added file 'src/zorbautils/specializations.h' | |||
1332 | --- src/zorbautils/specializations.h 1970-01-01 00:00:00 +0000 | |||
1333 | +++ src/zorbautils/specializations.h 2013-10-01 23:33:38 +0000 | |||
1334 | @@ -0,0 +1,46 @@ | |||
1335 | 1 | /* | ||
1336 | 2 | * Copyright 2006-2013 The FLWOR Foundation. | ||
1337 | 3 | * | ||
1338 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); | ||
1339 | 5 | * you may not use this file except in compliance with the License. | ||
1340 | 6 | * You may obtain a copy of the License at | ||
1341 | 7 | * | ||
1342 | 8 | * http://www.apache.org/licenses/LICENSE-2.0 | ||
1343 | 9 | * | ||
1344 | 10 | * Unless required by applicable law or agreed to in writing, software | ||
1345 | 11 | * distributed under the License is distributed on an "AS IS" BASIS, | ||
1346 | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
1347 | 13 | * See the License for the specific language governing permissions and | ||
1348 | 14 | * limitations under the License. | ||
1349 | 15 | */ | ||
1350 | 16 | |||
1351 | 17 | #ifndef ZORBA_SPECIALIZATIONS_H | ||
1352 | 18 | #define ZORBA_SPECIALIZATIONS_H | ||
1353 | 19 | |||
1354 | 20 | #include "store/api/item.h" | ||
1355 | 21 | #include "util/hash/hash.h" | ||
1356 | 22 | |||
1357 | 23 | namespace zorba { | ||
1358 | 24 | namespace ztd { | ||
1359 | 25 | |||
1360 | 26 | /////////////////////////////////////////////////////////////////////////////// | ||
1361 | 27 | |||
1362 | 28 | /** Specialization for <code>store::Item*</code>. */ | ||
1363 | 29 | template<> inline | ||
1364 | 30 | size_t hash<store::Item*>::operator()( store::Item *item ) const { | ||
1365 | 31 | return item->hash(); | ||
1366 | 32 | } | ||
1367 | 33 | |||
1368 | 34 | /** Specialization for <code>store::Item const*</code>. */ | ||
1369 | 35 | template<> inline | ||
1370 | 36 | size_t hash<store::Item const*>::operator()( store::Item const *item ) const { | ||
1371 | 37 | return item->hash(); | ||
1372 | 38 | } | ||
1373 | 39 | |||
1374 | 40 | /////////////////////////////////////////////////////////////////////////////// | ||
1375 | 41 | |||
1376 | 42 | } // namespace ztd | ||
1377 | 43 | } // namespace zorba | ||
1378 | 44 | |||
1379 | 45 | #endif /* ZORBA_SPECIALIZATIONS_H */ | ||
1380 | 46 | /* vim:set et sw=2 ts=2: */ | ||
1381 | 0 | 47 | ||
1382 | === added directory 'test/rbkt/ExpQueryResults/zorba/seq' | |||
1383 | === added file 'test/rbkt/ExpQueryResults/zorba/seq/seq-value-except-01.xml.res' | |||
1384 | --- test/rbkt/ExpQueryResults/zorba/seq/seq-value-except-01.xml.res 1970-01-01 00:00:00 +0000 | |||
1385 | +++ test/rbkt/ExpQueryResults/zorba/seq/seq-value-except-01.xml.res 2013-10-01 23:33:38 +0000 | |||
1386 | @@ -0,0 +1,1 @@ | |||
1387 | 1 | 1 | ||
1388 | 0 | 2 | ||
1389 | === added file 'test/rbkt/ExpQueryResults/zorba/seq/seq-value-intersect-01.xml.res' | |||
1390 | --- test/rbkt/ExpQueryResults/zorba/seq/seq-value-intersect-01.xml.res 1970-01-01 00:00:00 +0000 | |||
1391 | +++ test/rbkt/ExpQueryResults/zorba/seq/seq-value-intersect-01.xml.res 2013-10-01 23:33:38 +0000 | |||
1392 | @@ -0,0 +1,1 @@ | |||
1393 | 1 | 2 3 | ||
1394 | 0 | 2 | ||
1395 | === added file 'test/rbkt/ExpQueryResults/zorba/seq/seq-value-union-01.xml.res' | |||
1396 | --- test/rbkt/ExpQueryResults/zorba/seq/seq-value-union-01.xml.res 1970-01-01 00:00:00 +0000 | |||
1397 | +++ test/rbkt/ExpQueryResults/zorba/seq/seq-value-union-01.xml.res 2013-10-01 23:33:38 +0000 | |||
1398 | @@ -0,0 +1,1 @@ | |||
1399 | 1 | 1 2 3 4 | ||
1400 | 0 | 2 | ||
1401 | === added directory 'test/rbkt/Queries/zorba/seq' | |||
1402 | === added file 'test/rbkt/Queries/zorba/seq/seq-value-except-01.xq' | |||
1403 | --- test/rbkt/Queries/zorba/seq/seq-value-except-01.xq 1970-01-01 00:00:00 +0000 | |||
1404 | +++ test/rbkt/Queries/zorba/seq/seq-value-except-01.xq 2013-10-01 23:33:38 +0000 | |||
1405 | @@ -0,0 +1,7 @@ | |||
1406 | 1 | import module namespace seq = "http://zorba.io/modules/sequence"; | ||
1407 | 2 | |||
1408 | 3 | let $s1 := (1, 1, 2, 3) | ||
1409 | 4 | let $s2 := (2, 3, 3, 4, 4) | ||
1410 | 5 | return seq:value-except( $s1, $s2 ) | ||
1411 | 6 | |||
1412 | 7 | (: vim:set et sw=2 ts=2: :) | ||
1413 | 0 | 8 | ||
1414 | === added file 'test/rbkt/Queries/zorba/seq/seq-value-intersect-01.xq' | |||
1415 | --- test/rbkt/Queries/zorba/seq/seq-value-intersect-01.xq 1970-01-01 00:00:00 +0000 | |||
1416 | +++ test/rbkt/Queries/zorba/seq/seq-value-intersect-01.xq 2013-10-01 23:33:38 +0000 | |||
1417 | @@ -0,0 +1,7 @@ | |||
1418 | 1 | import module namespace seq = "http://zorba.io/modules/sequence"; | ||
1419 | 2 | |||
1420 | 3 | let $s1 := (1, 1, 2, 3) | ||
1421 | 4 | let $s2 := (2, 3, 3, 4, 4) | ||
1422 | 5 | return seq:value-intersect( $s1, $s2 ) | ||
1423 | 6 | |||
1424 | 7 | (: vim:set et sw=2 ts=2: :) | ||
1425 | 0 | 8 | ||
1426 | === added file 'test/rbkt/Queries/zorba/seq/seq-value-union-01.xq' | |||
1427 | --- test/rbkt/Queries/zorba/seq/seq-value-union-01.xq 1970-01-01 00:00:00 +0000 | |||
1428 | +++ test/rbkt/Queries/zorba/seq/seq-value-union-01.xq 2013-10-01 23:33:38 +0000 | |||
1429 | @@ -0,0 +1,7 @@ | |||
1430 | 1 | import module namespace seq = "http://zorba.io/modules/sequence"; | ||
1431 | 2 | |||
1432 | 3 | let $s1 := (1, 1, 2, 3) | ||
1433 | 4 | let $s2 := (2, 3, 3, 4, 4) | ||
1434 | 5 | return seq:value-union( $s1, $s2 ) | ||
1435 | 6 | |||
1436 | 7 | (: vim:set et sw=2 ts=2: :) |
documentation in "Performs TODO"