line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Finnigan::GenericDataDescriptor; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
10
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
72
|
|
4
|
2
|
|
|
2
|
|
8
|
use warnings FATAL => qw( all ); |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
121
|
|
5
|
|
|
|
|
|
|
our $VERSION = 0.0206; |
6
|
|
|
|
|
|
|
|
7
|
2
|
|
|
2
|
|
10
|
use Finnigan; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
36
|
|
8
|
2
|
|
|
2
|
|
25
|
use base 'Finnigan::Decoder'; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
146
|
|
9
|
|
|
|
|
|
|
|
10
|
2
|
|
|
2
|
|
1671
|
use overload ('""' => 'stringify'); |
|
2
|
|
|
|
|
1040
|
|
|
2
|
|
|
|
|
15
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub decode { |
13
|
608
|
|
|
608
|
1
|
913
|
my ($class, $stream) = @_; |
14
|
|
|
|
|
|
|
|
15
|
608
|
|
|
|
|
2335
|
my $fields = [ |
16
|
|
|
|
|
|
|
"type" => ['V', 'UInt32'], |
17
|
|
|
|
|
|
|
"length" => ['V', 'UInt32'], |
18
|
|
|
|
|
|
|
"label" => ['varstr', 'PascalStringWin32'], |
19
|
|
|
|
|
|
|
]; |
20
|
|
|
|
|
|
|
|
21
|
608
|
|
|
|
|
1966
|
my $self = Finnigan::Decoder->read($stream, $fields); |
22
|
|
|
|
|
|
|
|
23
|
608
|
|
|
|
|
2998
|
return bless $self, $class; |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub type { |
27
|
1223
|
|
|
1223
|
1
|
2835
|
shift->{data}->{"type"}->{value}; |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub length { |
31
|
29
|
|
|
29
|
1
|
100
|
shift->{data}->{"length"}->{value}; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub label { |
35
|
615
|
|
|
615
|
1
|
2394
|
shift->{data}->{"label"}->{value}; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
sub stringify { |
39
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
40
|
0
|
|
|
|
|
0
|
my $type = $self->type; |
41
|
0
|
|
|
|
|
0
|
my $length = $self->length; |
42
|
0
|
|
|
|
|
0
|
my $label = $self->label; |
43
|
0
|
|
|
|
|
0
|
return "$label [type $type, length $length]"; |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub definition { |
47
|
1216
|
|
|
1216
|
1
|
1795
|
my ($self, $ord) = @_; |
48
|
|
|
|
|
|
|
|
49
|
1216
|
100
|
|
|
|
4569
|
my $key = defined $ord ? "$ord|$self->{data}->{label}->{value}" : $self->{data}->{label}->{value}; |
50
|
1216
|
|
|
|
|
2313
|
my $type = $self->type; |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
# a gap in the listing or a section title |
53
|
1216
|
100
|
|
|
|
2486
|
if ( $type == 0 ) { |
54
|
80
|
|
|
|
|
290
|
return $key => undef; |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
# c char (a signed byte) |
58
|
1136
|
100
|
|
|
|
2004
|
if ( $type == 0x1 ) { |
59
|
2
|
|
|
|
|
12
|
return $key => ['c', 'Int8']; |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
# bool (true/false) |
63
|
1134
|
50
|
|
|
|
1874
|
if ( $type == 0x2 ) { |
64
|
0
|
|
|
|
|
0
|
return $key => ['C', 'UInt8 (true/false)']; |
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
# yes/no |
68
|
1134
|
100
|
|
|
|
1895
|
if ( $type == 0x3 ) { |
69
|
16
|
|
|
|
|
62
|
return $key => ['C', 'UInt8 (yes/no)']; |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
# on/off |
73
|
1118
|
100
|
|
|
|
1885
|
if ( $type == 0x4 ) { |
74
|
8
|
|
|
|
|
55
|
return $key => ['C', 'UInt8 (on/off)']; |
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
# c unsigned char |
78
|
1110
|
50
|
|
|
|
1995
|
if ( $type == 0x5 ) { |
79
|
0
|
|
|
|
|
0
|
return $key => ['C', 'UInt8']; |
80
|
|
|
|
|
|
|
} |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
# c short |
83
|
1110
|
100
|
|
|
|
1929
|
if ( $type == 0x6 ) { |
84
|
44
|
|
|
|
|
201
|
return $key => ['s<', 'Int16']; |
85
|
|
|
|
|
|
|
} |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
# c unsigned short |
88
|
1066
|
50
|
|
|
|
1762
|
if ( $type == 0x7 ) { |
89
|
0
|
|
|
|
|
0
|
return $key => ['v', 'UInt16']; |
90
|
|
|
|
|
|
|
} |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
# c long |
93
|
1066
|
50
|
|
|
|
1749
|
if ( $type == 0x8 ) { |
94
|
0
|
|
|
|
|
0
|
return $key => ['l<', 'Int32']; |
95
|
|
|
|
|
|
|
} |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
# c unsigned long |
98
|
1066
|
100
|
|
|
|
1782
|
if ( $type == 0x9 ) { |
99
|
18
|
|
|
|
|
77
|
return $key => ['V', 'UInt32']; |
100
|
|
|
|
|
|
|
} |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
# c float |
103
|
1048
|
100
|
|
|
|
1835
|
if ( $type == 0xA ) { |
104
|
222
|
|
|
|
|
986
|
return $key => ['f<', 'Float32']; |
105
|
|
|
|
|
|
|
} |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
# c double |
108
|
826
|
100
|
|
|
|
1619
|
if ( $type == 0xB ) { |
109
|
804
|
|
|
|
|
3791
|
return $key => ['d<', 'Float64']; |
110
|
|
|
|
|
|
|
} |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
# asciiz string |
113
|
22
|
100
|
|
|
|
48
|
if ( $type == 0xC ) { |
114
|
4
|
|
|
|
|
11
|
my $l = $self->length; |
115
|
4
|
|
|
|
|
24
|
return $key => ['string', "ASCIIZ:$l"]; |
116
|
|
|
|
|
|
|
} |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
# wide string, zero-terminated |
119
|
18
|
50
|
|
|
|
39
|
if ( $type == 0xD ) { |
120
|
18
|
|
|
|
|
33
|
my $l = $self->length * 2; |
121
|
18
|
|
|
|
|
97
|
return $key => ['string', "UTF-16-LE:$l"]; |
122
|
|
|
|
|
|
|
} |
123
|
|
|
|
|
|
|
|
124
|
0
|
|
|
|
|
|
die "unkown data type at $self->{addr}, " . $self; |
125
|
|
|
|
|
|
|
} |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
1; |
128
|
|
|
|
|
|
|
__END__ |