Skip to content

Commit 24a9451

Browse files
committed
add comment explaining %KIND2I values
1 parent 94c4cdc commit 24a9451

File tree

1 file changed

+1
-10
lines changed

1 file changed

+1
-10
lines changed

slatec.pd

+1-10
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,6 @@ sub intcopy {
247247
(sub {"&".$cvarname->(@_)}, sub {"PDL_LongLong *"},
248248
sub {"PDL_LongLong ".$cvarname->(@_)." = ".$rvalue->(@_).";"});
249249
}
250-
251250
# defslatec( $pdlname, $funcnames, $argstr, $docstring, $funcref )
252251
#
253252
# $pdlname is the name of the PDL function to be created
@@ -278,6 +277,7 @@ sub intcopy {
278277
# text within $docstring. This string gets printed out
279278
# in the perldl shell after a '?? string' command
280279
#
280+
# [Par_forcetype(undef=none,ref=OtherPar), C_argin, C_paramtype, C_decl_value]
281281
my %KIND2I = (
282282
Mat => ['', sub{"\$P($_[0][2])"}, sub {PDL::Type->new($_[0])->ctype." *"}],
283283
FuncRet => ['', sub {()}, sub {()}],
@@ -306,17 +306,14 @@ sub defslatec {
306306
)
307307
/x or die("Invalid slatec par $_");
308308
[$1,$2,$3,$4,$5]} @args;
309-
310309
# is this for a function (Type name eq "FuncRet")
311310
# or a subroutine?
312311
die "Only one FuncRet allowed in pars list.\n"
313312
if (my @funcret = grep $_->[0] eq "FuncRet", @args2) > 1;
314313
my $fpar = @funcret ? "\$$funcret[0][2]()" : undef;
315-
316314
my $pars = join ';', map
317315
+($KIND2I{$_->[0]}[0] // die "Invalid ppars ",join(',',@$_),"\n") . join('', @$_[1..3]),
318316
grep !$ignore_ppar{$_->[0]}, @args2;
319-
320317
my $otherpars = join ';', map
321318
${$KIND2I{$_->[0]}[0]} . join(' => ', @$_[2,2]),
322319
grep ref $KIND2I{$_->[0]}[0], @args2;
@@ -326,17 +323,13 @@ sub defslatec {
326323
my @opt = map $_->[2], grep $_->[1] =~ /\bo\b/, @args2;
327324
$argorder = [@mand, @opt];
328325
}
329-
330326
my @talts = map
331327
[$ftypes{$_} // die("FTYPE $_ NOT THERE\n"),$fnames->{$_}],
332328
sort keys %$fnames;
333-
334329
my $func = "PDL_FORTRAN(\$T".join('',map {$_->[0]} @talts) . "(" .
335330
join(',',map qq{$_->[1]}, @talts)."))";
336331
if ( defined $fpar ) { $func = "$fpar = $func"; }
337-
338332
my $funcargs = join ',', map $KIND2I{$_->[0]}[1]->($_), @args2;
339-
340333
my @protos = map $KIND2I{$_->[0]}[2], @args2;
341334
my @cheaders;
342335
foreach my $t ( @talts ) {
@@ -350,15 +343,13 @@ sub defslatec {
350343
. " PDL_FORTRAN($t->[1])(" .
351344
join(',', @decl_args) . ");";
352345
}
353-
354346
# add on the function reference, if supplied, to the start of
355347
# the doc string
356348
if ( defined $docstring ) {
357349
$docstring = "\n=for ref\n\n$funcref\n\n$docstring" if defined $funcref;
358350
} else {
359351
$docstring = '';
360352
}
361-
362353
# IntVals
363354
my @intcopy_code = map +($KIND2I{$_->[0]}[3]||sub{})->($_), @args2;
364355
my $code = join("\n", @intcopy_code, "$func($funcargs);");

0 commit comments

Comments
 (0)