Merge lp:~zorba-coders/zorba/redirect into lp:zorba

Proposed by Matthias Brantner
Status: Merged
Approved by: Markos Zaharioudakis
Approved revision: 10558
Merged at revision: 10556
Proposed branch: lp:~zorba-coders/zorba/redirect
Merge into: lp:zorba
Diff against target: 258 lines (+104/-71)
5 files modified
ChangeLog (+1/-0)
doc/zorba/impl_dep_features.dox (+2/-2)
src/compiler/translator/translator.cpp (+1/-7)
src/functions/signature.cpp (+91/-61)
src/functions/signature.h (+9/-1)
To merge this branch: bzr merge lp:~zorba-coders/zorba/redirect
Reviewer Review Type Date Requested Status
Markos Zaharioudakis Approve
Juan Zacarias Approve
Matthias Brantner Pending
Review via email: mp+83227@code.launchpad.net

Commit message

Allow external functions to be updating.

Description of the change

Allow external functions to be updating.

To post a comment you must log in.
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

Validation queue job redirect-2011-11-23T22-30-21.892Z is finished. The final status was:

All tests succeeded!

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

Voting does not meet specified criteria. Required: Approve > 1, Disapprove < 1. Got: 3 Pending.

Revision history for this message
Juan Zacarias (juan457) wrote :

It solves the issue for the evaluate-updating function for xqxq module to work as an updating function

review: Approve
Revision history for this message
Markos Zaharioudakis (markos-za) wrote :

I prefer a different fix, which brings us closer to the end goal of mixing PULs and XDM. I have committed this fix. Please review and make sure it works with xqxq.

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

Validation queue job redirect-2011-11-24T10-23-15.44Z is finished. The final status was:

All tests succeeded!

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

Voting does not meet specified criteria. Required: Approve > 1, Disapprove < 1. Got: 1 Approve, 3 Pending.

Revision history for this message
Juan Zacarias (juan457) wrote :

Is working for the xqxq module

Revision history for this message
Juan Zacarias (juan457) :
review: Approve
Revision history for this message
Markos Zaharioudakis (markos-za) :
review: Approve
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

Validation queue job redirect-2011-11-25T12-45-17.416Z is finished. The final status was:

All tests succeeded!

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'ChangeLog'
--- ChangeLog 2011-11-23 16:27:08 +0000
+++ ChangeLog 2011-11-24 10:24:28 +0000
@@ -15,6 +15,7 @@
15 * Implemented the probe-index-range-value for general indexes15 * Implemented the probe-index-range-value for general indexes
16 * Added ExternalFunctionParameter class to be registered in the DynamicContext16 * Added ExternalFunctionParameter class to be registered in the DynamicContext
17 * New module for compiling and executing XQueries from XQuery (xqxq)17 * New module for compiling and executing XQueries from XQuery (xqxq)
18 * External functions are allowed to be updating (i.e. return a pending update list)
1819
19Optimization:20Optimization:
20 * Optimization for positioned sequence access (e.g. $x[$x[1]] where $x is a21 * Optimization for positioned sequence access (e.g. $x[$x[1]] where $x is a
2122
=== modified file 'doc/zorba/impl_dep_features.dox'
--- doc/zorba/impl_dep_features.dox 2011-10-07 08:28:43 +0000
+++ doc/zorba/impl_dep_features.dox 2011-11-24 10:24:28 +0000
@@ -216,7 +216,7 @@
216 <tr bgcolor="lightcyan">216 <tr bgcolor="lightcyan">
217 <td>W3C XQuery Update Facility 1.0</td>217 <td>W3C XQuery Update Facility 1.0</td>
218 <td>The mechanism (if any) by which an external function can return an XDM instance and/or a pending update list to the invoking query.</td>218 <td>The mechanism (if any) by which an external function can return an XDM instance and/or a pending update list to the invoking query.</td>
219 <td>Zorba allows external functions to be implemented in C++. Such functions may return XDM instances. However, it is not possible to implement an updating external function.</td>219 <td>Zorba allows external functions to be implemented in C++. Such functions may return XDM instances. Moreover, external functions declared as updating may return pending update lists generated by any updating expression. However, it's not possible to create new update primtives and return those.</td>
220 </tr>220 </tr>
221 <tr bgcolor="lightcyan">221 <tr bgcolor="lightcyan">
222 <td>W3C XQuery Update Facility 1.0</td>222 <td>W3C XQuery Update Facility 1.0</td>
@@ -744,4 +744,4 @@
744 <td>static</td>744 <td>static</td>
745 <td>no wildcards </td>745 <td>no wildcards </td>
746 </tr>746 </tr>
747</table>*/
748\ No newline at end of file747\ No newline at end of file
748</table>*/
749749
=== modified file 'src/compiler/translator/translator.cpp'
--- src/compiler/translator/translator.cpp 2011-11-22 08:57:25 +0000
+++ src/compiler/translator/translator.cpp 2011-11-24 10:24:28 +0000
@@ -3188,12 +3188,6 @@
3188 // have an updating expr as input to a treat expr, which is not allowed3188 // have an updating expr as input to a treat expr, which is not allowed
3189 // yet.3189 // yet.
3190 //returnType = theRTM.EMPTY_TYPE;3190 //returnType = theRTM.EMPTY_TYPE;
3191
3192 // TODO: remove this
3193 if (func_decl->is_external())
3194 {
3195 returnType = theRTM.EMPTY_TYPE;
3196 }
3197 }3191 }
31983192
3199 // Create the function signature.3193 // Create the function signature.
@@ -3228,7 +3222,7 @@
3228 // We make sure that the types of the parameters and the return type3222 // We make sure that the types of the parameters and the return type
3229 // are equal to the one that is declared in the module3223 // are equal to the one that is declared in the module
3230 const signature& s = f->getSignature();3224 const signature& s = f->getSignature();
3231 if (!sig.equals(tm, s))3225 if (!s.subtype(tm, sig, loc))
3232 {3226 {
3233 RAISE_ERROR(zerr::ZXQP0007_FUNCTION_SIGNATURE_NOT_EQUAL, loc,3227 RAISE_ERROR(zerr::ZXQP0007_FUNCTION_SIGNATURE_NOT_EQUAL, loc,
3234 ERROR_PARAMS(BUILD_STRING('{',3228 ERROR_PARAMS(BUILD_STRING('{',
32353229
=== modified file 'src/functions/signature.cpp'
--- src/functions/signature.cpp 2011-07-01 05:22:12 +0000
+++ src/functions/signature.cpp 2011-11-24 10:24:28 +0000
@@ -37,68 +37,68 @@
37 :37 :
38 theQName(name),38 theQName(name),
39 theIsVariadic(variadic)39 theIsVariadic(variadic)
40{40{
41 theTypes.push_back(returnType);41 theTypes.push_back(returnType);
42 theTypes.push_back(paramType1);42 theTypes.push_back(paramType1);
43}43}
4444
4545
46signature::signature(46signature::signature(
47 const store::Item_t& name,47 const store::Item_t& name,
48 const xqtref_t& returnType)48 const xqtref_t& returnType)
49 :49 :
50 theQName(name),50 theQName(name),
51 theIsVariadic(false)51 theIsVariadic(false)
52{52{
53 theTypes.push_back(returnType);53 theTypes.push_back(returnType);
54}54}
5555
5656
57signature::signature(57signature::signature(
58 const store::Item_t& name,58 const store::Item_t& name,
59 const xqtref_t& paramType1,59 const xqtref_t& paramType1,
60 const xqtref_t& returnType)60 const xqtref_t& returnType)
61 :61 :
62 theQName(name),62 theQName(name),
63 theIsVariadic(false)63 theIsVariadic(false)
64{64{
65 theTypes.push_back(returnType);65 theTypes.push_back(returnType);
66 theTypes.push_back(paramType1);66 theTypes.push_back(paramType1);
67}67}
6868
6969
70signature::signature(70signature::signature(
71 const store::Item_t& name,71 const store::Item_t& name,
72 const xqtref_t& paramType1,72 const xqtref_t& paramType1,
73 const xqtref_t& paramType2,73 const xqtref_t& paramType2,
74 const xqtref_t& returnType)74 const xqtref_t& returnType)
75 :75 :
76 theQName(name),76 theQName(name),
77 theIsVariadic(false)77 theIsVariadic(false)
78{78{
79 theTypes.push_back(returnType);79 theTypes.push_back(returnType);
80 theTypes.push_back(paramType1);80 theTypes.push_back(paramType1);
81 theTypes.push_back(paramType2);81 theTypes.push_back(paramType2);
82}82}
8383
8484
85signature::signature(85signature::signature(
86 const store::Item_t& name,86 const store::Item_t& name,
87 const xqtref_t& paramType1,87 const xqtref_t& paramType1,
88 const xqtref_t& paramType2,88 const xqtref_t& paramType2,
89 const xqtref_t& paramType3,89 const xqtref_t& paramType3,
90 const xqtref_t& returnType)90 const xqtref_t& returnType)
91 :91 :
92 theQName(name),92 theQName(name),
93 theIsVariadic(false)93 theIsVariadic(false)
94{94{
95 theTypes.push_back(returnType);95 theTypes.push_back(returnType);
96 theTypes.push_back(paramType1);96 theTypes.push_back(paramType1);
97 theTypes.push_back(paramType2);97 theTypes.push_back(paramType2);
98 theTypes.push_back(paramType3);98 theTypes.push_back(paramType3);
99}99}
100100
101101
102signature::signature(102signature::signature(
103 const store::Item_t& name,103 const store::Item_t& name,
104 const xqtref_t& paramType1,104 const xqtref_t& paramType1,
@@ -237,7 +237,10 @@
237}237}
238238
239239
240bool signature::equals(const TypeManager* tm, const signature& s) const240bool signature::equals(
241 const TypeManager* tm,
242 const signature& s,
243 const QueryLoc& loc) const
241{244{
242 if (paramCount() != s.paramCount())245 if (paramCount() != s.paramCount())
243 return false;246 return false;
@@ -251,7 +254,34 @@
251 if (!TypeOps::is_equal(tm,254 if (!TypeOps::is_equal(tm,
252 *theTypes[i].getp(),255 *theTypes[i].getp(),
253 *s.theTypes[i].getp(), 256 *s.theTypes[i].getp(),
254 QueryLoc::null))257 loc))
258 {
259 return false;
260 }
261 }
262
263 return true;
264}
265
266
267bool signature::subtype(
268 const TypeManager* tm,
269 const signature& s,
270 const QueryLoc& loc) const
271{
272 if (paramCount() != s.paramCount())
273 return false;
274
275 if (!theQName->equals(s.theQName.getp()))
276 return false;
277
278 assert (s.theTypes.size() == theTypes.size() || theIsVariadic );
279 for (csize i = 0; i < theTypes.size(); ++i)
280 {
281 if (!TypeOps::is_subtype(tm,
282 *theTypes[i].getp(),
283 *s.theTypes[i].getp(),
284 loc))
255 {285 {
256 return false;286 return false;
257 }287 }
258288
=== modified file 'src/functions/signature.h'
--- src/functions/signature.h 2011-06-21 05:41:24 +0000
+++ src/functions/signature.h 2011-11-24 10:24:28 +0000
@@ -168,7 +168,15 @@
168168
169 xqtref_t& returnType() { return theTypes[0]; }169 xqtref_t& returnType() { return theTypes[0]; }
170170
171 bool equals(const TypeManager* tm, const signature& s) const;171 bool equals(
172 const TypeManager* tm,
173 const signature& s,
174 const QueryLoc& loc) const;
175
176 bool subtype(
177 const TypeManager* tm,
178 const signature& s,
179 const QueryLoc& loc) const;
172};180};
173181
174} /* namespace zorba */182} /* namespace zorba */

Subscribers

People subscribed via source and target branches