@@ -247,7 +247,6 @@ sub intcopy {
247
247
(sub {"&".$cvarname->(@_)}, sub {"PDL_LongLong *"},
248
248
sub {"PDL_LongLong ".$cvarname->(@_)." = ".$rvalue->(@_).";"});
249
249
}
250
-
251
250
# defslatec( $pdlname, $funcnames, $argstr, $docstring, $funcref )
252
251
#
253
252
# $pdlname is the name of the PDL function to be created
@@ -278,6 +277,7 @@ sub intcopy {
278
277
# text within $docstring. This string gets printed out
279
278
# in the perldl shell after a '?? string' command
280
279
#
280
+ # [Par_forcetype(undef=none,ref=OtherPar), C_argin, C_paramtype, C_decl_value]
281
281
my %KIND2I = (
282
282
Mat => ['', sub{"\$P($_[0][2])"}, sub {PDL::Type->new($_[0])->ctype." *"}],
283
283
FuncRet => ['', sub {()}, sub {()}],
@@ -306,17 +306,14 @@ sub defslatec {
306
306
)
307
307
/x or die("Invalid slatec par $_");
308
308
[$1,$2,$3,$4,$5]} @args;
309
-
310
309
# is this for a function (Type name eq "FuncRet")
311
310
# or a subroutine?
312
311
die "Only one FuncRet allowed in pars list.\n"
313
312
if (my @funcret = grep $_->[0] eq "FuncRet", @args2) > 1;
314
313
my $fpar = @funcret ? "\$$funcret[0][2]()" : undef;
315
-
316
314
my $pars = join ';', map
317
315
+($KIND2I{$_->[0]}[0] // die "Invalid ppars ",join(',',@$_),"\n") . join('', @$_[1..3]),
318
316
grep !$ignore_ppar{$_->[0]}, @args2;
319
-
320
317
my $otherpars = join ';', map
321
318
${$KIND2I{$_->[0]}[0]} . join(' => ', @$_[2,2]),
322
319
grep ref $KIND2I{$_->[0]}[0], @args2;
@@ -326,17 +323,13 @@ sub defslatec {
326
323
my @opt = map $_->[2], grep $_->[1] =~ /\bo\b/, @args2;
327
324
$argorder = [@mand, @opt];
328
325
}
329
-
330
326
my @talts = map
331
327
[$ftypes{$_} // die("FTYPE $_ NOT THERE\n"),$fnames->{$_}],
332
328
sort keys %$fnames;
333
-
334
329
my $func = "PDL_FORTRAN(\$T".join('',map {$_->[0]} @talts) . "(" .
335
330
join(',',map qq{$_->[1]}, @talts)."))";
336
331
if ( defined $fpar ) { $func = "$fpar = $func"; }
337
-
338
332
my $funcargs = join ',', map $KIND2I{$_->[0]}[1]->($_), @args2;
339
-
340
333
my @protos = map $KIND2I{$_->[0]}[2], @args2;
341
334
my @cheaders;
342
335
foreach my $t ( @talts ) {
@@ -350,15 +343,13 @@ sub defslatec {
350
343
. " PDL_FORTRAN($t->[1])(" .
351
344
join(',', @decl_args) . ");";
352
345
}
353
-
354
346
# add on the function reference, if supplied, to the start of
355
347
# the doc string
356
348
if ( defined $docstring ) {
357
349
$docstring = "\n=for ref\n\n$funcref\n\n$docstring" if defined $funcref;
358
350
} else {
359
351
$docstring = '';
360
352
}
361
-
362
353
# IntVals
363
354
my @intcopy_code = map +($KIND2I{$_->[0]}[3]||sub{})->($_), @args2;
364
355
my $code = join("\n", @intcopy_code, "$func($funcargs);");
0 commit comments