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

Proposed by Matthias Brantner
Status: Merged
Approved by: Markos Zaharioudakis
Approved revision: 10722
Merged at revision: 10776
Proposed branch: lp:~zorba-coders/zorba/bug-analyze_string
Merge into: lp:zorba
Diff against target: 162 lines (+79/-28)
5 files modified
src/functions/func_strings_impl.cpp (+38/-0)
src/functions/func_strings_impl.h (+38/-0)
src/functions/library.cpp (+2/-0)
src/functions/pregenerated/func_strings.cpp (+0/-27)
src/runtime/spec/strings/strings.xml (+1/-1)
To merge this branch: bzr merge lp:~zorba-coders/zorba/bug-analyze_string
Reviewer Review Type Date Requested Status
Markos Zaharioudakis Approve
Paul J. Lucas Approve
Review via email: mp+97671@code.launchpad.net

Commit message

proper return type specification for analyze-string

Description of the change

proper return type specification for analyze-string done manually instead of automatically done by the code generation.

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

Why isn't code-generation improved so it *can* be done via code-generation instead?

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

> Why isn't code-generation improved so it *can* be done via code-generation
> instead?

Automatic code-generation is going to be even more important (and necessary) in light of the forthcoming LLVM stuff. There's going to be even more code that ought to be generated automatically, e.g., C thunks, and lots of boilerplate LLVM C++ API code.

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

Validation queue job bug-analyze_string-2012-03-15T15-01-13.07Z 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, Needs Fixing < 1, Pending < 1. Got: 3 Pending.

Revision history for this message
Matthias Brantner (matthias-brantner) wrote :

> Why isn't code-generation improved so it *can* be done via code-generation
> instead?
There are plenty of cases to specify the user-defined types. Handling each of them automatically (i.e. generate the correct create_* function call to create the type) is not worth it for the 2 functions that we have _in the core_ that require this. I don't think there will be a lot more such functions in the core with user-defined return types. Hence, doing it manually seems to be the right thing to me.

Revision history for this message
Matthias Brantner (matthias-brantner) wrote :

> > Why isn't code-generation improved so it *can* be done via code-generation
> > instead?
>
> Automatic code-generation is going to be even more important (and necessary)
> in light of the forthcoming LLVM stuff. There's going to be even more code
> that ought to be generated automatically, e.g., C thunks, and lots of
> boilerplate LLVM C++ API code.
I totally agree. However, as far as I understand the issue is orthogonal because this mostly concerns the runtime code and not the code for declaring the functions in the compiler/context.

Revision history for this message
Paul J. Lucas (paul-lucas) :
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 bug-analyze_string-2012-04-18T13-55-07.571Z 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
1=== modified file 'src/functions/func_strings_impl.cpp'
2--- src/functions/func_strings_impl.cpp 2012-01-11 17:30:25 +0000
3+++ src/functions/func_strings_impl.cpp 2012-03-15 15:00:28 +0000
4@@ -61,6 +61,44 @@
5 return NULL;
6 }
7
8+
9+/*******************************************************************************
10+
11+********************************************************************************/
12+void populate_context_strings_impl(static_context* sctx)
13+{
14+ xqtref_t lAnalyzeStringResultType =
15+ GENV_TYPESYSTEM.create_node_type(
16+ store::StoreConsts::elementNode,
17+ createQName("http://www.w3.org/2005/xpath-functions","","analyze-string-result"),
18+ NULL,
19+ TypeConstants::QUANT_ONE,
20+ false,
21+ false
22+ );
23+
24+ {
25+ DECL_WITH_KIND(sctx, fn_analyze_string_3_0,
26+ (createQName("http://www.w3.org/2005/xpath-functions","","analyze-string"),
27+ GENV_TYPESYSTEM.STRING_TYPE_QUESTION,
28+ GENV_TYPESYSTEM.STRING_TYPE_ONE,
29+ lAnalyzeStringResultType),
30+ FunctionConsts::FN_ANALYZE_STRING_2);
31+
32+ }
33+
34+
35+ {
36+ DECL_WITH_KIND(sctx, fn_analyze_string_3_0,
37+ (createQName("http://www.w3.org/2005/xpath-functions","","analyze-string"),
38+ GENV_TYPESYSTEM.STRING_TYPE_QUESTION,
39+ GENV_TYPESYSTEM.STRING_TYPE_ONE,
40+ GENV_TYPESYSTEM.STRING_TYPE_ONE,
41+ lAnalyzeStringResultType),
42+ FunctionConsts::FN_ANALYZE_STRING_3);
43+ }
44+}
45+
46 }
47
48 /* vim:set et sw=2 ts=2: */
49
50=== added file 'src/functions/func_strings_impl.h'
51--- src/functions/func_strings_impl.h 1970-01-01 00:00:00 +0000
52+++ src/functions/func_strings_impl.h 2012-03-15 15:00:28 +0000
53@@ -0,0 +1,38 @@
54+/*
55+ * Copyright 2006-2012 The FLWOR Foundation.
56+ *
57+ * Licensed under the Apache License, Version 2.0 (the "License");
58+ * you may not use this file except in compliance with the License.
59+ * You may obtain a copy of the License at
60+ *
61+ * http://www.apache.org/licenses/LICENSE-2.0
62+ *
63+ * Unless required by applicable law or agreed to in writing, software
64+ * distributed under the License is distributed on an "AS IS" BASIS,
65+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
66+ * See the License for the specific language governing permissions and
67+ * limitations under the License.
68+ */
69+#pragma once
70+#ifndef ZORBA_FUNCTIONS_STRINGS_IMPL_H
71+#define ZORBA_FUNCTIONS_STRINGS_IMPL_H
72+
73+
74+#include "common/shared_types.h"
75+#include "functions/function.h"
76+#include "functions/function_impl.h"
77+#include "functions/function_consts.h"
78+
79+
80+namespace zorba {
81+
82+
83+void populate_context_strings_impl(static_context* sctx);
84+
85+
86+} //namespace zorba
87+
88+
89+#endif
90+/* vim:set et sw=2 ts=2: */
91+
92
93=== modified file 'src/functions/library.cpp'
94--- src/functions/library.cpp 2012-03-07 15:49:25 +0000
95+++ src/functions/library.cpp 2012-03-15 15:00:28 +0000
96@@ -57,6 +57,7 @@
97 #include "functions/func_sequences.h"
98 #include "functions/func_sequences_impl.h"
99 #include "functions/func_strings.h"
100+#include "functions/func_strings_impl.h"
101 #include "functions/func_uris.h"
102 #include "functions/func_json.h"
103 #include "functions/func_var_decl.h"
104@@ -122,6 +123,7 @@
105 populate_context_schema(sctx);
106 populate_context_sctx(sctx);
107 populate_context_strings(sctx);
108+ populate_context_strings_impl(sctx);
109 populate_context_uris(sctx);
110 populate_context_sequences(sctx);
111 populate_context_sequences_impl(sctx);
112
113=== modified file 'src/functions/pregenerated/func_strings.cpp'
114--- src/functions/pregenerated/func_strings.cpp 2012-02-16 12:48:17 +0000
115+++ src/functions/pregenerated/func_strings.cpp 2012-03-15 15:00:28 +0000
116@@ -853,33 +853,6 @@
117 {
118
119
120- DECL_WITH_KIND(sctx, fn_analyze_string_3_0,
121- (createQName("http://www.w3.org/2005/xpath-functions","","analyze-string"),
122- GENV_TYPESYSTEM.STRING_TYPE_QUESTION,
123- GENV_TYPESYSTEM.STRING_TYPE_ONE,
124- GENV_TYPESYSTEM.ELEMENT_TYPE_ONE),
125- FunctionConsts::FN_ANALYZE_STRING_2);
126-
127- }
128-
129-
130- {
131-
132-
133- DECL_WITH_KIND(sctx, fn_analyze_string_3_0,
134- (createQName("http://www.w3.org/2005/xpath-functions","","analyze-string"),
135- GENV_TYPESYSTEM.STRING_TYPE_QUESTION,
136- GENV_TYPESYSTEM.STRING_TYPE_ONE,
137- GENV_TYPESYSTEM.STRING_TYPE_ONE,
138- GENV_TYPESYSTEM.ELEMENT_TYPE_ONE),
139- FunctionConsts::FN_ANALYZE_STRING_3);
140-
141- }
142-
143-
144- {
145-
146-
147 DECL_WITH_KIND(sctx, fn_zorba_string_materialize,
148 (createQName("http://www.zorba-xquery.com/modules/string","","materialize"),
149 GENV_TYPESYSTEM.STRING_TYPE_ONE,
150
151=== modified file 'src/runtime/spec/strings/strings.xml'
152--- src/runtime/spec/strings/strings.xml 2012-01-11 17:30:25 +0000
153+++ src/runtime/spec/strings/strings.xml 2012-03-15 15:00:28 +0000
154@@ -668,7 +668,7 @@
155 fn:analyze-string
156 </zorba:description>
157
158- <zorba:function>
159+ <zorba:function generateDECL="false">
160 <zorba:signature localname="analyze-string" prefix="fn" version="3.0">
161 <zorba:param>xs:string?</zorba:param>
162 <zorba:param>xs:string</zorba:param>

Subscribers

People subscribed via source and target branches