"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "Basic/Gen/PP/PdlParObj.pm" between
PDL-2.079.tar.gz and PDL-2.080.tar.gz

About: PDL (Perl Data Language) aims to turn perl into an efficient numerical language for scientific computing (similar to IDL and MatLab).

PdlParObj.pm  (PDL-2.079):PdlParObj.pm  (PDL-2.080)
skipping to change at line 12 skipping to change at line 12
use strict; use strict;
use warnings; use warnings;
use Carp; use Carp;
use PDL::Types ':All'; use PDL::Types ':All';
our %INVALID_PAR = map +($_=>1), qw( our %INVALID_PAR = map +($_=>1), qw(
I I
); );
# split regex $re separated arglist
# but ignore bracket-protected bits
# (i.e. text that is within matched brackets)
my $prebrackreg = qr/^([^\(\{\[]*)/;
sub splitprotected ($$) {
require Text::Balanced;
my ($re,$txt) = @_;
return () if !defined $txt || $txt =~ /^\s*$/;
my ($got,$pre) = (1,'');
my @chunks = ('');
my $ct = 0; # infinite loop protection
while ($got && $txt =~ /[({\[]/ && $ct++ < 1000) {
# print "iteration $ct\n";
($got,$txt,$pre) =
Text::Balanced::extract_bracketed($txt,'{}()[]',$prebrackreg);
my @partialargs = split $re, $pre, -1;
$chunks[-1] .= shift @partialargs if @partialargs;
push @chunks, @partialargs;
$chunks[-1] .= $got;
}
confess "possible infinite parse loop, splitting '$txt' "
if $ct >= 1000;
my @partialargs = split $re, $txt, -1;
$chunks[-1] .= shift @partialargs if @partialargs;
push @chunks, @partialargs if @partialargs;
# print STDERR "args found: $#chunks\n";
# print STDERR "splitprotected $txt on $re: [",join('|',@chunks),"]\n";
return @chunks;
}
my $typeregex = join '|', map $_->ppforcetype, types; my $typeregex = join '|', map $_->ppforcetype, types;
my $complex_regex = join '|', qw(real complex); my $complex_regex = join '|', qw(real complex);
our $pars_re = qr/^ our $pars_re = qr/^
\s*(?:($complex_regex|$typeregex)\b([+]*)|)\s* # $1,2: first option then plus \s*(?:($complex_regex|$typeregex)\b([+]*)|)\s* # $1,2: first option then plus
(?: (?:
\[([^]]*)\] # $3: The initial [option] part \[([^]]*)\] # $3: The initial [option] part
)?\s* )?\s*
(\w+) # $4: The name (\w+) # $4: The name
\(([^)]*)\) # $5: The indices \(([^)]*)\) # $5: The indices
/x; /x;
skipping to change at line 222 skipping to change at line 192
"register PDL_Indx $for_local = __privtrans->$name; (void)$for_lo cal;\n"; "register PDL_Indx $for_local = __privtrans->$name; (void)$for_lo cal;\n";
} (0..$#{$this->{IndObjs}}) ) } (0..$#{$this->{IndObjs}}) )
} }
# Print an access part. # Print an access part.
sub do_access { sub do_access {
my($this,$inds,$context) = @_; my($this,$inds,$context) = @_;
my $pdl = $this->{Name}; my $pdl = $this->{Name};
# Parse substitutions into hash # Parse substitutions into hash
my %subst = map my %subst = map
{/^\s*(\w+)\s*=>\s*(\S*)\s*$/ or confess "Invalid subst $_ (no spaces in {/^\s*(\w+)\s*=>\s*(\S*)\s*$/ or confess "Invalid subst $_ in ($inds) (n
=> value)\n"; ($1,$2)} o spaces in => value)\n"; ($1,$2)}
splitprotected ',',$inds; PDL::PP::Rule::Substitute::split_cpp($inds);
# Generate the text # Generate the text
my $text; my $text;
$text = "(${pdl}_datap)"."["; $text = "(${pdl}_datap)"."[";
$text .= join '+','0',map { $text .= join '+','0',map {
$this->do_indterm($pdl,$_,\%subst,$context); $this->do_indterm($pdl,$_,\%subst,$context);
} (0..$#{$this->{IndObjs}}); } (0..$#{$this->{IndObjs}});
$text .= "]"; $text .= "]";
# If not all substitutions made, the user probably made a spelling # If not all substitutions made, the user probably made a spelling
# error. Barf. # error. Barf.
if(scalar(keys %subst) != 0) { if(scalar(keys %subst) != 0) {
 End of changes. 2 change blocks. 
33 lines changed or deleted 3 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)