Merge lp:~zorba-coders/zorba/threads into lp:zorba
- threads
- Merge into trunk
Status: | Merged |
---|---|
Merged at revision: | 11635 |
Proposed branch: | lp:~zorba-coders/zorba/threads |
Merge into: | lp:zorba |
Diff against target: |
1651 lines (+558/-394) 20 files modified
src/compiler/expression/expr_type.cpp (+1/-1) src/compiler/translator/translator.cpp (+93/-2) src/functions/func_fn_hof_functions_impl.cpp (+42/-94) src/functions/func_parse_fragment_impl.cpp (+11/-19) src/functions/func_strings_impl.cpp (+16/-9) src/functions/function.cpp (+6/-0) src/functions/function.h (+0/-8) src/functions/pregenerated/func_strings.h (+2/-0) src/functions/signature.cpp (+131/-96) src/functions/signature.h (+20/-7) src/runtime/spec/strings/strings.xml (+19/-12) src/system/globalenv.cpp (+22/-6) src/types/schema/schema.cpp (+28/-57) src/types/schema/schema.h (+0/-8) src/types/typeimpl.cpp (+55/-3) src/types/typeimpl.h (+59/-34) src/types/typemanagerimpl.cpp (+27/-10) src/types/typeops.cpp (+0/-1) src/zorbaserialization/class_serializer.cpp (+25/-26) src/zorbaserialization/class_serializer.h (+1/-1) |
To merge this branch: | bzr merge lp:~zorba-coders/zorba/threads |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Markos Zaharioudakis | Approve | ||
Review via email: mp+186514@code.launchpad.net |
Commit message
More multi-threading work:
1. Function objects for builtin functions should not use any non-builtin types in their signature.
2. XQType does not inherit from RCObject anymore; instead it replicates RCObject functionalityin
Description of the change
More multi-threading work:
1. Function objects for builtin functions should not use any non-builtin types in their signature.
2. XQType does not inherit from RCObject anymore; instead it replicates RCObject functionalityin
- 11579. By Markos Zaharioudakis
-
removed unnecessary recreation of mem archiver during shutdown
- 11580. By Markos Zaharioudakis
-
fixed type-related multi-threading problems
- 11581. By Markos Zaharioudakis
-
merge from trunk
- 11582. By Markos Zaharioudakis
-
fixed type-related multi-threading problems
Markos Zaharioudakis (markos-za) : | # |
Zorba Build Bot (zorba-buildbot) wrote : | # |
Zorba Build Bot (zorba-buildbot) wrote : | # |
Validation queue result for https:/
Stage "TestZorbaUbuntu" failed.
11 tests failed (8535 total tests run).
Check test results at http://
- 11583. By Markos Zaharioudakis
-
fixed type-related multi-threading problems
- 11584. By Markos Zaharioudakis
-
reverted previous change: the mem archiver MUST be recreated after shutdown
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.
6 tests failed (8535 total tests run).
Check test results at http://
- 11585. By Markos Zaharioudakis
-
fixed .csv files
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!
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.
1 tests failed (8550 total tests run).
Check test results at http://
Preview Diff
1 | === modified file 'src/compiler/expression/expr_type.cpp' | |||
2 | --- src/compiler/expression/expr_type.cpp 2013-08-16 13:00:06 +0000 | |||
3 | +++ src/compiler/expression/expr_type.cpp 2013-09-20 12:27:16 +0000 | |||
4 | @@ -675,7 +675,7 @@ | |||
5 | 675 | for (csize i = 0; i < fiExpr->get_function()->getSignature().paramCount(); ++i) | 675 | for (csize i = 0; i < fiExpr->get_function()->getSignature().paramCount(); ++i) |
6 | 676 | paramTypes.push_back(fiExpr->get_function()->getSignature()[i]); | 676 | paramTypes.push_back(fiExpr->get_function()->getSignature()[i]); |
7 | 677 | 677 | ||
9 | 678 | theType = new FunctionXQType(&rtm, paramTypes, retType, TypeConstants::QUANT_ONE); | 678 | theType = rtm.create_function_type(paramTypes, retType, TypeConstants::QUANT_ONE); |
10 | 679 | } | 679 | } |
11 | 680 | return; | 680 | return; |
12 | 681 | } | 681 | } |
13 | 682 | 682 | ||
14 | === modified file 'src/compiler/translator/translator.cpp' | |||
15 | --- src/compiler/translator/translator.cpp 2013-09-17 21:12:49 +0000 | |||
16 | +++ src/compiler/translator/translator.cpp 2013-09-20 12:27:16 +0000 | |||
17 | @@ -1506,8 +1506,99 @@ | |||
18 | 1506 | 1506 | ||
19 | 1507 | TypeManager* tm = argExpr->get_type_manager(); | 1507 | TypeManager* tm = argExpr->get_type_manager(); |
20 | 1508 | 1508 | ||
21 | 1509 | paramType = sign[i]; | ||
22 | 1510 | |||
23 | 1509 | switch (func->getKind()) | 1511 | switch (func->getKind()) |
24 | 1510 | { | 1512 | { |
25 | 1513 | case FunctionConsts::FN_ZORBA_XML_PARSE_2: | ||
26 | 1514 | { | ||
27 | 1515 | if (i == 1) | ||
28 | 1516 | { | ||
29 | 1517 | paramType = tm-> | ||
30 | 1518 | create_node_type(store::StoreConsts::elementNode, | ||
31 | 1519 | createQName(static_context::ZORBA_XML_FN_OPTIONS_NS, | ||
32 | 1520 | "", | ||
33 | 1521 | "options"), | ||
34 | 1522 | NULL, | ||
35 | 1523 | TypeConstants::QUANT_QUESTION, | ||
36 | 1524 | false, | ||
37 | 1525 | false); | ||
38 | 1526 | } | ||
39 | 1527 | break; | ||
40 | 1528 | } | ||
41 | 1529 | case FunctionConsts::FN_FOR_EACH_2: | ||
42 | 1530 | { | ||
43 | 1531 | if (i == 1) | ||
44 | 1532 | { | ||
45 | 1533 | std::vector<xqtref_t> args; | ||
46 | 1534 | args.push_back(theRTM.ITEM_TYPE_ONE); | ||
47 | 1535 | |||
48 | 1536 | paramType = tm-> | ||
49 | 1537 | create_function_type(args, | ||
50 | 1538 | theRTM.ITEM_TYPE_STAR, | ||
51 | 1539 | TypeConstants::QUANT_ONE); | ||
52 | 1540 | } | ||
53 | 1541 | break; | ||
54 | 1542 | } | ||
55 | 1543 | case FunctionConsts::FN_FOR_EACH_PAIR_3: | ||
56 | 1544 | { | ||
57 | 1545 | if (i == 2) | ||
58 | 1546 | { | ||
59 | 1547 | std::vector<xqtref_t> args; | ||
60 | 1548 | args.push_back(theRTM.ITEM_TYPE_ONE); | ||
61 | 1549 | args.push_back(theRTM.ITEM_TYPE_ONE); | ||
62 | 1550 | |||
63 | 1551 | paramType = tm-> | ||
64 | 1552 | create_function_type(args, | ||
65 | 1553 | theRTM.ITEM_TYPE_STAR, | ||
66 | 1554 | TypeConstants::QUANT_ONE); | ||
67 | 1555 | } | ||
68 | 1556 | break; | ||
69 | 1557 | } | ||
70 | 1558 | case FunctionConsts::FN_FOLD_LEFT_3: | ||
71 | 1559 | { | ||
72 | 1560 | if (i == 2) | ||
73 | 1561 | { | ||
74 | 1562 | std::vector<xqtref_t> args; | ||
75 | 1563 | args.push_back(theRTM.ITEM_TYPE_STAR); | ||
76 | 1564 | args.push_back(theRTM.ITEM_TYPE_ONE); | ||
77 | 1565 | |||
78 | 1566 | paramType = tm-> | ||
79 | 1567 | create_function_type(args, | ||
80 | 1568 | theRTM.ITEM_TYPE_STAR, | ||
81 | 1569 | TypeConstants::QUANT_ONE); | ||
82 | 1570 | } | ||
83 | 1571 | break; | ||
84 | 1572 | } | ||
85 | 1573 | case FunctionConsts::FN_FOLD_RIGHT_3: | ||
86 | 1574 | { | ||
87 | 1575 | if (i == 2) | ||
88 | 1576 | { | ||
89 | 1577 | std::vector<xqtref_t> args; | ||
90 | 1578 | args.push_back(theRTM.ITEM_TYPE_ONE); | ||
91 | 1579 | args.push_back(theRTM.ITEM_TYPE_STAR); | ||
92 | 1580 | |||
93 | 1581 | paramType = tm-> | ||
94 | 1582 | create_function_type(args, | ||
95 | 1583 | theRTM.ITEM_TYPE_STAR, | ||
96 | 1584 | TypeConstants::QUANT_ONE); | ||
97 | 1585 | } | ||
98 | 1586 | break; | ||
99 | 1587 | } | ||
100 | 1588 | case FunctionConsts::FN_FILTER_2: | ||
101 | 1589 | { | ||
102 | 1590 | if (i == 1) | ||
103 | 1591 | { | ||
104 | 1592 | std::vector<xqtref_t> args; | ||
105 | 1593 | args.push_back(theRTM.ITEM_TYPE_ONE); | ||
106 | 1594 | |||
107 | 1595 | paramType = tm-> | ||
108 | 1596 | create_function_type(args, | ||
109 | 1597 | theRTM.BOOLEAN_TYPE_ONE, | ||
110 | 1598 | TypeConstants::QUANT_ONE); | ||
111 | 1599 | } | ||
112 | 1600 | break; | ||
113 | 1601 | } | ||
114 | 1511 | case FunctionConsts::FN_ZORBA_XQDDF_PROBE_INDEX_POINT_VALUE_N: | 1602 | case FunctionConsts::FN_ZORBA_XQDDF_PROBE_INDEX_POINT_VALUE_N: |
115 | 1512 | { | 1603 | { |
116 | 1513 | if (i == 0) | 1604 | if (i == 0) |
117 | @@ -1562,7 +1653,7 @@ | |||
118 | 1562 | } | 1653 | } |
119 | 1563 | default: | 1654 | default: |
120 | 1564 | { | 1655 | { |
122 | 1565 | paramType = sign[i]; | 1656 | break; |
123 | 1566 | } | 1657 | } |
124 | 1567 | } | 1658 | } |
125 | 1568 | 1659 | ||
126 | @@ -4041,7 +4132,7 @@ | |||
127 | 4041 | // We make sure that the types of the parameters and the return type | 4132 | // We make sure that the types of the parameters and the return type |
128 | 4042 | // are subtypes of the ones declared in the module | 4133 | // are subtypes of the ones declared in the module |
129 | 4043 | const signature& s = f->getSignature(); | 4134 | const signature& s = f->getSignature(); |
131 | 4044 | if (!s.subtype(tm, sig, loc)) | 4135 | if (!s.subtype(tm, f, sig, loc)) |
132 | 4045 | { | 4136 | { |
133 | 4046 | RAISE_ERROR(zerr::ZXQP0007_FUNCTION_SIGNATURE_NOT_EQUAL, loc, | 4137 | RAISE_ERROR(zerr::ZXQP0007_FUNCTION_SIGNATURE_NOT_EQUAL, loc, |
134 | 4047 | ERROR_PARAMS(BUILD_STRING('{', | 4138 | ERROR_PARAMS(BUILD_STRING('{', |
135 | 4048 | 4139 | ||
136 | === modified file 'src/functions/func_fn_hof_functions_impl.cpp' | |||
137 | --- src/functions/func_fn_hof_functions_impl.cpp 2013-06-04 21:47:40 +0000 | |||
138 | +++ src/functions/func_fn_hof_functions_impl.cpp 2013-09-20 12:27:16 +0000 | |||
139 | @@ -143,100 +143,48 @@ | |||
140 | 143 | ********************************************************************************/ | 143 | ********************************************************************************/ |
141 | 144 | void populate_context_hof_impl(static_context* sctx) | 144 | void populate_context_hof_impl(static_context* sctx) |
142 | 145 | { | 145 | { |
237 | 146 | { | 146 | DECL_WITH_KIND(sctx, |
238 | 147 | std::vector<xqtref_t> args; | 147 | fn_for_each_3_0, |
239 | 148 | args.push_back(GENV_TYPESYSTEM.ITEM_TYPE_ONE); | 148 | (createQName(static_context::W3C_FN_NS, "", "for-each"), |
240 | 149 | 149 | GENV_TYPESYSTEM.ITEM_TYPE_STAR, | |
241 | 150 | xqtref_t hofParamType = GENV_TYPESYSTEM.create_function_type( | 150 | GENV_TYPESYSTEM.ANY_FUNCTION_TYPE_ONE, |
242 | 151 | args, | 151 | GENV_TYPESYSTEM.ITEM_TYPE_STAR), |
243 | 152 | GENV_TYPESYSTEM.ITEM_TYPE_STAR, | 152 | FunctionConsts::FN_FOR_EACH_2); |
244 | 153 | TypeConstants::QUANT_ONE); | 153 | |
245 | 154 | 154 | DECL_WITH_KIND(sctx, | |
246 | 155 | DECL_WITH_KIND(sctx, | 155 | fn_filter, |
247 | 156 | fn_for_each_3_0, | 156 | (createQName(static_context::W3C_FN_NS, "", "filter"), |
248 | 157 | (createQName(static_context::W3C_FN_NS, "", "for-each"), | 157 | GENV_TYPESYSTEM.ITEM_TYPE_STAR, |
249 | 158 | GENV_TYPESYSTEM.ITEM_TYPE_STAR, | 158 | GENV_TYPESYSTEM.ANY_FUNCTION_TYPE_ONE, |
250 | 159 | hofParamType, | 159 | GENV_TYPESYSTEM.ITEM_TYPE_STAR), |
251 | 160 | GENV_TYPESYSTEM.ITEM_TYPE_STAR), | 160 | FunctionConsts::FN_FILTER_2); |
252 | 161 | FunctionConsts::FN_FOR_EACH_2); | 161 | |
253 | 162 | } | 162 | DECL_WITH_KIND(sctx, |
254 | 163 | 163 | fn_for_each_pair_3_0, | |
255 | 164 | { | 164 | (createQName(static_context::W3C_FN_NS, "", "for-each-pair"), |
256 | 165 | std::vector<xqtref_t> args; | 165 | GENV_TYPESYSTEM.ITEM_TYPE_STAR, |
257 | 166 | args.push_back(GENV_TYPESYSTEM.ITEM_TYPE_ONE); | 166 | GENV_TYPESYSTEM.ITEM_TYPE_STAR, |
258 | 167 | 167 | GENV_TYPESYSTEM.ANY_FUNCTION_TYPE_ONE, | |
259 | 168 | xqtref_t hofParamType = GENV_TYPESYSTEM.create_function_type( | 168 | GENV_TYPESYSTEM.ITEM_TYPE_STAR), |
260 | 169 | args, | 169 | FunctionConsts::FN_FOR_EACH_PAIR_3); |
261 | 170 | GENV_TYPESYSTEM.BOOLEAN_TYPE_ONE, | 170 | |
262 | 171 | TypeConstants::QUANT_ONE); | 171 | DECL_WITH_KIND(sctx, |
263 | 172 | 172 | fn_fold_left_3_0, | |
264 | 173 | DECL_WITH_KIND(sctx, | 173 | (createQName(static_context::W3C_FN_NS, "", "fold-left"), |
265 | 174 | fn_filter, | 174 | GENV_TYPESYSTEM.ITEM_TYPE_STAR, |
266 | 175 | (createQName(static_context::W3C_FN_NS, "", "filter"), | 175 | GENV_TYPESYSTEM.ITEM_TYPE_STAR, |
267 | 176 | GENV_TYPESYSTEM.ITEM_TYPE_STAR, | 176 | GENV_TYPESYSTEM.ANY_FUNCTION_TYPE_ONE, |
268 | 177 | hofParamType, | 177 | GENV_TYPESYSTEM.ITEM_TYPE_STAR), |
269 | 178 | GENV_TYPESYSTEM.ITEM_TYPE_STAR), | 178 | FunctionConsts::FN_FOLD_LEFT_3); |
270 | 179 | FunctionConsts::FN_FILTER_2); | 179 | |
271 | 180 | } | 180 | DECL_WITH_KIND(sctx, |
272 | 181 | 181 | fn_fold_right_3_0, | |
273 | 182 | { | 182 | (createQName(static_context::W3C_FN_NS, "", "fold-right"), |
274 | 183 | std::vector<xqtref_t> args; | 183 | GENV_TYPESYSTEM.ITEM_TYPE_STAR, |
275 | 184 | args.push_back(GENV_TYPESYSTEM.ITEM_TYPE_ONE); | 184 | GENV_TYPESYSTEM.ITEM_TYPE_STAR, |
276 | 185 | args.push_back(GENV_TYPESYSTEM.ITEM_TYPE_ONE); | 185 | GENV_TYPESYSTEM.ANY_FUNCTION_TYPE_ONE, |
277 | 186 | 186 | GENV_TYPESYSTEM.ITEM_TYPE_STAR), | |
278 | 187 | xqtref_t hofParamType = GENV_TYPESYSTEM.create_function_type( | 187 | FunctionConsts::FN_FOLD_RIGHT_3); |
185 | 188 | args, | ||
186 | 189 | GENV_TYPESYSTEM.ITEM_TYPE_STAR, | ||
187 | 190 | TypeConstants::QUANT_ONE); | ||
188 | 191 | |||
189 | 192 | DECL_WITH_KIND(sctx, | ||
190 | 193 | fn_for_each_pair_3_0, | ||
191 | 194 | (createQName(static_context::W3C_FN_NS, "", "for-each-pair"), | ||
192 | 195 | GENV_TYPESYSTEM.ITEM_TYPE_STAR, | ||
193 | 196 | GENV_TYPESYSTEM.ITEM_TYPE_STAR, | ||
194 | 197 | hofParamType, | ||
195 | 198 | GENV_TYPESYSTEM.ITEM_TYPE_STAR), | ||
196 | 199 | FunctionConsts::FN_FOR_EACH_PAIR_3); | ||
197 | 200 | } | ||
198 | 201 | |||
199 | 202 | { | ||
200 | 203 | std::vector<xqtref_t> args; | ||
201 | 204 | xqtref_t hofParamType; | ||
202 | 205 | |||
203 | 206 | args.push_back(GENV_TYPESYSTEM.ITEM_TYPE_STAR); | ||
204 | 207 | args.push_back(GENV_TYPESYSTEM.ITEM_TYPE_ONE); | ||
205 | 208 | hofParamType = GENV_TYPESYSTEM.create_function_type( | ||
206 | 209 | args, | ||
207 | 210 | GENV_TYPESYSTEM.ITEM_TYPE_STAR, | ||
208 | 211 | TypeConstants::QUANT_ONE); | ||
209 | 212 | |||
210 | 213 | DECL_WITH_KIND(sctx, | ||
211 | 214 | fn_fold_left_3_0, | ||
212 | 215 | (createQName(static_context::W3C_FN_NS, "", "fold-left"), | ||
213 | 216 | GENV_TYPESYSTEM.ITEM_TYPE_STAR, | ||
214 | 217 | GENV_TYPESYSTEM.ITEM_TYPE_STAR, | ||
215 | 218 | hofParamType, | ||
216 | 219 | GENV_TYPESYSTEM.ITEM_TYPE_STAR), | ||
217 | 220 | FunctionConsts::FN_FOLD_LEFT_3); | ||
218 | 221 | |||
219 | 222 | args.clear(); | ||
220 | 223 | args.push_back(GENV_TYPESYSTEM.ITEM_TYPE_ONE); | ||
221 | 224 | args.push_back(GENV_TYPESYSTEM.ITEM_TYPE_STAR); | ||
222 | 225 | hofParamType = GENV_TYPESYSTEM.create_function_type( | ||
223 | 226 | args, | ||
224 | 227 | GENV_TYPESYSTEM.ITEM_TYPE_STAR, | ||
225 | 228 | TypeConstants::QUANT_ONE); | ||
226 | 229 | |||
227 | 230 | DECL_WITH_KIND(sctx, | ||
228 | 231 | fn_fold_right_3_0, | ||
229 | 232 | (createQName(static_context::W3C_FN_NS, "", "fold-right"), | ||
230 | 233 | GENV_TYPESYSTEM.ITEM_TYPE_STAR, | ||
231 | 234 | GENV_TYPESYSTEM.ITEM_TYPE_STAR, | ||
232 | 235 | hofParamType, | ||
233 | 236 | GENV_TYPESYSTEM.ITEM_TYPE_STAR), | ||
234 | 237 | FunctionConsts::FN_FOLD_RIGHT_3); | ||
235 | 238 | } | ||
236 | 239 | |||
279 | 240 | } | 188 | } |
280 | 241 | 189 | ||
281 | 242 | } | 190 | } |
282 | 243 | 191 | ||
283 | === modified file 'src/functions/func_parse_fragment_impl.cpp' | |||
284 | --- src/functions/func_parse_fragment_impl.cpp 2013-07-24 09:06:02 +0000 | |||
285 | +++ src/functions/func_parse_fragment_impl.cpp 2013-09-20 12:27:16 +0000 | |||
286 | @@ -37,25 +37,17 @@ | |||
287 | 37 | ********************************************************************************/ | 37 | ********************************************************************************/ |
288 | 38 | void populate_context_parse_fragment_impl(static_context* sctx) | 38 | void populate_context_parse_fragment_impl(static_context* sctx) |
289 | 39 | { | 39 | { |
309 | 40 | xqtref_t lParseOptType = | 40 | // Note: the actual type of the 2nd param should be element(options)? |
310 | 41 | GENV_TYPESYSTEM.create_node_type( | 41 | // However, we cannot use a non-builtin type in the signature of a builtin |
311 | 42 | store::StoreConsts::elementNode, | 42 | // function. That's why we use type element() here and do special handling |
312 | 43 | createQName(static_context::ZORBA_XML_FN_OPTIONS_NS,"","options"), | 43 | // of this function in the translator. |
313 | 44 | NULL, | 44 | DECL_WITH_KIND(sctx, fn_zorba_xml_parse, |
314 | 45 | TypeConstants::QUANT_QUESTION, | 45 | (createQName(static_context::ZORBA_XML_FN_NS, "", "parse"), |
315 | 46 | false, | 46 | GENV_TYPESYSTEM.STRING_TYPE_QUESTION, |
316 | 47 | false | 47 | GENV_TYPESYSTEM.ELEMENT_TYPE_QUESTION, |
317 | 48 | ); | 48 | GENV_TYPESYSTEM.ANY_NODE_TYPE_STAR), |
318 | 49 | 49 | FunctionConsts::FN_ZORBA_XML_PARSE_2); | |
319 | 50 | { | 50 | |
301 | 51 | DECL_WITH_KIND(sctx, fn_zorba_xml_parse, | ||
302 | 52 | (createQName(static_context::ZORBA_XML_FN_NS,"","parse"), | ||
303 | 53 | GENV_TYPESYSTEM.STRING_TYPE_QUESTION, | ||
304 | 54 | lParseOptType, | ||
305 | 55 | GENV_TYPESYSTEM.ANY_NODE_TYPE_STAR), | ||
306 | 56 | FunctionConsts::FN_ZORBA_XML_PARSE_2); | ||
307 | 57 | |||
308 | 58 | } | ||
320 | 59 | } | 51 | } |
321 | 60 | 52 | ||
322 | 61 | } | 53 | } |
323 | 62 | 54 | ||
324 | === modified file 'src/functions/func_strings_impl.cpp' | |||
325 | --- src/functions/func_strings_impl.cpp 2013-02-07 17:24:36 +0000 | |||
326 | +++ src/functions/func_strings_impl.cpp 2013-09-20 12:27:16 +0000 | |||
327 | @@ -62,27 +62,34 @@ | |||
328 | 62 | } | 62 | } |
329 | 63 | 63 | ||
330 | 64 | 64 | ||
331 | 65 | |||
332 | 65 | /******************************************************************************* | 66 | /******************************************************************************* |
333 | 66 | 67 | ||
334 | 67 | ********************************************************************************/ | 68 | ********************************************************************************/ |
336 | 68 | void populate_context_strings_impl(static_context* sctx) | 69 | xqtref_t fn_analyze_string_3_0::getReturnType(const fo_expr* caller) const |
337 | 69 | { | 70 | { |
340 | 70 | xqtref_t lAnalyzeStringResultType = | 71 | return |
341 | 71 | GENV_TYPESYSTEM.create_node_type( | 72 | GENV_TYPESYSTEM.create_node_type( |
342 | 72 | store::StoreConsts::elementNode, | 73 | store::StoreConsts::elementNode, |
344 | 73 | createQName("http://www.w3.org/2005/xpath-functions","","analyze-string-result"), | 74 | createQName(static_context::W3C_FN_NS,"","analyze-string-result"), |
345 | 74 | NULL, | 75 | NULL, |
346 | 75 | TypeConstants::QUANT_ONE, | 76 | TypeConstants::QUANT_ONE, |
347 | 76 | false, | 77 | false, |
351 | 77 | false | 78 | false); |
352 | 78 | ); | 79 | } |
353 | 79 | 80 | ||
354 | 81 | |||
355 | 82 | /******************************************************************************* | ||
356 | 83 | |||
357 | 84 | ********************************************************************************/ | ||
358 | 85 | void populate_context_strings_impl(static_context* sctx) | ||
359 | 86 | { | ||
360 | 80 | { | 87 | { |
361 | 81 | DECL_WITH_KIND(sctx, fn_analyze_string_3_0, | 88 | DECL_WITH_KIND(sctx, fn_analyze_string_3_0, |
362 | 82 | (createQName("http://www.w3.org/2005/xpath-functions","","analyze-string"), | 89 | (createQName("http://www.w3.org/2005/xpath-functions","","analyze-string"), |
363 | 83 | GENV_TYPESYSTEM.STRING_TYPE_QUESTION, | 90 | GENV_TYPESYSTEM.STRING_TYPE_QUESTION, |
364 | 84 | GENV_TYPESYSTEM.STRING_TYPE_ONE, | 91 | GENV_TYPESYSTEM.STRING_TYPE_ONE, |
366 | 85 | lAnalyzeStringResultType), | 92 | GENV_TYPESYSTEM.ELEMENT_TYPE_ONE), |
367 | 86 | FunctionConsts::FN_ANALYZE_STRING_2); | 93 | FunctionConsts::FN_ANALYZE_STRING_2); |
368 | 87 | 94 | ||
369 | 88 | } | 95 | } |
370 | @@ -94,7 +101,7 @@ | |||
371 | 94 | GENV_TYPESYSTEM.STRING_TYPE_QUESTION, | 101 | GENV_TYPESYSTEM.STRING_TYPE_QUESTION, |
372 | 95 | GENV_TYPESYSTEM.STRING_TYPE_ONE, | 102 | GENV_TYPESYSTEM.STRING_TYPE_ONE, |
373 | 96 | GENV_TYPESYSTEM.STRING_TYPE_ONE, | 103 | GENV_TYPESYSTEM.STRING_TYPE_ONE, |
375 | 97 | lAnalyzeStringResultType), | 104 | GENV_TYPESYSTEM.ELEMENT_TYPE_ONE), |
376 | 98 | FunctionConsts::FN_ANALYZE_STRING_3); | 105 | FunctionConsts::FN_ANALYZE_STRING_3); |
377 | 99 | } | 106 | } |
378 | 100 | } | 107 | } |
379 | 101 | 108 | ||
380 | === modified file 'src/functions/function.cpp' | |||
381 | --- src/functions/function.cpp 2013-07-31 16:35:39 +0000 | |||
382 | +++ src/functions/function.cpp 2013-09-20 12:27:16 +0000 | |||
383 | @@ -57,6 +57,12 @@ | |||
384 | 57 | setFlag(FunctionConsts::isBuiltin); | 57 | setFlag(FunctionConsts::isBuiltin); |
385 | 58 | #ifndef NDEBUG | 58 | #ifndef NDEBUG |
386 | 59 | theRefCount = 1000000; | 59 | theRefCount = 1000000; |
387 | 60 | |||
388 | 61 | csize numTypes = sig.theTypes.size(); | ||
389 | 62 | for (csize i = 0; i < numTypes; ++i) | ||
390 | 63 | { | ||
391 | 64 | assert(sig.theTypes[i]->is_builtin()); | ||
392 | 65 | } | ||
393 | 60 | #endif | 66 | #endif |
394 | 61 | } | 67 | } |
395 | 62 | 68 | ||
396 | 63 | 69 | ||
397 | === modified file 'src/functions/function.h' | |||
398 | --- src/functions/function.h 2013-08-02 21:35:01 +0000 | |||
399 | +++ src/functions/function.h 2013-09-20 12:27:16 +0000 | |||
400 | @@ -48,11 +48,7 @@ | |||
401 | 48 | The root sctx of the module containing the declaration. It is NULL for | 48 | The root sctx of the module containing the declaration. It is NULL for |
402 | 49 | functions that must be executed in the static context of the caller. | 49 | functions that must be executed in the static context of the caller. |
403 | 50 | ********************************************************************************/ | 50 | ********************************************************************************/ |
404 | 51 | #if defined NDEBUG || defined ZORBA_FOR_ONE_THREAD_ONLY | ||
405 | 52 | class function : public SimpleRCObject | 51 | class function : public SimpleRCObject |
406 | 53 | #else | ||
407 | 54 | class function : public SyncedRCObject | ||
408 | 55 | #endif | ||
409 | 56 | { | 52 | { |
410 | 57 | protected: | 53 | protected: |
411 | 58 | signature theSignature; | 54 | signature theSignature; |
412 | @@ -66,11 +62,7 @@ | |||
413 | 66 | 62 | ||
414 | 67 | public: | 63 | public: |
415 | 68 | SERIALIZABLE_CLASS(function); | 64 | SERIALIZABLE_CLASS(function); |
416 | 69 | #if defined NDEBUG || defined ZORBA_FOR_ONE_THREAD_ONLY | ||
417 | 70 | SERIALIZABLE_CLASS_CONSTRUCTOR3(function, SimpleRCObject, theSignature); | 65 | SERIALIZABLE_CLASS_CONSTRUCTOR3(function, SimpleRCObject, theSignature); |
418 | 71 | #else | ||
419 | 72 | SERIALIZABLE_CLASS_CONSTRUCTOR3(function, SyncedRCObject, theSignature); | ||
420 | 73 | #endif | ||
421 | 74 | void serialize(::zorba::serialization::Archiver& ar); | 66 | void serialize(::zorba::serialization::Archiver& ar); |
422 | 75 | 67 | ||
423 | 76 | public: | 68 | public: |
424 | 77 | 69 | ||
425 | === modified file 'src/functions/pregenerated/func_strings.h' | |||
426 | --- src/functions/pregenerated/func_strings.h 2013-07-11 22:08:29 +0000 | |||
427 | +++ src/functions/pregenerated/func_strings.h 2013-09-20 12:27:16 +0000 | |||
428 | @@ -447,6 +447,8 @@ | |||
429 | 447 | theXQueryVersion = StaticContextConsts::xquery_version_3_0; | 447 | theXQueryVersion = StaticContextConsts::xquery_version_3_0; |
430 | 448 | } | 448 | } |
431 | 449 | 449 | ||
432 | 450 | xqtref_t getReturnType(const fo_expr* caller) const; | ||
433 | 451 | |||
434 | 450 | CODEGEN_DECL(); | 452 | CODEGEN_DECL(); |
435 | 451 | }; | 453 | }; |
436 | 452 | 454 | ||
437 | 453 | 455 | ||
438 | === modified file 'src/functions/signature.cpp' | |||
439 | --- src/functions/signature.cpp 2013-03-04 21:00:58 +0000 | |||
440 | +++ src/functions/signature.cpp 2013-09-20 12:27:16 +0000 | |||
441 | @@ -21,6 +21,13 @@ | |||
442 | 21 | 21 | ||
443 | 22 | #include "types/typeops.h" | 22 | #include "types/typeops.h" |
444 | 23 | 23 | ||
445 | 24 | #include "functions/function.h" | ||
446 | 25 | #include "functions/library.h" | ||
447 | 26 | |||
448 | 27 | #include "context/static_context.h" | ||
449 | 28 | |||
450 | 29 | #include "store/api/item_factory.h" | ||
451 | 30 | |||
452 | 24 | #include "zorbaserialization/serialize_template_types.h" | 31 | #include "zorbaserialization/serialize_template_types.h" |
453 | 25 | #include "zorbaserialization/serialize_zorba_types.h" | 32 | #include "zorbaserialization/serialize_zorba_types.h" |
454 | 26 | 33 | ||
455 | @@ -31,100 +38,100 @@ | |||
456 | 31 | { | 38 | { |
457 | 32 | 39 | ||
458 | 33 | SERIALIZABLE_CLASS_VERSIONS(signature) | 40 | SERIALIZABLE_CLASS_VERSIONS(signature) |
539 | 34 | 41 | ||
540 | 35 | 42 | ||
541 | 36 | signature::signature( | 43 | signature::signature( |
542 | 37 | const store::Item_t& name, | 44 | const store::Item_t& name, |
543 | 38 | const xqtref_t& paramType1, | 45 | const xqtref_t& paramType1, |
544 | 39 | bool variadic, | 46 | bool variadic, |
545 | 40 | const xqtref_t& returnType) | 47 | const xqtref_t& returnType) |
546 | 41 | : | 48 | : |
547 | 42 | theQName(name), | 49 | theQName(name), |
548 | 43 | theNonOptimizedReturnType(NULL), | 50 | theNonOptimizedReturnType(NULL), |
549 | 44 | theIsVariadic(variadic) | 51 | theIsVariadic(variadic) |
550 | 45 | { | 52 | { |
551 | 46 | theTypes.push_back(returnType); | 53 | theTypes.push_back(returnType); |
552 | 47 | theTypes.push_back(paramType1); | 54 | theTypes.push_back(paramType1); |
553 | 48 | } | 55 | } |
554 | 49 | 56 | ||
555 | 50 | 57 | ||
556 | 51 | signature::signature( | 58 | signature::signature( |
557 | 52 | const store::Item_t& name, | 59 | const store::Item_t& name, |
558 | 53 | const xqtref_t& paramType1, | 60 | const xqtref_t& paramType1, |
559 | 54 | const xqtref_t& paramType2, | 61 | const xqtref_t& paramType2, |
560 | 55 | bool variadic, | 62 | bool variadic, |
561 | 56 | const xqtref_t& returnType) | 63 | const xqtref_t& returnType) |
562 | 57 | : | 64 | : |
563 | 58 | theQName(name), | 65 | theQName(name), |
564 | 59 | theNonOptimizedReturnType(NULL), | 66 | theNonOptimizedReturnType(NULL), |
565 | 60 | theIsVariadic(variadic) | 67 | theIsVariadic(variadic) |
566 | 61 | { | 68 | { |
567 | 62 | theTypes.push_back(returnType); | 69 | theTypes.push_back(returnType); |
568 | 63 | theTypes.push_back(paramType1); | 70 | theTypes.push_back(paramType1); |
569 | 64 | theTypes.push_back(paramType2); | 71 | theTypes.push_back(paramType2); |
570 | 65 | } | 72 | } |
571 | 66 | 73 | ||
572 | 67 | 74 | ||
573 | 68 | signature::signature( | 75 | signature::signature( |
574 | 69 | const store::Item_t& name, | 76 | const store::Item_t& name, |
575 | 70 | const xqtref_t& returnType) | 77 | const xqtref_t& returnType) |
576 | 71 | : | 78 | : |
577 | 72 | theQName(name), | 79 | theQName(name), |
578 | 73 | theNonOptimizedReturnType(NULL), | 80 | theNonOptimizedReturnType(NULL), |
579 | 74 | theIsVariadic(false) | 81 | theIsVariadic(false) |
580 | 75 | { | 82 | { |
581 | 76 | theTypes.push_back(returnType); | 83 | theTypes.push_back(returnType); |
582 | 77 | } | 84 | } |
583 | 78 | 85 | ||
584 | 79 | 86 | ||
585 | 80 | signature::signature( | 87 | signature::signature( |
586 | 81 | const store::Item_t& name, | 88 | const store::Item_t& name, |
587 | 82 | const xqtref_t& paramType1, | 89 | const xqtref_t& paramType1, |
588 | 83 | const xqtref_t& returnType) | 90 | const xqtref_t& returnType) |
589 | 84 | : | 91 | : |
590 | 85 | theQName(name), | 92 | theQName(name), |
591 | 86 | theNonOptimizedReturnType(NULL), | 93 | theNonOptimizedReturnType(NULL), |
592 | 87 | theIsVariadic(false) | 94 | theIsVariadic(false) |
593 | 88 | { | 95 | { |
594 | 89 | theTypes.push_back(returnType); | 96 | theTypes.push_back(returnType); |
595 | 90 | theTypes.push_back(paramType1); | 97 | theTypes.push_back(paramType1); |
596 | 91 | } | 98 | } |
597 | 92 | 99 | ||
598 | 93 | 100 | ||
599 | 94 | signature::signature( | 101 | signature::signature( |
600 | 95 | const store::Item_t& name, | 102 | const store::Item_t& name, |
601 | 96 | const xqtref_t& paramType1, | 103 | const xqtref_t& paramType1, |
602 | 97 | const xqtref_t& paramType2, | 104 | const xqtref_t& paramType2, |
603 | 98 | const xqtref_t& returnType) | 105 | const xqtref_t& returnType) |
604 | 99 | : | 106 | : |
605 | 100 | theQName(name), | 107 | theQName(name), |
606 | 101 | theNonOptimizedReturnType(NULL), | 108 | theNonOptimizedReturnType(NULL), |
607 | 102 | theIsVariadic(false) | 109 | theIsVariadic(false) |
608 | 103 | { | 110 | { |
609 | 104 | theTypes.push_back(returnType); | 111 | theTypes.push_back(returnType); |
610 | 105 | theTypes.push_back(paramType1); | 112 | theTypes.push_back(paramType1); |
611 | 106 | theTypes.push_back(paramType2); | 113 | theTypes.push_back(paramType2); |
612 | 107 | } | 114 | } |
613 | 108 | 115 | ||
614 | 109 | 116 | ||
615 | 110 | signature::signature( | 117 | signature::signature( |
616 | 111 | const store::Item_t& name, | 118 | const store::Item_t& name, |
617 | 112 | const xqtref_t& paramType1, | 119 | const xqtref_t& paramType1, |
618 | 113 | const xqtref_t& paramType2, | 120 | const xqtref_t& paramType2, |
619 | 114 | const xqtref_t& paramType3, | 121 | const xqtref_t& paramType3, |
629 | 115 | const xqtref_t& returnType) | 122 | const xqtref_t& returnType) |
630 | 116 | : | 123 | : |
631 | 117 | theQName(name), | 124 | theQName(name), |
632 | 118 | theNonOptimizedReturnType(NULL), | 125 | theNonOptimizedReturnType(NULL), |
633 | 119 | theIsVariadic(false) | 126 | theIsVariadic(false) |
634 | 120 | { | 127 | { |
635 | 121 | theTypes.push_back(returnType); | 128 | theTypes.push_back(returnType); |
636 | 122 | theTypes.push_back(paramType1); | 129 | theTypes.push_back(paramType1); |
637 | 123 | theTypes.push_back(paramType2); | 130 | theTypes.push_back(paramType2); |
638 | 124 | theTypes.push_back(paramType3); | 131 | theTypes.push_back(paramType3); |
639 | 125 | } | 132 | } |
642 | 126 | 133 | ||
643 | 127 | 134 | ||
644 | 128 | signature::signature( | 135 | signature::signature( |
645 | 129 | const store::Item_t& name, | 136 | const store::Item_t& name, |
646 | 130 | const xqtref_t& paramType1, | 137 | const xqtref_t& paramType1, |
647 | @@ -309,8 +316,13 @@ | |||
648 | 309 | } | 316 | } |
649 | 310 | 317 | ||
650 | 311 | 318 | ||
651 | 319 | /******************************************************************************* | ||
652 | 320 | "this" is the signature of the function object. "s" is the signature of the | ||
653 | 321 | declaration appearing in the lib module. | ||
654 | 322 | ********************************************************************************/ | ||
655 | 312 | bool signature::subtype( | 323 | bool signature::subtype( |
656 | 313 | const TypeManager* tm, | 324 | const TypeManager* tm, |
657 | 325 | const function* func, | ||
658 | 314 | const signature& s, | 326 | const signature& s, |
659 | 315 | const QueryLoc& loc) const | 327 | const QueryLoc& loc) const |
660 | 316 | { | 328 | { |
661 | @@ -320,8 +332,8 @@ | |||
662 | 320 | if (!theQName->equals(s.theQName.getp())) | 332 | if (!theQName->equals(s.theQName.getp())) |
663 | 321 | return false; | 333 | return false; |
664 | 322 | 334 | ||
667 | 323 | if (theNonOptimizedReturnType.getp() != NULL && s.theNonOptimizedReturnType.getp() != NULL | 335 | if (theNonOptimizedReturnType.getp() != NULL && |
668 | 324 | && | 336 | s.theNonOptimizedReturnType.getp() != NULL && |
669 | 325 | !TypeOps::is_subtype(tm, | 337 | !TypeOps::is_subtype(tm, |
670 | 326 | *theNonOptimizedReturnType.getp(), | 338 | *theNonOptimizedReturnType.getp(), |
671 | 327 | *s.theNonOptimizedReturnType.getp(), | 339 | *s.theNonOptimizedReturnType.getp(), |
672 | @@ -330,12 +342,35 @@ | |||
673 | 330 | return false; | 342 | return false; |
674 | 331 | } | 343 | } |
675 | 332 | 344 | ||
677 | 333 | assert (s.theTypes.size() == theTypes.size() || theIsVariadic ); | 345 | assert (s.theTypes.size() == theTypes.size() || theIsVariadic); |
678 | 346 | |||
679 | 334 | for (csize i = 0; i < theTypes.size(); ++i) | 347 | for (csize i = 0; i < theTypes.size(); ++i) |
680 | 335 | { | 348 | { |
681 | 349 | xqtref_t builtinParamType = theTypes[i]; | ||
682 | 350 | |||
683 | 351 | if (func == BUILTIN_FUNC(FN_ZORBA_XML_PARSE_2)) | ||
684 | 352 | { | ||
685 | 353 | if (i == 2) | ||
686 | 354 | { | ||
687 | 355 | store::Item_t typeName; | ||
688 | 356 | GENV_ITEMFACTORY->createQName(typeName, | ||
689 | 357 | static_context::ZORBA_XML_FN_OPTIONS_NS, | ||
690 | 358 | "", | ||
691 | 359 | "options"), | ||
692 | 360 | |||
693 | 361 | builtinParamType = tm-> | ||
694 | 362 | create_node_type(store::StoreConsts::elementNode, | ||
695 | 363 | typeName, | ||
696 | 364 | NULL, | ||
697 | 365 | TypeConstants::QUANT_QUESTION, | ||
698 | 366 | false, | ||
699 | 367 | false); | ||
700 | 368 | } | ||
701 | 369 | } | ||
702 | 370 | |||
703 | 336 | if (!TypeOps::is_subtype(tm, | 371 | if (!TypeOps::is_subtype(tm, |
706 | 337 | *theTypes[i].getp(), | 372 | *builtinParamType, // subtype |
707 | 338 | *s.theTypes[i].getp(), | 373 | *s.theTypes[i].getp(), // supertype |
708 | 339 | loc)) | 374 | loc)) |
709 | 340 | { | 375 | { |
710 | 341 | return false; | 376 | return false; |
711 | 342 | 377 | ||
712 | === modified file 'src/functions/signature.h' | |||
713 | --- src/functions/signature.h 2013-03-04 21:00:58 +0000 | |||
714 | +++ src/functions/signature.h 2013-09-20 12:27:16 +0000 | |||
715 | @@ -25,24 +25,36 @@ | |||
716 | 25 | 25 | ||
717 | 26 | namespace zorba { | 26 | namespace zorba { |
718 | 27 | 27 | ||
719 | 28 | class function; | ||
720 | 29 | |||
721 | 28 | #define VARIADIC_SIG_SIZE 1000000 | 30 | #define VARIADIC_SIG_SIZE 1000000 |
722 | 29 | 31 | ||
723 | 30 | /******************************************************************************* | 32 | /******************************************************************************* |
724 | 31 | 33 | ||
729 | 32 | By convention, theTypes[0] = return type | 34 | theQName : |
730 | 33 | theTypes[1] = first param type | 35 | the qname of the function |
731 | 34 | theTypes[2] = second param type | 36 | |
732 | 35 | ... = ... | 37 | theTypes: |
733 | 38 | The return type and the paremater types. By convention, theTypes[0] holds the | ||
734 | 39 | return type, theTypes[1] holds the first param type, theTypes[2] holds the 2nd | ||
735 | 40 | param type, etc. | ||
736 | 41 | |||
737 | 42 | theNonOptimizedReturnType: | ||
738 | 43 | This is the original, non-optimized return type of a function. Used in function | ||
739 | 44 | literals type checks. | ||
740 | 45 | |||
741 | 46 | theIsVariadic: | ||
742 | 47 | Whether thefunction is variadic. | ||
743 | 36 | 48 | ||
744 | 37 | ********************************************************************************/ | 49 | ********************************************************************************/ |
745 | 38 | class signature: public SimpleRCObject | 50 | class signature: public SimpleRCObject |
746 | 39 | { | 51 | { |
747 | 52 | friend class function; | ||
748 | 53 | |||
749 | 40 | protected: | 54 | protected: |
750 | 41 | store::Item_t theQName; | 55 | store::Item_t theQName; |
751 | 42 | checked_vector<xqtref_t> theTypes; | 56 | checked_vector<xqtref_t> theTypes; |
755 | 43 | xqtref_t theNonOptimizedReturnType; // This is the original, non-optimized | 57 | xqtref_t theNonOptimizedReturnType; |
753 | 44 | // return type of a function. Used in | ||
754 | 45 | // function literals type checks. | ||
756 | 46 | bool theIsVariadic; | 58 | bool theIsVariadic; |
757 | 47 | 59 | ||
758 | 48 | public: | 60 | public: |
759 | @@ -192,6 +204,7 @@ | |||
760 | 192 | 204 | ||
761 | 193 | bool subtype( | 205 | bool subtype( |
762 | 194 | const TypeManager* tm, | 206 | const TypeManager* tm, |
763 | 207 | const function* func, | ||
764 | 195 | const signature& s, | 208 | const signature& s, |
765 | 196 | const QueryLoc& loc) const; | 209 | const QueryLoc& loc) const; |
766 | 197 | }; | 210 | }; |
767 | 198 | 211 | ||
768 | === modified file 'src/runtime/spec/strings/strings.xml' | |||
769 | --- src/runtime/spec/strings/strings.xml 2013-07-11 22:08:29 +0000 | |||
770 | +++ src/runtime/spec/strings/strings.xml 2013-09-20 12:27:16 +0000 | |||
771 | @@ -670,19 +670,26 @@ | |||
772 | 670 | </zorba:description> | 670 | </zorba:description> |
773 | 671 | 671 | ||
774 | 672 | <zorba:function generateDECL="false"> | 672 | <zorba:function generateDECL="false"> |
787 | 673 | <zorba:signature localname="analyze-string" prefix="fn" version="3.0"> | 673 | |
788 | 674 | <zorba:param>xs:string?</zorba:param> | 674 | <zorba:signature localname="analyze-string" prefix="fn" version="3.0"> |
789 | 675 | <zorba:param>xs:string</zorba:param> | 675 | <zorba:param>xs:string?</zorba:param> |
790 | 676 | <zorba:output>element()</zorba:output> | 676 | <zorba:param>xs:string</zorba:param> |
791 | 677 | </zorba:signature> | 677 | <zorba:output>element()</zorba:output> |
792 | 678 | 678 | </zorba:signature> | |
793 | 679 | <zorba:signature localname="analyze-string" prefix="fn" version="3.0"> | 679 | |
794 | 680 | <zorba:param>xs:string?</zorba:param> | 680 | <zorba:signature localname="analyze-string" prefix="fn" version="3.0"> |
795 | 681 | <zorba:param>xs:string</zorba:param> | 681 | <zorba:param>xs:string?</zorba:param> |
796 | 682 | <zorba:param>xs:string</zorba:param> | 682 | <zorba:param>xs:string</zorba:param> |
797 | 683 | <zorba:output>element()</zorba:output> | 683 | <zorba:param>xs:string</zorba:param> |
798 | 684 | </zorba:signature> | 684 | <zorba:output>element()</zorba:output> |
799 | 685 | </zorba:signature> | ||
800 | 686 | |||
801 | 687 | <zorba:methods> | ||
802 | 688 | <zorba:getReturnType/> | ||
803 | 689 | </zorba:methods> | ||
804 | 690 | |||
805 | 685 | </zorba:function> | 691 | </zorba:function> |
806 | 692 | |||
807 | 686 | </zorba:iterator> | 693 | </zorba:iterator> |
808 | 687 | 694 | ||
809 | 688 | <!-- | 695 | <!-- |
810 | 689 | 696 | ||
811 | === modified file 'src/system/globalenv.cpp' | |||
812 | --- src/system/globalenv.cpp 2013-08-14 08:46:44 +0000 | |||
813 | +++ src/system/globalenv.cpp 2013-09-20 12:27:16 +0000 | |||
814 | @@ -61,6 +61,11 @@ | |||
815 | 61 | 61 | ||
816 | 62 | #include "diagnostics/assert.h" | 62 | #include "diagnostics/assert.h" |
817 | 63 | 63 | ||
818 | 64 | |||
819 | 65 | #include "types/schema/xercesIncludes.h" | ||
820 | 66 | #include "types/schema/StrX.h" | ||
821 | 67 | |||
822 | 68 | |||
823 | 64 | using namespace zorba; | 69 | using namespace zorba; |
824 | 65 | 70 | ||
825 | 66 | 71 | ||
826 | @@ -72,7 +77,18 @@ | |||
827 | 72 | void GlobalEnvironment::init(store::Store* store) | 77 | void GlobalEnvironment::init(store::Store* store) |
828 | 73 | { | 78 | { |
829 | 74 | // initialize Xerces-C lib | 79 | // initialize Xerces-C lib |
831 | 75 | Schema::initialize(); | 80 | #ifndef ZORBA_NO_XMLSCHEMA |
832 | 81 | try | ||
833 | 82 | { | ||
834 | 83 | XERCES_CPP_NAMESPACE::XMLPlatformUtils::Initialize(); | ||
835 | 84 | } | ||
836 | 85 | catch (const XERCES_CPP_NAMESPACE::XMLException& toCatch) | ||
837 | 86 | { | ||
838 | 87 | std::cerr << "Error during Xerces-C initialization! Message:\n" | ||
839 | 88 | << StrX(toCatch.getMessage()) << std::endl; | ||
840 | 89 | abort(); | ||
841 | 90 | } | ||
842 | 91 | #endif | ||
843 | 76 | 92 | ||
844 | 77 | m_globalEnv = new GlobalEnvironment(); | 93 | m_globalEnv = new GlobalEnvironment(); |
845 | 78 | 94 | ||
846 | @@ -122,10 +138,9 @@ | |||
847 | 122 | 138 | ||
848 | 123 | 139 | ||
849 | 124 | /******************************************************************************* | 140 | /******************************************************************************* |
851 | 125 | 141 | destroy all components that were initialized in init | |
852 | 142 | note: destruction must be done in reverse initialization order | ||
853 | 126 | ********************************************************************************/ | 143 | ********************************************************************************/ |
854 | 127 | // destroy all components that were initialized in init | ||
855 | 128 | // note: destruction must be done in reverse initialization order | ||
856 | 129 | void GlobalEnvironment::destroy() | 144 | void GlobalEnvironment::destroy() |
857 | 130 | { | 145 | { |
858 | 131 | delete m_globalEnv->theDynamicLoader; | 146 | delete m_globalEnv->theDynamicLoader; |
859 | @@ -168,8 +183,9 @@ | |||
860 | 168 | m_globalEnv = NULL; | 183 | m_globalEnv = NULL; |
861 | 169 | 184 | ||
862 | 170 | // terminate Xerces-C lib | 185 | // terminate Xerces-C lib |
865 | 171 | Schema::terminate(); | 186 | #ifndef ZORBA_NO_XMLSCHEMA |
866 | 172 | 187 | XERCES_CPP_NAMESPACE::XMLPlatformUtils::Terminate(); | |
867 | 188 | #endif | ||
868 | 173 | } | 189 | } |
869 | 174 | 190 | ||
870 | 175 | 191 | ||
871 | 176 | 192 | ||
872 | === modified file 'src/types/schema/schema.cpp' | |||
873 | --- src/types/schema/schema.cpp 2013-09-17 21:12:49 +0000 | |||
874 | +++ src/types/schema/schema.cpp 2013-09-20 12:27:16 +0000 | |||
875 | @@ -18,6 +18,7 @@ | |||
876 | 18 | #include <string> | 18 | #include <string> |
877 | 19 | 19 | ||
878 | 20 | #include "compiler/parser/query_loc.h" | 20 | #include "compiler/parser/query_loc.h" |
879 | 21 | |||
880 | 21 | #include "context/namespace_context.h" | 22 | #include "context/namespace_context.h" |
881 | 22 | #include "context/static_context.h" | 23 | #include "context/static_context.h" |
882 | 23 | #include "context/uri_resolver.h" | 24 | #include "context/uri_resolver.h" |
883 | @@ -36,10 +37,14 @@ | |||
884 | 36 | #include "types/schema/LoadSchemaErrorHandler.h" | 37 | #include "types/schema/LoadSchemaErrorHandler.h" |
885 | 37 | #include "types/schema/PrintSchema.h" | 38 | #include "types/schema/PrintSchema.h" |
886 | 38 | #include "types/schema/XercesParseUtils.h" | 39 | #include "types/schema/XercesParseUtils.h" |
887 | 40 | #include "types/schema/xercesIncludes.h" | ||
888 | 41 | |||
889 | 39 | #include "system/globalenv.h" | 42 | #include "system/globalenv.h" |
890 | 43 | |||
891 | 40 | #include "store/api/item_factory.h" | 44 | #include "store/api/item_factory.h" |
892 | 45 | |||
893 | 41 | #include "util/utf8_util.h" | 46 | #include "util/utf8_util.h" |
895 | 42 | #include "types/schema/xercesIncludes.h" | 47 | |
896 | 43 | #include "zorbatypes/URI.h" | 48 | #include "zorbatypes/URI.h" |
897 | 44 | #include <zorba/internal/unique_ptr.h> | 49 | #include <zorba/internal/unique_ptr.h> |
898 | 45 | 50 | ||
899 | @@ -82,8 +87,6 @@ | |||
900 | 82 | 87 | ||
901 | 83 | const char* Schema::XSD_NAMESPACE = static_context::W3C_XML_SCHEMA_NS; | 88 | const char* Schema::XSD_NAMESPACE = static_context::W3C_XML_SCHEMA_NS; |
902 | 84 | 89 | ||
903 | 85 | bool Schema::theIsInitialized = false; | ||
904 | 86 | |||
905 | 87 | #ifndef ZORBA_NO_XMLSCHEMA | 90 | #ifndef ZORBA_NO_XMLSCHEMA |
906 | 88 | 91 | ||
907 | 89 | 92 | ||
908 | @@ -332,45 +335,6 @@ | |||
909 | 332 | 335 | ||
910 | 333 | 336 | ||
911 | 334 | /******************************************************************************* | 337 | /******************************************************************************* |
912 | 335 | Initialize the Xerces platform. Called from GlobalEnvironment::init(). | ||
913 | 336 | *******************************************************************************/ | ||
914 | 337 | void Schema::initialize() | ||
915 | 338 | { | ||
916 | 339 | #ifndef ZORBA_NO_XMLSCHEMA | ||
917 | 340 | if (theIsInitialized) | ||
918 | 341 | return; | ||
919 | 342 | |||
920 | 343 | try | ||
921 | 344 | { | ||
922 | 345 | XERCES_CPP_NAMESPACE::XMLPlatformUtils::Initialize(); | ||
923 | 346 | theIsInitialized = true; | ||
924 | 347 | } | ||
925 | 348 | catch (const XERCES_CPP_NAMESPACE::XMLException& toCatch) | ||
926 | 349 | { | ||
927 | 350 | std::cerr << "Error during Xerces-C initialization! Message:\n" | ||
928 | 351 | << StrX(toCatch.getMessage()) << std::endl; | ||
929 | 352 | return; | ||
930 | 353 | } | ||
931 | 354 | #endif | ||
932 | 355 | } | ||
933 | 356 | |||
934 | 357 | |||
935 | 358 | /******************************************************************************* | ||
936 | 359 | Terminate the Xerces platform. Called from GlobalEnvironment::destroy(). | ||
937 | 360 | *******************************************************************************/ | ||
938 | 361 | void Schema::terminate() | ||
939 | 362 | { | ||
940 | 363 | #ifndef ZORBA_NO_XMLSCHEMA | ||
941 | 364 | if (theIsInitialized) | ||
942 | 365 | { | ||
943 | 366 | XERCES_CPP_NAMESPACE::XMLPlatformUtils::Terminate(); | ||
944 | 367 | theIsInitialized = false; | ||
945 | 368 | } | ||
946 | 369 | #endif | ||
947 | 370 | } | ||
948 | 371 | |||
949 | 372 | |||
950 | 373 | /******************************************************************************* | ||
951 | 374 | 338 | ||
952 | 375 | *******************************************************************************/ | 339 | *******************************************************************************/ |
953 | 376 | Schema::Schema(TypeManager* tm) | 340 | Schema::Schema(TypeManager* tm) |
954 | @@ -378,6 +342,8 @@ | |||
955 | 378 | theTypeManager(tm), | 342 | theTypeManager(tm), |
956 | 379 | theHasXSD(false) | 343 | theHasXSD(false) |
957 | 380 | { | 344 | { |
958 | 345 | ZORBA_ASSERT(tm != &GENV_TYPESYSTEM); | ||
959 | 346 | |||
960 | 381 | #ifndef ZORBA_NO_XMLSCHEMA | 347 | #ifndef ZORBA_NO_XMLSCHEMA |
961 | 382 | theGrammarPool = new XMLGrammarPoolImpl(XMLPlatformUtils::fgMemoryManager); | 348 | theGrammarPool = new XMLGrammarPoolImpl(XMLPlatformUtils::fgMemoryManager); |
962 | 383 | // QQQ should be zstring | 349 | // QQQ should be zstring |
963 | @@ -393,7 +359,6 @@ | |||
964 | 393 | Schema::Schema(::zorba::serialization::Archiver& ar) | 359 | Schema::Schema(::zorba::serialization::Archiver& ar) |
965 | 394 | { | 360 | { |
966 | 395 | #ifndef ZORBA_NO_XMLSCHEMA | 361 | #ifndef ZORBA_NO_XMLSCHEMA |
967 | 396 | initialize(); | ||
968 | 397 | theGrammarPool = new XMLGrammarPoolImpl(XMLPlatformUtils::fgMemoryManager); | 362 | theGrammarPool = new XMLGrammarPoolImpl(XMLPlatformUtils::fgMemoryManager); |
969 | 398 | theHasXSD = false; | 363 | theHasXSD = false; |
970 | 399 | #endif | 364 | #endif |
971 | @@ -443,8 +408,8 @@ | |||
972 | 443 | try | 408 | try |
973 | 444 | { | 409 | { |
974 | 445 | SAX2XMLReader* reader = | 410 | SAX2XMLReader* reader = |
977 | 446 | XMLReaderFactory::createXMLReader(XMLPlatformUtils::fgMemoryManager, | 411 | XMLReaderFactory::createXMLReader(XMLPlatformUtils::fgMemoryManager, |
978 | 447 | theGrammarPool); | 412 | theGrammarPool); |
979 | 448 | 413 | ||
980 | 449 | parser.reset(reader); | 414 | parser.reset(reader); |
981 | 450 | // Perform namespace processing | 415 | // Perform namespace processing |
982 | @@ -879,7 +844,8 @@ | |||
983 | 879 | baseXQType, | 844 | baseXQType, |
984 | 880 | TypeConstants::QUANT_ONE, | 845 | TypeConstants::QUANT_ONE, |
985 | 881 | XQType::ATOMIC_UDT, | 846 | XQType::ATOMIC_UDT, |
987 | 882 | XQType::SIMPLE_CONTENT_KIND); | 847 | XQType::SIMPLE_CONTENT_KIND, |
988 | 848 | false); | ||
989 | 883 | 849 | ||
990 | 884 | TRACE("created atomic " << qname->getStringValue() | 850 | TRACE("created atomic " << qname->getStringValue() |
991 | 885 | << " base:" << baseXQType->toString()); | 851 | << " base:" << baseXQType->toString()); |
992 | @@ -913,7 +879,8 @@ | |||
993 | 913 | xsTypeDef->getAnonymous(), | 879 | xsTypeDef->getAnonymous(), |
994 | 914 | qname, | 880 | qname, |
995 | 915 | NULL, | 881 | NULL, |
997 | 916 | itemXQType.getp()); | 882 | itemXQType.getp(), |
998 | 883 | false); | ||
999 | 917 | 884 | ||
1000 | 918 | //cout << " created UDT Simple List Type: " << xqType->toString() << | 885 | //cout << " created UDT Simple List Type: " << xqType->toString() << |
1001 | 919 | // endl; cout.flush(); | 886 | // endl; cout.flush(); |
1002 | @@ -970,7 +937,8 @@ | |||
1003 | 970 | qname, | 937 | qname, |
1004 | 971 | baseXQType, | 938 | baseXQType, |
1005 | 972 | TypeConstants::QUANT_ONE, | 939 | TypeConstants::QUANT_ONE, |
1007 | 973 | unionItemTypes); | 940 | unionItemTypes, |
1008 | 941 | false); | ||
1009 | 974 | 942 | ||
1010 | 975 | //std::cout << " created UDT Union Type: " << xqType->toString() << std::endl; | 943 | //std::cout << " created UDT Union Type: " << xqType->toString() << std::endl; |
1011 | 976 | // std::cout.flush(); | 944 | // std::cout.flush(); |
1012 | @@ -1073,7 +1041,8 @@ | |||
1013 | 1073 | baseXQType, | 1041 | baseXQType, |
1014 | 1074 | TypeConstants::QUANT_ONE, | 1042 | TypeConstants::QUANT_ONE, |
1015 | 1075 | XQType::COMPLEX_UDT, | 1043 | XQType::COMPLEX_UDT, |
1017 | 1076 | contentType); | 1044 | contentType, |
1018 | 1045 | false); | ||
1019 | 1077 | 1046 | ||
1020 | 1078 | result = xqType; | 1047 | result = xqType; |
1021 | 1079 | 1048 | ||
1022 | @@ -1330,7 +1299,8 @@ | |||
1023 | 1330 | } | 1299 | } |
1024 | 1331 | 1300 | ||
1025 | 1332 | XSNamedMap<XSObject> * elemDefs = | 1301 | XSNamedMap<XSObject> * elemDefs = |
1027 | 1333 | model->getComponents(XSConstants::ELEMENT_DECLARATION); | 1302 | model->getComponents(XSConstants::ELEMENT_DECLARATION); |
1028 | 1303 | |||
1029 | 1334 | for( uint i = 0; i<elemDefs->getLength(); i++) | 1304 | for( uint i = 0; i<elemDefs->getLength(); i++) |
1030 | 1335 | { | 1305 | { |
1031 | 1336 | XSElementDeclaration* elemDecl = (XSElementDeclaration*)(elemDefs->item(i)); | 1306 | XSElementDeclaration* elemDecl = (XSElementDeclaration*)(elemDefs->item(i)); |
1032 | @@ -1539,13 +1509,14 @@ | |||
1033 | 1539 | } | 1509 | } |
1034 | 1540 | 1510 | ||
1035 | 1541 | xqtref_t xqType = | 1511 | xqtref_t xqType = |
1043 | 1542 | xqtref_t(new UserDefinedXQType(typeManager, | 1512 | xqtref_t(new UserDefinedXQType(typeManager, |
1044 | 1543 | xsTypeDef->getAnonymous(), | 1513 | xsTypeDef->getAnonymous(), |
1045 | 1544 | qname, | 1514 | qname, |
1046 | 1545 | baseXQType, | 1515 | baseXQType, |
1047 | 1546 | TypeConstants::QUANT_ONE, | 1516 | TypeConstants::QUANT_ONE, |
1048 | 1547 | XQType::COMPLEX_UDT, | 1517 | XQType::COMPLEX_UDT, |
1049 | 1548 | contentType)); | 1518 | contentType, |
1050 | 1519 | false)); | ||
1051 | 1549 | 1520 | ||
1052 | 1550 | addTypeToCache(xqType); | 1521 | addTypeToCache(xqType); |
1053 | 1551 | 1522 | ||
1054 | 1552 | 1523 | ||
1055 | === modified file 'src/types/schema/schema.h' | |||
1056 | --- src/types/schema/schema.h 2013-05-16 17:38:41 +0000 | |||
1057 | +++ src/types/schema/schema.h 2013-09-20 12:27:16 +0000 | |||
1058 | @@ -68,23 +68,15 @@ | |||
1059 | 68 | static const char* XSD_NAMESPACE; | 68 | static const char* XSD_NAMESPACE; |
1060 | 69 | 69 | ||
1061 | 70 | private: | 70 | private: |
1062 | 71 | static bool theIsInitialized; | ||
1063 | 72 | |||
1064 | 73 | TypeManager * theTypeManager; | 71 | TypeManager * theTypeManager; |
1065 | 74 | 72 | ||
1066 | 75 | bool theHasXSD; | 73 | bool theHasXSD; |
1067 | 76 | #ifndef ZORBA_NO_XMLSCHEMA | 74 | #ifndef ZORBA_NO_XMLSCHEMA |
1068 | 77 | XERCES_CPP_NAMESPACE::XMLGrammarPool * theGrammarPool; | 75 | XERCES_CPP_NAMESPACE::XMLGrammarPool * theGrammarPool; |
1069 | 78 | // QQQ use zstring? | ||
1070 | 79 | UdTypesCache * theUdTypesCache; | 76 | UdTypesCache * theUdTypesCache; |
1071 | 80 | #endif // ZORBA_NO_XMLSCHEMA | 77 | #endif // ZORBA_NO_XMLSCHEMA |
1072 | 81 | 78 | ||
1073 | 82 | public: | 79 | public: |
1074 | 83 | static void initialize(); | ||
1075 | 84 | |||
1076 | 85 | static void terminate(); | ||
1077 | 86 | |||
1078 | 87 | public: | ||
1079 | 88 | SERIALIZABLE_CLASS(Schema) | 80 | SERIALIZABLE_CLASS(Schema) |
1080 | 89 | Schema(::zorba::serialization::Archiver& ar); | 81 | Schema(::zorba::serialization::Archiver& ar); |
1081 | 90 | void serialize(::zorba::serialization::Archiver& ar); | 82 | void serialize(::zorba::serialization::Archiver& ar); |
1082 | 91 | 83 | ||
1083 | === modified file 'src/types/typeimpl.cpp' | |||
1084 | --- src/types/typeimpl.cpp 2013-07-23 17:34:35 +0000 | |||
1085 | +++ src/types/typeimpl.cpp 2013-09-20 12:27:16 +0000 | |||
1086 | @@ -174,6 +174,7 @@ | |||
1087 | 174 | TypeConstants::quantifier_t quantifier, | 174 | TypeConstants::quantifier_t quantifier, |
1088 | 175 | bool builtin) | 175 | bool builtin) |
1089 | 176 | : | 176 | : |
1090 | 177 | theRefCount(0), | ||
1091 | 177 | theManager((TypeManager*)manager), | 178 | theManager((TypeManager*)manager), |
1092 | 178 | theKind(type_kind), | 179 | theKind(type_kind), |
1093 | 179 | theQuantifier(quantifier), | 180 | theQuantifier(quantifier), |
1094 | @@ -182,13 +183,33 @@ | |||
1095 | 182 | if (theIsBuiltin) | 183 | if (theIsBuiltin) |
1096 | 183 | { | 184 | { |
1097 | 184 | #ifndef NDEBUG | 185 | #ifndef NDEBUG |
1099 | 185 | theRefCount = 1000000; | 186 | //theRefCount = 1000000; |
1100 | 186 | #endif | 187 | #endif |
1101 | 187 | // register this hardcoded object to help plan serialization | 188 | // register this hardcoded object to help plan serialization |
1102 | 188 | XQType* this_ptr = this; | 189 | XQType* this_ptr = this; |
1103 | 189 | *::zorba::serialization::ClassSerializer::getInstance()-> | 190 | *::zorba::serialization::ClassSerializer::getInstance()-> |
1104 | 190 | getArchiverForHardcodedObjects() & this_ptr; | 191 | getArchiverForHardcodedObjects() & this_ptr; |
1105 | 191 | } | 192 | } |
1106 | 193 | #if 0 | ||
1107 | 194 | else | ||
1108 | 195 | { | ||
1109 | 196 | std::cout << "allocated type " << this << " of kind " | ||
1110 | 197 | << KIND_STRINGS[type_kind] << std::endl; | ||
1111 | 198 | } | ||
1112 | 199 | #endif | ||
1113 | 200 | } | ||
1114 | 201 | |||
1115 | 202 | |||
1116 | 203 | /******************************************************************************* | ||
1117 | 204 | |||
1118 | 205 | ********************************************************************************/ | ||
1119 | 206 | XQType::~XQType() | ||
1120 | 207 | { | ||
1121 | 208 | if (theIsBuiltin) | ||
1122 | 209 | { | ||
1123 | 210 | assert(theRefCount == 0); | ||
1124 | 211 | theRefCount = 0; | ||
1125 | 212 | } | ||
1126 | 192 | } | 213 | } |
1127 | 193 | 214 | ||
1128 | 194 | 215 | ||
1129 | @@ -796,6 +817,21 @@ | |||
1130 | 796 | (contentType == NULL || | 817 | (contentType == NULL || |
1131 | 797 | contentType->type_kind() == XQType::UNTYPED_KIND || | 818 | contentType->type_kind() == XQType::UNTYPED_KIND || |
1132 | 798 | contentType->type_kind() == XQType::ANY_TYPE_KIND)); | 819 | contentType->type_kind() == XQType::ANY_TYPE_KIND)); |
1133 | 820 | |||
1134 | 821 | #if 0 | ||
1135 | 822 | if (theIsBuiltin == false && | ||
1136 | 823 | nodeKind == store::StoreConsts::elementNode && | ||
1137 | 824 | contentType == NULL && | ||
1138 | 825 | nodeName == NULL) | ||
1139 | 826 | { | ||
1140 | 827 | ZORBA_ASSERT(false); | ||
1141 | 828 | } | ||
1142 | 829 | |||
1143 | 830 | if (!theIsBuiltin) | ||
1144 | 831 | { | ||
1145 | 832 | std::cout << "allocated type " << this << " : " << toSchemaString() << std::endl; | ||
1146 | 833 | } | ||
1147 | 834 | #endif | ||
1148 | 799 | } | 835 | } |
1149 | 800 | 836 | ||
1150 | 801 | 837 | ||
1151 | @@ -804,15 +840,31 @@ | |||
1152 | 804 | ********************************************************************************/ | 840 | ********************************************************************************/ |
1153 | 805 | NodeXQType::NodeXQType( | 841 | NodeXQType::NodeXQType( |
1154 | 806 | const NodeXQType& source, | 842 | const NodeXQType& source, |
1156 | 807 | TypeConstants::quantifier_t quantifier) | 843 | TypeConstants::quantifier_t quantifier, |
1157 | 844 | bool builtin) | ||
1158 | 808 | : | 845 | : |
1160 | 809 | XQType(source.theManager, NODE_TYPE_KIND, quantifier, false), | 846 | XQType(source.theManager, NODE_TYPE_KIND, quantifier, builtin), |
1161 | 810 | theNodeKind(source.theNodeKind), | 847 | theNodeKind(source.theNodeKind), |
1162 | 811 | theNodeName(source.theNodeName), | 848 | theNodeName(source.theNodeName), |
1163 | 812 | theContentType(source.theContentType), | 849 | theContentType(source.theContentType), |
1164 | 813 | theNillable(source.theNillable), | 850 | theNillable(source.theNillable), |
1165 | 814 | theIsSchemaTest(source.theIsSchemaTest) | 851 | theIsSchemaTest(source.theIsSchemaTest) |
1166 | 815 | { | 852 | { |
1167 | 853 | #if 0 | ||
1168 | 854 | if (theIsBuiltin == false && | ||
1169 | 855 | theNodeKind == store::StoreConsts::elementNode && | ||
1170 | 856 | theContentType == NULL && | ||
1171 | 857 | theNodeName == NULL) | ||
1172 | 858 | { | ||
1173 | 859 | std::cerr << "STRANGE TYPE" << std::endl; | ||
1174 | 860 | theNodeKind = store::StoreConsts::elementNode; | ||
1175 | 861 | } | ||
1176 | 862 | |||
1177 | 863 | if (!theIsBuiltin) | ||
1178 | 864 | { | ||
1179 | 865 | std::cout << "allocated copy type " << this << " : " << toSchemaString() << std::endl; | ||
1180 | 866 | } | ||
1181 | 867 | #endif | ||
1182 | 816 | } | 868 | } |
1183 | 817 | 869 | ||
1184 | 818 | 870 | ||
1185 | 819 | 871 | ||
1186 | === modified file 'src/types/typeimpl.h' | |||
1187 | --- src/types/typeimpl.h 2013-08-02 21:35:01 +0000 | |||
1188 | +++ src/types/typeimpl.h 2013-09-20 12:27:16 +0000 | |||
1189 | @@ -264,11 +264,7 @@ | |||
1190 | 264 | TypeManager is deleted during engine shutdown. | 264 | TypeManager is deleted during engine shutdown. |
1191 | 265 | 265 | ||
1192 | 266 | ********************************************************************************/ | 266 | ********************************************************************************/ |
1198 | 267 | #if defined NDEBUG || defined ZORBA_FOR_ONE_THREAD_ONLY | 267 | class XQType : public serialization::SerializeBaseClass |
1194 | 268 | class XQType : public SimpleRCObject | ||
1195 | 269 | #else | ||
1196 | 270 | class XQType : public SyncedRCObject | ||
1197 | 271 | #endif | ||
1199 | 272 | { | 268 | { |
1200 | 273 | public: | 269 | public: |
1201 | 274 | // | 270 | // |
1202 | @@ -341,6 +337,8 @@ | |||
1203 | 341 | protected: | 337 | protected: |
1204 | 342 | static const char * KIND_STRINGS[XQType::MAX_TYPE_KIND]; | 338 | static const char * KIND_STRINGS[XQType::MAX_TYPE_KIND]; |
1205 | 343 | 339 | ||
1206 | 340 | mutable long theRefCount; | ||
1207 | 341 | |||
1208 | 344 | TypeManager * theManager; | 342 | TypeManager * theManager; |
1209 | 345 | TypeKind theKind; | 343 | TypeKind theKind; |
1210 | 346 | TypeConstants::quantifier_t theQuantifier; | 344 | TypeConstants::quantifier_t theQuantifier; |
1211 | @@ -349,21 +347,42 @@ | |||
1212 | 349 | 347 | ||
1213 | 350 | public: | 348 | public: |
1214 | 351 | SERIALIZABLE_ABSTRACT_CLASS(XQType) | 349 | SERIALIZABLE_ABSTRACT_CLASS(XQType) |
1220 | 352 | #if defined NDEBUG || defined ZORBA_FOR_ONE_THREAD_ONLY | 350 | |
1221 | 353 | SERIALIZABLE_CLASS_CONSTRUCTOR2(XQType, SimpleRCObject) | 351 | XQType(::zorba::serialization::Archiver& ar) |
1222 | 354 | #else | 352 | : |
1223 | 355 | SERIALIZABLE_CLASS_CONSTRUCTOR2(XQType, SyncedRCObject) | 353 | serialization::SerializeBaseClass(), |
1224 | 356 | #endif | 354 | theRefCount(0), |
1225 | 355 | theIsBuiltin(false) | ||
1226 | 356 | { | ||
1227 | 357 | } | ||
1228 | 358 | |||
1229 | 357 | void serialize(::zorba::serialization::Archiver& ar); | 359 | void serialize(::zorba::serialization::Archiver& ar); |
1230 | 358 | 360 | ||
1231 | 359 | public: | 361 | public: |
1239 | 360 | virtual ~XQType() { } | 362 | long getRefCount() const |
1240 | 361 | 363 | { | |
1241 | 362 | void free() | 364 | return theRefCount; |
1242 | 363 | { | 365 | } |
1243 | 364 | if (!theIsBuiltin) | 366 | |
1244 | 365 | delete this; | 367 | void addReference() const |
1245 | 366 | } | 368 | { |
1246 | 369 | if (!theIsBuiltin) | ||
1247 | 370 | ++theRefCount; | ||
1248 | 371 | } | ||
1249 | 372 | |||
1250 | 373 | void removeReference() | ||
1251 | 374 | { | ||
1252 | 375 | if (!theIsBuiltin) | ||
1253 | 376 | { | ||
1254 | 377 | assert(getRefCount() > 0); | ||
1255 | 378 | |||
1256 | 379 | if (--theRefCount == 0) | ||
1257 | 380 | delete this; | ||
1258 | 381 | } | ||
1259 | 382 | } | ||
1260 | 383 | |||
1261 | 384 | public: | ||
1262 | 385 | virtual ~XQType(); | ||
1263 | 367 | 386 | ||
1264 | 368 | TypeManager* get_manager() const { return theManager; } | 387 | TypeManager* get_manager() const { return theManager; } |
1265 | 369 | 388 | ||
1266 | @@ -421,6 +440,9 @@ | |||
1267 | 421 | TypeKind kind, | 440 | TypeKind kind, |
1268 | 422 | TypeConstants::quantifier_t quant, | 441 | TypeConstants::quantifier_t quant, |
1269 | 423 | bool builtin); | 442 | bool builtin); |
1270 | 443 | |||
1271 | 444 | private: | ||
1272 | 445 | XQType& operator=(const XQType& t); | ||
1273 | 424 | }; | 446 | }; |
1274 | 425 | 447 | ||
1275 | 426 | 448 | ||
1276 | @@ -435,7 +457,7 @@ | |||
1277 | 435 | class NoneXQType : public XQType | 457 | class NoneXQType : public XQType |
1278 | 436 | { | 458 | { |
1279 | 437 | public: | 459 | public: |
1281 | 438 | NoneXQType(const TypeManager* manager, bool builtin = false); | 460 | NoneXQType(const TypeManager* manager, bool builtin); |
1282 | 439 | 461 | ||
1283 | 440 | public: | 462 | public: |
1284 | 441 | SERIALIZABLE_CLASS(NoneXQType) | 463 | SERIALIZABLE_CLASS(NoneXQType) |
1285 | @@ -450,7 +472,7 @@ | |||
1286 | 450 | class EmptyXQType : public XQType | 472 | class EmptyXQType : public XQType |
1287 | 451 | { | 473 | { |
1288 | 452 | public: | 474 | public: |
1290 | 453 | EmptyXQType(const TypeManager* manager, bool builtin = false); | 475 | EmptyXQType(const TypeManager* manager, bool builtin); |
1291 | 454 | 476 | ||
1292 | 455 | public: | 477 | public: |
1293 | 456 | SERIALIZABLE_CLASS(EmptyXQType) | 478 | SERIALIZABLE_CLASS(EmptyXQType) |
1294 | @@ -468,7 +490,7 @@ | |||
1295 | 468 | ItemXQType( | 490 | ItemXQType( |
1296 | 469 | const TypeManager* tm, | 491 | const TypeManager* tm, |
1297 | 470 | TypeConstants::quantifier_t q, | 492 | TypeConstants::quantifier_t q, |
1299 | 471 | bool builtin = false); | 493 | bool builtin); |
1300 | 472 | 494 | ||
1301 | 473 | public: | 495 | public: |
1302 | 474 | SERIALIZABLE_CLASS(ItemXQType) | 496 | SERIALIZABLE_CLASS(ItemXQType) |
1303 | @@ -501,7 +523,7 @@ | |||
1304 | 501 | const TypeManager* manager, | 523 | const TypeManager* manager, |
1305 | 502 | store::SchemaTypeCode code, | 524 | store::SchemaTypeCode code, |
1306 | 503 | TypeConstants::quantifier_t quant, | 525 | TypeConstants::quantifier_t quant, |
1308 | 504 | bool builtin = false) | 526 | bool builtin) |
1309 | 505 | : | 527 | : |
1310 | 506 | XQType(manager, ATOMIC_TYPE_KIND, quant, builtin), | 528 | XQType(manager, ATOMIC_TYPE_KIND, quant, builtin), |
1311 | 507 | theAtomicCode(code) | 529 | theAtomicCode(code) |
1312 | @@ -524,7 +546,7 @@ | |||
1313 | 524 | StructuredItemXQType( | 546 | StructuredItemXQType( |
1314 | 525 | const TypeManager* tm, | 547 | const TypeManager* tm, |
1315 | 526 | TypeConstants::quantifier_t quant, | 548 | TypeConstants::quantifier_t quant, |
1317 | 527 | bool builtin = false); | 549 | bool builtin); |
1318 | 528 | 550 | ||
1319 | 529 | public: | 551 | public: |
1320 | 530 | SERIALIZABLE_CLASS(StructuredItemXQType) | 552 | SERIALIZABLE_CLASS(StructuredItemXQType) |
1321 | @@ -552,7 +574,7 @@ | |||
1322 | 552 | const TypeManager* manager, | 574 | const TypeManager* manager, |
1323 | 553 | store::StoreConsts::JSONItemKind kind, | 575 | store::StoreConsts::JSONItemKind kind, |
1324 | 554 | TypeConstants::quantifier_t quantifier, | 576 | TypeConstants::quantifier_t quantifier, |
1326 | 555 | bool builtin = false); | 577 | bool builtin); |
1327 | 556 | 578 | ||
1328 | 557 | store::StoreConsts::JSONItemKind get_json_kind() const { return theJSONKind; } | 579 | store::StoreConsts::JSONItemKind get_json_kind() const { return theJSONKind; } |
1329 | 558 | 580 | ||
1330 | @@ -589,9 +611,12 @@ | |||
1331 | 589 | TypeConstants::quantifier_t quantifier, | 611 | TypeConstants::quantifier_t quantifier, |
1332 | 590 | bool nillable, | 612 | bool nillable, |
1333 | 591 | bool schematest, | 613 | bool schematest, |
1335 | 592 | bool builtin = false); | 614 | bool builtin); |
1336 | 593 | 615 | ||
1338 | 594 | NodeXQType(const NodeXQType& source, TypeConstants::quantifier_t quant); | 616 | NodeXQType( |
1339 | 617 | const NodeXQType& source, | ||
1340 | 618 | TypeConstants::quantifier_t quant, | ||
1341 | 619 | bool builtin); | ||
1342 | 595 | 620 | ||
1343 | 596 | store::StoreConsts::NodeKind get_node_kind() const { return theNodeKind; } | 621 | store::StoreConsts::NodeKind get_node_kind() const { return theNodeKind; } |
1344 | 597 | 622 | ||
1345 | @@ -630,7 +655,7 @@ | |||
1346 | 630 | class AnyFunctionXQType : public XQType | 655 | class AnyFunctionXQType : public XQType |
1347 | 631 | { | 656 | { |
1348 | 632 | public: | 657 | public: |
1350 | 633 | AnyFunctionXQType(const TypeManager* manager, bool builtin = false) | 658 | AnyFunctionXQType(const TypeManager* manager, bool builtin) |
1351 | 634 | : | 659 | : |
1352 | 635 | XQType(manager, ANY_FUNCTION_TYPE_KIND, TypeConstants::QUANT_STAR, builtin) | 660 | XQType(manager, ANY_FUNCTION_TYPE_KIND, TypeConstants::QUANT_STAR, builtin) |
1353 | 636 | { | 661 | { |
1354 | @@ -639,7 +664,7 @@ | |||
1355 | 639 | AnyFunctionXQType( | 664 | AnyFunctionXQType( |
1356 | 640 | const TypeManager* manager, | 665 | const TypeManager* manager, |
1357 | 641 | TypeConstants::quantifier_t quantifier, | 666 | TypeConstants::quantifier_t quantifier, |
1359 | 642 | bool builtin = false) | 667 | bool builtin) |
1360 | 643 | : | 668 | : |
1361 | 644 | XQType(manager, ANY_FUNCTION_TYPE_KIND, quantifier, builtin) | 669 | XQType(manager, ANY_FUNCTION_TYPE_KIND, quantifier, builtin) |
1362 | 645 | { | 670 | { |
1363 | @@ -673,7 +698,7 @@ | |||
1364 | 673 | const std::vector<xqtref_t>& aParamTypes, | 698 | const std::vector<xqtref_t>& aParamTypes, |
1365 | 674 | const xqtref_t& aReturnType, | 699 | const xqtref_t& aReturnType, |
1366 | 675 | TypeConstants::quantifier_t quantifier, | 700 | TypeConstants::quantifier_t quantifier, |
1368 | 676 | bool builtin = false); | 701 | bool builtin); |
1369 | 677 | 702 | ||
1370 | 678 | const std::vector<xqtref_t>& | 703 | const std::vector<xqtref_t>& |
1371 | 679 | get_param_types() const { return m_param_types; } | 704 | get_param_types() const { return m_param_types; } |
1372 | @@ -773,7 +798,7 @@ | |||
1373 | 773 | TypeConstants::quantifier_t quantifier, | 798 | TypeConstants::quantifier_t quantifier, |
1374 | 774 | UDTKind typeCategory, | 799 | UDTKind typeCategory, |
1375 | 775 | content_kind_t contentKind, | 800 | content_kind_t contentKind, |
1377 | 776 | bool builtin = false); | 801 | bool builtin); |
1378 | 777 | 802 | ||
1379 | 778 | // Constructor for List types | 803 | // Constructor for List types |
1380 | 779 | UserDefinedXQType( | 804 | UserDefinedXQType( |
1381 | @@ -782,7 +807,7 @@ | |||
1382 | 782 | store::Item_t qname, | 807 | store::Item_t qname, |
1383 | 783 | const xqtref_t& baseType, | 808 | const xqtref_t& baseType, |
1384 | 784 | const XQType* listItemType, | 809 | const XQType* listItemType, |
1386 | 785 | bool builtin = false); | 810 | bool builtin); |
1387 | 786 | 811 | ||
1388 | 787 | // Constructor for Union types | 812 | // Constructor for Union types |
1389 | 788 | UserDefinedXQType( | 813 | UserDefinedXQType( |
1390 | @@ -792,7 +817,7 @@ | |||
1391 | 792 | const xqtref_t& baseType, | 817 | const xqtref_t& baseType, |
1392 | 793 | TypeConstants::quantifier_t quantifier, | 818 | TypeConstants::quantifier_t quantifier, |
1393 | 794 | const std::vector<xqtref_t>& unionItemTypes, | 819 | const std::vector<xqtref_t>& unionItemTypes, |
1395 | 795 | bool builtin = false); | 820 | bool builtin); |
1396 | 796 | 821 | ||
1397 | 797 | virtual ~UserDefinedXQType() {} | 822 | virtual ~UserDefinedXQType() {} |
1398 | 798 | 823 | ||
1399 | @@ -823,7 +848,7 @@ | |||
1400 | 823 | class AnyXQType : public XQType | 848 | class AnyXQType : public XQType |
1401 | 824 | { | 849 | { |
1402 | 825 | public: | 850 | public: |
1404 | 826 | AnyXQType(const TypeManager* manager, bool builtin = false) | 851 | AnyXQType(const TypeManager* manager, bool builtin) |
1405 | 827 | : | 852 | : |
1406 | 828 | XQType(manager, ANY_TYPE_KIND, TypeConstants::QUANT_STAR, builtin) | 853 | XQType(manager, ANY_TYPE_KIND, TypeConstants::QUANT_STAR, builtin) |
1407 | 829 | { | 854 | { |
1408 | @@ -842,7 +867,7 @@ | |||
1409 | 842 | class UntypedXQType : public XQType | 867 | class UntypedXQType : public XQType |
1410 | 843 | { | 868 | { |
1411 | 844 | public: | 869 | public: |
1413 | 845 | UntypedXQType(const TypeManager* manager, bool builtin = false) | 870 | UntypedXQType(const TypeManager* manager, bool builtin) |
1414 | 846 | : | 871 | : |
1415 | 847 | XQType(manager, UNTYPED_KIND, TypeConstants::QUANT_STAR, builtin) | 872 | XQType(manager, UNTYPED_KIND, TypeConstants::QUANT_STAR, builtin) |
1416 | 848 | { | 873 | { |
1417 | @@ -861,7 +886,7 @@ | |||
1418 | 861 | class AnySimpleXQType : public XQType | 886 | class AnySimpleXQType : public XQType |
1419 | 862 | { | 887 | { |
1420 | 863 | public: | 888 | public: |
1422 | 864 | AnySimpleXQType(const TypeManager* manager, bool builtin = false) | 889 | AnySimpleXQType(const TypeManager* manager, bool builtin) |
1423 | 865 | : | 890 | : |
1424 | 866 | XQType(manager, ANY_SIMPLE_TYPE_KIND, TypeConstants::QUANT_STAR, builtin) | 891 | XQType(manager, ANY_SIMPLE_TYPE_KIND, TypeConstants::QUANT_STAR, builtin) |
1425 | 867 | { | 892 | { |
1426 | 868 | 893 | ||
1427 | === modified file 'src/types/typemanagerimpl.cpp' | |||
1428 | --- src/types/typemanagerimpl.cpp 2013-07-01 18:59:06 +0000 | |||
1429 | +++ src/types/typemanagerimpl.cpp 2013-09-20 12:27:16 +0000 | |||
1430 | @@ -112,6 +112,8 @@ | |||
1431 | 112 | ********************************************************************************/ | 112 | ********************************************************************************/ |
1432 | 113 | void TypeManagerImpl::initializeSchema() | 113 | void TypeManagerImpl::initializeSchema() |
1433 | 114 | { | 114 | { |
1434 | 115 | ZORBA_ASSERT(this != &GENV_TYPESYSTEM); | ||
1435 | 116 | |||
1436 | 115 | if ( m_schema == NULL ) | 117 | if ( m_schema == NULL ) |
1437 | 116 | m_schema = new Schema(this); | 118 | m_schema = new Schema(this); |
1438 | 117 | } | 119 | } |
1439 | @@ -223,7 +225,7 @@ | |||
1440 | 223 | const xqtref_t& returnType, | 225 | const xqtref_t& returnType, |
1441 | 224 | TypeConstants::quantifier_t quant) const | 226 | TypeConstants::quantifier_t quant) const |
1442 | 225 | { | 227 | { |
1444 | 226 | return new FunctionXQType(this, paramTypes, returnType, quant); | 228 | return new FunctionXQType(this, paramTypes, returnType, quant, false); |
1445 | 227 | } | 229 | } |
1446 | 228 | 230 | ||
1447 | 229 | 231 | ||
1448 | @@ -532,7 +534,14 @@ | |||
1449 | 532 | } | 534 | } |
1450 | 533 | else | 535 | else |
1451 | 534 | { | 536 | { |
1453 | 535 | return new NodeXQType(this, nodeKind, NULL, contentType, quant, false, false); | 537 | return new NodeXQType(this, |
1454 | 538 | nodeKind, | ||
1455 | 539 | NULL, | ||
1456 | 540 | contentType, | ||
1457 | 541 | quant, | ||
1458 | 542 | false, | ||
1459 | 543 | false, | ||
1460 | 544 | false); | ||
1461 | 536 | } | 545 | } |
1462 | 537 | } | 546 | } |
1463 | 538 | 547 | ||
1464 | @@ -548,7 +557,8 @@ | |||
1465 | 548 | contentType, | 557 | contentType, |
1466 | 549 | quant, | 558 | quant, |
1467 | 550 | nillable, | 559 | nillable, |
1469 | 551 | schematest); | 560 | schematest, |
1470 | 561 | false); | ||
1471 | 552 | } | 562 | } |
1472 | 553 | else | 563 | else |
1473 | 554 | { | 564 | { |
1474 | @@ -567,7 +577,8 @@ | |||
1475 | 567 | contentType, | 577 | contentType, |
1476 | 568 | quant, | 578 | quant, |
1477 | 569 | false, | 579 | false, |
1479 | 570 | schematest); | 580 | schematest, |
1480 | 581 | false); | ||
1481 | 571 | } | 582 | } |
1482 | 572 | else | 583 | else |
1483 | 573 | { | 584 | { |
1484 | @@ -594,6 +605,7 @@ | |||
1485 | 594 | RTM.STRING_TYPE_ONE, | 605 | RTM.STRING_TYPE_ONE, |
1486 | 595 | quant, | 606 | quant, |
1487 | 596 | nillable, | 607 | nillable, |
1488 | 608 | false, | ||
1489 | 597 | false); | 609 | false); |
1490 | 598 | } | 610 | } |
1491 | 599 | } | 611 | } |
1492 | @@ -861,7 +873,8 @@ | |||
1493 | 861 | return new FunctionXQType(this, | 873 | return new FunctionXQType(this, |
1494 | 862 | paramTypes, | 874 | paramTypes, |
1495 | 863 | nonOptimizedRetType.getp() ? nonOptimizedRetType : retType, | 875 | nonOptimizedRetType.getp() ? nonOptimizedRetType : retType, |
1497 | 864 | quant); | 876 | quant, |
1498 | 877 | false); | ||
1499 | 865 | } | 878 | } |
1500 | 866 | 879 | ||
1501 | 867 | else | 880 | else |
1502 | @@ -1006,7 +1019,7 @@ | |||
1503 | 1006 | } | 1019 | } |
1504 | 1007 | else | 1020 | else |
1505 | 1008 | { | 1021 | { |
1507 | 1009 | return new NodeXQType(nt, quantifier); | 1022 | return new NodeXQType(nt, quantifier, false); |
1508 | 1010 | } | 1023 | } |
1509 | 1011 | } | 1024 | } |
1510 | 1012 | 1025 | ||
1511 | @@ -1027,7 +1040,8 @@ | |||
1512 | 1027 | return new FunctionXQType(this, | 1040 | return new FunctionXQType(this, |
1513 | 1028 | ft.get_param_types(), | 1041 | ft.get_param_types(), |
1514 | 1029 | ft.get_return_type(), | 1042 | ft.get_return_type(), |
1516 | 1030 | quantifier); | 1043 | quantifier, |
1517 | 1044 | false); | ||
1518 | 1031 | } | 1045 | } |
1519 | 1032 | 1046 | ||
1520 | 1033 | case XQType::ITEM_KIND: | 1047 | case XQType::ITEM_KIND: |
1521 | @@ -1064,7 +1078,8 @@ | |||
1522 | 1064 | udt.isAnonymous(), | 1078 | udt.isAnonymous(), |
1523 | 1065 | udt.getQName(), | 1079 | udt.getQName(), |
1524 | 1066 | udt.getBaseType(), | 1080 | udt.getBaseType(), |
1526 | 1067 | udt.getListItemType()); | 1081 | udt.getListItemType(), |
1527 | 1082 | false); | ||
1528 | 1068 | } | 1083 | } |
1529 | 1069 | else if (udt.isUnion()) | 1084 | else if (udt.isUnion()) |
1530 | 1070 | { | 1085 | { |
1531 | @@ -1073,7 +1088,8 @@ | |||
1532 | 1073 | udt.getQName(), | 1088 | udt.getQName(), |
1533 | 1074 | udt.getBaseType(), | 1089 | udt.getBaseType(), |
1534 | 1075 | quantifier, | 1090 | quantifier, |
1536 | 1076 | udt.getUnionItemTypes()); | 1091 | udt.getUnionItemTypes(), |
1537 | 1092 | false); | ||
1538 | 1077 | } | 1093 | } |
1539 | 1078 | else | 1094 | else |
1540 | 1079 | { | 1095 | { |
1541 | @@ -1083,7 +1099,8 @@ | |||
1542 | 1083 | udt.getBaseType(), | 1099 | udt.getBaseType(), |
1543 | 1084 | quantifier, | 1100 | quantifier, |
1544 | 1085 | udt.getUDTKind(), | 1101 | udt.getUDTKind(), |
1546 | 1086 | udt.contentKind()); | 1102 | udt.contentKind(), |
1547 | 1103 | false); | ||
1548 | 1087 | } | 1104 | } |
1549 | 1088 | } | 1105 | } |
1550 | 1089 | default: | 1106 | default: |
1551 | 1090 | 1107 | ||
1552 | === modified file 'src/types/typeops.cpp' | |||
1553 | --- src/types/typeops.cpp 2013-06-24 07:56:21 +0000 | |||
1554 | +++ src/types/typeops.cpp 2013-09-20 12:27:16 +0000 | |||
1555 | @@ -322,7 +322,6 @@ | |||
1556 | 322 | 322 | ||
1557 | 323 | case XQType::JSON_TYPE_KIND: | 323 | case XQType::JSON_TYPE_KIND: |
1558 | 324 | case XQType::NODE_TYPE_KIND: | 324 | case XQType::NODE_TYPE_KIND: |
1559 | 325 | |||
1560 | 326 | { | 325 | { |
1561 | 327 | if (type.get_quantifier() == TypeConstants::QUANT_ONE) | 326 | if (type.get_quantifier() == TypeConstants::QUANT_ONE) |
1562 | 328 | return &type; | 327 | return &type; |
1563 | 329 | 328 | ||
1564 | === modified file 'src/zorbaserialization/class_serializer.cpp' | |||
1565 | --- src/zorbaserialization/class_serializer.cpp 2013-02-07 17:24:36 +0000 | |||
1566 | +++ src/zorbaserialization/class_serializer.cpp 2013-09-20 12:27:16 +0000 | |||
1567 | @@ -40,6 +40,16 @@ | |||
1568 | 40 | /******************************************************************************* | 40 | /******************************************************************************* |
1569 | 41 | 41 | ||
1570 | 42 | ********************************************************************************/ | 42 | ********************************************************************************/ |
1571 | 43 | ClassSerializer* ClassSerializer::getInstance() | ||
1572 | 44 | { | ||
1573 | 45 | static ClassSerializer theInstance; | ||
1574 | 46 | return &theInstance; | ||
1575 | 47 | } | ||
1576 | 48 | |||
1577 | 49 | |||
1578 | 50 | /******************************************************************************* | ||
1579 | 51 | |||
1580 | 52 | ********************************************************************************/ | ||
1581 | 43 | ClassSerializer::ClassSerializer() | 53 | ClassSerializer::ClassSerializer() |
1582 | 44 | { | 54 | { |
1583 | 45 | theClassFactories.resize(TYPE_LAST); | 55 | theClassFactories.resize(TYPE_LAST); |
1584 | @@ -60,12 +70,21 @@ | |||
1585 | 60 | 70 | ||
1586 | 61 | 71 | ||
1587 | 62 | /******************************************************************************* | 72 | /******************************************************************************* |
1594 | 63 | 73 | called from GlobalEnvironment::destroy() | |
1595 | 64 | ********************************************************************************/ | 74 | ********************************************************************************/ |
1596 | 65 | ClassSerializer* ClassSerializer::getInstance() | 75 | void ClassSerializer::destroyArchiverForHardcodedObjects() |
1597 | 66 | { | 76 | { |
1598 | 67 | static ClassSerializer theInstance; | 77 | delete harcoded_objects_archive; |
1599 | 68 | return &theInstance; | 78 | harcoded_objects_archive = new MemArchiver(true, true);; |
1600 | 79 | } | ||
1601 | 80 | |||
1602 | 81 | |||
1603 | 82 | /******************************************************************************* | ||
1604 | 83 | |||
1605 | 84 | ********************************************************************************/ | ||
1606 | 85 | Archiver* ClassSerializer::getArchiverForHardcodedObjects() | ||
1607 | 86 | { | ||
1608 | 87 | return harcoded_objects_archive; | ||
1609 | 69 | } | 88 | } |
1610 | 70 | 89 | ||
1611 | 71 | 90 | ||
1612 | @@ -93,26 +112,6 @@ | |||
1613 | 93 | } | 112 | } |
1614 | 94 | 113 | ||
1615 | 95 | 114 | ||
1616 | 96 | /******************************************************************************* | ||
1617 | 97 | |||
1618 | 98 | ********************************************************************************/ | ||
1619 | 99 | Archiver* ClassSerializer::getArchiverForHardcodedObjects() | ||
1620 | 100 | { | ||
1621 | 101 | return harcoded_objects_archive; | ||
1622 | 102 | } | ||
1623 | 103 | |||
1624 | 104 | |||
1625 | 105 | /******************************************************************************* | ||
1626 | 106 | called at shutdown | ||
1627 | 107 | ********************************************************************************/ | ||
1628 | 108 | void ClassSerializer::destroyArchiverForHardcodedObjects() | ||
1629 | 109 | { | ||
1630 | 110 | delete harcoded_objects_archive; | ||
1631 | 111 | harcoded_objects_archive = NULL; | ||
1632 | 112 | harcoded_objects_archive = new MemArchiver(true, true); | ||
1633 | 113 | } | ||
1634 | 114 | |||
1635 | 115 | |||
1636 | 116 | } // namespace serialization | 115 | } // namespace serialization |
1637 | 117 | } // namespace zorba | 116 | } // namespace zorba |
1638 | 118 | /* vim:set et sw=2 ts=2: */ | 117 | /* vim:set et sw=2 ts=2: */ |
1639 | 119 | 118 | ||
1640 | === modified file 'src/zorbaserialization/class_serializer.h' | |||
1641 | --- src/zorbaserialization/class_serializer.h 2013-03-05 00:45:43 +0000 | |||
1642 | +++ src/zorbaserialization/class_serializer.h 2013-09-20 12:27:16 +0000 | |||
1643 | @@ -125,7 +125,7 @@ | |||
1644 | 125 | void operator&(Archiver& ar, T*& obj). | 125 | void operator&(Archiver& ar, T*& obj). |
1645 | 126 | 126 | ||
1646 | 127 | ********************************************************************************/ | 127 | ********************************************************************************/ |
1648 | 128 | class ZORBA_DLL_PUBLIC SerializeBaseClass | 128 | class SerializeBaseClass |
1649 | 129 | { | 129 | { |
1650 | 130 | public: | 130 | public: |
1651 | 131 | virtual ~SerializeBaseClass() {} | 131 | virtual ~SerializeBaseClass() {} |
Validation queue starting for the following merge proposals: /code.launchpad .net/~zorba- coders/ zorba/threads/ +merge/ 186514
https:/
Progress dashboard at http:// jenkins. lambda. nu/view/ ValidationQueue