Gentoo Archives: gentoo-commits

From: Markus Meier <maekke@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] dev/maekke:master commit in: media-gfx/hugin/files/, media-gfx/hugin/
Date: Fri, 02 Jan 2015 18:31:46
Message-Id: 1420223484.f740ee8ee532576e98c44b1824b14387eea77184.maekke@gentoo
1 commit: f740ee8ee532576e98c44b1824b14387eea77184
2 Author: Markus Meier <maekke <AT> gentoo <DOT> org>
3 AuthorDate: Fri Jan 2 18:31:24 2015 +0000
4 Commit: Markus Meier <maekke <AT> gentoo <DOT> org>
5 CommitDate: Fri Jan 2 18:31:24 2015 +0000
6 URL: http://sources.gentoo.org/gitweb/?p=dev/maekke.git;a=commit;h=f740ee8e
7
8 fix building with dev-libs/boost-1.56, bug #525400
9
10 Package-Manager: portage-2.2.15
11 Manifest-Sign-Key: 072AD062
12
13 ---
14 media-gfx/hugin/Manifest | 11 +-
15 .../hugin/files/hugin-2014.0.0-ParseExp.patch | 527 +++++++++++++++++++++
16 media-gfx/hugin/hugin-2014.0.0-r1.ebuild | 5 +-
17 media-gfx/hugin/hugin-2014.0.0.ebuild | 5 +-
18 4 files changed, 541 insertions(+), 7 deletions(-)
19
20 diff --git a/media-gfx/hugin/Manifest b/media-gfx/hugin/Manifest
21 index 9441812..6be43ff 100644
22 --- a/media-gfx/hugin/Manifest
23 +++ b/media-gfx/hugin/Manifest
24 @@ -6,20 +6,21 @@ AUX hugin-2011.4.0-gcc47.patch 1243 SHA256 ff1e2f55eb94e22546c3185cde458f51a503f
25 AUX hugin-2012.0.0-boost.patch 1690 SHA256 024354bf8c6fea9cc113f8645224eb8402c4406e310db5b72b27c2d6bd188182 SHA512 78dbeb9e2e0450f354ea2920a8081f34024a512db6a2536508401db622be5cce292661b244788eebec9fb03c89c5c3b17c5c8eef7c6a9bde31cca78e68de416b WHIRLPOOL 42452ac88ad1fc0dd2d7a94c5ea0c412c9742c1a255943242614bad1f459aed46de44ef281f3d443dd4377549bef3f4dfd86561e2ebbf14f42b8d508e3c1dc82
26 AUX hugin-2012.0.0-perl.patch 272 SHA256 2e21c6cbffe4d06a9a97787f22fbe6e6eff6130906c791d051cb7e1a6a05a92a SHA512 0f0e6d42012ae70ccf3ede51a24763f6e9cd6e46e7cc287c2a52b5b2753928dcda630568811a23d6cc5e836e11a9b3bec5202844a878e4ac58349ea379c7d9d8 WHIRLPOOL 82256829f4083bd043aa8105088a19bb0c04e7de9deb6802f33d1055f56663630437419a6b8830ff95a2904a9bc5ed74de1969aa45774723f650074db79bfcfb
27 AUX hugin-2013.0.0-boost.patch 1690 SHA256 4a4e507546d344811f16390dcfc90f42d70807bc3ace8e7b1df3ceb9dea7cc30 SHA512 280d3555dc3774ccead2a962a8efd3a3942da296d6565185b9f84e79f03b9a6398e103357b80496b121fa07822fd1cfb9b580ef0c4da8fbaf6ddd7665d135cd7 WHIRLPOOL 60770064bb4fb292a4a12308ee4a004b6b114ada751cd713a2df061dc7670e0b0c7f39c50d3f6510f037a9e987a69f9e4aef645d6d9674dfc0306d4e155982fa
28 +AUX hugin-2014.0.0-ParseExp.patch 16829 SHA256 d4c9b4770bcac21aaa476646c08654885829eb2c05f03943e07f4c92d134d633 SHA512 8058e693c2bc0e80483d716dc033784828cf8c34c59c2108b9cccffb65ca818f4107b9af8d9acc1a82abb65e3498e69ec39708d2a359c99d14b286ed39e02cf4 WHIRLPOOL a2e498485b620d9cbece1e3a91215b95f2c08614b52cd3bca138f5b4050766df31abd608299288244c336023fb6d0a8830737fbf0d3cd5d2b2eb2a83f931678b
29 AUX hugin-2014.0.0-lensfun-0.3.0.patch 612 SHA256 d4099a2ebc2203bd23807823c0370364bf65faba1ec5ebc596053fda3e6333db SHA512 3fbea4e1c123bfd797514703a32311e5fa19bae1f531f5e81e9cbc4e72a5c4547c3e707709c8c7e3589f6b591c277c0f99600d4ca0d69b4676990e471040f485 WHIRLPOOL 63841447a3f7ef940b9b4e660097e5ff2df3fc2e66568bba8ef605e28a1fe00c235ecf057644a887216a0da2f8cf936c2aac006fab934868284f2f896ad9966f
30 DIST hugin-2012.0.0.tar.bz2 11658665 SHA256 63dfd88ac90d3af4b958111db951bb7fbf2c66ad6b0246e6305403eb5de971b3 SHA512 acf97d383091eca300074a8e207ec5500a8b96a5116708a6ff23fb8f5359a77016867ee2ae21a4e40c4d07d056b5c27844c03c275ec29c0b604ecb31b73ee0a8 WHIRLPOOL d058639202aef1f6beb475bc8c170ac4269bf5050bfcbc48678ddde67188e12eb29c216b6ce8f79571c91ff43e271dac706bd4f432d3f640d549f87b371caa43
31 DIST hugin-2013.0.0.tar.bz2 11247583 SHA256 484e1ed58fa6fe4bae1f423967101549345bcca2653b992afbc0ed9ec0dbebd5 SHA512 dea1682c16991441278a881e5e0916ffdbe8e0012f0dcf45875ee97fe7dc698d4d98037916e63c9a651557adc45c89e4e350ad976fec020562bc17a31f608a86 WHIRLPOOL c3d8e175ff23c8761815406039a8027da327925f07a18b00bde4d457228a2562f30f5df3fb5dff17f8003f985d7b51ec39d557a064c7e228b09ff73473c41e6a
32 DIST hugin-2014.0.0.tar.bz2 10974274 SHA256 f098aa0ede44010d3bb2bb38693177533fd776c45063a338c4c483d7e471ec29 SHA512 f4dd7a59f96d4574d420691d221265309d1ff18b7df04df2c2f0946f3d669e78823e2a53f038ac7bddaaf2037e21c45bf54f19d2a90ce9d5d95a836331e34ca5 WHIRLPOOL e8915454fcc5d54037289b0e91b8c441288706874891b72541414cad83556f6587d15d18be38405917da6c69b590121bc74a2ffa130bb9f1abea223c6fb1375d
33 EBUILD hugin-2012.0.0.ebuild 1649 SHA256 263d0a369e9c552afdb170e11e1e2965106f3d97d5d8cbdc771c14c578ce4e43 SHA512 ce0c63b945690dcbe2d0bac11a87073127505d0bf15809ac95f99c04399e211eb132d51e7c8de82909225651e8f01f5be66fd640131360f2568187af5f476855 WHIRLPOOL df1ce0cb4f1728145a3ba69608dbc03f2373d97976052bfec37a9bc9353a4f184a8cc2476471f3153ed786dbd98267ca6eca10c1077f00997defaf284892f54d
34 EBUILD hugin-2013.0.0-r1.ebuild 2035 SHA256 1e6dc81a4fa7cda22bfd3181587588e22be6f8269fbe3328f0419d8718ba5c6e SHA512 a69d73c96eef15fc1ceea490c6a7014f44f08fc6845c0679e4b6656e171ac4f5d78636aaa746fd46e96abc3f0228ca6f7458115080d9c6e2dfb6a2a2845bedf8 WHIRLPOOL 79a39aca4bec1406bf066e3e70bde7c11e18384de2a13c16793b232435676773db2f6ad0b6eca73a0e213c56fb22f3e548470874ab46aef6822b74d9d07d7811
35 -EBUILD hugin-2014.0.0-r1.ebuild 2060 SHA256 40940f37d48d0468dd372a82ed10219fbfe2ae920afc0c5366f4341b7c8f684e SHA512 c03a9ad8dafc5682417433519b3c6f0067b478414727de19c6443ca4a0e5086bbea6da5e7e36c7c7ae0c111bde5510ee4952a782704be025be407065f82cb688 WHIRLPOOL eeb7d1e0ada2b7e75d3515a2eb626f91b02074a3c9d9f66e36dbc28bf72230d991e29103d1e5e79f43ab359b8bdddd375c1627945827ac921709bf6579290723
36 -EBUILD hugin-2014.0.0.ebuild 2063 SHA256 38fc3ee06e20de44394423a65d194fec9c30a5eb1d320f2dfa22e6d4aa00a858 SHA512 e7d92f001d79bda595f550f84caf84e6bf79e8267142b30c505d253eb5327d58f7302fb79b00ac9fecd8e7abba5503cac40f88473aeba2ea55cb2bd1f6afd4dd WHIRLPOOL c1deb0032c37b5a11ca324c8d5b11f27c60a36bafd059cfa84e23de5b9f605ae2ae6185086b029614cc8d7ac5aa57bff239763feb04eb12cc961dc33c9674190
37 +EBUILD hugin-2014.0.0-r1.ebuild 2096 SHA256 7ffd51acefe25d17e44c5df9d56bc74045b118e2c07a43a3ea48875aec6b9dfc SHA512 33048905f4db1bb0a67334b60ab50b7d8bf926ace7e67374f02f250f4a232999f09a7c0b82fda9bad5065f4bec963a37c02b863758ffc539e42b4e3059eb3c6e WHIRLPOOL bc555f22030f7377fcf85d649904a6c634b8f0d8f1c1322572c9ac3e56683d9454ed9b66da9aca189dc6789e8182c7c539551146625b964a4b76ec8b3b9a4fb1
38 +EBUILD hugin-2014.0.0.ebuild 2099 SHA256 8e9dd0277346f198b0cac3fc1dda21db341c662ad67c00128f270bf327cb71e7 SHA512 565610edddfd4031b964803951d5d254d82e00a9d8c8d4958bedf52889a2617a6dffebbaef2057b40ca7b70222c75ae66c510df7f0118bd06844a3532124653d WHIRLPOOL d53da4f8669b3179f65bd463babd44b7e31692d0d38a61c126c293c7f24923715616fceedaf6c7130dda141156b90e2a04ed4110759c3071b99ae4270e9137a0
39 EBUILD hugin-9999.ebuild 2033 SHA256 4ecb687517f373ffe547edee0dba76948d19b434a08b1298c8708bb2c79ba1dc SHA512 be3f2fdb1ad69ab8197b82be34e9061431381c1581bbaecb6092ff1da8ba44d2fa5eebec08c222676e150bc10627ca440ce74bff4b1a2dbfd34c427bd4199d3e WHIRLPOOL aa82437f1b2cdcb3d50fe1c6712a51a63033da2a34343ad08dd0de957dc0b6b980622dd00e510a639cc6e892a272c0788aa02e1daed93232a71167cff2eece1f
40 MISC metadata.xml 395 SHA256 1e88681d08863b52f3ae17f149901c3d84b6c6197913f7538d17572b33adbf9b SHA512 52848e953af2d3a398f9309a8af40261df0bb78365a3065f805ad06fbc40bea2a44b23ca70aa898b7dbb39a1c2e1309f036762de81d66824bdea09f767039a21 WHIRLPOOL dbdfadbbd20f6acd3961b786bb7bc5e57fd8fd954373cf4a645a008ddaf9273406072cc5ab1497ca1bdefbb77834996d8210c4d9f8cf1a716a7a788b29431684
41 -----BEGIN PGP SIGNATURE-----
42 Version: GnuPG v2
43
44 -iEYEAREIAAYFAlSmy74ACgkQkKaRLQcq0GLKmgCgi9vrXeNL3b5xqlDqjREPIh3g
45 -hXEAoKadz06RU+ipFGg8i5Q922J5Boq/
46 -=Lp5C
47 +iEYEAREIAAYFAlSm4/wACgkQkKaRLQcq0GIGPgCcCuWDu1KaQNrgRv7h66eieKjr
48 +HnMAnjCynW5ixznFnCjY3z/TvMpIYqGQ
49 +=byVF
50 -----END PGP SIGNATURE-----
51
52 diff --git a/media-gfx/hugin/files/hugin-2014.0.0-ParseExp.patch b/media-gfx/hugin/files/hugin-2014.0.0-ParseExp.patch
53 new file mode 100644
54 index 0000000..3ee0dee
55 --- /dev/null
56 +++ b/media-gfx/hugin/files/hugin-2014.0.0-ParseExp.patch
57 @@ -0,0 +1,527 @@
58 +Contains revisions 6407:917d117ba6b0 6597:5b768c308932 6688:dde84e96b755 6689:e237d6d1d873 of ParseExp.cpp/h
59 +
60 +diff -r 917d117ba6b0 -r e237d6d1d873 src/tools/ParseExp.cpp
61 +--- a/src/tools/ParseExp.cpp Sun Dec 15 18:20:14 2013 +0100
62 ++++ b/src/tools/ParseExp.cpp Sat Sep 13 11:22:39 2014 +0200
63 +@@ -1,262 +1,246 @@
64 +-// -*- c-basic-offset: 4 -*-
65 +-
66 +-/** @file ParseExp.cpp
67 +- *
68 +- * @brief functions to parse expressions from strings
69 +- *
70 +- * @author T. Modes
71 +- *
72 +- */
73 +-
74 +-/* This program is free software; you can redistribute it and/or
75 +- * modify it under the terms of the GNU General Public
76 +- * License as published by the Free Software Foundation; either
77 +- * version 2 of the License, or (at your option) any later version.
78 +- *
79 +- * This software is distributed in the hope that it will be useful,
80 +- * but WITHOUT ANY WARRANTY; without even the implied warranty of
81 +- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
82 +- * General Public License for more details.
83 +- *
84 +- * You should have received a copy of the GNU General Public
85 +- * License along with this software; if not, write to the Free Software
86 +- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
87 +- *
88 +- */
89 +-
90 +-// implementation is based on blog at
91 +-// http://agentzlerich.blogspot.de/2011/06/using-boost-spirit-21-to-evaluate.html
92 +-// modified to Hugins need
93 +-// added if statement
94 +-
95 +-#include "ParseExp.h"
96 +-
97 +-#include <limits>
98 +-#include <iterator>
99 +-
100 +-#include <boost/spirit/version.hpp>
101 +-#if !defined(SPIRIT_VERSION) || SPIRIT_VERSION < 0x2010
102 +-#error "At least Spirit version 2.1 required"
103 +-#endif
104 +-#include <boost/math/constants/constants.hpp>
105 +-#include <boost/spirit/include/phoenix.hpp>
106 +-#include <boost/spirit/include/qi.hpp>
107 +-
108 +-namespace Parser
109 +-{
110 +-
111 +-// helper classes to implement operators
112 +-
113 +-//power function
114 +-struct lazy_pow_
115 +-{
116 +- template <typename X, typename Y>
117 +- struct result { typedef X type; };
118 +-
119 +- template <typename X, typename Y>
120 +- X operator()(X x, Y y) const
121 +- {
122 +- return std::pow(x, y);
123 +- }
124 +-};
125 +-
126 +-// modulus for double values
127 +-struct lazy_mod_
128 +-{
129 +- template <typename X, typename Y>
130 +- struct result { typedef X type; };
131 +-
132 +- template <typename X, typename Y>
133 +- X operator()(X x, Y y) const
134 +- {
135 +- return std::fmod(x,y);
136 +- }
137 +-};
138 +-
139 +-// if statement
140 +-struct lazy_if_
141 +-{
142 +- template <typename X, typename Y, typename Z>
143 +- struct result { typedef Y type; };
144 +-
145 +- template <typename X, typename Y, typename Z>
146 +- X operator()(X x, Y y, Z z) const
147 +- {
148 +- return x ? y : z;
149 +- }
150 +-};
151 +-
152 +-// wrapper for unary function
153 +-struct lazy_ufunc_
154 +-{
155 +- template <typename F, typename A1>
156 +- struct result { typedef A1 type; };
157 +-
158 +- template <typename F, typename A1>
159 +- A1 operator()(F f, A1 a1) const
160 +- {
161 +- return f(a1);
162 +- }
163 +-};
164 +-
165 +-// convert rad into deg
166 +-double deg(const double d)
167 +-{
168 +- return d*180.0/boost::math::constants::pi<double>();
169 +-};
170 +-
171 +-// convert deg into rad
172 +-double rad(const double d)
173 +-{
174 +- return d*boost::math::constants::pi<double>()/180;
175 +-};
176 +-
177 +-// the main grammar class
178 +-struct grammar:boost::spirit::qi::grammar<std::string::const_iterator, double(), boost::spirit::ascii::space_type>
179 +-{
180 +-
181 +- // symbol table for constants like "pi", e.g. image number and value
182 +- struct constant_ : boost::spirit::qi::symbols<char, double>
183 +- {
184 +- constant_(const ConstantMap constMap)
185 +- {
186 +- this->add("pi", boost::math::constants::pi<double>());
187 +- if(constMap.size()>0)
188 +- {
189 +- for(ConstantMap::const_iterator it=constMap.begin(); it!=constMap.end(); it++)
190 +- {
191 +- this->add(it->first, it->second);
192 +- };
193 +- };
194 +- };
195 +- };
196 +-
197 +- // symbol table for unary functions like "abs"
198 +- struct ufunc_ : boost::spirit::qi::symbols<char, double(*)(double) >
199 +- {
200 +- ufunc_()
201 +- {
202 +- this->add
203 +- ("abs" , (double (*)(double)) std::abs )
204 +- ("acos" , (double (*)(double)) std::acos )
205 +- ("asin" , (double (*)(double)) std::asin )
206 +- ("atan" , (double (*)(double)) std::atan )
207 +- ("ceil" , (double (*)(double)) std::ceil )
208 +- ("sin" , (double (*)(double)) std::sin )
209 +- ("cos" , (double (*)(double)) std::cos )
210 +- ("tan" , (double (*)(double)) std::tan )
211 +- ("exp" , (double (*)(double)) std::exp )
212 +- ("floor" , (double (*)(double)) std::floor)
213 +- ("sqrt" , (double (*)(double)) std::sqrt )
214 +- ("deg" , (double (*)(double)) deg )
215 +- ("rad" , (double (*)(double)) rad )
216 +- ;
217 +- }
218 +- } ufunc;
219 +-
220 +- boost::spirit::qi::rule<std::string::const_iterator, double(), boost::spirit::ascii::space_type> expression, term, factor, primary, compExpression, compTerm, numExpression;
221 +-
222 +- grammar(const ConstantMap constMap) : grammar::base_type(expression)
223 +- {
224 +- using boost::spirit::qi::real_parser;
225 +- using boost::spirit::qi::real_policies;
226 +- real_parser<double,real_policies<double> > real;
227 +-
228 +- using boost::spirit::qi::_1;
229 +- using boost::spirit::qi::_2;
230 +- using boost::spirit::qi::_3;
231 +- using boost::spirit::qi::no_case;
232 +- using boost::spirit::qi::_val;
233 +- struct constant_ constant(constMap);
234 +-
235 +- boost::phoenix::function<lazy_pow_> lazy_pow;
236 +- boost::phoenix::function<lazy_mod_> lazy_mod;
237 +- boost::phoenix::function<lazy_if_> lazy_if;
238 +- boost::phoenix::function<lazy_ufunc_> lazy_ufunc;
239 +-
240 +- expression =
241 +- (compExpression >> '\?' >> compExpression >> ':' >> compExpression) [_val = lazy_if(_1, _2, _3)]
242 +- | compExpression [_val=_1]
243 +- ;
244 +-
245 +- compExpression=
246 +- compTerm [_val=_1]
247 +- >> * ( ("&&" >> compTerm [_val = _val && _1] )
248 +- |("||" >> compTerm [_val = _val || _1] )
249 +- )
250 +- ;
251 +-
252 +- compTerm =
253 +- numExpression [_val = _1 ]
254 +- >>*( ( '<' >> numExpression [_val = _val < _1])
255 +- |( '>' >> numExpression [_val = _val > _1])
256 +- |( "<=" >> numExpression [_val = _val <= _1])
257 +- |( ">=" >> numExpression [_val = _val >= _1])
258 +- |( "==" >> numExpression [_val = _val == _1])
259 +- |( "!=" >> numExpression [_val = _val != _1])
260 +- )
261 +- ;
262 +-
263 +- numExpression =
264 +- term [_val = _1]
265 +- >> *( ('+' >> term [_val += _1])
266 +- | ('-' >> term [_val -= _1])
267 +- )
268 +- ;
269 +-
270 +- term =
271 +- factor [_val = _1]
272 +- >> *( ('*' >> factor [_val *= _1])
273 +- | ('/' >> factor [_val /= _1])
274 +- | ('%' >> factor [_val = lazy_mod(_val, _1)])
275 +- )
276 +- ;
277 +-
278 +- factor =
279 +- primary [_val = _1]
280 +- >> *( ('^' >> factor [_val = lazy_pow(_val, _1)]) )
281 +- ;
282 +-
283 +- primary =
284 +- real [_val = _1]
285 +- | '(' >> expression [_val = _1] >> ')'
286 +- | ('-' >> primary [_val = -_1])
287 +- | ('+' >> primary [_val = _1])
288 +- | no_case[constant] [_val = _1]
289 +- | (no_case[ufunc] >> '(' >> expression >> ')') [_val = lazy_ufunc(_1, _2) ]
290 +- ;
291 +-
292 +- };
293 +-};
294 +-
295 +-//template <typename ParserType, typename Iterator>
296 +-bool parse(std::string::const_iterator &iter,
297 +- std::string::const_iterator end,
298 +- const grammar &g,
299 +- double& result)
300 +-{
301 +- if(!boost::spirit::qi::phrase_parse(iter, end, g, boost::spirit::ascii::space, result))
302 +- {
303 +- return false;
304 +- };
305 +- // we check if the full string could parsed
306 +- return iter==end;
307 +-}
308 +-
309 +-// the function which exposes the interface to external
310 +-// version without pre-defined constants
311 +-bool ParseExpression(const std::string& expression, double& result)
312 +-{
313 +- ConstantMap constants;
314 +- return ParseExpression(expression, result, constants);
315 +-};
316 +-
317 +-// version with pre-defined constants
318 +-bool ParseExpression(const std::string& expression, double& result, const ConstantMap& constants)
319 +-{
320 +- grammar g(constants);
321 +- std::string::const_iterator it=expression.begin();
322 +- return parse(it, expression.end(), g, result);
323 +-};
324 +-
325 +-} // namespace
326 ++// -*- c-basic-offset: 4 -*-
327 ++
328 ++/** @file ParseExp.cpp
329 ++ *
330 ++ * @brief functions to parse expressions from strings
331 ++ *
332 ++ * @author T. Modes
333 ++ *
334 ++ */
335 ++
336 ++/* This program is free software; you can redistribute it and/or
337 ++ * modify it under the terms of the GNU General Public
338 ++ * License as published by the Free Software Foundation; either
339 ++ * version 2 of the License, or (at your option) any later version.
340 ++ *
341 ++ * This software is distributed in the hope that it will be useful,
342 ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
343 ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
344 ++ * General Public License for more details.
345 ++ *
346 ++ * You should have received a copy of the GNU General Public
347 ++ * License along with this software; if not, write to the Free Software
348 ++ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
349 ++ *
350 ++ */
351 ++
352 ++// implementation is based on blog at
353 ++// http://agentzlerich.blogspot.de/2011/06/using-boost-spirit-21-to-evaluate.html
354 ++// modified to Hugins need
355 ++// added if statement
356 ++
357 ++#include "ParseExp.h"
358 ++
359 ++#include <limits>
360 ++#include <iterator>
361 ++
362 ++#define BOOST_SPIRIT_USE_PHOENIX_V3 1
363 ++#include <boost/spirit/version.hpp>
364 ++#if !defined(SPIRIT_VERSION) || SPIRIT_VERSION < 0x2010
365 ++#error "At least Spirit version 2.1 required"
366 ++#endif
367 ++#include <boost/math/constants/constants.hpp>
368 ++#include <boost/spirit/include/phoenix.hpp>
369 ++#include <boost/spirit/include/qi.hpp>
370 ++
371 ++namespace Parser
372 ++{
373 ++
374 ++// helper classes to implement operators
375 ++
376 ++//power function
377 ++struct lazy_pow_
378 ++{
379 ++ typedef double result_type;
380 ++
381 ++ double operator()(double x, double y) const
382 ++ {
383 ++ return std::pow(x, y);
384 ++ }
385 ++};
386 ++
387 ++// modulus for double values
388 ++struct lazy_mod_
389 ++{
390 ++ typedef double result_type;
391 ++
392 ++ double operator()(double x, double y) const
393 ++ {
394 ++ return std::fmod(x,y);
395 ++ }
396 ++};
397 ++
398 ++// if statement
399 ++struct lazy_if_
400 ++{
401 ++ typedef double result_type;
402 ++
403 ++ double operator()(double x, double y, double z) const
404 ++ {
405 ++ return (std::fabs(x)>1e-5) ? y : z;
406 ++ }
407 ++};
408 ++
409 ++// wrapper for unary function
410 ++struct lazy_ufunc_
411 ++{
412 ++ typedef double result_type;
413 ++
414 ++ double operator()(double (*f)(double), double a1) const
415 ++ {
416 ++ return f(a1);
417 ++ }
418 ++};
419 ++
420 ++// convert rad into deg
421 ++const double deg(const double d)
422 ++{
423 ++ return d*180.0/boost::math::constants::pi<double>();
424 ++};
425 ++
426 ++// convert deg into rad
427 ++const double rad(const double d)
428 ++{
429 ++ return d*boost::math::constants::pi<double>()/180;
430 ++};
431 ++
432 ++// the main grammar class
433 ++struct grammar:boost::spirit::qi::grammar<std::string::const_iterator, double(), boost::spirit::ascii::space_type>
434 ++{
435 ++
436 ++ // symbol table for constants like "pi", e.g. image number and value
437 ++ struct constant_ : boost::spirit::qi::symbols<char, double>
438 ++ {
439 ++ constant_(const ConstantMap constMap)
440 ++ {
441 ++ this->add("pi", boost::math::constants::pi<double>());
442 ++ if (constMap.size()>0)
443 ++ {
444 ++ for (ConstantMap::const_iterator it = constMap.begin(); it != constMap.end(); it++)
445 ++ {
446 ++ this->add(it->first, it->second);
447 ++ };
448 ++ };
449 ++ };
450 ++ };
451 ++
452 ++ // symbol table for unary functions like "abs"
453 ++ struct ufunc_ : boost::spirit::qi::symbols<char, double(*)(double) >
454 ++ {
455 ++ ufunc_()
456 ++ {
457 ++ this->add
458 ++ ("abs", (double(*)(double)) std::abs)
459 ++ ("acos", (double(*)(double)) std::acos)
460 ++ ("asin", (double(*)(double)) std::asin)
461 ++ ("atan", (double(*)(double)) std::atan)
462 ++ ("ceil", (double(*)(double)) std::ceil)
463 ++ ("sin", (double(*)(double)) std::sin)
464 ++ ("cos", (double(*)(double)) std::cos)
465 ++ ("tan", (double(*)(double)) std::tan)
466 ++ ("exp", (double(*)(double)) std::exp)
467 ++ ("floor", (double(*)(double)) std::floor)
468 ++ ("sqrt", (double(*)(double)) std::sqrt)
469 ++ ("deg", (double(*)(double)) deg)
470 ++ ("rad", (double(*)(double)) rad)
471 ++ ;
472 ++ }
473 ++ } ufunc;
474 ++
475 ++ boost::spirit::qi::rule<std::string::const_iterator, double(), boost::spirit::ascii::space_type> expression, term, factor, primary, compExpression, compTerm, numExpression;
476 ++
477 ++ grammar(const ConstantMap constMap) : grammar::base_type(expression)
478 ++ {
479 ++ using boost::spirit::qi::real_parser;
480 ++ using boost::spirit::qi::real_policies;
481 ++ real_parser<double, real_policies<double> > real;
482 ++
483 ++ using boost::spirit::qi::_1;
484 ++ using boost::spirit::qi::_2;
485 ++ using boost::spirit::qi::_3;
486 ++ using boost::spirit::qi::no_case;
487 ++ using boost::spirit::qi::_val;
488 ++ struct constant_ constant(constMap);
489 ++
490 ++ boost::phoenix::function<lazy_pow_> lazy_pow;
491 ++ boost::phoenix::function<lazy_mod_> lazy_mod;
492 ++ boost::phoenix::function<lazy_if_> lazy_if;
493 ++ boost::phoenix::function<lazy_ufunc_> lazy_ufunc;
494 ++
495 ++ expression =
496 ++ (compExpression >> '\?' >> compExpression >> ':' >> compExpression)[_val = lazy_if(_1, _2, _3)]
497 ++ | compExpression[_val = _1]
498 ++ ;
499 ++
500 ++ compExpression =
501 ++ compTerm[_val = _1]
502 ++ >> *(("&&" >> compTerm[_val = _val && _1])
503 ++ | ("||" >> compTerm[_val = _val || _1])
504 ++ )
505 ++ ;
506 ++
507 ++ compTerm =
508 ++ numExpression[_val = _1]
509 ++ >> *(('<' >> numExpression[_val = _val < _1])
510 ++ | ('>' >> numExpression[_val = _val > _1])
511 ++ | ("<=" >> numExpression[_val = _val <= _1])
512 ++ | (">=" >> numExpression[_val = _val >= _1])
513 ++ | ("==" >> numExpression[_val = _val == _1])
514 ++ | ("!=" >> numExpression[_val = _val != _1])
515 ++ )
516 ++ ;
517 ++
518 ++ numExpression =
519 ++ term[_val = _1]
520 ++ >> *(('+' >> term[_val += _1])
521 ++ | ('-' >> term[_val -= _1])
522 ++ )
523 ++ ;
524 ++
525 ++ term =
526 ++ factor[_val = _1]
527 ++ >> *(('*' >> factor[_val *= _1])
528 ++ | ('/' >> factor[_val /= _1])
529 ++ | ('%' >> factor[_val = lazy_mod(_val, _1)])
530 ++ )
531 ++ ;
532 ++
533 ++ factor =
534 ++ primary[_val = _1]
535 ++ >> *(('^' >> factor[_val = lazy_pow(_val, _1)]))
536 ++ ;
537 ++
538 ++ primary =
539 ++ real[_val = _1]
540 ++ | '(' >> expression[_val = _1] >> ')'
541 ++ | ('-' >> primary[_val = -_1])
542 ++ | ('+' >> primary[_val = _1])
543 ++ | no_case[constant][_val = _1]
544 ++ | (no_case[ufunc] >> '(' >> expression >> ')')[_val = lazy_ufunc(_1, _2)]
545 ++ ;
546 ++
547 ++ };
548 ++};
549 ++
550 ++bool parse(std::string::const_iterator& iter,
551 ++ std::string::const_iterator end,
552 ++ const grammar& g,
553 ++ double& result)
554 ++{
555 ++ if(!boost::spirit::qi::phrase_parse(iter, end, g, boost::spirit::ascii::space, result))
556 ++ {
557 ++ return false;
558 ++ };
559 ++ // we check if the full string could parsed
560 ++ return iter==end;
561 ++}
562 ++
563 ++// version with pre-defined constants
564 ++bool ParseExpression(const std::string& expression, double& result, const ConstantMap& constants)
565 ++{
566 ++ grammar g(constants);
567 ++ std::string::const_iterator it=expression.begin();
568 ++ return parse(it, expression.end(), g, result);
569 ++};
570 ++
571 ++} // namespace
572 +diff -r 917d117ba6b0 -r e237d6d1d873 src/tools/ParseExp.h
573 +--- a/src/tools/ParseExp.h Sun Dec 15 18:20:14 2013 +0100
574 ++++ b/src/tools/ParseExp.h Sat Sep 13 11:22:39 2014 +0200
575 +@@ -33,8 +33,7 @@
576 + {
577 + typedef std::map<const char*, double> ConstantMap;
578 +
579 +-bool ParseExpression(const std::string& expression, double& result);
580 +-bool ParseExpression(const std::string& expression, double& result, const ConstantMap& constants);
581 ++bool ParseExpression(const std::string& expression, double& result, const ConstantMap& constants=ConstantMap());
582 +
583 + };
584 +
585
586 diff --git a/media-gfx/hugin/hugin-2014.0.0-r1.ebuild b/media-gfx/hugin/hugin-2014.0.0-r1.ebuild
587 index 284490e..8481afe 100644
588 --- a/media-gfx/hugin/hugin-2014.0.0-r1.ebuild
589 +++ b/media-gfx/hugin/hugin-2014.0.0-r1.ebuild
590 @@ -51,7 +51,10 @@ REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
591
592 S=${WORKDIR}/${PN}-$(get_version_component_range 1-3)
593
594 -PATCHES=( "${FILESDIR}"/${P}-lensfun-0.3.0.patch )
595 +PATCHES=(
596 + "${FILESDIR}"/${P}-lensfun-0.3.0.patch
597 + "${FILESDIR}"/${P}-ParseExp.patch
598 +)
599
600 pkg_setup() {
601 DOCS="authors.txt README TODO"
602
603 diff --git a/media-gfx/hugin/hugin-2014.0.0.ebuild b/media-gfx/hugin/hugin-2014.0.0.ebuild
604 index 527fd4e..05f7dff 100644
605 --- a/media-gfx/hugin/hugin-2014.0.0.ebuild
606 +++ b/media-gfx/hugin/hugin-2014.0.0.ebuild
607 @@ -51,7 +51,10 @@ REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
608
609 S=${WORKDIR}/${PN}-$(get_version_component_range 1-3)
610
611 -PATCHES=( "${FILESDIR}"/${P}-lensfun-0.3.0.patch )
612 +PATCHES=(
613 + "${FILESDIR}"/${P}-lensfun-0.3.0.patch
614 + "${FILESDIR}"/${P}-ParseExp.patch
615 +)
616
617 pkg_setup() {
618 DOCS="authors.txt README TODO"