| 1 | sub pp_defc { |
| 2 | my ($function, %hash) = @_; |
| 3 | $hash{GenericTypes} ||= [qw(F D)]; |
| 4 | $hash{Doc} ||= "\n=for ref\n\nComplex version of L<PDL::LinearAlgebra::Real/$function>\n\n"; |
| 5 | my $decl = delete($hash{_decl}) || ''; |
| 6 | $decl =~ s/\$GENERIC\(\)\s*\*/void */g; # dodge float vs float complex ptr problem |
| 7 | $hash{Code} = "$decl\n$hash{Code}"; |
| 8 | $hash{Pars} = join ';', map s/\(2(?:,|(?=\)))/(/ ? "complex $_" : $_, split /;/, $hash{Pars}; |
| 9 | if ($hash{RedoDimsCode}) { |
| 10 | # decrement numbers being compared to, or dims offsets |
| 11 | $hash{RedoDimsCode} =~ s/(>\s*)(\d+)|(\[\s*)(\d+)(\s*\])/ |
| 12 | $1 |
| 13 | ? $1.($2 - 1) |
| 14 | : $3.($4 - 1).$5 |
| 15 | /ge; |
| 16 | } |
| 17 | pp_def("c$function", %hash); |
| 18 | } |