Skip to content

Commit e3d176d

Browse files
committed
pp_defc to just make obvious xform without wrapper
1 parent 6ab5286 commit e3d176d

File tree

1 file changed

+6
-27
lines changed

1 file changed

+6
-27
lines changed

pp_defc.pl

+6-27
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,18 @@
11
sub pp_defc {
22
my ($function, %hash) = @_;
33
$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}) || '';
76
$decl =~ s/\$GENERIC\(\)\s*\*/void */g; # dodge float vs float complex ptr problem
87
$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}) {
1210
# 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*\])/
1412
$1
1513
? $1.($2 - 1)
1614
: $3.($4 - 1).$5
1715
/ge;
1816
}
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);
3918
}

0 commit comments

Comments
 (0)