line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
############################################## |
2
|
|
|
|
|
|
|
package PDLA::PP::PdlDimsObj; # Hold more dims |
3
|
3
|
|
|
3
|
|
23
|
use Carp; |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
672
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
sub new { |
6
|
7
|
|
|
7
|
|
936
|
my($type) = @_; |
7
|
7
|
|
|
|
|
32
|
bless {},$type; |
8
|
|
|
|
|
|
|
} |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub get_indobj_make { |
11
|
11
|
|
|
11
|
|
27
|
my($this,$expr) = @_; |
12
|
11
|
50
|
|
|
|
64
|
$expr =~ /^([a-zA-Z0-9]+)(?:=([0-9]+))?$/ or confess "Invalid index expr '$expr'\n"; |
13
|
11
|
|
|
|
|
28
|
my $name = $1; my $val = $2; |
|
11
|
|
|
|
|
20
|
|
14
|
11
|
|
|
|
|
14
|
my $indobj; |
15
|
11
|
100
|
|
|
|
43
|
if(defined $this->{$name}) { |
16
|
3
|
|
|
|
|
7
|
$indobj = $this->{$name}; |
17
|
|
|
|
|
|
|
} else { |
18
|
8
|
|
|
|
|
33
|
$indobj = PDLA::PP::Ind->new($name); |
19
|
8
|
|
|
|
|
24
|
$this->{$name}=$indobj; |
20
|
|
|
|
|
|
|
} |
21
|
11
|
100
|
|
|
|
27
|
if(defined $val) { $indobj->add_value($val); } |
|
1
|
|
|
|
|
4
|
|
22
|
11
|
|
|
|
|
50
|
return $indobj; |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
##################################################################### |
26
|
|
|
|
|
|
|
# |
27
|
|
|
|
|
|
|
# Encapsulate one index. |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
package PDLA::PP::Ind; |
30
|
3
|
|
|
3
|
|
22
|
use Carp; |
|
3
|
|
|
|
|
8
|
|
|
3
|
|
|
|
|
1485
|
|
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub new { |
33
|
8
|
|
|
8
|
|
20
|
my($type,$name) = @_; |
34
|
8
|
|
|
|
|
24
|
my $this = bless {Name => $name},$type; |
35
|
8
|
|
|
|
|
17
|
return $this; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
# set the value of an index, also used by perl level threading |
39
|
|
|
|
|
|
|
sub add_value { |
40
|
10
|
|
|
10
|
|
18
|
my($this,$val) = @_; |
41
|
10
|
50
|
|
|
|
23
|
croak("index values for $this->{Name} must be positive") |
42
|
|
|
|
|
|
|
unless $val > 0; |
43
|
10
|
100
|
|
|
|
21
|
if(defined $this->{Value}) { |
44
|
4
|
50
|
33
|
|
|
31
|
if ($this->{Value} == -1 || $this->{Value} == 1) |
|
|
100
|
100
|
|
|
|
|
45
|
0
|
|
|
|
|
0
|
{ $this->{Value} = $val } |
46
|
|
|
|
|
|
|
elsif($val != 1 && $val != $this->{Value}) { |
47
|
2
|
|
|
|
|
43
|
croak("For index $this->{Name} conflicting values $this->{Value} and $val given\n"); |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
} else { |
50
|
6
|
|
|
|
|
17
|
$this->{Value} = $val; |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
# This index will take its size value from outside parameter ... |
55
|
0
|
|
|
0
|
|
0
|
sub set_from { my($this,$otherpar) = @_; |
56
|
0
|
|
|
|
|
0
|
$this->{From} = $otherpar; |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
32
|
|
|
32
|
|
184
|
sub name {return (shift)->{Name}} |
60
|
|
|
|
|
|
|
|
61
|
1
|
|
|
1
|
|
3
|
sub get_decldim { my($this) = @_; |
62
|
1
|
|
|
|
|
6
|
return "PDLA_Indx __$this->{Name}_size;"; |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
|
65
|
1
|
|
|
1
|
|
2
|
sub get_initdim { my($this) = @_; |
66
|
1
|
|
|
|
|
3
|
my $init = '-1'; |
67
|
|
|
|
|
|
|
$init = "\$COMP(".$this->{From}->{ProtoName}.")" |
68
|
1
|
50
|
|
|
|
4
|
if $this->{From}; |
69
|
1
|
50
|
|
|
|
3
|
$init = $this->{Value} if defined $this->{Value}; |
70
|
1
|
|
|
|
|
6
|
"\$PRIV(__$this->{Name}_size) = $init;" |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
|
73
|
1
|
|
|
1
|
|
3
|
sub get_copydim { my($this,$fromsub,$tosub) = @_; |
74
|
1
|
|
|
|
|
4
|
my($iname) = "__$this->{Name}_size"; |
75
|
1
|
|
|
|
|
3
|
&$tosub($iname) ."=". &$fromsub($iname) .";" ; |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
|
78
|
2
|
|
|
2
|
|
5
|
sub get_size { my($this) = @_; |
79
|
2
|
|
|
|
|
7
|
"\$PRIV(__$this->{Name}_size)" |
80
|
|
|
|
|
|
|
} |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
1; |