Merge lp:~zorba-coders/zorba/feature-gen_audit_props into lp:zorba

Proposed by Matthias Brantner
Status: Merged
Approved by: Matthias Brantner
Approved revision: 11340
Merged at revision: 11340
Proposed branch: lp:~zorba-coders/zorba/feature-gen_audit_props
Merge into: lp:zorba
Diff against target: 370 lines (+243/-34)
9 files modified
cmake_modules/ZorbaRuntimeGenerator.cmake (+33/-0)
src/api/CMakeLists.txt (+24/-0)
src/api/audit.xml (+30/-0)
src/api/auditimpl.cpp (+2/-26)
src/api/auditimpl.h (+2/-8)
src/api/auditprops_cpp.xq (+74/-0)
src/api/auditprops_h.xq (+55/-0)
src/api/pregenerated/auditprops.cpp (+16/-0)
src/api/pregenerated/auditprops.h (+7/-0)
To merge this branch: bzr merge lp:~zorba-coders/zorba/feature-gen_audit_props
Reviewer Review Type Date Requested Status
Matthias Brantner Approve
Till Westmann Approve
Review via email: mp+156994@code.launchpad.net

Commit message

generate audit properties

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 feature-gen_audit_props-2013-04-03T23-11-43.877Z 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, Needs Information < 1, Resubmit < 1. Got: 2 Pending.

Revision history for this message
Till Westmann (tillw) :
review: Approve
Revision history for this message
Matthias Brantner (matthias-brantner) :
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 feature-gen_audit_props-2013-04-04T00-41-42.235Z 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 'cmake_modules/ZorbaRuntimeGenerator.cmake'
--- cmake_modules/ZorbaRuntimeGenerator.cmake 2013-03-04 16:17:30 +0000
+++ cmake_modules/ZorbaRuntimeGenerator.cmake 2013-04-03 23:02:22 +0000
@@ -127,3 +127,36 @@
127 -D "test_only:BOOLEAN=TRUE"127 -D "test_only:BOOLEAN=TRUE"
128 -P "${GEN_SCRIPT}")128 -P "${GEN_SCRIPT}")
129ENDMACRO(ZORBA_DIAGNOSTIC_GENERATOR)129ENDMACRO(ZORBA_DIAGNOSTIC_GENERATOR)
130
131MACRO(ZORBA_AUDIT_GENERATOR GEN_QUERY EXTVARS EXTRA_DEPS OUTPUT)
132 # CMake is annoyingly limited when it comes to lists. There's no way
133 # (that I know of) to create a list where any item contains a
134 # semicolon. Since some of our arguments contain semicolons, we
135 # cannot create a variable to hold the arguments to CMake
136 # here. Therefore, we must duplicate them. It is important for
137 # testing purposes that the arguments to CMAKE_COMMAND in both
138 # ADD_CUSTOM_COMMAND() and ADD_TEST() here be the same, except for
139 # -Dtest_only.
140 STRING(REPLACE " " "_" TEST_NAME "${OUTPUT}")
141 ADD_CUSTOM_COMMAND(OUTPUT "${OUTPUT}"
142 COMMAND "${CMAKE_COMMAND}"
143 -D "source_dir=\"${CMAKE_SOURCE_DIR}\""
144 -D "binary_dir=\"${CMAKE_BINARY_DIR}\""
145 -D "ZORBA_EXE=\"${ZORBA_EXE}\""
146 -D "query=\"${GEN_QUERY}\""
147 -D "gen_file=\"${OUTPUT}\""
148 -D "extvars:STRING=${EXTVARS}"
149 -P "${GEN_SCRIPT}"
150 MAIN_DEPENDENCY ${GEN_QUERY}
151 DEPENDS ${EXTRA_DEPS}
152 ${GEN_SCRIPT} ${CMAKE_SOURCE_DIR}/cmake_modules/ZorbaRuntimeGenerator.cmake)
153 ADD_TEST("RuntimeGeneratorTest-${TEST_NAME}" "${CMAKE_COMMAND}"
154 -D "source_dir=${CMAKE_SOURCE_DIR}"
155 -D "binary_dir=${CMAKE_BINARY_DIR}"
156 -D "ZORBA_EXE=${ZORBA_EXE}"
157 -D "query=${GEN_QUERY}"
158 -D "gen_file=${OUTPUT}"
159 -D "extvars:STRING=${EXTVARS}"
160 -D "test_only:BOOLEAN=TRUE"
161 -P "${GEN_SCRIPT}")
162ENDMACRO(ZORBA_AUDIT_GENERATOR)
130163
=== modified file 'src/api/CMakeLists.txt'
--- src/api/CMakeLists.txt 2013-02-07 17:24:36 +0000
+++ src/api/CMakeLists.txt 2013-04-03 23:02:22 +0000
@@ -81,4 +81,28 @@
81 ${CMAKE_CURRENT_BINARY_DIR}/api/version.cpp81 ${CMAKE_CURRENT_BINARY_DIR}/api/version.cpp
82 )82 )
8383
84SET(AUDIT_HEADER_GENERATOR "${CMAKE_SOURCE_DIR}/src/api/auditprops_h.xq")
85SET(AUDIT_CPP_GENERATOR "${CMAKE_SOURCE_DIR}/src/api/auditprops_cpp.xq")
86SET(AUDIT_HEADER "${CMAKE_BINARY_DIR}/src/api/auditprops.h")
87SET(AUDIT_CPP "${CMAKE_BINARY_DIR}/src/api/auditprops.cpp")
88SET(AUDIT_PROPS_SPEC "${CMAKE_SOURCE_DIR}/src/api/audit.xml")
89
90ZORBA_AUDIT_GENERATOR(
91 ${AUDIT_CPP_GENERATOR}
92 "auditspecfile:=${AUDIT_PROPS_SPEC}"
93 ${AUDIT_PROPS_SPEC}
94 ${AUDIT_CPP})
95
96ZORBA_AUDIT_GENERATOR(
97 ${AUDIT_HEADER_GENERATOR}
98 "auditspecfile:=${AUDIT_PROPS_SPEC}"
99 ${AUDIT_PROPS_SPEC}
100 ${AUDIT_HEADER})
101
102SET_SOURCE_FILES_PROPERTIES("${CMAKE_SOURCE_DIR}/src/api/auditimpl.cpp"
103 PROPERTIES OBJECT_DEPENDS
104 "${CMAKE_BINARY_DIR}/src/api/auditprops.cpp;${CMAKE_BINARY_DIR}/src/api/auditprops.h")
105SET_SOURCE_FILES_PROPERTIES("${CMAKE_SOURCE_DIR}/src/api/auditimpl.h"
106 PROPERTIES OBJECT_DEPENDS
107 "${CMAKE_BINARY_DIR}/src/api/auditprops.h")
84# vim:set et sw=2 ts=2:108# vim:set et sw=2 ts=2:
85109
=== added file 'src/api/audit.xml'
--- src/api/audit.xml 1970-01-01 00:00:00 +0000
+++ src/api/audit.xml 2013-04-03 23:02:22 +0000
@@ -0,0 +1,30 @@
1<?xml version="1.0" encoding="UTF-8"?>
2<!--
3 : Copyright 2013 The FLWOR Foundation.
4 :
5 : Licensed under the Apache License, Version 2.0 (the "License");
6 : you may not use this file except in compliance with the License.
7 : You may obtain a copy of the License at
8 :
9 : http://www.apache.org/licenses/LICENSE-2.0
10 :
11 : Unless required by applicable law or agreed to in writing, software
12 : distributed under the License is distributed on an "AS IS" BASIS,
13 : WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 : See the License for the specific language governing permissions and
15 : limitations under the License.
16-->
17
18<audit>
19
20 <group name="xquery">
21 <group name="compilation">
22 <property name="filename" type="string"/>
23 <property name="parse-duration" type="int"/>
24 <property name="translation-duration" type="int"/>
25 <property name="optimization-duration" type="int"/>
26 <property name="codegeneration-duration" type="int"/>
27 </group>
28 </group>
29
30</audit>
031
=== modified file 'src/api/auditimpl.cpp'
--- src/api/auditimpl.cpp 2013-02-07 17:24:36 +0000
+++ src/api/auditimpl.cpp 2013-04-03 23:02:22 +0000
@@ -30,10 +30,7 @@
30// PropertyGroupImpl30// PropertyGroupImpl
31//************************************************************************31//************************************************************************
3232
33const char* XQUERY_COMPILATION_PATH[] = { "xquery", "compilation" };
34
35const PropertyGroupImpl EMPTY_OBJECT (0, NULL);33const PropertyGroupImpl EMPTY_OBJECT (0, NULL);
36const PropertyGroupImpl XQUERY_COMPILATION(2, XQUERY_COMPILATION_PATH);
3734
38PropertyGroupImpl::PropertyGroupImpl(const size_t pathLength, const char** path)35PropertyGroupImpl::PropertyGroupImpl(const size_t pathLength, const char** path)
39 : m_pathLength(pathLength), m_path(path) {36 : m_pathLength(pathLength), m_path(path) {
@@ -60,29 +57,6 @@
6057
61const PropertyImpl INVALID("");58const PropertyImpl INVALID("");
6259
63const PropertyImpl XQUERY_COMPILATION_FILENAME(
64 XQUERY_COMPILATION, "filename", 0, Property::STRING);
65
66const PropertyImpl XQUERY_COMPILATION_PARSE_DURATION(
67 XQUERY_COMPILATION, "parse-duration", 1, Property::INT);
68
69const PropertyImpl XQUERY_COMPILATION_TRANSLATION_DURATION(
70 XQUERY_COMPILATION, "translation-duration", 2, Property::INT);
71
72const PropertyImpl XQUERY_COMPILATION_OPTIMIZATION_DURATION(
73 XQUERY_COMPILATION, "optimization-duration", 3, Property::INT);
74
75const PropertyImpl XQUERY_COMPILATION_CODEGENERATION_DURATION(
76 XQUERY_COMPILATION, "codegeneration-duration", 4, Property::INT);
77
78const PropertyImpl* PROPERTIES[] = {
79 &XQUERY_COMPILATION_FILENAME,
80 &XQUERY_COMPILATION_PARSE_DURATION,
81 &XQUERY_COMPILATION_TRANSLATION_DURATION,
82 &XQUERY_COMPILATION_OPTIMIZATION_DURATION,
83 &XQUERY_COMPILATION_CODEGENERATION_DURATION
84};
85
86PropertyImpl::PropertyImpl(const PropertyGroup& g, const char n[], long i, Type t)60PropertyImpl::PropertyImpl(const PropertyGroup& g, const char n[], long i, Type t)
87 : m_group(g), m_id(i), m_type(t) {61 : m_group(g), m_id(i), m_type(t) {
88 String result;62 String result;
@@ -120,6 +94,8 @@
120 return m_type;94 return m_type;
121}95}
12296
97#include "api/auditprops.cpp"
98
123//************************************************************************99//************************************************************************
124// Observation100// Observation
125//************************************************************************101//************************************************************************
126102
=== modified file 'src/api/auditimpl.h'
--- src/api/auditimpl.h 2013-02-07 17:24:36 +0000
+++ src/api/auditimpl.h 2013-04-03 23:02:22 +0000
@@ -43,8 +43,6 @@
43 const char** m_path;43 const char** m_path;
44 };44 };
4545
46 extern const PropertyGroupImpl XQUERY_COMPILATION;
47
48 class PropertyImpl : public Property {46 class PropertyImpl : public Property {
49 public:47 public:
5048
@@ -74,12 +72,6 @@
74 const Type m_type;72 const Type m_type;
75 };73 };
7674
77 extern const PropertyImpl XQUERY_COMPILATION_FILENAME;
78 extern const PropertyImpl XQUERY_COMPILATION_PARSE_DURATION;
79 extern const PropertyImpl XQUERY_COMPILATION_TRANSLATION_DURATION;
80 extern const PropertyImpl XQUERY_COMPILATION_OPTIMIZATION_DURATION;
81 extern const PropertyImpl XQUERY_COMPILATION_CODEGENERATION_DURATION;
82
83 class ObservationImpl : public Observation {75 class ObservationImpl : public Observation {
84 public:76 public:
85 union Value {77 union Value {
@@ -210,6 +202,8 @@
210 };202 };
211203
212 extern ProviderImpl PROVIDER_IMPL;204 extern ProviderImpl PROVIDER_IMPL;
205
206#include "api/auditprops.h"
213}207}
214}208}
215209
216210
=== added file 'src/api/auditprops_cpp.xq'
--- src/api/auditprops_cpp.xq 1970-01-01 00:00:00 +0000
+++ src/api/auditprops_cpp.xq 2013-04-03 23:02:22 +0000
@@ -0,0 +1,74 @@
1(:
2 : Copyright 2013 The FLWOR Foundation.
3 :
4 : Licensed under the Apache License, Version 2.0 (the "License");
5 : you may not use this file except in compliance with the License.
6 : You may obtain a copy of the License at
7 :
8 : http://www.apache.org/licenses/LICENSE-2.0
9 :
10 : Unless required by applicable law or agreed to in writing, software
11 : distributed under the License is distributed on an "AS IS" BASIS,
12 : WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 : See the License for the specific language governing permissions and
14 : limitations under the License.
15:)
16import module namespace file = "http://expath.org/ns/file";
17
18declare variable $auditspecfile as xs:string external;
19
20declare function local:gen-group-spec($group as element()?) as xs:string*
21{
22 if ($group)
23 then
24 ($group/@name, local:gen-group-spec($group/parent::group))
25 else ()
26};
27
28declare function local:group-path($group-spec as xs:string*) as xs:string
29{
30let $name := string-join($group-spec ! upper-case(.), "_")
31let $path := $name || "_PATH"
32return
33 'const char* '
34 || $path || "[]"
35 || " = { " || string-join($group-spec ! concat('"', ., '"'), ", ")
36 || " };&#10;"
37 || 'const PropertyGroupImpl ' || $name
38 || "(" || count($group-spec) || ", " || $path || ");&#10;"
39};
40
41variable $counter := -1;
42
43(
44let $spec := parse-xml(file:read-text($auditspecfile))
45return
46 string-join(
47 for $first-prop in $spec//group/property[1]
48 let $group-spec := reverse(local:gen-group-spec($first-prop/parent::group))
49 return
50 local:group-path($group-spec) ||
51 string-join(
52 for $prop in ($first-prop, $first-prop/following-sibling::property)
53 let $group := string-join($group-spec ! upper-case(.), "_")
54 return {
55 $counter := $counter + 1;
56 "const PropertyImpl " || $group || "_" || replace(upper-case($prop/@name), "-", "_")
57 || "(" || $group || ', "' || $prop/@name || '", ' || $counter
58 || ", Property::" || upper-case($prop/@type) || ");&#10;"
59 }
60 ) || "&#10;"
61 ) || "&#10;" ||
62 "const PropertyImpl* PROPERTIES[] = {&#10;" ||
63 string-join(
64 for $first-prop in $spec//group/property[1]
65 let $group-spec := reverse(local:gen-group-spec($first-prop/parent::group))
66 return
67 string-join(
68 for $prop in ($first-prop, $first-prop/following-sibling::property)
69 return
70 (" &amp;" || string-join($group-spec ! upper-case(.), "_") || "_"
71 || replace(upper-case($prop/@name), "-", "_")), ",&#10;"
72 ), ",&#10;"
73 ) || "&#10;};&#10;"
74)
075
=== added file 'src/api/auditprops_h.xq'
--- src/api/auditprops_h.xq 1970-01-01 00:00:00 +0000
+++ src/api/auditprops_h.xq 2013-04-03 23:02:22 +0000
@@ -0,0 +1,55 @@
1(:
2 : Copyright 2013 The FLWOR Foundation.
3 :
4 : Licensed under the Apache License, Version 2.0 (the "License");
5 : you may not use this file except in compliance with the License.
6 : You may obtain a copy of the License at
7 :
8 : http://www.apache.org/licenses/LICENSE-2.0
9 :
10 : Unless required by applicable law or agreed to in writing, software
11 : distributed under the License is distributed on an "AS IS" BASIS,
12 : WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 : See the License for the specific language governing permissions and
14 : limitations under the License.
15:)
16import module namespace file = "http://expath.org/ns/file";
17
18declare variable $auditspecfile as xs:string external;
19
20declare function local:gen-group-spec($group as element()?) as xs:string*
21{
22 if ($group)
23 then
24 ($group/@name, local:gen-group-spec($group/parent::group))
25 else ()
26};
27
28
29declare function local:group($group-spec as xs:string*) as xs:string
30{
31'extern const PropertyGroupImpl '
32 || string-join($group-spec ! upper-case(.), "_")
33 || ';
34'
35};
36
37string-join(
38 (
39 let $spec := parse-xml(file:read-text($auditspecfile))
40 for $first-prop in $spec//group/property[1]
41 let $group-spec := reverse(local:gen-group-spec($first-prop/parent::group))
42 return
43 local:group($group-spec) ||
44 string-join(
45 for $prop in ($first-prop, $first-prop/following-sibling::property)
46 return
47 'extern const PropertyImpl '
48 || string-join($group-spec ! upper-case(.), "_")
49 || '_' || replace(upper-case($prop/@name), "-", "_")
50 || ';'
51 , "
52") || '
53
54'))
55
056
=== added directory 'src/api/pregenerated'
=== added file 'src/api/pregenerated/auditprops.cpp'
--- src/api/pregenerated/auditprops.cpp 1970-01-01 00:00:00 +0000
+++ src/api/pregenerated/auditprops.cpp 2013-04-03 23:02:22 +0000
@@ -0,0 +1,16 @@
1const char* XQUERY_COMPILATION_PATH[] = { "xquery", "compilation" };
2const PropertyGroupImpl XQUERY_COMPILATION(2, XQUERY_COMPILATION_PATH);
3const PropertyImpl XQUERY_COMPILATION_FILENAME(XQUERY_COMPILATION, "filename", 0, Property::STRING);
4const PropertyImpl XQUERY_COMPILATION_PARSE_DURATION(XQUERY_COMPILATION, "parse-duration", 1, Property::INT);
5const PropertyImpl XQUERY_COMPILATION_TRANSLATION_DURATION(XQUERY_COMPILATION, "translation-duration", 2, Property::INT);
6const PropertyImpl XQUERY_COMPILATION_OPTIMIZATION_DURATION(XQUERY_COMPILATION, "optimization-duration", 3, Property::INT);
7const PropertyImpl XQUERY_COMPILATION_CODEGENERATION_DURATION(XQUERY_COMPILATION, "codegeneration-duration", 4, Property::INT);
8
9
10const PropertyImpl* PROPERTIES[] = {
11 &XQUERY_COMPILATION_FILENAME,
12 &XQUERY_COMPILATION_PARSE_DURATION,
13 &XQUERY_COMPILATION_TRANSLATION_DURATION,
14 &XQUERY_COMPILATION_OPTIMIZATION_DURATION,
15 &XQUERY_COMPILATION_CODEGENERATION_DURATION
16};
017
=== added file 'src/api/pregenerated/auditprops.h'
--- src/api/pregenerated/auditprops.h 1970-01-01 00:00:00 +0000
+++ src/api/pregenerated/auditprops.h 2013-04-03 23:02:22 +0000
@@ -0,0 +1,7 @@
1extern const PropertyGroupImpl XQUERY_COMPILATION;
2extern const PropertyImpl XQUERY_COMPILATION_FILENAME;
3extern const PropertyImpl XQUERY_COMPILATION_PARSE_DURATION;
4extern const PropertyImpl XQUERY_COMPILATION_TRANSLATION_DURATION;
5extern const PropertyImpl XQUERY_COMPILATION_OPTIMIZATION_DURATION;
6extern const PropertyImpl XQUERY_COMPILATION_CODEGENERATION_DURATION;
7

Subscribers

People subscribed via source and target branches