| 1 | package Finnigan::RunHeader; | ||||||||||
| 2 | |||||||||||
| 3 | 2 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 2 | ▶ | use warnings FATAL => qw( all ); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 2 | our $VERSION = 0.0206; | |||||||||
| 6 | |||||||||||
| 7 | 2 | ▶ | use Finnigan; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | 2 | ▶ | use base 'Finnigan::Decoder'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | |||||||||||
| 10 | |||||||||||
| 11 | 1 | ▶ | sub decode { | ||||||||
|
Subroutine
decode: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||
| 12 | 1 | my ($class, $stream, $version) = @_; | |||||||||
| 13 | |||||||||||
| 14 | 1 | my @common_fields = ( | |||||||||
| 15 | "sample info" => ['object', 'Finnigan::SampleInfo'], | ||||||||||
| 16 | ); | ||||||||||
| 17 | |||||||||||
| 18 | 1 | my %specific_fields; | |||||||||
| 19 | 1 | $specific_fields{8} = [ | |||||||||
| 20 | "orig file name" => ['varstr', 'PascalStringWin32'], | ||||||||||
| 21 | "file name[1]" => ['varstr', 'PascalStringWin32'], | ||||||||||
| 22 | "file name[2]" => ['varstr', 'PascalStringWin32'], | ||||||||||
| 23 | "file name[3]" => ['varstr', 'PascalStringWin32'], | ||||||||||
| 24 | ]; | ||||||||||
| 25 | |||||||||||
| 26 | 1 | $specific_fields{57} = [ | |||||||||
| 27 | "file name[1]" => ['U0C520', 'UTF16LE'], | ||||||||||
| 28 | "file name[2]" => ['U0C520', 'UTF16LE'], | ||||||||||
| 29 | "file name[3]" => ['U0C520', 'UTF16LE'], | ||||||||||
| 30 | "file name[4]" => ['U0C520', 'UTF16LE'], | ||||||||||
| 31 | "file name[5]" => ['U0C520', 'UTF16LE'], | ||||||||||
| 32 | "file name[6]" => ['U0C520', 'UTF16LE'], | ||||||||||
| 33 | "unknown double[1]" => ['d<', 'Float64'], | ||||||||||
| 34 | "unknown double[2]" => ['d<', 'Float64'], | ||||||||||
| 35 | "file name[7]" => ['U0C520', 'UTF16LE'], | ||||||||||
| 36 | "file name[8]" => ['U0C520', 'UTF16LE'], | ||||||||||
| 37 | "file name[9]" => ['U0C520', 'UTF16LE'], | ||||||||||
| 38 | "file name[a]" => ['U0C520', 'UTF16LE'], | ||||||||||
| 39 | "file name[b]" => ['U0C520', 'UTF16LE'], | ||||||||||
| 40 | "file name[c]" => ['U0C520', 'UTF16LE'], | ||||||||||
| 41 | "file name[d]" => ['U0C520', 'UTF16LE'], | ||||||||||
| 42 | "scan trailer addr" => ['V', 'UInt32'], | ||||||||||
| 43 | "scan params addr" => ['V', 'UInt32'], | ||||||||||
| 44 | "unknown length[1]" => ['V', 'UInt32'], | ||||||||||
| 45 | "unknown length[2]" => ['V', 'UInt32'], | ||||||||||
| 46 | "nsegs" => ['V', 'UInt32'], | ||||||||||
| 47 | "unknown long[1]" => ['V', 'UInt32'], | ||||||||||
| 48 | "unknown long[2]" => ['V', 'UInt32'], | ||||||||||
| 49 | "own addr" => ['V', 'UInt32'], | ||||||||||
| 50 | "unknown long[3]" => ['V', 'UInt32'], | ||||||||||
| 51 | "unknown long[4]" => ['V', 'UInt32'], | ||||||||||
| 52 | ]; | ||||||||||
| 53 | |||||||||||
| 54 | 1 | $specific_fields{60} = $specific_fields{57}; | |||||||||
| 55 | 1 | $specific_fields{62} = $specific_fields{57}; | |||||||||
| 56 | 1 | $specific_fields{63} = $specific_fields{57}; | |||||||||
| 57 | |||||||||||
| 58 | 1 | $specific_fields{64} = [ | |||||||||
| 59 | "file name[1]" => ['U0C520', 'UTF16LE'], | ||||||||||
| 60 | "file name[2]" => ['U0C520', 'UTF16LE'], | ||||||||||
| 61 | "file name[3]" => ['U0C520', 'UTF16LE'], | ||||||||||
| 62 | "file name[4]" => ['U0C520', 'UTF16LE'], | ||||||||||
| 63 | "file name[5]" => ['U0C520', 'UTF16LE'], | ||||||||||
| 64 | "file name[6]" => ['U0C520', 'UTF16LE'], | ||||||||||
| 65 | "unknown double[1]" => ['d<', 'Float64'], | ||||||||||
| 66 | "unknown double[2]" => ['d<', 'Float64'], | ||||||||||
| 67 | "file name[7]" => ['U0C520', 'UTF16LE'], | ||||||||||
| 68 | "file name[8]" => ['U0C520', 'UTF16LE'], | ||||||||||
| 69 | "file name[9]" => ['U0C520', 'UTF16LE'], | ||||||||||
| 70 | "file name[a]" => ['U0C520', 'UTF16LE'], | ||||||||||
| 71 | "file name[b]" => ['U0C520', 'UTF16LE'], | ||||||||||
| 72 | "file name[c]" => ['U0C520', 'UTF16LE'], | ||||||||||
| 73 | "file name[d]" => ['U0C520', 'UTF16LE'], | ||||||||||
| 74 | "32-bit scan trailer addr (defunct)" => ['V', 'UInt32'], | ||||||||||
| 75 | "32-bit scan params addr (defunct)" => ['V', 'UInt32'], | ||||||||||
| 76 | "unknown length[1]" => ['V', 'UInt32'], | ||||||||||
| 77 | "unknown length[2]" => ['V', 'UInt32'], | ||||||||||
| 78 | "nsegs" => ['V', 'UInt32'], | ||||||||||
| 79 | "unknown long[1]" => ['V', 'UInt32'], | ||||||||||
| 80 | "unknown long[2]" => ['V', 'UInt32'], | ||||||||||
| 81 | "32-bit own addr (defunct)" => ['V', 'UInt32'], | ||||||||||
| 82 | "unknown long[3]" => ['V', 'UInt32'], | ||||||||||
| 83 | "unknown long[4]" => ['V', 'UInt32'], | ||||||||||
| 84 | |||||||||||
| 85 | "scan index addr" => ['Q<', 'Uint64'], | ||||||||||
| 86 | "data addr" => ['Q<', 'Uint64'], | ||||||||||
| 87 | "inst log addr" => ['Q<', 'Uint64'], | ||||||||||
| 88 | "error log addr" => ['Q<', 'Uint64'], | ||||||||||
| 89 | "unknown addr[1]" => ['Q<', 'Uint64'], | ||||||||||
| 90 | "scan trailer addr" => ['Q<', 'Uint64'], | ||||||||||
| 91 | "scan params addr" => ['Q<', 'Uint64'], | ||||||||||
| 92 | "unknown addr[2]" => ['Q<', 'Uint64'], | ||||||||||
| 93 | "own addr" => ['Q<', 'Uint64'], | ||||||||||
| 94 | |||||||||||
| 95 | "unknown long[5]" => ['V', 'UInt32'], | ||||||||||
| 96 | "unknown long[6]" => ['V', 'UInt32'], | ||||||||||
| 97 | "unknown long[7]" => ['V', 'UInt32'], | ||||||||||
| 98 | "unknown long[8]" => ['V', 'UInt32'], | ||||||||||
| 99 | "unknown long[9]" => ['V', 'UInt32'], | ||||||||||
| 100 | "unknown long[10]" => ['V', 'UInt32'], | ||||||||||
| 101 | "unknown long[11]" => ['V', 'UInt32'], | ||||||||||
| 102 | "unknown long[12]" => ['V', 'UInt32'], | ||||||||||
| 103 | "unknown long[13]" => ['V', 'UInt32'], | ||||||||||
| 104 | "unknown long[14]" => ['V', 'UInt32'], | ||||||||||
| 105 | "unknown long[15]" => ['V', 'UInt32'], | ||||||||||
| 106 | "unknown long[16]" => ['V', 'UInt32'], | ||||||||||
| 107 | "unknown long[17]" => ['V', 'UInt32'], | ||||||||||
| 108 | "unknown long[18]" => ['V', 'UInt32'], | ||||||||||
| 109 | "unknown long[19]" => ['V', 'UInt32'], | ||||||||||
| 110 | "unknown long[20]" => ['V', 'UInt32'], | ||||||||||
| 111 | "unknown long[21]" => ['V', 'UInt32'], | ||||||||||
| 112 | "unknown long[22]" => ['V', 'UInt32'], | ||||||||||
| 113 | "unknown long[23]" => ['V', 'UInt32'], | ||||||||||
| 114 | "unknown long[24]" => ['V', 'UInt32'], | ||||||||||
| 115 | "unknown long[25]" => ['V', 'UInt32'], | ||||||||||
| 116 | "unknown long[26]" => ['V', 'UInt32'], | ||||||||||
| 117 | "unknown long[27]" => ['V', 'UInt32'], | ||||||||||
| 118 | "unknown long[28]" => ['V', 'UInt32'], | ||||||||||
| 119 | ]; | ||||||||||
| 120 | 1 | $specific_fields{66} = $specific_fields{64}; | |||||||||
| 121 | |||||||||||
| 122 | 1 | ▶ | die "don't know how to parse version $version" unless $specific_fields{$version}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 123 | 1 | my $self = Finnigan::Decoder->read($stream, [@common_fields, @{$specific_fields{$version}}]); | |||||||||
| 124 | 1 | $self->{version} = $version; | |||||||||
| 125 | |||||||||||
| 126 | 1 | return bless $self, $class; | |||||||||
| 127 | } | ||||||||||
| 128 | |||||||||||
| 129 | 5 | ▶ | sub sample_info { | ||||||||
|
Subroutine
sample_info: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 130 | 5 | shift->{data}->{"sample info"}->{value}; | |||||||||
| 131 | } | ||||||||||
| 132 | |||||||||||
| 133 | 1 | ▶ | sub self_addr { | ||||||||
|
Subroutine
self_addr: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 134 | 1 | shift->{data}->{"own addr"}->{value}; | |||||||||
| 135 | } | ||||||||||
| 136 | |||||||||||
| 137 | 1 | ▶ | sub trailer_addr { | ||||||||
|
Subroutine
trailer_addr: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 138 | 1 | shift->{data}->{"scan trailer addr"}->{value}; | |||||||||
| 139 | } | ||||||||||
| 140 | |||||||||||
| 141 | 1 | ▶ | sub params_addr { | ||||||||
|
Subroutine
params_addr: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 142 | 1 | shift->{data}->{"scan params addr"}->{value}; | |||||||||
| 143 | } | ||||||||||
| 144 | |||||||||||
| 145 | 1 | ▶ | sub scan_index_addr { | ||||||||
|
Subroutine
scan_index_addr: called CC=2 SCAR=7.6
Pod
documented
| |||||||||||
| 146 | 1 | my $self = shift; | |||||||||
| 147 | 1 | ▶ | if ($self->{version} >= 64 ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 148 | 0 | return $self->{data}->{"scan index addr"}->{value}; | |||||||||
| 149 | } | ||||||||||
| 150 | else { | ||||||||||
| 151 | 1 | return $self->sample_info->{data}->{"scan index addr"}->{value}; | |||||||||
| 152 | } | ||||||||||
| 153 | } | ||||||||||
| 154 | |||||||||||
| 155 | 1 | ▶ | sub data_addr { | ||||||||
|
Subroutine
data_addr: called CC=2 SCAR=7.6
Pod
documented
| |||||||||||
| 156 | 1 | my $self = shift; | |||||||||
| 157 | 1 | ▶ | if ($self->{version} >= 64 ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 158 | 0 | return $self->{data}->{"data addr"}->{value}; | |||||||||
| 159 | } | ||||||||||
| 160 | else { | ||||||||||
| 161 | 1 | return $self->sample_info->{data}->{"data addr"}->{value}; | |||||||||
| 162 | } | ||||||||||
| 163 | } | ||||||||||
| 164 | |||||||||||
| 165 | 1 | ▶ | sub inst_log_addr { | ||||||||
|
Subroutine
inst_log_addr: called CC=2 SCAR=7.6
Pod
documented
| |||||||||||
| 166 | 1 | my $self = shift; | |||||||||
| 167 | 1 | ▶ | if ($self->{version} >= 64 ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 168 | 0 | return $self->{data}->{"inst log addr"}->{value}; | |||||||||
| 169 | } | ||||||||||
| 170 | else { | ||||||||||
| 171 | 1 | return $self->sample_info->{data}->{"inst log addr"}->{value}; | |||||||||
| 172 | } | ||||||||||
| 173 | } | ||||||||||
| 174 | |||||||||||
| 175 | 1 | ▶ | sub error_log_addr { | ||||||||
|
Subroutine
error_log_addr: called CC=2 SCAR=7.6
Pod
documented
| |||||||||||
| 176 | 1 | my $self = shift; | |||||||||
| 177 | 1 | ▶ | if ($self->{version} >= 64 ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 178 | 0 | return $self->{data}->{"error log addr"}->{value}; | |||||||||
| 179 | } | ||||||||||
| 180 | else { | ||||||||||
| 181 | 1 | return $self->sample_info->{data}->{"error log addr"}->{value}; | |||||||||
| 182 | } | ||||||||||
| 183 | } | ||||||||||
| 184 | |||||||||||
| 185 | 1 | ▶ | sub ntrailer { | ||||||||
|
Subroutine
ntrailer: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||
| 186 | 1 | my $self = shift; | |||||||||
| 187 | 1 | my $l1 = $self->{data}->{"unknown length[1]"}->{value}; | |||||||||
| 188 | 1 | my $l2 = $self->{data}->{"unknown length[2]"}->{value}; | |||||||||
| 189 | 1 | ▶ | die "It\'s a happy day! We\'ve run into a case where the two lengths differ: l1 = $l1 and l2 = $l2" | ||||||||
|
Branch: 1 branch
| |||||||||||
| 190 | unless $l1 = $l2; | ||||||||||
| 191 | |||||||||||
| 192 | # I am assuming it is the length of TrailerScanEvent | ||||||||||
| 193 | 1 | return $l1; | |||||||||
| 194 | } | ||||||||||
| 195 | |||||||||||
| 196 | 1 | ▶ | sub nparams { | ||||||||
|
Subroutine
nparams: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||
| 197 | 1 | my $self = shift; | |||||||||
| 198 | 1 | my $l1 = $self->{data}->{"unknown length[1]"}->{value}; | |||||||||
| 199 | 1 | my $l2 = $self->{data}->{"unknown length[2]"}->{value}; | |||||||||
| 200 | 1 | ▶ | die "It\'s a happy day! We\'ve run into a case where the two lengths differ: l1 = $l1 and l2 = $l2" | ||||||||
|
Branch: 1 branch
| |||||||||||
| 201 | unless $l1 = $l2; | ||||||||||
| 202 | |||||||||||
| 203 | # I am assuming it is the length of ScanParams | ||||||||||
| 204 | 1 | return $l2; | |||||||||
| 205 | } | ||||||||||
| 206 | |||||||||||
| 207 | 1 | ▶ | sub nsegs { | ||||||||
|
Subroutine
nsegs: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 208 | 1 | shift->{data}->{"nsegs"}->{value}; | |||||||||
| 209 | } | ||||||||||
| 210 | |||||||||||
| 211 | 0 | ▶ | sub u1 { | ||||||||
|
Subroutine
u1: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 212 | 0 | shift->{data}->{"unknown double[1]"}->{value}; | |||||||||
| 213 | } | ||||||||||
| 214 | |||||||||||
| 215 | 0 | ▶ | sub u2 { | ||||||||
|
Subroutine
u2: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 216 | 0 | shift->{data}->{"unknown double[2]"}->{value}; | |||||||||
| 217 | } | ||||||||||
| 218 | |||||||||||
| 219 | 2 | 1; | |||||||||
| 220 | __END__ | ||||||||||