Debian Codegraph @

include/vigra/promote_traits.hxx.py

raw symbols SCIP
1 t = ['bool', 'signed char', 'unsigned char', 'short', 'unsigned short',
2 'int', 'unsigned int', 'long', 'unsigned long', 'float', 'double',
3 'long double', 'long long', 'unsigned long long']
4
5 pt = '''template <>
6 struct PromoteTraits<%(A)s, %(B)s> : public detail::PromoteType<%(A)s, %(B)s>
7 {
8 typedef detail::PromoteType<%(A)s, %(B)s>::Promote Promote;
9 using detail::PromoteType<%(A)s, %(B)s>::toPromote;
10 };
11 '''
12
13 def ifdefAround(k, l, s):
14 if (k in ['long long', 'unsigned long long']) or (l in ['long long', 'unsigned long long']):
15 return '#ifdef LLONG_MAX\n'+s+'#endif // LLONG_MAX\n\n'
16 else:
17 return s + '\n'
18
19 s = '''/************************************************************************/
20 /* */
21 /* Copyright 1998-2008 by Ullrich Koethe */
22 /* Cognitive Systems Group, University of Hamburg, Germany */
23 /* */
24 /* This file is part of the VIGRA computer vision library. */
25 /* The VIGRA Website is */
26 /* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */
27 /* Please direct questions, bug reports, and contributions to */
28 /* [email protected] or */
29 /* [email protected] */
30 /* */
31 /* Permission is hereby granted, free of charge, to any person */
32 /* obtaining a copy of this software and associated documentation */
33 /* files (the "Software"), to deal in the Software without */
34 /* restriction, including without limitation the rights to use, */
35 /* copy, modify, merge, publish, distribute, sublicense, and/or */
36 /* sell copies of the Software, and to permit persons to whom the */
37 /* Software is furnished to do so, subject to the following */
38 /* conditions: */
39 /* */
40 /* The above copyright notice and this permission notice shall be */
41 /* included in all copies or substantial portions of the */
42 /* Software. */
43 /* */
44 /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND */
45 /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES */
46 /* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND */
47 /* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT */
48 /* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, */
49 /* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING */
50 /* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR */
51 /* OTHER DEALINGS IN THE SOFTWARE. */
52 /* */
53 /************************************************************************/
54
55
56 #ifndef VIGRA_PROMOTETRAITS_HXX
57 #define VIGRA_PROMOTETRAITS_HXX
58
59 // this file was autogenerated from promote_traits.hxx.py - DO NOT EDIT
60
61 '''
62 for k in t:
63 s += ifdefAround(k, k, pt % { 'A': k, 'B': k})
64 for l in t:
65 if l == k: continue
66 s += ifdefAround(k, l, pt % { 'A': k, 'B': l})
67
68 s += '''
69
70 #endif // VIGRA_PROMOTETRAITS_HXX
71 '''
72 open('promote_traits.hxx', 'w').write(s)
73
74