line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Tie::Array::Cavity; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
26720
|
use 5.006; |
|
1
|
|
|
|
|
4
|
|
4
|
1
|
|
|
1
|
|
8
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
28
|
|
5
|
1
|
|
|
1
|
|
7
|
use warnings; |
|
1
|
|
|
|
|
5
|
|
|
1
|
|
|
|
|
37
|
|
6
|
1
|
|
|
1
|
|
1054
|
use Tie::Array; |
|
1
|
|
|
|
|
1688
|
|
|
1
|
|
|
|
|
123
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $VERSION = '0.03'; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub TIEARRAY |
12
|
|
|
|
|
|
|
{ |
13
|
0
|
|
|
0
|
|
|
my ( $class ) = @_; |
14
|
0
|
|
0
|
|
|
|
bless { |
|
|
|
0
|
|
|
|
|
15
|
|
|
|
|
|
|
_step => $_[1] || 1, |
16
|
|
|
|
|
|
|
_base => $_[2] || 0, |
17
|
|
|
|
|
|
|
_data => [], |
18
|
|
|
|
|
|
|
}, $class; |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub STORE |
23
|
|
|
|
|
|
|
{ |
24
|
1
|
|
|
1
|
|
1178
|
use integer; |
|
1
|
|
|
|
|
15
|
|
|
1
|
|
|
|
|
7
|
|
25
|
0
|
|
|
0
|
|
|
my $i = ( $_[1] - $_[0]->{ _base } ) / $_[0]->{ _step }; |
26
|
0
|
0
|
|
|
|
|
$i = 0 if ( $i < 0 ); |
27
|
1
|
|
|
1
|
|
74
|
no integer; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
7
|
|
28
|
0
|
|
|
|
|
|
$_[0]->{ _data }->[$i] = $_[2]; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub STORESIZE |
34
|
|
|
|
|
|
|
{ |
35
|
0
|
|
|
0
|
|
|
$#{ $_[0] } = $_[1] - 1; |
|
0
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub FETCHSIZE |
40
|
|
|
|
|
|
|
{ |
41
|
0
|
|
|
0
|
|
|
scalar @{ $_[0]->{ _data } }; |
|
0
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub FETCHCAVITY |
46
|
|
|
|
|
|
|
{ |
47
|
1
|
|
|
1
|
|
160
|
use integer; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
4
|
|
48
|
0
|
|
|
0
|
1
|
|
my $i = ( $_[1] - $_[0]->{ _base } ) / $_[0]->{ _step }; |
49
|
0
|
0
|
|
|
|
|
$i = 0 if ( $i < 0 ); |
50
|
1
|
|
|
1
|
|
63
|
no integer; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
4
|
|
51
|
0
|
|
|
|
|
|
$_[0]->{ _data }->[$i]; |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
sub FETCHKEY |
57
|
|
|
|
|
|
|
{ |
58
|
1
|
|
|
1
|
|
69
|
use integer; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
4
|
|
59
|
0
|
|
|
0
|
1
|
|
my $i = ( $_[1] - $_[0]->{ _base } ) / $_[0]->{ _step }; |
60
|
0
|
0
|
|
|
|
|
$i = 0 if ( $i < 0 ); |
61
|
1
|
|
|
1
|
|
49
|
no integer; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
3
|
|
62
|
0
|
|
|
|
|
|
( $i * $_[0]->{ _step } ) + $_[0]->{ _base }; |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
sub FETCHKEYCAVITY |
67
|
|
|
|
|
|
|
{ |
68
|
1
|
|
|
1
|
|
81
|
use integer; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
4
|
|
69
|
0
|
|
0
|
0
|
1
|
|
my $i = ( ($_[1] || 0 ) * $_[0]->{ _step } ) + $_[0]->{ _base }; |
70
|
0
|
0
|
|
|
|
|
$i = 0 if ( $i < 0 ); |
71
|
1
|
|
|
1
|
|
76
|
no integer; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
5
|
|
72
|
0
|
|
|
|
|
|
$i; |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
sub FETCH |
77
|
|
|
|
|
|
|
{ |
78
|
0
|
|
|
0
|
|
|
$_[0]->{ _data }->[ $_[1] ]; |
79
|
|
|
|
|
|
|
} |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
sub POP |
84
|
|
|
|
|
|
|
{ |
85
|
0
|
|
|
0
|
|
|
pop @{ $_[0]->{ _data } }; |
|
0
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
} |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
sub SHIFT |
90
|
|
|
|
|
|
|
{ |
91
|
0
|
|
|
0
|
|
|
shift @{ $_[0]->{ _data } }; |
|
0
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
} |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
sub PUSH |
97
|
|
|
|
|
|
|
{ |
98
|
0
|
|
|
0
|
|
|
push @{ $_[0]->{ _data } }, $_[1]; |
|
0
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
} |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
sub UNSHIFT |
105
|
|
|
|
|
|
|
{ |
106
|
0
|
|
|
0
|
|
|
unshift @{ $_[0]->{ _data } }, $_[1]; |
|
0
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
} |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
sub EXISTSCAVITY |
111
|
|
|
|
|
|
|
{ |
112
|
1
|
|
|
1
|
|
201
|
use integer; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
4
|
|
113
|
0
|
|
|
0
|
1
|
|
my $i = ( $_[1] - $_[0]->{ _base } ) / $_[0]->{ _step }; |
114
|
0
|
0
|
|
|
|
|
$i = 0 if ( $i < 0 ); |
115
|
1
|
|
|
1
|
|
64
|
no integer; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
3
|
|
116
|
0
|
|
|
|
|
|
exists $_[0]->{ _data }->[$i]; |
117
|
|
|
|
|
|
|
} |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
sub EXISTS |
121
|
|
|
|
|
|
|
{ |
122
|
0
|
|
|
0
|
|
|
exists $_[0]->{ _data }->[$_[1]]; |
123
|
|
|
|
|
|
|
} |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
sub DELETECAVITY |
127
|
|
|
|
|
|
|
{ |
128
|
1
|
|
|
1
|
|
88
|
use integer; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
3
|
|
129
|
0
|
|
|
0
|
1
|
|
my $i = ( $_[1] - $_[0]->{ _base } ) / $_[0]->{ _step }; |
130
|
0
|
0
|
|
|
|
|
$i = 0 if ( $i < 0 ); |
131
|
1
|
|
|
1
|
|
54
|
no integer; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
13
|
|
132
|
0
|
|
|
|
|
|
delete $_[0]->{ _data }->[$i]; |
133
|
|
|
|
|
|
|
} |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
sub DELETE |
137
|
|
|
|
|
|
|
{ |
138
|
0
|
|
|
0
|
|
|
delete $_[0]->{ _data }->[$_[1]]; |
139
|
|
|
|
|
|
|
} |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
sub SPLICECAVITY |
144
|
|
|
|
|
|
|
{ |
145
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
146
|
0
|
0
|
|
|
|
|
my $offset = @_ ? shift : 0; |
147
|
0
|
|
|
|
|
|
my $s = $self->{ _step }; |
148
|
0
|
|
|
|
|
|
my $b = $self->{ _base }; |
149
|
1
|
|
|
1
|
|
152
|
use integer; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
4
|
|
150
|
0
|
|
|
|
|
|
my $off = ( $offset - $b ) / $s; |
151
|
0
|
0
|
|
|
|
|
$off = 0 if ( $off < 0 ); |
152
|
0
|
|
|
|
|
|
my $sz = $self->FETCHSIZE; |
153
|
0
|
0
|
|
|
|
|
$off += $sz if $off < 0; |
154
|
0
|
0
|
|
|
|
|
my $len = @_ ? shift : $sz - $off; |
155
|
1
|
|
|
1
|
|
79
|
no integer; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
4
|
|
156
|
0
|
|
|
|
|
|
return splice( @{$self->{ _data }}, $off, $len, @_ ); |
|
0
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
} |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
sub SPLICE |
162
|
|
|
|
|
|
|
{ |
163
|
0
|
|
|
0
|
|
|
my $self = shift; |
164
|
0
|
0
|
|
|
|
|
my $offset = @_ ? shift : 0; |
165
|
0
|
|
|
|
|
|
my $sz = $self->FETCHSIZE; |
166
|
0
|
0
|
|
|
|
|
$offset += $sz if $offset < 0; |
167
|
0
|
0
|
|
|
|
|
my $len = @_ ? shift : $sz - $offset; |
168
|
0
|
|
|
|
|
|
return splice( @{$self->{ _data }}, $offset, $len, @_ ); |
|
0
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
} |
170
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
1; # End of Tie::Array::Cavity |
174
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
__END__ |