Merge lp:~zorba-coders/zorba/update3.0_string-module into lp:zorba
- update3.0_string-module
- Merge into trunk
Status: | Merged | ||||
---|---|---|---|---|---|
Approved by: | Matthias Brantner | ||||
Approved revision: | 11536 | ||||
Merged at revision: | 11565 | ||||
Proposed branch: | lp:~zorba-coders/zorba/update3.0_string-module | ||||
Merge into: | lp:zorba | ||||
Diff against target: |
672 lines (+247/-57) 28 files modified
doc/zorba/options.dox (+2/-2) modules/atomic/CMakeLists.txt (+2/-0) modules/atomic/string.xq (+51/-32) modules/com/zorba-xquery/www/modules/CMakeLists.txt (+0/-2) src/context/static_context.cpp (+1/-1) src/functions/pregenerated/func_strings.cpp (+25/-3) src/functions/pregenerated/func_strings.h (+15/-0) src/functions/pregenerated/function_enum.h (+1/-0) src/runtime/pregenerated/iterator_enum.h (+1/-0) src/runtime/spec/mappings.xml (+1/-1) src/runtime/spec/strings/strings.xml (+21/-1) src/runtime/strings/pregenerated/strings.cpp (+28/-0) src/runtime/strings/pregenerated/strings.h (+32/-0) src/runtime/strings/strings_impl.cpp (+28/-4) src/runtime/visitors/pregenerated/planiter_visitor.h (+5/-0) src/runtime/visitors/pregenerated/printer_visitor.cpp (+14/-0) src/runtime/visitors/pregenerated/printer_visitor.h (+3/-0) test/rbkt/ExpQueryResults/zorba/string/is-seekable.xml.res (+1/-0) test/rbkt/Queries/zorba/fetch/fetch_seekable.xq (+1/-1) test/rbkt/Queries/zorba/file/streamability1.xq (+2/-3) test/rbkt/Queries/zorba/file/streamability2.xq (+1/-1) test/rbkt/Queries/zorba/file/streamability3.xq (+1/-1) test/rbkt/Queries/zorba/string/AnalyzeString/http-client-doc.htm (+1/-1) test/rbkt/Queries/zorba/string/is-seekable.xq (+6/-0) test/rbkt/Queries/zorba/string/tokenize01.xq (+1/-1) test/rbkt/Queries/zorba/string/tokenize02.xq (+1/-1) test/rbkt/Queries/zorba/string/tokenize03.xq (+1/-1) test/rbkt/Queries/zorba/string/tokenize04.xq (+1/-1) |
||||
To merge this branch: | bzr merge lp:~zorba-coders/zorba/update3.0_string-module | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Matthias Brantner | Approve | ||
Chris Hillery | Approve | ||
Review via email: mp+171376@code.launchpad.net |
Commit message
Updated String module to Zorba 3.0 format.
Description of the change
Updated String module to Zorba 3.0 format.
- 11528. By Juan Zacarias
-
Merged with trunk
Matthias Brantner (matthias-brantner) wrote : | # |
Matthias Brantner (matthias-brantner) wrote : | # |
- Shouldn't the module be in version 1.0?
- I forgot what the final decision was but I thought that modules should be pure JSONiq if possible. This would be a perfect candidate in which case all the types should be changed (i.e. xs prefix removed).
- Can we make the link to the module in options.dox refer to zorba.io?
- I know that it's unrelated to the change but the example using file:read-text in the materialize function doesn't make sense anymore. Because read-text returns a seekable string it can be consumed more than once. The http-client would be the right example. Also, a is-seekable function would be great to have.
Chris Hillery (ceejatec) wrote : | # |
Per conf call today: yes, convert this to "pure JSONiq". That means, at least, having the "jsoniq" version declaration in the module, and eliminating the xs: prefix from all signatures. Not sure if anything else needs to be (or can be) done.
For the time being the file extension should remain .xq.
Juan Zacarias (juan457) wrote : | # |
All the changes were addressed except for
-I know that it's unrelated to the change but the example using file:read-text in the materialize function doesn't make sense anymore. Because read-text returns a seekable string it can be consumed more than once. The http-client would be the right example. Also, a is-seekable function would be great to have.
Should I do this change?
Chris Hillery (ceejatec) wrote : | # |
Discussed with Juan - the is-seekable() function should be easy enough to add, so sure, let's do it.
- 11529. By Juan Zacarias
-
merge with trunk
- 11530. By Juan Zacarias
-
Finishing touches for the "jsonification" of the string module.
- 11531. By Juan Zacarias
-
Added the function is-seekable to the string module.
- 11532. By Juan Zacarias
-
Added a test for the string is-seekable function.
Juan Zacarias (juan457) wrote : | # |
Added the implementation of the is-seekable function in the string module.
Also removed the materialize from the test since it was doing nothing, since it returns a seekable stream by the file function read-text.
Chris Hillery (ceejatec) : | # |
Chris Hillery (ceejatec) wrote : | # |
FYI, I moved the string module into the new modules/atomic directory. Also fixed the version number in DECLARE_
- 11533. By Chris Hillery
-
Merge from trunk.
- 11534. By Chris Hillery
-
Move string module into modules/atomic.
- 11535. By Chris Hillery
-
Fixed is-seekable test.
- 11536. By Matthias Brantner
-
improved documentation
Matthias Brantner (matthias-brantner) : | # |
Zorba Build Bot (zorba-buildbot) wrote : | # |
Validation queue starting for the following merge proposals:
https:/
Progress dashboard at http://
Zorba Build Bot (zorba-buildbot) wrote : | # |
Validation queue result for https:/
Stage "TestZorbaUbuntu" failed.
13 tests failed (8416 total tests run).
Check test results at http://
Zorba Build Bot (zorba-buildbot) wrote : | # |
Validation queue starting for the following merge proposals:
https:/
Progress dashboard at http://
Zorba Build Bot (zorba-buildbot) wrote : | # |
Validation queue succeeded - proposal merged!
Preview Diff
1 | === modified file 'doc/zorba/options.dox' |
2 | --- doc/zorba/options.dox 2013-06-25 03:55:20 +0000 |
3 | +++ doc/zorba/options.dox 2013-07-26 18:57:32 +0000 |
4 | @@ -375,11 +375,11 @@ |
5 | |
6 | However, the disadvantage is that a streamable string can only be consumed exactly once. |
7 | If a streamable string is consumed more than once, an error is raised. |
8 | -In order to enable multiple consumers of a streamable string, the materialize function of the string module (<a href="http://www.zorba-xquery.com/html/modules/zorba/xdm/atomic/string">http://www.zorba-xquery.com/modules/string</a>) should be used to materialize the entire contents in an (regular) xs:string item. |
9 | +In order to enable multiple consumers of a streamable string, the materialize function of the string module (<a href="http://zorba.io/html/modules/zorba/xdm/atomic/string">http://zorba.io/modules/string</a>) should be used to materialize the entire contents in an (regular) xs:string item. |
10 | |
11 | \code |
12 | import module namespace file = "http://expath.org/ns/file"; |
13 | -import module namespace string = "http://www.zorba-xquery.com/modules/string"; |
14 | +import module namespace string = "http://zorba.io/modules/string"; |
15 | |
16 | let $x := string:materialize(file:read-text("myfile.txt"))) |
17 | return ($x, $x) |
18 | |
19 | === modified file 'modules/atomic/CMakeLists.txt' |
20 | --- modules/atomic/CMakeLists.txt 2013-07-17 15:53:51 +0000 |
21 | +++ modules/atomic/CMakeLists.txt 2013-07-26 18:57:32 +0000 |
22 | @@ -18,3 +18,5 @@ |
23 | URI "http://zorba.io/modules/random") |
24 | DECLARE_ZORBA_MODULE(FILE base64.xq VERSION 1.0 |
25 | URI "http://zorba.io/modules/base64") |
26 | +DECLARE_ZORBA_MODULE(FILE string.xq VERSION 1.0 |
27 | + URI "http://zorba.io/modules/string") |
28 | |
29 | === renamed file 'modules/com/zorba-xquery/www/modules/string.xq' => 'modules/atomic/string.xq' |
30 | --- modules/com/zorba-xquery/www/modules/string.xq 2013-06-15 16:20:18 +0000 |
31 | +++ modules/atomic/string.xq 2013-07-26 18:57:32 +0000 |
32 | @@ -1,4 +1,4 @@ |
33 | -xquery version "1.0"; |
34 | +jsoniq version "1.0"; |
35 | |
36 | (: |
37 | : Copyright 2006-2009 The FLWOR Foundation. |
38 | @@ -17,26 +17,31 @@ |
39 | :) |
40 | |
41 | (:~ |
42 | - : This module provides string related functions. |
43 | + : <p>This module provides string related functions.</p> |
44 | + : |
45 | + : <p>Mostly, the functions in this module provide primitives |
46 | + : to work with streamable strings. For example, it allows to |
47 | + : check whether a given string is streamable or seekable.</p> |
48 | : |
49 | : @author Matthias Brantner |
50 | : @project Zorba/XQuery Data Model/Atomic/String |
51 | : |
52 | :) |
53 | -module namespace string = "http://www.zorba-xquery.com/modules/string"; |
54 | +module namespace string = "http://zorba.io/modules/string"; |
55 | declare namespace ver = "http://www.zorba-xquery.com/options/versioning"; |
56 | -declare option ver:module-version "2.1"; |
57 | +declare option ver:module-version "1.0"; |
58 | |
59 | (:~ |
60 | - : This function materializes a streamable string. |
61 | - : The drawback of a streamable string is that its value can only |
62 | - : be consumed once. That is, only one function can access the value |
63 | - : of a streamable string item. |
64 | - : |
65 | - : In order to remedy this situation, this function can be used to |
66 | + : <p>This function materializes a streamable string.</p> |
67 | + : |
68 | + : <p>The drawback of a streamable (non-seekable) string is that |
69 | + : its value can only be consumed once. That is, only one function |
70 | + : can access the value of astreamable string item.</p> |
71 | + : |
72 | + : <p>In order to remedy this situation, this function can be used to |
73 | : convert a streamable string into its non-streamable counterpart. As a |
74 | : result, the string returned by this function has the same value as its |
75 | - : input but is materialized and, hence, can be consumed multiple times. |
76 | + : input but is materialized and, hence, can be consumed multiple times.</p> |
77 | : |
78 | : @param $s the streamable string item to materialize |
79 | : @return a materialized string of its input or the input if the input |
80 | @@ -46,34 +51,48 @@ |
81 | : @see <a href="expath.org_ns_file.html#read-text-1">file:read-text#1</a> |
82 | : @see <a href="expath.org_ns_file.html#read-text-2">file:read-text#2</a> |
83 | :) |
84 | -declare function string:materialize($s as xs:string) as xs:string external; |
85 | +declare function string:materialize($s as string) as string external; |
86 | |
87 | (:~ |
88 | - : This function checks whether a given string item is implemented by a |
89 | - : streamable string. |
90 | - : A streamable string is produced by some functions of a module |
91 | - : (e.g. file:read-text()). It's an optimized implementation of an |
92 | - : xs:string to handle arbitrary sized data. The drawback is that |
93 | - : its value can only be consumed once. That is, only one function |
94 | - : can access the value of a streamable string item. |
95 | + : <p>This function checks whether a given string item is implemented by a |
96 | + : streamable string.</p> |
97 | + : |
98 | + : <p>A streamable string is produced by some functions of a module. |
99 | + : It's an optimized implementation of an string to handle arbitrary |
100 | + : sized data. The drawback is that its value can only be consumed once. |
101 | + : That is, only one function can access the value of a streamable string |
102 | + : item.</p> |
103 | : |
104 | : @param $s the string to check |
105 | + : |
106 | : @return true if the given item is implemented using a streamable string |
107 | : or false otherwise. |
108 | - : |
109 | - :) |
110 | -declare function string:is-streamable($s as xs:string) as xs:boolean external; |
111 | - |
112 | -(:~ |
113 | - : Returns a sequence of strings constructed by splitting the input wherever the given |
114 | - : separator is found. |
115 | - : |
116 | - : The function is different from fn:tokenize. It doesn't allow |
117 | + :) |
118 | +declare function string:is-streamable($s as string) as boolean external; |
119 | + |
120 | +(:~ |
121 | + : <p>This function checks whether a given string item is a |
122 | + : seekable stream string.</p> |
123 | + : |
124 | + : <p>For example, a seekable streamable string is returned by the |
125 | + : file module.</p> |
126 | + : |
127 | + : @param $s the string to check |
128 | + : |
129 | + : @return true if the given item is a seekable stream string |
130 | + : or false otherwise. |
131 | + :) |
132 | +declare function string:is-seekable($s as string) as boolean external; |
133 | + |
134 | +(:~ |
135 | + : <p>Returns a sequence of strings constructed by splitting the input wherever |
136 | + : the given separator is found.</p> |
137 | + : |
138 | + : <p>The function is different from tokenize. It doesn't allow |
139 | : the separator to be a regular expression. This restriction allows for more |
140 | : performant implementation. Specifically, the function processes |
141 | : streamable strings as input in a streamable way which is particularly useful |
142 | - : to tokenize huge strings (e.g. if returned by the file module's read-text |
143 | - : function). |
144 | + : to tokenize huge strings.</p> |
145 | : |
146 | : @param $s the input string to split |
147 | : @param $separator the separator used for splitting the input string $s |
148 | @@ -81,5 +100,5 @@ |
149 | : @return a sequence of strings constructed by splitting the input |
150 | :) |
151 | declare function string:split( |
152 | - $s as xs:string, |
153 | - $separator as xs:string) as xs:string* external; |
154 | + $s as string, |
155 | + $separator as string) as string* external; |
156 | |
157 | === modified file 'modules/com/zorba-xquery/www/modules/CMakeLists.txt' |
158 | --- modules/com/zorba-xquery/www/modules/CMakeLists.txt 2013-07-19 17:38:21 +0000 |
159 | +++ modules/com/zorba-xquery/www/modules/CMakeLists.txt 2013-07-26 18:57:32 +0000 |
160 | @@ -29,8 +29,6 @@ |
161 | URI "http://www.zorba-xquery.com/modules/reflection") |
162 | DECLARE_ZORBA_MODULE(FILE schema.xq VERSION 2.0 |
163 | URI "http://www.zorba-xquery.com/modules/schema") |
164 | -DECLARE_ZORBA_MODULE(FILE string.xq VERSION 2.1 |
165 | - URI "http://www.zorba-xquery.com/modules/string") |
166 | DECLARE_ZORBA_SCHEMA(FILE xml-options.xsd |
167 | URI "http://www.zorba-xquery.com/modules/xml-options") |
168 | DECLARE_ZORBA_MODULE(FILE uri.xq VERSION 1.0 |
169 | |
170 | === modified file 'src/context/static_context.cpp' |
171 | --- src/context/static_context.cpp 2013-07-25 09:30:55 +0000 |
172 | +++ src/context/static_context.cpp 2013-07-26 18:57:32 +0000 |
173 | @@ -453,7 +453,7 @@ |
174 | |
175 | const char* |
176 | static_context::ZORBA_STRING_FN_NS = |
177 | -"http://www.zorba-xquery.com/modules/string"; |
178 | +"http://zorba.io/modules/string"; |
179 | |
180 | const char* |
181 | static_context::ZORBA_URI_FN_NS = |
182 | |
183 | === modified file 'src/functions/pregenerated/func_strings.cpp' |
184 | --- src/functions/pregenerated/func_strings.cpp 2013-03-05 23:11:50 +0000 |
185 | +++ src/functions/pregenerated/func_strings.cpp 2013-07-26 18:57:32 +0000 |
186 | @@ -320,6 +320,16 @@ |
187 | return new StringIsStreamableIterator(sctx, loc, argv); |
188 | } |
189 | |
190 | +PlanIter_t fn_zorba_string_is_seekable::codegen( |
191 | + CompilerCB*, |
192 | + static_context* sctx, |
193 | + const QueryLoc& loc, |
194 | + std::vector<PlanIter_t>& argv, |
195 | + expr& ann) const |
196 | +{ |
197 | + return new StringIsSeekableIterator(sctx, loc, argv); |
198 | +} |
199 | + |
200 | PlanIter_t fn_zorba_string_split::codegen( |
201 | CompilerCB*, |
202 | static_context* sctx, |
203 | @@ -854,7 +864,7 @@ |
204 | |
205 | { |
206 | DECL_WITH_KIND(sctx, fn_zorba_string_materialize, |
207 | - (createQName("http://www.zorba-xquery.com/modules/string","","materialize"), |
208 | + (createQName("http://zorba.io/modules/string","","materialize"), |
209 | GENV_TYPESYSTEM.STRING_TYPE_ONE, |
210 | GENV_TYPESYSTEM.STRING_TYPE_ONE), |
211 | FunctionConsts::FN_ZORBA_STRING_MATERIALIZE_1); |
212 | @@ -866,7 +876,7 @@ |
213 | |
214 | { |
215 | DECL_WITH_KIND(sctx, fn_zorba_string_is_streamable, |
216 | - (createQName("http://www.zorba-xquery.com/modules/string","","is-streamable"), |
217 | + (createQName("http://zorba.io/modules/string","","is-streamable"), |
218 | GENV_TYPESYSTEM.STRING_TYPE_ONE, |
219 | GENV_TYPESYSTEM.BOOLEAN_TYPE_ONE), |
220 | FunctionConsts::FN_ZORBA_STRING_IS_STREAMABLE_1); |
221 | @@ -877,8 +887,20 @@ |
222 | |
223 | |
224 | { |
225 | + DECL_WITH_KIND(sctx, fn_zorba_string_is_seekable, |
226 | + (createQName("http://zorba.io/modules/string","","is-seekable"), |
227 | + GENV_TYPESYSTEM.STRING_TYPE_ONE, |
228 | + GENV_TYPESYSTEM.BOOLEAN_TYPE_ONE), |
229 | + FunctionConsts::FN_ZORBA_STRING_IS_SEEKABLE_1); |
230 | + |
231 | + } |
232 | + |
233 | + |
234 | + |
235 | + |
236 | + { |
237 | DECL_WITH_KIND(sctx, fn_zorba_string_split, |
238 | - (createQName("http://www.zorba-xquery.com/modules/string","","split"), |
239 | + (createQName("http://zorba.io/modules/string","","split"), |
240 | GENV_TYPESYSTEM.STRING_TYPE_ONE, |
241 | GENV_TYPESYSTEM.STRING_TYPE_ONE, |
242 | GENV_TYPESYSTEM.STRING_TYPE_STAR), |
243 | |
244 | === modified file 'src/functions/pregenerated/func_strings.h' |
245 | --- src/functions/pregenerated/func_strings.h 2013-03-05 23:11:50 +0000 |
246 | +++ src/functions/pregenerated/func_strings.h 2013-07-26 18:57:32 +0000 |
247 | @@ -481,6 +481,21 @@ |
248 | }; |
249 | |
250 | |
251 | +//fn-zorba-string:is-seekable |
252 | +class fn_zorba_string_is_seekable : public function |
253 | +{ |
254 | +public: |
255 | + fn_zorba_string_is_seekable(const signature& sig, FunctionConsts::FunctionKind kind) |
256 | + : |
257 | + function(sig, kind) |
258 | + { |
259 | + |
260 | + } |
261 | + |
262 | + CODEGEN_DECL(); |
263 | +}; |
264 | + |
265 | + |
266 | //fn-zorba-string:split |
267 | class fn_zorba_string_split : public function |
268 | { |
269 | |
270 | === modified file 'src/functions/pregenerated/function_enum.h' |
271 | --- src/functions/pregenerated/function_enum.h 2013-07-11 00:46:02 +0000 |
272 | +++ src/functions/pregenerated/function_enum.h 2013-07-26 18:57:32 +0000 |
273 | @@ -503,6 +503,7 @@ |
274 | FN_ANALYZE_STRING_3, |
275 | FN_ZORBA_STRING_MATERIALIZE_1, |
276 | FN_ZORBA_STRING_IS_STREAMABLE_1, |
277 | + FN_ZORBA_STRING_IS_SEEKABLE_1, |
278 | FN_ZORBA_STRING_SPLIT_2, |
279 | FN_ZORBA_URI_DECODE_3, |
280 | FN_ZORBA_URI_PARSE_1, |
281 | |
282 | === modified file 'src/runtime/pregenerated/iterator_enum.h' |
283 | --- src/runtime/pregenerated/iterator_enum.h 2013-07-11 00:46:02 +0000 |
284 | +++ src/runtime/pregenerated/iterator_enum.h 2013-07-26 18:57:32 +0000 |
285 | @@ -369,6 +369,7 @@ |
286 | TYPE_FnAnalyzeStringIterator, |
287 | TYPE_StringMaterializeIterator, |
288 | TYPE_StringIsStreamableIterator, |
289 | + TYPE_StringIsSeekableIterator, |
290 | TYPE_StringSplitIterator, |
291 | TYPE_DecodeURIIterator, |
292 | TYPE_ParseURIIterator, |
293 | |
294 | === modified file 'src/runtime/spec/mappings.xml' |
295 | --- src/runtime/spec/mappings.xml 2013-07-17 15:48:38 +0000 |
296 | +++ src/runtime/spec/mappings.xml 2013-07-26 18:57:32 +0000 |
297 | @@ -110,7 +110,7 @@ |
298 | define="ZORBA_UTIL_FN_NS" |
299 | prefix="fn-zorba-util"/> |
300 | |
301 | - <zorba:namespace uri="http://www.zorba-xquery.com/modules/string" |
302 | + <zorba:namespace uri="http://zorba.io/modules/string" |
303 | define="ZORBA_STRING_FN_NS" |
304 | prefix="fn-zorba-string"/> |
305 | |
306 | |
307 | === modified file 'src/runtime/spec/strings/strings.xml' |
308 | --- src/runtime/spec/strings/strings.xml 2013-02-07 17:24:36 +0000 |
309 | +++ src/runtime/spec/strings/strings.xml 2013-07-26 18:57:32 +0000 |
310 | @@ -687,7 +687,7 @@ |
311 | |
312 | <!-- |
313 | /******************************************************************************* |
314 | - * http://www.zorba-xquery.com/modules/string |
315 | + * http://zorba.io/modules/string |
316 | ********************************************************************************/ |
317 | --> |
318 | <!-- |
319 | @@ -732,6 +732,26 @@ |
320 | |
321 | <!-- |
322 | /******************************************************************************* |
323 | + * string:is-seekable |
324 | +********************************************************************************/ |
325 | +--> |
326 | +<zorba:iterator name="StringIsSeekableIterator"> |
327 | + |
328 | + <zorba:description author="Zorba Team"> |
329 | + string:is-seekable |
330 | + </zorba:description> |
331 | + |
332 | + <zorba:function> |
333 | + <zorba:signature localname="is-seekable" prefix="fn-zorba-string"> |
334 | + <zorba:param>xs:string</zorba:param> |
335 | + <zorba:output>xs:boolean</zorba:output> |
336 | + </zorba:signature> |
337 | + </zorba:function> |
338 | + |
339 | +</zorba:iterator> |
340 | + |
341 | +<!-- |
342 | +/******************************************************************************* |
343 | * string:tokenize |
344 | ********************************************************************************/ |
345 | --> |
346 | |
347 | === modified file 'src/runtime/strings/pregenerated/strings.cpp' |
348 | --- src/runtime/strings/pregenerated/strings.cpp 2013-03-05 23:11:50 +0000 |
349 | +++ src/runtime/strings/pregenerated/strings.cpp 2013-07-26 18:57:32 +0000 |
350 | @@ -830,6 +830,34 @@ |
351 | // </StringIsStreamableIterator> |
352 | |
353 | |
354 | +// <StringIsSeekableIterator> |
355 | +SERIALIZABLE_CLASS_VERSIONS(StringIsSeekableIterator) |
356 | + |
357 | +void StringIsSeekableIterator::serialize(::zorba::serialization::Archiver& ar) |
358 | +{ |
359 | + serialize_baseclass(ar, |
360 | + (NaryBaseIterator<StringIsSeekableIterator, PlanIteratorState>*)this); |
361 | +} |
362 | + |
363 | + |
364 | +void StringIsSeekableIterator::accept(PlanIterVisitor& v) const |
365 | +{ |
366 | + v.beginVisit(*this); |
367 | + |
368 | + std::vector<PlanIter_t>::const_iterator lIter = theChildren.begin(); |
369 | + std::vector<PlanIter_t>::const_iterator lEnd = theChildren.end(); |
370 | + for ( ; lIter != lEnd; ++lIter ){ |
371 | + (*lIter)->accept(v); |
372 | + } |
373 | + |
374 | + v.endVisit(*this); |
375 | +} |
376 | + |
377 | +StringIsSeekableIterator::~StringIsSeekableIterator() {} |
378 | + |
379 | +// </StringIsSeekableIterator> |
380 | + |
381 | + |
382 | // <StringSplitIterator> |
383 | SERIALIZABLE_CLASS_VERSIONS(StringSplitIterator) |
384 | |
385 | |
386 | === modified file 'src/runtime/strings/pregenerated/strings.h' |
387 | --- src/runtime/strings/pregenerated/strings.h 2013-03-05 23:11:50 +0000 |
388 | +++ src/runtime/strings/pregenerated/strings.h 2013-07-26 18:57:32 +0000 |
389 | @@ -966,6 +966,38 @@ |
390 | |
391 | /** |
392 | * |
393 | + * string:is-seekable |
394 | + * |
395 | + * Author: Zorba Team |
396 | + */ |
397 | +class StringIsSeekableIterator : public NaryBaseIterator<StringIsSeekableIterator, PlanIteratorState> |
398 | +{ |
399 | +public: |
400 | + SERIALIZABLE_CLASS(StringIsSeekableIterator); |
401 | + |
402 | + SERIALIZABLE_CLASS_CONSTRUCTOR2T(StringIsSeekableIterator, |
403 | + NaryBaseIterator<StringIsSeekableIterator, PlanIteratorState>); |
404 | + |
405 | + void serialize( ::zorba::serialization::Archiver& ar); |
406 | + |
407 | + StringIsSeekableIterator( |
408 | + static_context* sctx, |
409 | + const QueryLoc& loc, |
410 | + std::vector<PlanIter_t>& children) |
411 | + : |
412 | + NaryBaseIterator<StringIsSeekableIterator, PlanIteratorState>(sctx, loc, children) |
413 | + {} |
414 | + |
415 | + virtual ~StringIsSeekableIterator(); |
416 | + |
417 | + void accept(PlanIterVisitor& v) const; |
418 | + |
419 | + bool nextImpl(store::Item_t& result, PlanState& aPlanState) const; |
420 | +}; |
421 | + |
422 | + |
423 | +/** |
424 | + * |
425 | * string:split |
426 | * |
427 | * Author: Matthias Brantner |
428 | |
429 | === modified file 'src/runtime/strings/strings_impl.cpp' |
430 | --- src/runtime/strings/strings_impl.cpp 2013-07-01 18:59:06 +0000 |
431 | +++ src/runtime/strings/strings_impl.cpp 2013-07-26 18:57:32 +0000 |
432 | @@ -2271,11 +2271,10 @@ |
433 | STACK_END(state); |
434 | } |
435 | |
436 | - |
437 | /** |
438 | *______________________________________________________________________ |
439 | * |
440 | - * http://www.zorba-xquery.com/modules/string |
441 | + * http://zorba.io/modules/string |
442 | * string:materialize |
443 | */ |
444 | |
445 | @@ -2308,7 +2307,7 @@ |
446 | /** |
447 | *______________________________________________________________________ |
448 | * |
449 | - * http://www.zorba-xquery.com/modules/string |
450 | + * http://zorba.io/modules/string |
451 | * string:materialize |
452 | */ |
453 | bool StringIsStreamableIterator::nextImpl( |
454 | @@ -2333,7 +2332,32 @@ |
455 | /** |
456 | *______________________________________________________________________ |
457 | * |
458 | - * http://www.zorba-xquery.com/modules/string |
459 | + * http://zorba.io/modules/string |
460 | + * string:is-seekable |
461 | + */ |
462 | +bool StringIsSeekableIterator::nextImpl( |
463 | + store::Item_t& result, |
464 | + PlanState& planState) const |
465 | +{ |
466 | + store::Item_t item; |
467 | + |
468 | + PlanIteratorState* state; |
469 | + DEFAULT_STACK_INIT(PlanIteratorState, state, planState); |
470 | + |
471 | +#ifndef NDEBUG |
472 | + assert(consumeNext(item, theChildren[0].getp(), planState)); |
473 | +#else |
474 | + consumeNext(item, theChildren[0].getp(), planState); |
475 | +#endif |
476 | + STACK_PUSH(GENV_ITEMFACTORY->createBoolean(result, item->isSeekable()), state); |
477 | + |
478 | + STACK_END(state); |
479 | +} |
480 | + |
481 | +/** |
482 | + *______________________________________________________________________ |
483 | + * |
484 | + * http://zorba.io/modules/string |
485 | * string:split |
486 | */ |
487 | bool StringSplitIterator::nextImpl( |
488 | |
489 | === modified file 'src/runtime/visitors/pregenerated/planiter_visitor.h' |
490 | --- src/runtime/visitors/pregenerated/planiter_visitor.h 2013-07-11 00:46:02 +0000 |
491 | +++ src/runtime/visitors/pregenerated/planiter_visitor.h 2013-07-26 18:57:32 +0000 |
492 | @@ -745,6 +745,8 @@ |
493 | |
494 | class StringIsStreamableIterator; |
495 | |
496 | + class StringIsSeekableIterator; |
497 | + |
498 | class StringSplitIterator; |
499 | |
500 | class DecodeURIIterator; |
501 | @@ -1829,6 +1831,9 @@ |
502 | virtual void beginVisit ( const StringIsStreamableIterator& ) = 0; |
503 | virtual void endVisit ( const StringIsStreamableIterator& ) = 0; |
504 | |
505 | + virtual void beginVisit ( const StringIsSeekableIterator& ) = 0; |
506 | + virtual void endVisit ( const StringIsSeekableIterator& ) = 0; |
507 | + |
508 | virtual void beginVisit ( const StringSplitIterator& ) = 0; |
509 | virtual void endVisit ( const StringSplitIterator& ) = 0; |
510 | |
511 | |
512 | === modified file 'src/runtime/visitors/pregenerated/printer_visitor.cpp' |
513 | --- src/runtime/visitors/pregenerated/printer_visitor.cpp 2013-07-11 00:46:02 +0000 |
514 | +++ src/runtime/visitors/pregenerated/printer_visitor.cpp 2013-07-26 18:57:32 +0000 |
515 | @@ -4884,6 +4884,20 @@ |
516 | // </StringIsStreamableIterator> |
517 | |
518 | |
519 | +// <StringIsSeekableIterator> |
520 | +void PrinterVisitor::beginVisit ( const StringIsSeekableIterator& a) { |
521 | + thePrinter.startBeginVisit("StringIsSeekableIterator", ++theId); |
522 | + printCommons( &a, theId ); |
523 | + thePrinter.endBeginVisit( theId ); |
524 | +} |
525 | + |
526 | +void PrinterVisitor::endVisit ( const StringIsSeekableIterator& ) { |
527 | + thePrinter.startEndVisit(); |
528 | + thePrinter.endEndVisit(); |
529 | +} |
530 | +// </StringIsSeekableIterator> |
531 | + |
532 | + |
533 | // <StringSplitIterator> |
534 | void PrinterVisitor::beginVisit ( const StringSplitIterator& a) { |
535 | thePrinter.startBeginVisit("StringSplitIterator", ++theId); |
536 | |
537 | === modified file 'src/runtime/visitors/pregenerated/printer_visitor.h' |
538 | --- src/runtime/visitors/pregenerated/printer_visitor.h 2013-07-11 00:46:02 +0000 |
539 | +++ src/runtime/visitors/pregenerated/printer_visitor.h 2013-07-26 18:57:32 +0000 |
540 | @@ -1128,6 +1128,9 @@ |
541 | void beginVisit( const StringIsStreamableIterator& ); |
542 | void endVisit ( const StringIsStreamableIterator& ); |
543 | |
544 | + void beginVisit( const StringIsSeekableIterator& ); |
545 | + void endVisit ( const StringIsSeekableIterator& ); |
546 | + |
547 | void beginVisit( const StringSplitIterator& ); |
548 | void endVisit ( const StringSplitIterator& ); |
549 | |
550 | |
551 | === added file 'test/rbkt/ExpQueryResults/zorba/string/is-seekable.xml.res' |
552 | --- test/rbkt/ExpQueryResults/zorba/string/is-seekable.xml.res 1970-01-01 00:00:00 +0000 |
553 | +++ test/rbkt/ExpQueryResults/zorba/string/is-seekable.xml.res 2013-07-26 18:57:32 +0000 |
554 | @@ -0,0 +1,1 @@ |
555 | +true false |
556 | |
557 | === modified file 'test/rbkt/Queries/zorba/fetch/fetch_seekable.xq' |
558 | --- test/rbkt/Queries/zorba/fetch/fetch_seekable.xq 2012-05-09 21:48:57 +0000 |
559 | +++ test/rbkt/Queries/zorba/fetch/fetch_seekable.xq 2013-07-26 18:57:32 +0000 |
560 | @@ -1,6 +1,6 @@ |
561 | import module namespace fetch = "http://www.zorba-xquery.com/modules/fetch"; |
562 | |
563 | -import module namespace s = "http://www.zorba-xquery.com/modules/string"; |
564 | +import module namespace s = "http://zorba.io/modules/string"; |
565 | |
566 | (: make sure the returned string is streamable and can be consumed twice, i.e. is seekable :) |
567 | let $x := fetch:content(fn:resolve-uri("iso-8859-1.txt")) |
568 | |
569 | === modified file 'test/rbkt/Queries/zorba/file/streamability1.xq' |
570 | --- test/rbkt/Queries/zorba/file/streamability1.xq 2013-02-07 17:24:36 +0000 |
571 | +++ test/rbkt/Queries/zorba/file/streamability1.xq 2013-07-26 18:57:32 +0000 |
572 | @@ -1,8 +1,7 @@ |
573 | import module namespace file = "http://expath.org/ns/file"; |
574 | -import module namespace string = "http://www.zorba-xquery.com/modules/string"; |
575 | +import module namespace string = "http://zorba.io/modules/string"; |
576 | |
577 | declare variable $rbktPath as xs:string external; |
578 | |
579 | -(: test materialization of a streamable string :) |
580 | -let $x := string:materialize(file:read-text(concat($rbktPath, "/Queries/zorba/file/sample_files/sample.txt"))) |
581 | +let $x := file:read-text(concat($rbktPath, "/Queries/zorba/file/sample_files/sample.txt")) |
582 | return ($x, $x) |
583 | |
584 | === modified file 'test/rbkt/Queries/zorba/file/streamability2.xq' |
585 | --- test/rbkt/Queries/zorba/file/streamability2.xq 2013-02-07 17:24:36 +0000 |
586 | +++ test/rbkt/Queries/zorba/file/streamability2.xq 2013-07-26 18:57:32 +0000 |
587 | @@ -1,5 +1,5 @@ |
588 | import module namespace file = "http://expath.org/ns/file"; |
589 | -import module namespace string = "http://www.zorba-xquery.com/modules/string"; |
590 | +import module namespace string = "http://zorba.io/modules/string"; |
591 | |
592 | declare variable $rbktPath as xs:string external; |
593 | |
594 | |
595 | === modified file 'test/rbkt/Queries/zorba/file/streamability3.xq' |
596 | --- test/rbkt/Queries/zorba/file/streamability3.xq 2013-02-07 17:24:36 +0000 |
597 | +++ test/rbkt/Queries/zorba/file/streamability3.xq 2013-07-26 18:57:32 +0000 |
598 | @@ -1,5 +1,5 @@ |
599 | import module namespace file = "http://expath.org/ns/file"; |
600 | -import module namespace string = "http://www.zorba-xquery.com/modules/string"; |
601 | +import module namespace string = "http://zorba.io/modules/string"; |
602 | |
603 | declare variable $rbktPath as xs:string external; |
604 | |
605 | |
606 | === modified file 'test/rbkt/Queries/zorba/string/AnalyzeString/http-client-doc.htm' |
607 | --- test/rbkt/Queries/zorba/string/AnalyzeString/http-client-doc.htm 2013-07-17 15:48:38 +0000 |
608 | +++ test/rbkt/Queries/zorba/string/AnalyzeString/http-client-doc.htm 2013-07-26 18:57:32 +0000 |
609 | @@ -144,7 +144,7 @@ |
610 | </sup> |
611 | </li> |
612 | <li> |
613 | - <a href="www.zorba-xquery.com_modules_string.html" title="http://www.zorba-xquery.com/modules/string">string</a> |
614 | + <a href="www.zorba-xquery.com_modules_string.html" title="http://zorba.io/modules/string">string</a> |
615 | <sup> |
616 | <a href="http://www.w3.org/TR/xquery-30/#dt-external-function" target="_blank" title="There are external functions (either private or public) declared in this module.">(E)</a> |
617 | </sup> |
618 | |
619 | === added file 'test/rbkt/Queries/zorba/string/is-seekable.xq' |
620 | --- test/rbkt/Queries/zorba/string/is-seekable.xq 1970-01-01 00:00:00 +0000 |
621 | +++ test/rbkt/Queries/zorba/string/is-seekable.xq 2013-07-26 18:57:32 +0000 |
622 | @@ -0,0 +1,6 @@ |
623 | +import module namespace file = "http://expath.org/ns/file"; |
624 | +import module namespace string = "http://zorba.io/modules/string"; |
625 | + |
626 | +let $x := file:read-text(fn:resolve-uri("../file/sample_files/sample.txt")) |
627 | +return (string:is-seekable($x), string:is-seekable("test")) |
628 | + |
629 | |
630 | === modified file 'test/rbkt/Queries/zorba/string/tokenize01.xq' |
631 | --- test/rbkt/Queries/zorba/string/tokenize01.xq 2013-02-07 17:24:36 +0000 |
632 | +++ test/rbkt/Queries/zorba/string/tokenize01.xq 2013-07-26 18:57:32 +0000 |
633 | @@ -1,5 +1,5 @@ |
634 | import module namespace f = "http://expath.org/ns/file"; |
635 | -import module namespace s = "http://www.zorba-xquery.com/modules/string"; |
636 | +import module namespace s = "http://zorba.io/modules/string"; |
637 | |
638 | s:split(f:read-text(fn:resolve-uri("token01.txt")), "bc"), |
639 | s:split(s:materialize(f:read-text(fn:resolve-uri("token01.txt"))), "bc") |
640 | |
641 | === modified file 'test/rbkt/Queries/zorba/string/tokenize02.xq' |
642 | --- test/rbkt/Queries/zorba/string/tokenize02.xq 2013-02-07 17:24:36 +0000 |
643 | +++ test/rbkt/Queries/zorba/string/tokenize02.xq 2013-07-26 18:57:32 +0000 |
644 | @@ -1,5 +1,5 @@ |
645 | import module namespace f = "http://expath.org/ns/file"; |
646 | -import module namespace s = "http://www.zorba-xquery.com/modules/string"; |
647 | +import module namespace s = "http://zorba.io/modules/string"; |
648 | |
649 | s:split(f:read-text(fn:resolve-uri("token02.txt")), "bc"), |
650 | s:split(s:materialize(f:read-text(fn:resolve-uri("token02.txt"))), "bc") |
651 | |
652 | === modified file 'test/rbkt/Queries/zorba/string/tokenize03.xq' |
653 | --- test/rbkt/Queries/zorba/string/tokenize03.xq 2013-02-07 17:24:36 +0000 |
654 | +++ test/rbkt/Queries/zorba/string/tokenize03.xq 2013-07-26 18:57:32 +0000 |
655 | @@ -1,5 +1,5 @@ |
656 | import module namespace f = "http://expath.org/ns/file"; |
657 | -import module namespace s = "http://www.zorba-xquery.com/modules/string"; |
658 | +import module namespace s = "http://zorba.io/modules/string"; |
659 | |
660 | s:split(f:read-text(fn:resolve-uri("token03.txt")), "bc"), |
661 | s:split(s:materialize(f:read-text(fn:resolve-uri("token03.txt"))), "bc") |
662 | |
663 | === modified file 'test/rbkt/Queries/zorba/string/tokenize04.xq' |
664 | --- test/rbkt/Queries/zorba/string/tokenize04.xq 2013-02-07 17:24:36 +0000 |
665 | +++ test/rbkt/Queries/zorba/string/tokenize04.xq 2013-07-26 18:57:32 +0000 |
666 | @@ -1,5 +1,5 @@ |
667 | import module namespace f = "http://expath.org/ns/file"; |
668 | -import module namespace s = "http://www.zorba-xquery.com/modules/string"; |
669 | +import module namespace s = "http://zorba.io/modules/string"; |
670 | |
671 | s:split(f:read-text(fn:resolve-uri("token04.txt")), "f"), |
672 | s:split(s:materialize(f:read-text(fn:resolve-uri("token04.txt"))), "f") |
need merge with the trunk to get the static_context.cpp changes that Paul just submitted.