line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Finnigan::RawFileInfoPreamble; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
12
|
use strict; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
78
|
|
4
|
2
|
|
|
2
|
|
11
|
use warnings FATAL => qw( all ); |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
130
|
|
5
|
|
|
|
|
|
|
our $VERSION = 0.0206; |
6
|
|
|
|
|
|
|
|
7
|
2
|
|
|
2
|
|
11
|
use Finnigan; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
51
|
|
8
|
2
|
|
|
2
|
|
9
|
use base 'Finnigan::Decoder'; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
169
|
|
9
|
|
|
|
|
|
|
|
10
|
2
|
|
|
2
|
|
10
|
use overload ('""' => 'stringify'); |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
12
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub decode { |
13
|
1
|
|
|
1
|
1
|
2
|
my ($class, $stream, $version) = @_; |
14
|
|
|
|
|
|
|
|
15
|
1
|
|
|
|
|
15
|
my @common_fields = ( |
16
|
|
|
|
|
|
|
"method file present" => ['V', 'UInt32'], |
17
|
|
|
|
|
|
|
year => ['v', 'UInt16'], |
18
|
|
|
|
|
|
|
month => ['v', 'UInt16'], |
19
|
|
|
|
|
|
|
"day of the week" => ['v', 'UInt16'], |
20
|
|
|
|
|
|
|
day => ['v', 'UInt16'], |
21
|
|
|
|
|
|
|
hour => ['v', 'UInt16'], |
22
|
|
|
|
|
|
|
minute => ['v', 'UInt16'], |
23
|
|
|
|
|
|
|
second => ['v', 'UInt16'], |
24
|
|
|
|
|
|
|
millisecond => ['v', 'UInt16'], |
25
|
|
|
|
|
|
|
); |
26
|
|
|
|
|
|
|
|
27
|
1
|
|
|
|
|
2
|
my %specific_fields; |
28
|
1
|
|
|
|
|
11
|
$specific_fields{8} = [], |
29
|
|
|
|
|
|
|
$specific_fields{57} = [ |
30
|
|
|
|
|
|
|
"unknown_long[2]" => ['V', 'UInt32'], |
31
|
|
|
|
|
|
|
"data addr" => ['V', 'UInt32'], |
32
|
|
|
|
|
|
|
"unknown_long[3]" => ['V', 'UInt32'], |
33
|
|
|
|
|
|
|
"unknown_long[4]" => ['V', 'UInt32'], |
34
|
|
|
|
|
|
|
"unknown_long[5]" => ['V', 'UInt32'], |
35
|
|
|
|
|
|
|
"unknown_long[6]" => ['V', 'UInt32'], |
36
|
|
|
|
|
|
|
"run header addr" => ['V', 'UInt32'], |
37
|
|
|
|
|
|
|
unknown_area => ['C756', 'RawBytes'], # 804 - 12 * 4 (804 is the fixed size of RawFileInfoPreamble prior to v.64) |
38
|
|
|
|
|
|
|
]; |
39
|
|
|
|
|
|
|
|
40
|
1
|
|
|
|
|
3
|
$specific_fields{60} = $specific_fields{57}; |
41
|
1
|
|
|
|
|
2
|
$specific_fields{62} = $specific_fields{57}; |
42
|
1
|
|
|
|
|
3
|
$specific_fields{63} = $specific_fields{57}; |
43
|
|
|
|
|
|
|
|
44
|
1
|
|
|
|
|
12
|
$specific_fields{64} = [ |
45
|
|
|
|
|
|
|
"unknown_long[2]" => ['V', 'UInt32'], |
46
|
|
|
|
|
|
|
"32-bit data addr (unused)" => ['V', 'UInt32'], |
47
|
|
|
|
|
|
|
"unknown_long[3]" => ['V', 'UInt32'], |
48
|
|
|
|
|
|
|
"unknown_long[4]" => ['V', 'UInt32'], |
49
|
|
|
|
|
|
|
"unknown_long[5]" => ['V', 'UInt32'], |
50
|
|
|
|
|
|
|
"unknown_long[6]" => ['V', 'UInt32'], |
51
|
|
|
|
|
|
|
"32-b run header addr (unused)" => ['V', 'UInt32'], |
52
|
|
|
|
|
|
|
"unknown_area[1]" => ['C760', 'RawBytes'], |
53
|
|
|
|
|
|
|
"data addr" => ['Q<', 'UInt64'], |
54
|
|
|
|
|
|
|
"unknown_long[7]" => ['V', 'UInt32'], |
55
|
|
|
|
|
|
|
"unknown_long[8]" => ['V', 'UInt32'], |
56
|
|
|
|
|
|
|
"run header addr" => ['Q<', 'UInt64'], |
57
|
|
|
|
|
|
|
"unknown_area[2]" => ['C1008', 'RawBytes'], |
58
|
|
|
|
|
|
|
]; |
59
|
|
|
|
|
|
|
|
60
|
1
|
50
|
|
|
|
4
|
if ($version == 66) { |
61
|
0
|
|
|
|
|
0
|
$specific_fields{66} = $specific_fields{64}; |
62
|
0
|
|
|
|
|
0
|
$specific_fields{66}->[-1]->[0] = 'C1024'; # unknown_area[2] has been extended |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
|
65
|
1
|
50
|
|
|
|
5
|
die "don't know how to parse version $version" unless $specific_fields{$version}; |
66
|
1
|
|
|
|
|
3
|
my $self = Finnigan::Decoder->read($stream, [@common_fields, @{$specific_fields{$version}}]); |
|
1
|
|
|
|
|
10
|
|
67
|
|
|
|
|
|
|
|
68
|
1
|
|
|
|
|
14
|
return bless $self, $class; |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
sub timestamp { |
72
|
1
|
|
|
1
|
1
|
3
|
my $self = shift; |
73
|
1
|
|
|
|
|
4
|
my @dow_abbr = qw/X Mon Tue Wed Thu Fri Sat Sun/; |
74
|
1
|
|
|
|
|
4
|
my @month_abbr = qw/X Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec/; |
75
|
1
|
|
|
|
|
16
|
$dow_abbr[$self->{data}->{"day of the week"}->{value}] . " " |
76
|
|
|
|
|
|
|
. $month_abbr[$self->{data}->{month}->{value}] |
77
|
|
|
|
|
|
|
. " " |
78
|
|
|
|
|
|
|
. $self->{data}->{day}->{value} |
79
|
|
|
|
|
|
|
. " " |
80
|
|
|
|
|
|
|
. $self->{data}->{year}->{value} |
81
|
|
|
|
|
|
|
. " " |
82
|
|
|
|
|
|
|
. $self->{data}->{hour}->{value} |
83
|
|
|
|
|
|
|
. ":" |
84
|
|
|
|
|
|
|
. $self->{data}->{minute}->{value} |
85
|
|
|
|
|
|
|
. ":" |
86
|
|
|
|
|
|
|
. $self->{data}->{second}->{value} |
87
|
|
|
|
|
|
|
. "." |
88
|
|
|
|
|
|
|
. $self->{data}->{millisecond}->{value} |
89
|
|
|
|
|
|
|
; |
90
|
|
|
|
|
|
|
} |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
sub xmlTimestamp { |
93
|
1
|
|
|
1
|
1
|
2
|
my $self = shift; |
94
|
1
|
|
|
|
|
23
|
sprintf( |
95
|
|
|
|
|
|
|
'%04d-%02d-%02dT%02d:%02d:%02.0fZ', |
96
|
|
|
|
|
|
|
$self->{data}->{year}->{value}, |
97
|
|
|
|
|
|
|
$self->{data}->{month}->{value}, |
98
|
|
|
|
|
|
|
$self->{data}->{day}->{value}, |
99
|
|
|
|
|
|
|
$self->{data}->{hour}->{value}, |
100
|
|
|
|
|
|
|
$self->{data}->{minute}->{value}, |
101
|
|
|
|
|
|
|
$self->{data}->{second}->{value} + $self->{data}->{millisecond}->{value} / 1000 |
102
|
|
|
|
|
|
|
); |
103
|
|
|
|
|
|
|
} |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
sub run_header_addr { |
106
|
3
|
|
|
3
|
1
|
12
|
shift->{data}->{"run header addr"}->{value}; |
107
|
|
|
|
|
|
|
} |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
sub data_addr { |
110
|
2
|
|
|
2
|
1
|
10
|
shift->{data}->{"data addr"}->{value}; |
111
|
|
|
|
|
|
|
} |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
sub stringify { |
114
|
1
|
|
|
1
|
1
|
4
|
my $self = shift; |
115
|
1
|
|
|
|
|
3
|
return $self->timestamp |
116
|
|
|
|
|
|
|
. "; " |
117
|
|
|
|
|
|
|
. "data addr: " . $self->data_addr |
118
|
|
|
|
|
|
|
. "; " |
119
|
|
|
|
|
|
|
. "RunHeader addr: " . $self->run_header_addr |
120
|
|
|
|
|
|
|
; |
121
|
|
|
|
|
|
|
} |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
1; |
124
|
|
|
|
|
|
|
__END__ |