File: local.perldlrc

package info (click to toggle)
pdl 1%3A2.4.11-4
  • links: PTS
  • area: main
  • in suites: wheezy
  • size: 11,152 kB
  • sloc: perl: 31,295; fortran: 13,113; ansic: 8,910; makefile: 76; sh: 28; sed: 6
file content (31 lines) | stat: -rw-r--r-- 775 bytes parent folder | download | duplicates (12)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# some useful functions to experiment with
# the new PDL source filter within the perldl shell

# report switches translation reporting on/off
# trans and notrans switch source filtering on/off

# include the perl code below in your standard
# perldl startup file ($ENV{HOME}/.perldlrc)
# to have it always available when working
# in the perldl shell

$PERLDL::report = 0;
sub report {
  my $ret = $PERLDL::report;
  $PERLDL::report = $_[0] if $#_ > -1;
  return $ret;
}

use PDL::NiceSlice;
my $preproc = sub { my ($txt) = @_;
	my $new = PDL::NiceSlice::perldlpp $txt;
	print STDERR "processed $new\n" if report && $new ne $txt;
	return $new;
};

sub trans { $PERLDL::PREPROCESS  = $preproc }
sub notrans { $PERLDL::PREPROCESS  = undef }
trans; # switch on by default


1;