| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Tie::Array::Pointer; |
|
2
|
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
92699
|
use strict; |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
249
|
|
|
4
|
2
|
|
|
2
|
|
13
|
use vars qw($VERSION); |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
167
|
|
|
5
|
2
|
|
|
2
|
|
13
|
use base qw(Tie::Array DynaLoader); |
|
|
2
|
|
|
|
|
8
|
|
|
|
2
|
|
|
|
|
2729
|
|
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
$VERSION = '0.000059'; |
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
Tie::Array::Pointer->bootstrap($VERSION); |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
# |
|
12
|
|
|
|
|
|
|
sub TIEARRAY { |
|
13
|
1
|
|
|
1
|
|
19
|
my $class = shift; |
|
14
|
1
|
|
|
|
|
3
|
my $opt = shift; |
|
15
|
1
|
|
|
|
|
6
|
my $self = { %$opt }; |
|
16
|
1
|
|
|
|
|
3
|
bless($self, __PACKAGE__); |
|
17
|
|
|
|
|
|
|
|
|
18
|
1
|
50
|
|
|
|
6
|
if ($self->address) { |
|
19
|
0
|
|
|
|
|
0
|
$self->{allocated} = 0; |
|
20
|
|
|
|
|
|
|
} else { |
|
21
|
1
|
|
|
|
|
13
|
my $addr = tsp_malloc($self->{length} * 4); |
|
22
|
1
|
50
|
|
|
|
10
|
die('Memory could not be allocated') if (!$addr); |
|
23
|
1
|
|
|
|
|
3
|
$self->{address} = $addr; |
|
24
|
1
|
|
|
|
|
6
|
$self->{allocated} = 1; |
|
25
|
|
|
|
|
|
|
} |
|
26
|
|
|
|
|
|
|
|
|
27
|
1
|
|
|
|
|
5
|
return $self; |
|
28
|
|
|
|
|
|
|
} |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub DESTROY { |
|
31
|
1
|
|
|
1
|
|
278
|
my $self = shift; |
|
32
|
1
|
50
|
|
|
|
7
|
if ($self->{allocated}) { |
|
33
|
1
|
|
|
|
|
121
|
tsp_free($self->{address}); |
|
34
|
|
|
|
|
|
|
} |
|
35
|
|
|
|
|
|
|
} |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
# |
|
38
|
|
|
|
|
|
|
sub FETCH { |
|
39
|
1
|
|
|
1
|
|
8
|
my $self = shift; |
|
40
|
1
|
|
|
|
|
2
|
my $n = shift; |
|
41
|
1
|
|
|
|
|
2
|
my $type = $self->{type}; |
|
42
|
|
|
|
|
|
|
|
|
43
|
1
|
|
|
|
|
3
|
my $int; |
|
44
|
1
|
50
|
33
|
|
|
31
|
if ($type eq 'c' || $type eq 'C') { |
|
|
|
50
|
33
|
|
|
|
|
|
|
|
50
|
33
|
|
|
|
|
|
45
|
0
|
|
|
|
|
0
|
$int = tsp_r8($self->{address} + $n); |
|
46
|
|
|
|
|
|
|
} elsif ($type eq 's' || $type eq 'S') { |
|
47
|
0
|
|
|
|
|
0
|
$int = tsp_r16($self->{address} + $n * 2); |
|
48
|
|
|
|
|
|
|
} elsif ($type eq 'l' || $type eq 'L') { |
|
49
|
1
|
|
|
|
|
5
|
$int = tsp_r32($self->{address} + $n * 4); |
|
50
|
|
|
|
|
|
|
} |
|
51
|
|
|
|
|
|
|
|
|
52
|
1
|
|
|
|
|
5
|
return $int; |
|
53
|
|
|
|
|
|
|
} |
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
# |
|
56
|
|
|
|
|
|
|
sub FETCHSIZE { |
|
57
|
1
|
|
|
1
|
|
6
|
return $_[0]->{length}; |
|
58
|
|
|
|
|
|
|
} |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
# |
|
61
|
|
|
|
|
|
|
sub STORE { |
|
62
|
1
|
|
|
1
|
|
3
|
my $self = shift; |
|
63
|
1
|
|
|
|
|
2
|
my $n = shift; |
|
64
|
1
|
|
|
|
|
2
|
my $val = shift; |
|
65
|
|
|
|
|
|
|
|
|
66
|
1
|
|
|
|
|
3
|
my $type = $self->{type}; |
|
67
|
1
|
|
|
|
|
1
|
my $int; |
|
68
|
1
|
50
|
33
|
|
|
25
|
if ($type eq 'c' || $type eq 'C') { |
|
|
|
50
|
33
|
|
|
|
|
|
|
|
50
|
33
|
|
|
|
|
|
69
|
0
|
|
|
|
|
0
|
$int = tsp_w8($self->{address} + $n, $val); |
|
70
|
|
|
|
|
|
|
} elsif ($type eq 's' || $type eq 'S') { |
|
71
|
0
|
|
|
|
|
0
|
$int = tsp_w16($self->{address} + $n * 2, $val); |
|
72
|
|
|
|
|
|
|
} elsif ($type eq 'l' || $type eq 'L') { |
|
73
|
1
|
|
|
|
|
6
|
$int = tsp_w32($self->{address} + $n * 4, $val); |
|
74
|
|
|
|
|
|
|
} |
|
75
|
1
|
|
|
|
|
4
|
return $val; |
|
76
|
|
|
|
|
|
|
} |
|
77
|
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
# |
|
79
|
|
|
|
|
|
|
sub STORESIZE { |
|
80
|
0
|
|
|
0
|
|
0
|
die('not allowed (yet)'); |
|
81
|
|
|
|
|
|
|
} |
|
82
|
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
sub PUSH { |
|
84
|
1
|
|
|
1
|
|
12
|
die('not allowed (yet)'); |
|
85
|
|
|
|
|
|
|
} |
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
sub POP { |
|
88
|
0
|
|
|
0
|
|
0
|
die('not allowed (yet)'); |
|
89
|
|
|
|
|
|
|
} |
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
sub SHIFT { |
|
92
|
0
|
|
|
0
|
|
0
|
die('not allowed (yet)'); |
|
93
|
|
|
|
|
|
|
} |
|
94
|
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
sub UNSHIFT { |
|
96
|
1
|
|
|
1
|
|
243
|
die('not allowed (yet)'); |
|
97
|
|
|
|
|
|
|
} |
|
98
|
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
sub DELETE { |
|
100
|
0
|
|
|
0
|
|
0
|
my $self = shift; |
|
101
|
0
|
|
|
|
|
0
|
my $n = shift; |
|
102
|
0
|
|
|
|
|
0
|
$self->STORE($n, 0); |
|
103
|
|
|
|
|
|
|
} |
|
104
|
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
sub EXISTS { |
|
106
|
2
|
|
|
2
|
|
4581
|
my $self = shift; |
|
107
|
2
|
|
|
|
|
5
|
my $n = shift; |
|
108
|
2
|
100
|
|
|
|
173
|
if ($n < $self->{length}) { |
|
109
|
1
|
|
|
|
|
173
|
return 1; |
|
110
|
|
|
|
|
|
|
} else { |
|
111
|
1
|
|
|
|
|
5
|
return 0; |
|
112
|
|
|
|
|
|
|
} |
|
113
|
|
|
|
|
|
|
} |
|
114
|
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
# base address in memory of C array |
|
116
|
|
|
|
|
|
|
sub address { |
|
117
|
2
|
|
|
2
|
1
|
444
|
return $_[0]->{address}; |
|
118
|
|
|
|
|
|
|
} |
|
119
|
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
1; |
|
121
|
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
__END__ |