3 # Generate a header file which is additionally included in cint
4 # to work around the broken overloading resolution of cint for
6 # e.g. if a function declared as ex sin(ex const & x) and called
7 # with sin(y) where y is a symbol, cint favours a conversion from
8 # symbol to void * to double over symbol to ex and thus calls the
9 # C math library function double sin(double x) (sigh!)
11 $header='cint_workaround.h';
13 # types which need help to be converted to ex
14 @types=('symbol','function','constant','idx','lorentzidx','coloridx');
15 @moretypes=('numeric','int','double');
18 # functions with one parameter
19 @functions1p=('sin','cos','tan','asin','acos','atan','exp','log','sqrt',
20 'sinh','cosh','tanh','abs');
22 # functions with two parameters
23 @functions2p=('pow','atan2');
27 foreach $f (@functions1p) {
28 print OUT "// fixes for $f(x)\n";
30 print OUT "inline ex $f($t const & x) { return $f(ex(x)); }\n";
36 my ($types1ref,$types2ref)=@_;
37 foreach $t1 (@$types1ref) {
38 foreach $t2 (@$types2ref) {
39 print OUT "inline ex $f($t1 const & x,$t2 const & y) {\n";
40 print OUT " return $f(ex(x),ex(y));\n";
46 foreach $f (@functions2p) {
47 print OUT "// fixes for $f(x,y)\n";
48 inlines2(\@types,\@types);
49 inlines2(\@types,\@moretypes);
50 inlines2(\@moretypes,\@types);
51 inlines2(\@extype,\@moretypes);
52 inlines2(\@moretypes,\@extype);