Signature.pm (PDL-2.081) | : | Signature.pm (PDL-2.082) | ||
---|---|---|---|---|
skipping to change at line 46 | skipping to change at line 46 | |||
$_->add_inds($dimsobj) for @objects; | $_->add_inds($dimsobj) for @objects; | |||
my (%ind2use, %ind2obj); | my (%ind2use, %ind2obj); | |||
for my $o (@objects) { | for my $o (@objects) { | |||
for my $io (@{$o->{IndObjs}}) { | for my $io (@{$o->{IndObjs}}) { | |||
push @{$ind2use{$io->name}}, $o; | push @{$ind2use{$io->name}}, $o; | |||
$ind2obj{$io->name} = $io; | $ind2obj{$io->name} = $io; | |||
} | } | |||
} | } | |||
$this->{Ind2Use} = \%ind2use; | $this->{Ind2Use} = \%ind2use; | |||
$this->{Ind2Obj} = \%ind2obj; | $this->{Ind2Obj} = \%ind2obj; | |||
$this->{IndNamesSorted} = [ sort keys %ind2use ]; | @$this{qw(OtherNames OtherObjs OtherAnyOut OtherFlags)} = $this->_otherPars_nf | |||
t($otherpars||''); | ||||
$this->{IndNamesSorted} = [ sort keys %ind2obj ]; | ||||
my $i=0; my %ind2index = map +($_=>$i++), @{$this->{IndNamesSorted}}; | my $i=0; my %ind2index = map +($_=>$i++), @{$this->{IndNamesSorted}}; | |||
$this->{Ind2Index} = \%ind2index; | $this->{Ind2Index} = \%ind2index; | |||
$ind2obj{$_}->set_index($ind2index{$_}) for sort keys %ind2index; | $ind2obj{$_}->set_index($ind2index{$_}) for sort keys %ind2index; | |||
@$this{qw(OtherNames OtherObjs OtherAnyOut OtherFlags)} = $this->_otherPars_nf t($otherpars||''); | ||||
$this; | $this; | |||
} | } | |||
sub _otherPars_nft { | sub _otherPars_nft { | |||
my ($sig,$otherpars) = @_; | my ($sig,$otherpars) = @_; | |||
my $dimobjs = $sig && $sig->dims_obj; | my $dimobjs = $sig && $sig->dims_obj; | |||
my (@names,%types,$type,$any_out,%allflags); | my (@names,%types,$type,$any_out,%allflags); | |||
for (nospacesplit(';',$otherpars)) { | for (nospacesplit(';',$otherpars)) { | |||
my (%flags); | my (%flags); | |||
if (s/^\s*$PDL::PP::PdlParObj::sqbr_re\s*//) { | if (s/^\s*$PDL::PP::PdlParObj::sqbr_re\s*//) { | |||
%flags = my %lflags = map +($_=>1), split /\s*,\s*/, my $opts = $1; | %flags = my %lflags = map +($_=>1), split /\s*,\s*/, my $opts = $1; | |||
my $this_out = delete $lflags{o}; | my $this_out = delete $lflags{o}; | |||
die "Invalid options '$opts' in '$_'" if keys %lflags; | die "Invalid options '$opts' in '$_'" if keys %lflags; | |||
$any_out ||= $this_out; | $any_out ||= $this_out; | |||
} | } | |||
if (/^\s*([^=]+?)\s*=>\s*(\S+)\s*$/) { | if (/^\s*([^=]+?)\s*=>\s*(\S+)\s*$/) { | |||
# support 'int ndim => n;' syntax | # support 'int ndim => n;' syntax | |||
my ($ctype,$dim) = ($1,$2); | my ($ctype,$dim) = ($1,$2); | |||
print "OtherPars: setting dim '$dim' from '$ctype'\n" if $::PP_VERBOS E; | print "OtherPars: setting dim '$dim' from '$ctype'\n" if $::PP_VERBOS E; | |||
croak "can't set unknown dimension '$dim' from '$otherpars'" | ||||
unless defined($dimobjs->{$dim}); | ||||
$type = PDL::PP::CType->new($ctype); | $type = PDL::PP::CType->new($ctype); | |||
$dimobjs->{$dim}->set_from($type); | ($sig->{Ind2Obj}{$dim} ||= $dimobjs->get_indobj_make($dim))->set_from ($type); | |||
} else { | } else { | |||
$type = PDL::PP::CType->new($_); | $type = PDL::PP::CType->new($_); | |||
} | } | |||
my $name = $type->protoname; | my $name = $type->protoname; | |||
croak "Invalid OtherPars name: $name" | croak "Invalid OtherPars name: $name" | |||
if $PDL::PP::PdlParObj::INVALID_PAR{$name}; | if $PDL::PP::PdlParObj::INVALID_PAR{$name}; | |||
push @names,$name; | push @names,$name; | |||
$types{$name} = $type; | $types{$name} = $type; | |||
$types{"${name}_count"} = PDL::PP::CType->new("PDL_Indx ${name}_count") i f $type->is_array; | $types{"${name}_count"} = PDL::PP::CType->new("PDL_Indx ${name}_count") i f $type->is_array; | |||
$allflags{$name} = \%flags; | $allflags{$name} = \%flags; | |||
End of changes. 4 change blocks. | ||||
5 lines changed or deleted | 4 lines changed or added |