|
1 | 1 | sub pp_defc { |
2 | 2 | my ($function, %hash) = @_; |
3 | 3 | $hash{GenericTypes} ||= [qw(F D)]; |
4 | | - my $doc = $hash{Doc} || "\n=for ref\n\nComplex version of L<PDL::LinearAlgebra::Real/$function>\n\n"; |
5 | | - $hash{Doc} = undef; |
6 | | - my $decl = delete $hash{_decl}; |
| 4 | + $hash{Doc} ||= "\n=for ref\n\nComplex version of L<PDL::LinearAlgebra::Real/$function>\n\n"; |
| 5 | + my $decl = delete($hash{_decl}) || ''; |
7 | 6 | $decl =~ s/\$GENERIC\(\)\s*\*/void */g; # dodge float vs float complex ptr problem |
8 | 7 | $hash{Code} = "$decl\n$hash{Code}"; |
9 | | - my %hash2 = %hash; |
10 | | - $hash2{Pars} = join ';', map s/\(2(?:,|(?=\)))/(/ ? "complex $_" : $_, split /;/, $hash2{Pars}; |
11 | | - if ($hash2{RedoDimsCode}) { |
| 8 | + $hash{Pars} = join ';', map s/\(2(?:,|(?=\)))/(/ ? "complex $_" : $_, split /;/, $hash{Pars}; |
| 9 | + if ($hash{RedoDimsCode}) { |
12 | 10 | # decrement numbers being compared to, or dims offsets |
13 | | - $hash2{RedoDimsCode} =~ s/(>\s*)(\d+)|(\[\s*)(\d+)(\s*\])/ |
| 11 | + $hash{RedoDimsCode} =~ s/(>\s*)(\d+)|(\[\s*)(\d+)(\s*\])/ |
14 | 12 | $1 |
15 | 13 | ? $1.($2 - 1) |
16 | 14 | : $3.($4 - 1).$5 |
17 | 15 | /ge; |
18 | 16 | } |
19 | | - pp_def("__Nc$function", %hash2); |
20 | | - pp_add_exported("c$function"); |
21 | | - my $sig = join ';', grep defined, @hash2{qw(Pars OtherPars)}; |
22 | | - pp_addpm(<<EOF); |
23 | | -=head2 c$function |
24 | | -
|
25 | | -=for sig |
26 | | -
|
27 | | - Signature: ($sig) |
28 | | - |
29 | | -$doc |
30 | | - |
31 | | -=cut |
32 | | - |
33 | | -sub PDL::c$function { |
34 | | - goto &PDL::__Nc$function; |
35 | | -} |
36 | | -*c$function = \\&PDL::c$function; |
37 | | - |
38 | | -EOF |
| 17 | + pp_def("c$function", %hash); |
39 | 18 | } |
0 commit comments