1 # Create files containing dummies, wrappers and so on to overcome certain
2 # deficiencies in Cint. In an ideal world it would be unnecessary.
7 # Generate a header file which is additionally included in cint
8 # to work around the broken overloading resolution of cint for
9 # C library functions and other problems.
10 # E.g: if a function declared as ex sin(ex const & x) and called
11 # with sin(y) where y is a symbol, cint favours a conversion from
12 # symbol to void * to double over symbol to ex and thus calls the
13 # C math library function double sin(double x) (sigh!)
15 # types which need help to be converted to ex
16 @types=('symbol','function','constant','idx','lorentzidx','coloridx');
17 @moretypes=('numeric','int','double');
20 # functions with one parameter
21 @functions1p=('sin','cos','tan','asin','acos','atan','exp','log','sqrt',
22 'sinh','cosh','tanh','abs');
24 # functions with two parameters
25 @functions2p=('pow','atan2');
29 $opening=<<END_OF_OPENING;
32 * Dummies and wrappers to overcome certain deficiencies of Cint.
33 * This file was generated automatically by dummies.pl.
34 * Please do not modify it directly, edit the perl script instead!
41 foreach $f (@functions1p) {
42 print OUT "// fixes for $f(x)\n";
44 print OUT "inline ex $f($t const & x) { return $f(ex(x)); }\n";
50 my ($types1ref,$types2ref)=@_;
51 foreach $t1 (@$types1ref) {
52 foreach $t2 (@$types2ref) {
53 print OUT "inline ex $f($t1 const & x,$t2 const & y) {\n";
54 print OUT " return $f(ex(x),ex(y));\n";
60 foreach $f (@functions2p) {
61 print OUT "// fixes for $f(x,y)\n";
62 inlines2(\@types,\@types);
63 inlines2(\@types,\@moretypes);
64 inlines2(\@moretypes,\@types);
65 inlines2(\@extype,\@moretypes);
66 inlines2(\@moretypes,\@extype);
72 # Create a file containing stubs that may be necessary because Cint always
73 # wants to link against anything that was ever declared:
77 $opening=<<END_OF_OPENING;
80 * Dummies and stubs to overcome certain deficiencies of Cint.
81 * This file was generated automatically by dummies.pl.
82 * Please do not modify it directly, edit the perl script instead!
85 #include <ginac/function.h>
87 #ifndef NO_NAMESPACE_GINAC
88 using namespace GiNaC;
89 #endif // ndef NO_NAMESPACE_GINAC
94 print OUT "void ginsh_get_ginac_functions(void) { }\n";