| 1 | #------------------------------------------------------------------------------ | ||||||||||||||||||||||||||||||||||||||||||
| 2 | # File: PostScript.pm | ||||||||||||||||||||||||||||||||||||||||||
| 3 | # | ||||||||||||||||||||||||||||||||||||||||||
| 4 | # Description: Read PostScript meta information | ||||||||||||||||||||||||||||||||||||||||||
| 5 | # | ||||||||||||||||||||||||||||||||||||||||||
| 6 | # Revisions: 07/08/2005 - P. Harvey Created | ||||||||||||||||||||||||||||||||||||||||||
| 7 | # | ||||||||||||||||||||||||||||||||||||||||||
| 8 | # References: 1) http://partners.adobe.com/public/developer/en/ps/5002.EPSF_Spec.pdf | ||||||||||||||||||||||||||||||||||||||||||
| 9 | # 2) http://partners.adobe.com/public/developer/en/ps/5001.DSC_Spec.pdf | ||||||||||||||||||||||||||||||||||||||||||
| 10 | # 3) http://partners.adobe.com/public/developer/en/illustrator/sdk/AI7FileFormat.pdf | ||||||||||||||||||||||||||||||||||||||||||
| 11 | #------------------------------------------------------------------------------ | ||||||||||||||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||||||||||||
| 13 | package Image::ExifTool::PostScript; | ||||||||||||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||||||||||||
| 15 | 29 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 16 | 29 | ▶ | use vars qw($VERSION $AUTOLOAD); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 17 | 29 | ▶ | use Image::ExifTool qw(:DataAccess :Utils); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||||||||||||||||
| 19 | 29 | $VERSION = '1.46'; | |||||||||||||||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||||||||||||||||
| 21 | sub WritePS($$); | ||||||||||||||||||||||||||||||||||||||||||
| 22 | sub ProcessPS($$;$); | ||||||||||||||||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||||||||||||||||
| 24 | # PostScript tag table | ||||||||||||||||||||||||||||||||||||||||||
| 25 | 29 | %Image::ExifTool::PostScript::Main = ( | |||||||||||||||||||||||||||||||||||||||||
| 26 | PROCESS_PROC => \&ProcessPS, | ||||||||||||||||||||||||||||||||||||||||||
| 27 | WRITE_PROC => \&WritePS, | ||||||||||||||||||||||||||||||||||||||||||
| 28 | PREFERRED => 1, # always add these tags when writing | ||||||||||||||||||||||||||||||||||||||||||
| 29 | GROUPS => { 2 => 'Image' }, | ||||||||||||||||||||||||||||||||||||||||||
| 30 | # Note: Make all of these tags priority 0 since the first one found at | ||||||||||||||||||||||||||||||||||||||||||
| 31 | # the start of the file should take priority (in case multiples exist) | ||||||||||||||||||||||||||||||||||||||||||
| 32 | Author => { Priority => 0, Groups => { 2 => 'Author' }, Writable => 'string' }, | ||||||||||||||||||||||||||||||||||||||||||
| 33 | BoundingBox => { Priority => 0 }, | ||||||||||||||||||||||||||||||||||||||||||
| 34 | Copyright => { Priority => 0, Writable => 'string' }, #2 | ||||||||||||||||||||||||||||||||||||||||||
| 35 | CreationDate => { | ||||||||||||||||||||||||||||||||||||||||||
| 36 | Name => 'CreateDate', | ||||||||||||||||||||||||||||||||||||||||||
| 37 | Priority => 0, | ||||||||||||||||||||||||||||||||||||||||||
| 38 | Groups => { 2 => 'Time' }, | ||||||||||||||||||||||||||||||||||||||||||
| 39 | Writable => 'string', | ||||||||||||||||||||||||||||||||||||||||||
| 40 | PrintConv => '$self->ConvertDateTime($val)', | ||||||||||||||||||||||||||||||||||||||||||
| 41 | PrintConvInv => '$self->InverseDateTime($val)', | ||||||||||||||||||||||||||||||||||||||||||
| 42 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 43 | Creator => { Priority => 0, Writable => 'string' }, | ||||||||||||||||||||||||||||||||||||||||||
| 44 | ImageData => { Priority => 0 }, | ||||||||||||||||||||||||||||||||||||||||||
| 45 | For => { Priority => 0, Writable => 'string', Notes => 'for whom the document was prepared'}, | ||||||||||||||||||||||||||||||||||||||||||
| 46 | Keywords => { Priority => 0, Writable => 'string' }, | ||||||||||||||||||||||||||||||||||||||||||
| 47 | ModDate => { | ||||||||||||||||||||||||||||||||||||||||||
| 48 | Name => 'ModifyDate', | ||||||||||||||||||||||||||||||||||||||||||
| 49 | Priority => 0, | ||||||||||||||||||||||||||||||||||||||||||
| 50 | Groups => { 2 => 'Time' }, | ||||||||||||||||||||||||||||||||||||||||||
| 51 | Writable => 'string', | ||||||||||||||||||||||||||||||||||||||||||
| 52 | PrintConv => '$self->ConvertDateTime($val)', | ||||||||||||||||||||||||||||||||||||||||||
| 53 | PrintConvInv => '$self->InverseDateTime($val)', | ||||||||||||||||||||||||||||||||||||||||||
| 54 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 55 | Pages => { Priority => 0 }, | ||||||||||||||||||||||||||||||||||||||||||
| 56 | Routing => { Priority => 0, Writable => 'string' }, #2 | ||||||||||||||||||||||||||||||||||||||||||
| 57 | Subject => { Priority => 0, Writable => 'string' }, | ||||||||||||||||||||||||||||||||||||||||||
| 58 | Title => { Priority => 0, Writable => 'string' }, | ||||||||||||||||||||||||||||||||||||||||||
| 59 | Version => { Priority => 0, Writable => 'string' }, #2 | ||||||||||||||||||||||||||||||||||||||||||
| 60 | # these subdirectories for documentation only | ||||||||||||||||||||||||||||||||||||||||||
| 61 | BeginPhotoshop => { | ||||||||||||||||||||||||||||||||||||||||||
| 62 | Name => 'PhotoshopData', | ||||||||||||||||||||||||||||||||||||||||||
| 63 | SubDirectory => { | ||||||||||||||||||||||||||||||||||||||||||
| 64 | TagTable => 'Image::ExifTool::Photoshop::Main', | ||||||||||||||||||||||||||||||||||||||||||
| 65 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 66 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 67 | BeginICCProfile => { | ||||||||||||||||||||||||||||||||||||||||||
| 68 | Name => 'ICC_Profile', | ||||||||||||||||||||||||||||||||||||||||||
| 69 | SubDirectory => { | ||||||||||||||||||||||||||||||||||||||||||
| 70 | TagTable => 'Image::ExifTool::ICC_Profile::Main', | ||||||||||||||||||||||||||||||||||||||||||
| 71 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 72 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 73 | begin_xml_packet => { | ||||||||||||||||||||||||||||||||||||||||||
| 74 | Name => 'XMP', | ||||||||||||||||||||||||||||||||||||||||||
| 75 | SubDirectory => { | ||||||||||||||||||||||||||||||||||||||||||
| 76 | TagTable => 'Image::ExifTool::XMP::Main', | ||||||||||||||||||||||||||||||||||||||||||
| 77 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 78 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 79 | TIFFPreview => { | ||||||||||||||||||||||||||||||||||||||||||
| 80 | Groups => { 2 => 'Preview' }, | ||||||||||||||||||||||||||||||||||||||||||
| 81 | Binary => 1, | ||||||||||||||||||||||||||||||||||||||||||
| 82 | Notes => q{ | ||||||||||||||||||||||||||||||||||||||||||
| 83 | not a real tag ID, but used to represent the TIFF preview extracted from DOS | ||||||||||||||||||||||||||||||||||||||||||
| 84 | EPS images | ||||||||||||||||||||||||||||||||||||||||||
| 85 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 86 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 87 | BeginDocument => { | ||||||||||||||||||||||||||||||||||||||||||
| 88 | Name => 'EmbeddedFile', | ||||||||||||||||||||||||||||||||||||||||||
| 89 | SubDirectory => { | ||||||||||||||||||||||||||||||||||||||||||
| 90 | TagTable => 'Image::ExifTool::PostScript::Main', | ||||||||||||||||||||||||||||||||||||||||||
| 91 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 92 | Notes => 'extracted with L<ExtractEmbedded|../ExifTool.html#ExtractEmbedded> option', | ||||||||||||||||||||||||||||||||||||||||||
| 93 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 94 | EmbeddedFileName => { | ||||||||||||||||||||||||||||||||||||||||||
| 95 | Notes => q{ | ||||||||||||||||||||||||||||||||||||||||||
| 96 | not a real tag ID, but the file name from a BeginDocument statement. | ||||||||||||||||||||||||||||||||||||||||||
| 97 | Extracted with document metadata when L<ExtractEmbedded|../ExifTool.html#ExtractEmbedded> option is used | ||||||||||||||||||||||||||||||||||||||||||
| 98 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 99 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 100 | # AI metadata (most with a single leading '%') | ||||||||||||||||||||||||||||||||||||||||||
| 101 | AI9_ColorModel => { | ||||||||||||||||||||||||||||||||||||||||||
| 102 | Name => 'AIColorModel', | ||||||||||||||||||||||||||||||||||||||||||
| 103 | PrintConv => { | ||||||||||||||||||||||||||||||||||||||||||
| 104 | 1 => 'RGB', | ||||||||||||||||||||||||||||||||||||||||||
| 105 | 2 => 'CMYK', | ||||||||||||||||||||||||||||||||||||||||||
| 106 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 107 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 108 | AI3_ColorUsage => { Name => 'AIColorUsage' }, | ||||||||||||||||||||||||||||||||||||||||||
| 109 | AI5_RulerUnits => { | ||||||||||||||||||||||||||||||||||||||||||
| 110 | Name => 'AIRulerUnits', | ||||||||||||||||||||||||||||||||||||||||||
| 111 | PrintConv => { | ||||||||||||||||||||||||||||||||||||||||||
| 112 | 0 => 'Inches', | ||||||||||||||||||||||||||||||||||||||||||
| 113 | 1 => 'Millimeters', | ||||||||||||||||||||||||||||||||||||||||||
| 114 | 2 => 'Points', | ||||||||||||||||||||||||||||||||||||||||||
| 115 | 3 => 'Picas', | ||||||||||||||||||||||||||||||||||||||||||
| 116 | 4 => 'Centimeters', | ||||||||||||||||||||||||||||||||||||||||||
| 117 | 6 => 'Pixels', | ||||||||||||||||||||||||||||||||||||||||||
| 118 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 119 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 120 | AI5_TargetResolution => { Name => 'AITargetResolution' }, | ||||||||||||||||||||||||||||||||||||||||||
| 121 | AI5_NumLayers => { Name => 'AINumLayers' }, | ||||||||||||||||||||||||||||||||||||||||||
| 122 | AI5_FileFormat => { Name => 'AIFileFormat' }, | ||||||||||||||||||||||||||||||||||||||||||
| 123 | AI8_CreatorVersion => { Name => 'AICreatorVersion' }, # (double leading '%') | ||||||||||||||||||||||||||||||||||||||||||
| 124 | AI12_BuildNumber => { Name => 'AIBuildNumber' }, | ||||||||||||||||||||||||||||||||||||||||||
| 125 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 126 | |||||||||||||||||||||||||||||||||||||||||||
| 127 | # composite tags | ||||||||||||||||||||||||||||||||||||||||||
| 128 | 29 | %Image::ExifTool::PostScript::Composite = ( | |||||||||||||||||||||||||||||||||||||||||
| 129 | GROUPS => { 2 => 'Image' }, | ||||||||||||||||||||||||||||||||||||||||||
| 130 | # BoundingBox is in points, not pixels, | ||||||||||||||||||||||||||||||||||||||||||
| 131 | # but use it anyway if ImageData is not available | ||||||||||||||||||||||||||||||||||||||||||
| 132 | ImageWidth => { | ||||||||||||||||||||||||||||||||||||||||||
| 133 | Desire => { | ||||||||||||||||||||||||||||||||||||||||||
| 134 | 0 => 'Main:PostScript:ImageData', | ||||||||||||||||||||||||||||||||||||||||||
| 135 | 1 => 'PostScript:BoundingBox', | ||||||||||||||||||||||||||||||||||||||||||
| 136 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 137 | ValueConv => 'Image::ExifTool::PostScript::ImageSize(\@val, 0)', | ||||||||||||||||||||||||||||||||||||||||||
| 138 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 139 | ImageHeight => { | ||||||||||||||||||||||||||||||||||||||||||
| 140 | Desire => { | ||||||||||||||||||||||||||||||||||||||||||
| 141 | 0 => 'Main:PostScript:ImageData', | ||||||||||||||||||||||||||||||||||||||||||
| 142 | 1 => 'PostScript:BoundingBox', | ||||||||||||||||||||||||||||||||||||||||||
| 143 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 144 | ValueConv => 'Image::ExifTool::PostScript::ImageSize(\@val, 1)', | ||||||||||||||||||||||||||||||||||||||||||
| 145 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 146 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 147 | |||||||||||||||||||||||||||||||||||||||||||
| 148 | # add our composite tags | ||||||||||||||||||||||||||||||||||||||||||
| 149 | 29 | Image::ExifTool::AddCompositeTags('Image::ExifTool::PostScript'); | |||||||||||||||||||||||||||||||||||||||||
| 150 | |||||||||||||||||||||||||||||||||||||||||||
| 151 | #------------------------------------------------------------------------------ | ||||||||||||||||||||||||||||||||||||||||||
| 152 | # AutoLoad our writer routines when necessary | ||||||||||||||||||||||||||||||||||||||||||
| 153 | # | ||||||||||||||||||||||||||||||||||||||||||
| 154 | sub AUTOLOAD | ||||||||||||||||||||||||||||||||||||||||||
| 155 | 19 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
AUTOLOAD: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 156 | 19 | return Image::ExifTool::DoAutoLoad($AUTOLOAD, @_); | |||||||||||||||||||||||||||||||||||||||||
| 157 | } | ||||||||||||||||||||||||||||||||||||||||||
| 158 | |||||||||||||||||||||||||||||||||||||||||||
| 159 | #------------------------------------------------------------------------------ | ||||||||||||||||||||||||||||||||||||||||||
| 160 | # Get image width or height | ||||||||||||||||||||||||||||||||||||||||||
| 161 | # Inputs: 0) value list ref (ImageData, BoundingBox), 1) true to get height | ||||||||||||||||||||||||||||||||||||||||||
| 162 | sub ImageSize($$) | ||||||||||||||||||||||||||||||||||||||||||
| 163 | 4 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
ImageSize: called CC=6 SCAR=23.5
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 164 | 4 | my ($vals, $getHeight) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 165 | 4 | my ($w, $h); | |||||||||||||||||||||||||||||||||||||||||
| 166 | 4 | ▶ | if ($$vals[0] and $$vals[0] =~ /^(\d+) (\d+)/) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition33%1/3
$vals->[0] and $vals->[0] =~ /^(\d+) (\d+)/
MC/DC0%0/2
$vals->[0] and $vals->[0] =~ /^(\d+) (\d+)/
$vals->[0]
$vals->[0] =~ /^(\d+) (\d+)/
Truth table33%1/3
A and B
A= $vals->[0]B= $vals->[0] =~ /^(\d+) (\d+)/
| |||||||||||||||||||||||||||||||||||||||||||
| 167 | 4 | ($w, $h) = ($1, $2); | |||||||||||||||||||||||||||||||||||||||||
| 168 | ▶ | } elsif ($$vals[1] and $$vals[1] =~ /^(\d+) (\d+) (\d+) (\d+)/) { | |||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$vals->[1] and $vals->[1] =~ /^(\d+) (\d+) (\d+) (\d+)/
MC/DC0%0/2
$vals->[1] and $vals->[1] =~ /^(\d+) (\d+) (\d+) (\d+)/
$vals->[1]
$vals->[1] =~ /^(\d+) (\d+) (\d+) (\d+)/
Truth table0%0/3
A and B
A= $vals->[1]B= $vals->[1] =~ /^(\d+) (\d+) (\d+) (\d+)/
| |||||||||||||||||||||||||||||||||||||||||||
| 169 | 0 | ($w, $h) = ($3 - $1, $4 - $2); | |||||||||||||||||||||||||||||||||||||||||
| 170 | } | ||||||||||||||||||||||||||||||||||||||||||
| 171 | 4 | ▶ | return $getHeight ? $h : $w; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 172 | } | ||||||||||||||||||||||||||||||||||||||||||
| 173 | |||||||||||||||||||||||||||||||||||||||||||
| 174 | #------------------------------------------------------------------------------ | ||||||||||||||||||||||||||||||||||||||||||
| 175 | # Set PostScript format error warning | ||||||||||||||||||||||||||||||||||||||||||
| 176 | # Inputs: 0) ExifTool object reference, 1) error string | ||||||||||||||||||||||||||||||||||||||||||
| 177 | # Returns: 1 | ||||||||||||||||||||||||||||||||||||||||||
| 178 | sub PSErr($$) | ||||||||||||||||||||||||||||||||||||||||||
| 179 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
PSErr: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 180 | 0 | my ($et, $str) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 181 | # set file type if not done already | ||||||||||||||||||||||||||||||||||||||||||
| 182 | 0 | my $ext = $$et{FILE_EXT}; | |||||||||||||||||||||||||||||||||||||||||
| 183 | 0 | ▶ | $et->SetFileType(($ext and $ext eq 'AI') ? 'AI' : 'PS'); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$ext and $ext eq "AI"
MC/DC0%0/2
$ext and $ext eq "AI"
$ext
$ext eq "AI"
Truth table0%0/3
A and B
A= $extB= $ext eq "AI"
| |||||||||||||||||||||||||||||||||||||||||||
| 184 | 0 | $et->Warn("PostScript format error ($str)"); | |||||||||||||||||||||||||||||||||||||||||
| 185 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 186 | } | ||||||||||||||||||||||||||||||||||||||||||
| 187 | |||||||||||||||||||||||||||||||||||||||||||
| 188 | #------------------------------------------------------------------------------ | ||||||||||||||||||||||||||||||||||||||||||
| 189 | # Return input record separator to use for the specified file | ||||||||||||||||||||||||||||||||||||||||||
| 190 | # Inputs: 0) RAF reference | ||||||||||||||||||||||||||||||||||||||||||
| 191 | # Returns: Input record separator or undef on error | ||||||||||||||||||||||||||||||||||||||||||
| 192 | sub GetInputRecordSeparator($) | ||||||||||||||||||||||||||||||||||||||||||
| 193 | 8 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
GetInputRecordSeparator: called CC=8 SCAR=21.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 194 | 8 | my $raf = shift; | |||||||||||||||||||||||||||||||||||||||||
| 195 | 8 | my $pos = $raf->Tell(); # save current position | |||||||||||||||||||||||||||||||||||||||||
| 196 | 8 | my ($data, $sep); | |||||||||||||||||||||||||||||||||||||||||
| 197 | 8 | ▶ | $raf->Read($data,256) or return undef; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 198 | 8 | my ($a, $d) = (999,999); | |||||||||||||||||||||||||||||||||||||||||
| 199 | 8 | ▶ | $a = pos($data), pos($data) = 0 if $data =~ /\x0a/g; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 200 | 8 | ▶ | $d = pos($data) if $data =~ /\x0d/g; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 201 | 8 | my $diff = $a - $d; | |||||||||||||||||||||||||||||||||||||||||
| 202 | 8 | ▶ | if ($diff == 1) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 4 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 203 | 0 | $sep = "\x0d\x0a"; | |||||||||||||||||||||||||||||||||||||||||
| 204 | } elsif ($diff == -1) { | ||||||||||||||||||||||||||||||||||||||||||
| 205 | 0 | $sep = "\x0a\x0d"; | |||||||||||||||||||||||||||||||||||||||||
| 206 | } elsif ($diff > 0) { | ||||||||||||||||||||||||||||||||||||||||||
| 207 | 3 | $sep = "\x0d"; | |||||||||||||||||||||||||||||||||||||||||
| 208 | } elsif ($diff < 0) { | ||||||||||||||||||||||||||||||||||||||||||
| 209 | 4 | $sep = "\x0a"; | |||||||||||||||||||||||||||||||||||||||||
| 210 | } # else error | ||||||||||||||||||||||||||||||||||||||||||
| 211 | 8 | $raf->Seek($pos, 0); # restore original position | |||||||||||||||||||||||||||||||||||||||||
| 212 | 8 | return $sep; | |||||||||||||||||||||||||||||||||||||||||
| 213 | } | ||||||||||||||||||||||||||||||||||||||||||
| 214 | |||||||||||||||||||||||||||||||||||||||||||
| 215 | #------------------------------------------------------------------------------ | ||||||||||||||||||||||||||||||||||||||||||
| 216 | # Split into lines ending in any CR, LF or CR+LF combination | ||||||||||||||||||||||||||||||||||||||||||
| 217 | # (this is annoying, and could be avoided if EPS files didn't mix linefeeds!) | ||||||||||||||||||||||||||||||||||||||||||
| 218 | # Inputs: 0) data pointer, 1) reference to lines array | ||||||||||||||||||||||||||||||||||||||||||
| 219 | # Notes: Fills @$lines with lines from splitting $$dataPt | ||||||||||||||||||||||||||||||||||||||||||
| 220 | sub SplitLine($$) | ||||||||||||||||||||||||||||||||||||||||||
| 221 | 1 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
SplitLine: called CC=7 SCAR=20.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 222 | 1 | my ($dataPt, $lines) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 223 | 1 | for (;;) { | |||||||||||||||||||||||||||||||||||||||||
| 224 | 108 | my $endl; | |||||||||||||||||||||||||||||||||||||||||
| 225 | # find the position of the first LF (\x0a) | ||||||||||||||||||||||||||||||||||||||||||
| 226 | 108 | ▶ | $endl = pos($$dataPt), pos($$dataPt) = 0 if $$dataPt =~ /\x0a/g; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 227 | 108 | ▶ | if ($$dataPt =~ /\x0d/g) { # find the first CR (\x0d) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 228 | 108 | ▶ | if (defined $endl) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 229 | # (remember, CR+LF is a DOS newline...) | ||||||||||||||||||||||||||||||||||||||||||
| 230 | 107 | ▶ | $endl = pos($$dataPt) if pos($$dataPt) < $endl - 1; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 231 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 232 | 1 | $endl = pos($$dataPt); | |||||||||||||||||||||||||||||||||||||||||
| 233 | } | ||||||||||||||||||||||||||||||||||||||||||
| 234 | } elsif (not defined $endl) { | ||||||||||||||||||||||||||||||||||||||||||
| 235 | 0 | push @$lines, $$dataPt; | |||||||||||||||||||||||||||||||||||||||||
| 236 | 0 | last; | |||||||||||||||||||||||||||||||||||||||||
| 237 | } | ||||||||||||||||||||||||||||||||||||||||||
| 238 | 108 | ▶ | if (length $$dataPt == $endl) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 239 | 1 | push @$lines, $$dataPt; | |||||||||||||||||||||||||||||||||||||||||
| 240 | 1 | last; | |||||||||||||||||||||||||||||||||||||||||
| 241 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 242 | # continue to split into separate lines | ||||||||||||||||||||||||||||||||||||||||||
| 243 | 107 | push @$lines, substr($$dataPt, 0, $endl); | |||||||||||||||||||||||||||||||||||||||||
| 244 | 107 | $$dataPt = substr($$dataPt, $endl); | |||||||||||||||||||||||||||||||||||||||||
| 245 | } | ||||||||||||||||||||||||||||||||||||||||||
| 246 | } | ||||||||||||||||||||||||||||||||||||||||||
| 247 | } | ||||||||||||||||||||||||||||||||||||||||||
| 248 | |||||||||||||||||||||||||||||||||||||||||||
| 249 | #------------------------------------------------------------------------------ | ||||||||||||||||||||||||||||||||||||||||||
| 250 | # check to be sure we haven't read past end of PS data in DOS-style file | ||||||||||||||||||||||||||||||||||||||||||
| 251 | # Inputs: 0) RAF ref (with PSEnd member), 1) data ref | ||||||||||||||||||||||||||||||||||||||||||
| 252 | # - modifies data and sets RAF to EOF if end of PS is reached | ||||||||||||||||||||||||||||||||||||||||||
| 253 | sub CheckPSEnd($$) | ||||||||||||||||||||||||||||||||||||||||||
| 254 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
CheckPSEnd: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 255 | 0 | my ($raf, $dataPt) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 256 | 0 | my $pos = $raf->Tell(); | |||||||||||||||||||||||||||||||||||||||||
| 257 | 0 | ▶ | if ($pos >= $$raf{PSEnd}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 258 | 0 | $raf->Seek(0, 2); # seek to end of file so we can't read any more | |||||||||||||||||||||||||||||||||||||||||
| 259 | 0 | ▶ | $$dataPt = substr($$dataPt, 0, length($$dataPt) - $pos + $$raf{PSEnd}) if $pos > $$raf{PSEnd}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 260 | } | ||||||||||||||||||||||||||||||||||||||||||
| 261 | } | ||||||||||||||||||||||||||||||||||||||||||
| 262 | |||||||||||||||||||||||||||||||||||||||||||
| 263 | #------------------------------------------------------------------------------ | ||||||||||||||||||||||||||||||||||||||||||
| 264 | # Read next line from EPS file | ||||||||||||||||||||||||||||||||||||||||||
| 265 | # Inputs: 0) RAF ref (with PSEnd member if Postscript ends before end of file) | ||||||||||||||||||||||||||||||||||||||||||
| 266 | # 1) array of lines from file | ||||||||||||||||||||||||||||||||||||||||||
| 267 | # Returns: true on success | ||||||||||||||||||||||||||||||||||||||||||
| 268 | sub GetNextLine($$) | ||||||||||||||||||||||||||||||||||||||||||
| 269 | 114 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
GetNextLine: called CC=9 SCAR=27.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 270 | 114 | my ($raf, $lines) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 271 | 114 | my ($data, $changedNL); | |||||||||||||||||||||||||||||||||||||||||
| 272 | 114 | ▶ | my $altnl = ($/ eq "\x0d") ? "\x0a" : "\x0d"; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 273 | 114 | for (;;) { | |||||||||||||||||||||||||||||||||||||||||
| 274 | 114 | ▶ | $raf->ReadLine($data) or last; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 275 | 114 | ▶ | $$raf{PSEnd} and CheckPSEnd($raf, \$data); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 276 | # split line if it contains other newline sequences | ||||||||||||||||||||||||||||||||||||||||||
| 277 | 114 | ▶ | if ($data =~ /$altnl/) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 278 | 1 | ▶ | if (length($data) > 500000 and Image::ExifTool::IsPC()) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
length $data > 500000 and &Image::ExifTool::IsPC()
MC/DC0%0/2
length $data > 500000 and &Image::ExifTool::IsPC()
length $data > 500000
&Image::ExifTool::IsPC()
Truth table33%1/3
A and B
A= length $data > 500000B= &Image::ExifTool::IsPC()
| |||||||||||||||||||||||||||||||||||||||||||
| 279 | # patch for Windows memory problem | ||||||||||||||||||||||||||||||||||||||||||
| 280 | 0 | ▶ | unless ($changedNL) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 281 | 0 | $changedNL = $/; | |||||||||||||||||||||||||||||||||||||||||
| 282 | 0 | $/ = $altnl; | |||||||||||||||||||||||||||||||||||||||||
| 283 | 0 | $altnl = $changedNL; | |||||||||||||||||||||||||||||||||||||||||
| 284 | 0 | $raf->Seek(-length($data), 1); | |||||||||||||||||||||||||||||||||||||||||
| 285 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||
| 286 | } | ||||||||||||||||||||||||||||||||||||||||||
| 287 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 288 | # split into separate lines | ||||||||||||||||||||||||||||||||||||||||||
| 289 | # push @$lines, split /$altnl/, $data, -1; | ||||||||||||||||||||||||||||||||||||||||||
| 290 | # if (@$lines == 2 and $$lines[1] eq $/) { | ||||||||||||||||||||||||||||||||||||||||||
| 291 | # # handle case of DOS newline data inside file using Unix newlines | ||||||||||||||||||||||||||||||||||||||||||
| 292 | # $$lines[0] .= pop @$lines; | ||||||||||||||||||||||||||||||||||||||||||
| 293 | # } | ||||||||||||||||||||||||||||||||||||||||||
| 294 | # split into separate lines if necessary | ||||||||||||||||||||||||||||||||||||||||||
| 295 | 1 | SplitLine(\$data, $lines); | |||||||||||||||||||||||||||||||||||||||||
| 296 | } | ||||||||||||||||||||||||||||||||||||||||||
| 297 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 298 | 113 | push @$lines, $data; | |||||||||||||||||||||||||||||||||||||||||
| 299 | } | ||||||||||||||||||||||||||||||||||||||||||
| 300 | 114 | ▶ | $/ = $changedNL if $changedNL; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 301 | 114 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 302 | } | ||||||||||||||||||||||||||||||||||||||||||
| 303 | 0 | return 0; | |||||||||||||||||||||||||||||||||||||||||
| 304 | } | ||||||||||||||||||||||||||||||||||||||||||
| 305 | |||||||||||||||||||||||||||||||||||||||||||
| 306 | #------------------------------------------------------------------------------ | ||||||||||||||||||||||||||||||||||||||||||
| 307 | # Decode comment from PostScript file | ||||||||||||||||||||||||||||||||||||||||||
| 308 | # Inputs: 0) comment string, 1) RAF ref, 2) reference to lines array | ||||||||||||||||||||||||||||||||||||||||||
| 309 | # 3) optional data reference for extra lines read from file | ||||||||||||||||||||||||||||||||||||||||||
| 310 | # Returns: Decoded comment string (may be an array reference) | ||||||||||||||||||||||||||||||||||||||||||
| 311 | # - handles multi-line comments and escape sequences | ||||||||||||||||||||||||||||||||||||||||||
| 312 | sub DecodeComment($$$;$) | ||||||||||||||||||||||||||||||||||||||||||
| 313 | 31 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
DecodeComment: called CC=18 SCAR=48.7
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 314 | 31 | my ($val, $raf, $lines, $dataPt) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 315 | 31 | $val =~ s/\x0d*\x0a*$//; # remove trailing CR, LF or CR/LF | |||||||||||||||||||||||||||||||||||||||||
| 316 | # check for continuation comments | ||||||||||||||||||||||||||||||||||||||||||
| 317 | 31 | for (;;) { | |||||||||||||||||||||||||||||||||||||||||
| 318 | 31 | ▶ | @$lines or GetNextLine($raf, $lines) or last; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
@$lines or &GetNextLine($raf, $lines)
MC/DC0%0/2
@$lines or &GetNextLine($raf, $lines)
@$lines
&GetNextLine($raf, $lines)
Truth table33%1/3
A or B
A= @$linesB= &GetNextLine($raf, $lines)
| |||||||||||||||||||||||||||||||||||||||||||
| 319 | 31 | ▶ | last unless $$lines[0] =~ /^%%\+/; # is the next line a continuation? | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 320 | 0 | ▶ | $$dataPt .= $$lines[0] if $dataPt; # add to data if necessary | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 321 | 0 | $$lines[0] =~ s/\x0d*\x0a*$//; # remove trailing CR, LF or CR/LF | |||||||||||||||||||||||||||||||||||||||||
| 322 | 0 | $val .= substr(shift(@$lines), 3); # add to value (without leading "%%+") | |||||||||||||||||||||||||||||||||||||||||
| 323 | } | ||||||||||||||||||||||||||||||||||||||||||
| 324 | 31 | my @vals; | |||||||||||||||||||||||||||||||||||||||||
| 325 | # handle bracketed string values | ||||||||||||||||||||||||||||||||||||||||||
| 326 | 31 | ▶ | if ($val =~ s/^\((.*)\)$/$1/) { # remove brackets if necessary | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 327 | # split into an array of strings if necessary | ||||||||||||||||||||||||||||||||||||||||||
| 328 | 3 | my $nesting = 1; | |||||||||||||||||||||||||||||||||||||||||
| 329 | 3 | ▶ | while ($val =~ /(\(|\))/g) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 330 | 0 | my $bra = $1; | |||||||||||||||||||||||||||||||||||||||||
| 331 | 0 | my $pos = pos($val) - 2; | |||||||||||||||||||||||||||||||||||||||||
| 332 | 0 | my $backslashes = 0; | |||||||||||||||||||||||||||||||||||||||||
| 333 | 0 | ▶ | while ($pos and substr($val, $pos, 1) eq '\\') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$pos and substr($val, $pos, 1) eq "\\"
MC/DC0%0/2
$pos and substr($val, $pos, 1) eq "\\"
$pos
substr($val, $pos, 1) eq "\\"
Truth table0%0/3
A and B
A= $posB= substr($val, $pos, 1) eq "\\"
| |||||||||||||||||||||||||||||||||||||||||||
| 334 | 0 | --$pos; | |||||||||||||||||||||||||||||||||||||||||
| 335 | 0 | ++$backslashes; | |||||||||||||||||||||||||||||||||||||||||
| 336 | } | ||||||||||||||||||||||||||||||||||||||||||
| 337 | 0 | ▶ | next if $backslashes & 0x01; # escaped if odd number | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 338 | 0 | ▶ | if ($bra eq '(') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 339 | 0 | ++$nesting; | |||||||||||||||||||||||||||||||||||||||||
| 340 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 341 | 0 | --$nesting; | |||||||||||||||||||||||||||||||||||||||||
| 342 | 0 | ▶ | unless ($nesting) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 343 | 0 | push @vals, substr($val, 0, pos($val)-1); | |||||||||||||||||||||||||||||||||||||||||
| 344 | 0 | $val = substr($val, pos($val)); | |||||||||||||||||||||||||||||||||||||||||
| 345 | 0 | ▶ | ++$nesting if $val =~ s/\s*\(//; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 346 | } | ||||||||||||||||||||||||||||||||||||||||||
| 347 | } | ||||||||||||||||||||||||||||||||||||||||||
| 348 | } | ||||||||||||||||||||||||||||||||||||||||||
| 349 | 3 | push @vals, $val; | |||||||||||||||||||||||||||||||||||||||||
| 350 | 3 | foreach $val (@vals) { | |||||||||||||||||||||||||||||||||||||||||
| 351 | # decode escape sequences in bracketed strings | ||||||||||||||||||||||||||||||||||||||||||
| 352 | # (similar to code in PDF.pm, but without line continuation) | ||||||||||||||||||||||||||||||||||||||||||
| 353 | 3 | ▶ | while ($val =~ /\\(.)/sg) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 354 | 0 | my $n = pos($val) - 2; | |||||||||||||||||||||||||||||||||||||||||
| 355 | 0 | my $c = $1; | |||||||||||||||||||||||||||||||||||||||||
| 356 | 0 | my $r; | |||||||||||||||||||||||||||||||||||||||||
| 357 | 0 | ▶ | if ($c =~ /[0-7]/) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 358 | # get up to 2 more octal digits | ||||||||||||||||||||||||||||||||||||||||||
| 359 | 0 | ▶ | $c .= $1 if $val =~ /\G([0-7]{1,2})/g; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 360 | # convert octal escape code | ||||||||||||||||||||||||||||||||||||||||||
| 361 | 0 | $r = chr(oct($c) & 0xff); | |||||||||||||||||||||||||||||||||||||||||
| 362 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 363 | # convert escaped characters | ||||||||||||||||||||||||||||||||||||||||||
| 364 | 0 | ($r = $c) =~ tr/nrtbf/\n\r\t\b\f/; | |||||||||||||||||||||||||||||||||||||||||
| 365 | } | ||||||||||||||||||||||||||||||||||||||||||
| 366 | 0 | substr($val, $n, length($c)+1) = $r; | |||||||||||||||||||||||||||||||||||||||||
| 367 | # continue search after this character | ||||||||||||||||||||||||||||||||||||||||||
| 368 | 0 | pos($val) = $n + length($r); | |||||||||||||||||||||||||||||||||||||||||
| 369 | } | ||||||||||||||||||||||||||||||||||||||||||
| 370 | } | ||||||||||||||||||||||||||||||||||||||||||
| 371 | 3 | ▶ | $val = @vals > 1 ? \@vals : $vals[0]; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 372 | } | ||||||||||||||||||||||||||||||||||||||||||
| 373 | 31 | return $val; | |||||||||||||||||||||||||||||||||||||||||
| 374 | } | ||||||||||||||||||||||||||||||||||||||||||
| 375 | |||||||||||||||||||||||||||||||||||||||||||
| 376 | #------------------------------------------------------------------------------ | ||||||||||||||||||||||||||||||||||||||||||
| 377 | # Unescape PostScript string | ||||||||||||||||||||||||||||||||||||||||||
| 378 | # Inputs: 0) string | ||||||||||||||||||||||||||||||||||||||||||
| 379 | # Returns: unescaped string | ||||||||||||||||||||||||||||||||||||||||||
| 380 | sub UnescapePostScript($) | ||||||||||||||||||||||||||||||||||||||||||
| 381 | 10 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
UnescapePostScript: called CC=7 SCAR=21.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 382 | 10 | my $str = shift; | |||||||||||||||||||||||||||||||||||||||||
| 383 | # decode escape sequences in literal strings | ||||||||||||||||||||||||||||||||||||||||||
| 384 | 10 | ▶ | while ($str =~ /\\(.)/sg) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 385 | 12 | my $n = pos($str) - 2; | |||||||||||||||||||||||||||||||||||||||||
| 386 | 12 | my $c = $1; | |||||||||||||||||||||||||||||||||||||||||
| 387 | 12 | my $r; | |||||||||||||||||||||||||||||||||||||||||
| 388 | 12 | ▶ | if ($c =~ /[0-7]/) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 389 | # get up to 2 more octal digits | ||||||||||||||||||||||||||||||||||||||||||
| 390 | 11 | ▶ | $c .= $1 if $str =~ /\G([0-7]{1,2})/g; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 391 | # convert octal escape code | ||||||||||||||||||||||||||||||||||||||||||
| 392 | 11 | $r = chr(oct($c) & 0xff); | |||||||||||||||||||||||||||||||||||||||||
| 393 | } elsif ($c eq "\x0d") { | ||||||||||||||||||||||||||||||||||||||||||
| 394 | # the string is continued if the line ends with '\' | ||||||||||||||||||||||||||||||||||||||||||
| 395 | # (also remove "\x0d\x0a") | ||||||||||||||||||||||||||||||||||||||||||
| 396 | 0 | ▶ | $c .= $1 if $str =~ /\G(\x0a)/g; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 397 | 0 | $r = ''; | |||||||||||||||||||||||||||||||||||||||||
| 398 | } elsif ($c eq "\x0a") { | ||||||||||||||||||||||||||||||||||||||||||
| 399 | 0 | $r = ''; | |||||||||||||||||||||||||||||||||||||||||
| 400 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 401 | # convert escaped characters | ||||||||||||||||||||||||||||||||||||||||||
| 402 | 1 | ($r = $c) =~ tr/nrtbf/\n\r\t\b\f/; | |||||||||||||||||||||||||||||||||||||||||
| 403 | } | ||||||||||||||||||||||||||||||||||||||||||
| 404 | 12 | substr($str, $n, length($c)+1) = $r; | |||||||||||||||||||||||||||||||||||||||||
| 405 | # continue search after this character | ||||||||||||||||||||||||||||||||||||||||||
| 406 | 12 | pos($str) = $n + length($r); | |||||||||||||||||||||||||||||||||||||||||
| 407 | } | ||||||||||||||||||||||||||||||||||||||||||
| 408 | 10 | return $str; | |||||||||||||||||||||||||||||||||||||||||
| 409 | } | ||||||||||||||||||||||||||||||||||||||||||
| 410 | |||||||||||||||||||||||||||||||||||||||||||
| 411 | #------------------------------------------------------------------------------ | ||||||||||||||||||||||||||||||||||||||||||
| 412 | # Extract information from EPS, PS or AI file | ||||||||||||||||||||||||||||||||||||||||||
| 413 | # Inputs: 0) ExifTool object reference, 1) dirInfo reference, 2) optional tag table ref | ||||||||||||||||||||||||||||||||||||||||||
| 414 | # Returns: 1 if this was a valid PostScript file | ||||||||||||||||||||||||||||||||||||||||||
| 415 | sub ProcessPS($$;$) | ||||||||||||||||||||||||||||||||||||||||||
| 416 | 4 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
ProcessPS: called CC=97 SCAR=67.7
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 417 | 4 | my ($et, $dirInfo, $tagTablePtr) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 418 | 4 | my $raf = $$dirInfo{RAF}; | |||||||||||||||||||||||||||||||||||||||||
| 419 | 4 | my $embedded = $et->Options('ExtractEmbedded'); | |||||||||||||||||||||||||||||||||||||||||
| 420 | 4 | my ($data, $dos, $endDoc, $fontTable, $comment); | |||||||||||||||||||||||||||||||||||||||||
| 421 | |||||||||||||||||||||||||||||||||||||||||||
| 422 | # allow read from data | ||||||||||||||||||||||||||||||||||||||||||
| 423 | 4 | ▶ | unless ($raf) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 424 | 0 | $raf = File::RandomAccess->new($$dirInfo{DataPt}); | |||||||||||||||||||||||||||||||||||||||||
| 425 | 0 | $et->VerboseDir('PostScript'); | |||||||||||||||||||||||||||||||||||||||||
| 426 | } | ||||||||||||||||||||||||||||||||||||||||||
| 427 | # | ||||||||||||||||||||||||||||||||||||||||||
| 428 | # determine if this is a postscript file | ||||||||||||||||||||||||||||||||||||||||||
| 429 | # | ||||||||||||||||||||||||||||||||||||||||||
| 430 | 4 | ▶ | $raf->Read($data, 4) == 4 or return 0; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 431 | # accept either ASCII or DOS binary postscript file format | ||||||||||||||||||||||||||||||||||||||||||
| 432 | 4 | ▶ | return 0 unless $data =~ /^(%!PS|%!Ad|%!Fo|\xc5\xd0\xd3\xc6)/; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 433 | 4 | ▶ | if ($data =~ /^%!Ad/) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 434 | # I've seen PS files start with "%!Adobe-PS"... | ||||||||||||||||||||||||||||||||||||||||||
| 435 | 0 | ▶ | return 0 unless $raf->Read($data, 6) == 6 and $data eq "obe-PS"; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$raf->Read($data, 6) == 6 and $data eq "obe-PS"
MC/DC0%0/2
$raf->Read($data, 6) == 6 and $data eq "obe-PS"
$raf->Read($data, 6) == 6
$data eq "obe-PS"
Truth table0%0/3
A and B
A= $raf->Read($data, 6) == 6B= $data eq "obe-PS"
| |||||||||||||||||||||||||||||||||||||||||||
| 436 | } elsif ($data =~ /^\xc5\xd0\xd3\xc6/) { | ||||||||||||||||||||||||||||||||||||||||||
| 437 | # process DOS binary file header | ||||||||||||||||||||||||||||||||||||||||||
| 438 | # - save DOS header then seek ahead and check PS header | ||||||||||||||||||||||||||||||||||||||||||
| 439 | 0 | ▶ | $raf->Read($dos, 26) == 26 or return 0; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 440 | 0 | SetByteOrder('II'); | |||||||||||||||||||||||||||||||||||||||||
| 441 | 0 | my $psStart = Get32u(\$dos, 0); | |||||||||||||||||||||||||||||||||||||||||
| 442 | 0 | ▶ | unless ($raf->Seek($psStart, 0) and | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
$raf->Seek($psStart, 0) and $raf->Read($data, 4) == 4 and $data eq "%!PS"
$raf->Seek($psStart, 0) and $raf->Read($data, 4) == 4
MC/DC0%0/3
$raf->Seek($psStart, 0) and $raf->Read($data, 4) == 4 and $data eq "%!PS"
$raf->Seek($psStart, 0)
$raf->Read($data, 4) == 4
$data eq "%!PS"
Truth table0%0/4
A and B and C
A= $raf->Seek($psStart, 0)B= $raf->Read($data, 4) == 4C= $data eq "%!PS"
| |||||||||||||||||||||||||||||||||||||||||||
| 443 | $raf->Read($data, 4) == 4 and $data eq '%!PS') | ||||||||||||||||||||||||||||||||||||||||||
| 444 | { | ||||||||||||||||||||||||||||||||||||||||||
| 445 | 0 | return PSErr($et, 'invalid header'); | |||||||||||||||||||||||||||||||||||||||||
| 446 | } | ||||||||||||||||||||||||||||||||||||||||||
| 447 | 0 | $$raf{PSEnd} = $psStart + Get32u(\$dos, 4); # set end of PostScript data in RAF | |||||||||||||||||||||||||||||||||||||||||
| 448 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 449 | # check for PostScript font file (PFA or PFB) | ||||||||||||||||||||||||||||||||||||||||||
| 450 | 4 | my $d2; | |||||||||||||||||||||||||||||||||||||||||
| 451 | 4 | ▶ | $data .= $d2 if $raf->Read($d2,12); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 452 | 4 | ▶ | if ($data =~ /^%!(PS-(AdobeFont-|Bitstream )|FontType1-)/) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 453 | 2 | $et->SetFileType('PFA'); # PostScript ASCII font file | |||||||||||||||||||||||||||||||||||||||||
| 454 | 2 | $fontTable = GetTagTable('Image::ExifTool::Font::PSInfo'); | |||||||||||||||||||||||||||||||||||||||||
| 455 | # PostScript font files may contain an unformatted comments which may | ||||||||||||||||||||||||||||||||||||||||||
| 456 | # contain useful information, so accumulate these for the Comment tag | ||||||||||||||||||||||||||||||||||||||||||
| 457 | 2 | $comment = 1; | |||||||||||||||||||||||||||||||||||||||||
| 458 | } | ||||||||||||||||||||||||||||||||||||||||||
| 459 | 4 | $raf->Seek(-length($data), 1); | |||||||||||||||||||||||||||||||||||||||||
| 460 | } | ||||||||||||||||||||||||||||||||||||||||||
| 461 | # | ||||||||||||||||||||||||||||||||||||||||||
| 462 | # set the newline type based on the first newline found in the file | ||||||||||||||||||||||||||||||||||||||||||
| 463 | # | ||||||||||||||||||||||||||||||||||||||||||
| 464 | 4 | local $/ = GetInputRecordSeparator($raf); | |||||||||||||||||||||||||||||||||||||||||
| 465 | 4 | ▶ | $/ or return PSErr($et, 'invalid PS data'); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 466 | |||||||||||||||||||||||||||||||||||||||||||
| 467 | # set file type (PostScript or EPS) | ||||||||||||||||||||||||||||||||||||||||||
| 468 | 4 | ▶ | $raf->ReadLine($data) or $data = ''; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 469 | 4 | my $type; | |||||||||||||||||||||||||||||||||||||||||
| 470 | 4 | ▶ | if ($data =~ /EPSF/) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 471 | 2 | $type = 'EPS'; | |||||||||||||||||||||||||||||||||||||||||
| 472 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 473 | # read next line to see if this is an Illustrator file | ||||||||||||||||||||||||||||||||||||||||||
| 474 | 2 | my $line2; | |||||||||||||||||||||||||||||||||||||||||
| 475 | 2 | my $pos = $raf->Tell(); | |||||||||||||||||||||||||||||||||||||||||
| 476 | 2 | ▶ | if ($raf->ReadLine($line2) and $line2 =~ /^%%Creator: Adobe Illustrator/) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$raf->ReadLine($line2) and $line2 =~ /^%%Creator: Adobe Illustrator/
MC/DC0%0/2
$raf->ReadLine($line2) and $line2 =~ /^%%Creator: Adobe Illustrator/
$raf->ReadLine($line2)
$line2 =~ /^%%Creator: Adobe Illustrator/
Truth table33%1/3
A and B
A= $raf->ReadLine($line2)B= $line2 =~ /^%%Creator: Adobe Illustrator/
| |||||||||||||||||||||||||||||||||||||||||||
| 477 | 0 | $type = 'AI'; | |||||||||||||||||||||||||||||||||||||||||
| 478 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 479 | 2 | $type = 'PS'; | |||||||||||||||||||||||||||||||||||||||||
| 480 | } | ||||||||||||||||||||||||||||||||||||||||||
| 481 | 2 | $raf->Seek($pos, 0); | |||||||||||||||||||||||||||||||||||||||||
| 482 | } | ||||||||||||||||||||||||||||||||||||||||||
| 483 | 4 | $et->SetFileType($type); | |||||||||||||||||||||||||||||||||||||||||
| 484 | 4 | ▶ | return 1 if $$et{OPTIONS}{FastScan} and $$et{OPTIONS}{FastScan} == 3; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$et->{"OPTIONS"}{"FastScan"} and $et->{"OPTIONS"}{"FastScan"} == 3
MC/DC0%0/2
$et->{"OPTIONS"}{"FastScan"} and $et->{"OPTIONS"}{"FastScan"} == 3
$et->{"OPTIONS"}{"FastScan"}
$et->{"OPTIONS"}{"FastScan"} == 3
Truth table33%1/3
A and B
A= $et->{"OPTIONS"}{"FastScan"}B= $et->{"OPTIONS"}{"FastScan"} == 3
| |||||||||||||||||||||||||||||||||||||||||||
| 485 | # | ||||||||||||||||||||||||||||||||||||||||||
| 486 | # extract TIFF information from DOS header | ||||||||||||||||||||||||||||||||||||||||||
| 487 | # | ||||||||||||||||||||||||||||||||||||||||||
| 488 | 4 | ▶ | $tagTablePtr or $tagTablePtr = GetTagTable('Image::ExifTool::PostScript::Main'); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 489 | 4 | ▶ | if ($dos) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 490 | 0 | my $base = Get32u(\$dos, 16); | |||||||||||||||||||||||||||||||||||||||||
| 491 | 0 | ▶ | if ($base) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 492 | 0 | my $pos = $raf->Tell(); | |||||||||||||||||||||||||||||||||||||||||
| 493 | # extract the TIFF preview | ||||||||||||||||||||||||||||||||||||||||||
| 494 | 0 | my $len = Get32u(\$dos, 20); | |||||||||||||||||||||||||||||||||||||||||
| 495 | 0 | my $val = $et->ExtractBinary($base, $len, 'TIFFPreview'); | |||||||||||||||||||||||||||||||||||||||||
| 496 | 0 | ▶ | if (defined $val and $val =~ /^(MM\0\x2a|II\x2a\0|Binary)/) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $val and $val =~ /^(MM\0\x2a|II\x2a\0|Binary)/
MC/DC0%0/2
defined $val and $val =~ /^(MM\0\x2a|II\x2a\0|Binary)/
defined $val
$val =~ /^(MM\0\x2a|II\x2a\0|Binary)/
Truth table0%0/3
A and B
A= defined $valB= $val =~ /^(MM\0\x2a|II\x2a\0|Binary)/
| |||||||||||||||||||||||||||||||||||||||||||
| 497 | 0 | $et->HandleTag($tagTablePtr, 'TIFFPreview', $val); | |||||||||||||||||||||||||||||||||||||||||
| 498 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 499 | 0 | $et->Warn('Bad TIFF preview image'); | |||||||||||||||||||||||||||||||||||||||||
| 500 | } | ||||||||||||||||||||||||||||||||||||||||||
| 501 | # extract information from TIFF in DOS header | ||||||||||||||||||||||||||||||||||||||||||
| 502 | # (set Parent to '' to avoid setting FileType tag again) | ||||||||||||||||||||||||||||||||||||||||||
| 503 | 0 | my %dirInfo = ( | |||||||||||||||||||||||||||||||||||||||||
| 504 | Parent => '', | ||||||||||||||||||||||||||||||||||||||||||
| 505 | RAF => $raf, | ||||||||||||||||||||||||||||||||||||||||||
| 506 | Base => $base, | ||||||||||||||||||||||||||||||||||||||||||
| 507 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 508 | 0 | ▶ | $et->ProcessTIFF(\%dirInfo) or $et->Warn('Bad embedded TIFF'); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 509 | # position file pointer to extract PS information | ||||||||||||||||||||||||||||||||||||||||||
| 510 | 0 | $raf->Seek($pos, 0); | |||||||||||||||||||||||||||||||||||||||||
| 511 | } | ||||||||||||||||||||||||||||||||||||||||||
| 512 | } | ||||||||||||||||||||||||||||||||||||||||||
| 513 | # | ||||||||||||||||||||||||||||||||||||||||||
| 514 | # parse the postscript | ||||||||||||||||||||||||||||||||||||||||||
| 515 | # | ||||||||||||||||||||||||||||||||||||||||||
| 516 | 4 | my ($buff, $mode, $beginToken, $endToken, $docNum, $subDocNum, $changedNL); | |||||||||||||||||||||||||||||||||||||||||
| 517 | 4 | my (@lines, $altnl); | |||||||||||||||||||||||||||||||||||||||||
| 518 | 4 | ▶ | if ($/ eq "\x0d") { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 519 | 2 | $altnl = "\x0a"; | |||||||||||||||||||||||||||||||||||||||||
| 520 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 521 | 2 | $/ = "\x0a"; # end on any LF (even if DOS CR+LF) | |||||||||||||||||||||||||||||||||||||||||
| 522 | 2 | $altnl = "\x0d"; | |||||||||||||||||||||||||||||||||||||||||
| 523 | } | ||||||||||||||||||||||||||||||||||||||||||
| 524 | 4 | for (;;) { | |||||||||||||||||||||||||||||||||||||||||
| 525 | 725 | ▶ | if (@lines) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 526 | 243 | $data = shift @lines; | |||||||||||||||||||||||||||||||||||||||||
| 527 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 528 | 482 | ▶ | $raf->ReadLine($data) or last; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 529 | # check for alternate newlines as efficiently as possible | ||||||||||||||||||||||||||||||||||||||||||
| 530 | 478 | ▶ | if ($data =~ /$altnl/) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 531 | 2 | ▶ | if (length($data) > 500000 and Image::ExifTool::IsPC()) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
length $data > 500000 and &Image::ExifTool::IsPC()
MC/DC0%0/2
length $data > 500000 and &Image::ExifTool::IsPC()
length $data > 500000
&Image::ExifTool::IsPC()
Truth table33%1/3
A and B
A= length $data > 500000B= &Image::ExifTool::IsPC()
| |||||||||||||||||||||||||||||||||||||||||||
| 532 | # Windows can't split very long lines due to poor memory handling, | ||||||||||||||||||||||||||||||||||||||||||
| 533 | # so re-read the file with the other newline character instead | ||||||||||||||||||||||||||||||||||||||||||
| 534 | # (slower but uses less memory) | ||||||||||||||||||||||||||||||||||||||||||
| 535 | 0 | ▶ | unless ($changedNL) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 536 | 0 | $changedNL = 1; | |||||||||||||||||||||||||||||||||||||||||
| 537 | 0 | my $t = $/; | |||||||||||||||||||||||||||||||||||||||||
| 538 | 0 | $/ = $altnl; | |||||||||||||||||||||||||||||||||||||||||
| 539 | 0 | $altnl = $t; | |||||||||||||||||||||||||||||||||||||||||
| 540 | 0 | $raf->Seek(-length($data), 1); | |||||||||||||||||||||||||||||||||||||||||
| 541 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||
| 542 | } | ||||||||||||||||||||||||||||||||||||||||||
| 543 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 544 | # split into separate lines | ||||||||||||||||||||||||||||||||||||||||||
| 545 | 2 | @lines = split /$altnl/, $data, -1; | |||||||||||||||||||||||||||||||||||||||||
| 546 | 2 | $data = shift @lines; | |||||||||||||||||||||||||||||||||||||||||
| 547 | 2 | ▶ | if (@lines == 1 and $lines[0] eq $/) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
@lines == 1 and $lines[0] eq $/
MC/DC0%0/2
@lines == 1 and $lines[0] eq $/
@lines == 1
$lines[0] eq $/
Truth table33%1/3
A and B
A= @lines == 1B= $lines[0] eq $/
| |||||||||||||||||||||||||||||||||||||||||||
| 548 | # handle case of DOS newline data inside file using Unix newlines | ||||||||||||||||||||||||||||||||||||||||||
| 549 | 0 | $data .= $lines[0]; | |||||||||||||||||||||||||||||||||||||||||
| 550 | 0 | undef @lines; | |||||||||||||||||||||||||||||||||||||||||
| 551 | } | ||||||||||||||||||||||||||||||||||||||||||
| 552 | } | ||||||||||||||||||||||||||||||||||||||||||
| 553 | } | ||||||||||||||||||||||||||||||||||||||||||
| 554 | } | ||||||||||||||||||||||||||||||||||||||||||
| 555 | 721 | undef $changedNL; | |||||||||||||||||||||||||||||||||||||||||
| 556 | 721 | ▶ | if ($mode) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 7 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 557 | 306 | ▶ | if (not $endToken) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 558 | 0 | $buff .= $data; | |||||||||||||||||||||||||||||||||||||||||
| 559 | 0 | ▶ | next unless $data =~ m{<\?xpacket end=.(w|r).\?>(\n|\r|$)}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 560 | } elsif ($data !~ /^$endToken/i) { | ||||||||||||||||||||||||||||||||||||||||||
| 561 | 298 | ▶ | if ($mode eq 'XMP') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 562 | 216 | $buff .= $data; | |||||||||||||||||||||||||||||||||||||||||
| 563 | } elsif ($mode eq 'Document') { | ||||||||||||||||||||||||||||||||||||||||||
| 564 | # ignore embedded documents, but keep track of nesting level | ||||||||||||||||||||||||||||||||||||||||||
| 565 | 29 | ▶ | $docNum .= '-1' if $data =~ /^$beginToken/; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 566 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 567 | # data is ASCII-hex encoded | ||||||||||||||||||||||||||||||||||||||||||
| 568 | 53 | $data =~ tr/0-9A-Fa-f//dc; # remove all but hex characters | |||||||||||||||||||||||||||||||||||||||||
| 569 | 53 | $buff .= pack('H*', $data); # translate from hex | |||||||||||||||||||||||||||||||||||||||||
| 570 | } | ||||||||||||||||||||||||||||||||||||||||||
| 571 | 298 | next; | |||||||||||||||||||||||||||||||||||||||||
| 572 | } elsif ($mode eq 'Document') { | ||||||||||||||||||||||||||||||||||||||||||
| 573 | 4 | $docNum =~ s/-?\d+$//; # decrement document nesting level | |||||||||||||||||||||||||||||||||||||||||
| 574 | # done with Document mode if we are back at the top level | ||||||||||||||||||||||||||||||||||||||||||
| 575 | 4 | ▶ | undef $mode unless $docNum; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 576 | 4 | next; | |||||||||||||||||||||||||||||||||||||||||
| 577 | } | ||||||||||||||||||||||||||||||||||||||||||
| 578 | ▶ | } elsif ($endDoc and $data =~ /^$endDoc/i) { | |||||||||||||||||||||||||||||||||||||||||
|
Condition100%3/3
$endDoc and $data =~ /^$endDoc/i
MC/DC100%2/2
$endDoc and $data =~ /^$endDoc/i
$endDoc
$data =~ /^$endDoc/i
Truth table100%3/3
A and B
A= $endDocB= $data =~ /^$endDoc/i
| |||||||||||||||||||||||||||||||||||||||||||
| 579 | 4 | $docNum =~ s/-?(\d+)$//; # decrement nesting level | |||||||||||||||||||||||||||||||||||||||||
| 580 | 4 | $subDocNum = $1; # remember our last sub-document number | |||||||||||||||||||||||||||||||||||||||||
| 581 | 4 | $$et{DOC_NUM} = $docNum; | |||||||||||||||||||||||||||||||||||||||||
| 582 | 4 | ▶ | undef $endDoc unless $docNum; # done with document if top level | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 583 | 4 | next; | |||||||||||||||||||||||||||||||||||||||||
| 584 | } elsif ($data =~ /^(%{1,2})(Begin)(_xml_packet|Photoshop|ICCProfile|Document|Binary)/i) { | ||||||||||||||||||||||||||||||||||||||||||
| 585 | # the beginning of a data block | ||||||||||||||||||||||||||||||||||||||||||
| 586 | 13 | my %modeLookup = ( | |||||||||||||||||||||||||||||||||||||||||
| 587 | _xml_packet => 'XMP', | ||||||||||||||||||||||||||||||||||||||||||
| 588 | photoshop => 'Photoshop', | ||||||||||||||||||||||||||||||||||||||||||
| 589 | iccprofile => 'ICC_Profile', | ||||||||||||||||||||||||||||||||||||||||||
| 590 | document => 'Document', | ||||||||||||||||||||||||||||||||||||||||||
| 591 | binary => undef, # (we will try to skip this) | ||||||||||||||||||||||||||||||||||||||||||
| 592 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 593 | 13 | $mode = $modeLookup{lc $3}; | |||||||||||||||||||||||||||||||||||||||||
| 594 | 13 | ▶ | unless ($mode) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 595 | 2 | ▶ | if (not @lines and $data =~ /^%{1,2}BeginBinary:\s*(\d+)/i) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
not @lines and $data =~ /^%{1,2}BeginBinary:\s*(\d+)/i
MC/DC0%0/2
not @lines and $data =~ /^%{1,2}BeginBinary:\s*(\d+)/i
not @lines
$data =~ /^%{1,2}BeginBinary:\s*(\d+)/i
Truth table33%1/3
not(A) and B
A= not @linesB= $data =~ /^%{1,2}BeginBinary:\s*(\d+)/i
| |||||||||||||||||||||||||||||||||||||||||||
| 596 | 2 | ▶ | $raf->Seek($1, 1) or last; # skip binary data | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 597 | } | ||||||||||||||||||||||||||||||||||||||||||
| 598 | 2 | next; | |||||||||||||||||||||||||||||||||||||||||
| 599 | } | ||||||||||||||||||||||||||||||||||||||||||
| 600 | 11 | $buff = ''; | |||||||||||||||||||||||||||||||||||||||||
| 601 | 11 | $beginToken = $1 . $2 . $3; | |||||||||||||||||||||||||||||||||||||||||
| 602 | 11 | ▶ | $endToken = $1 . ($2 eq 'begin' ? 'end' : 'End') . $3; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 603 | 11 | ▶ | if ($mode eq 'Document') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 604 | # this is either the 1st sub-document or Nth document | ||||||||||||||||||||||||||||||||||||||||||
| 605 | 7 | ▶ | if ($docNum) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 606 | # increase nesting level | ||||||||||||||||||||||||||||||||||||||||||
| 607 | 1 | $docNum .= '-' . (++$subDocNum); | |||||||||||||||||||||||||||||||||||||||||
| 608 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 609 | # this is the Nth document | ||||||||||||||||||||||||||||||||||||||||||
| 610 | 6 | $docNum = $$et{DOC_COUNT} + 1; | |||||||||||||||||||||||||||||||||||||||||
| 611 | } | ||||||||||||||||||||||||||||||||||||||||||
| 612 | 7 | $subDocNum = 0; # new level, so reset subDocNum | |||||||||||||||||||||||||||||||||||||||||
| 613 | 7 | ▶ | next unless $embedded; # skip over this document | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 614 | # set document number for family 4-7 group names | ||||||||||||||||||||||||||||||||||||||||||
| 615 | 4 | $$et{DOC_NUM} = $docNum; | |||||||||||||||||||||||||||||||||||||||||
| 616 | 4 | $$et{LIST_TAGS} = { }; # don't build lists across different documents | |||||||||||||||||||||||||||||||||||||||||
| 617 | 4 | $$et{PROCESSED} = { }; # re-initialize processed directory lookup too | |||||||||||||||||||||||||||||||||||||||||
| 618 | 4 | $endDoc = $endToken; # parse to EndDocument token | |||||||||||||||||||||||||||||||||||||||||
| 619 | # reset mode to allow parsing into sub-directories | ||||||||||||||||||||||||||||||||||||||||||
| 620 | 4 | undef $endToken; | |||||||||||||||||||||||||||||||||||||||||
| 621 | 4 | undef $mode; | |||||||||||||||||||||||||||||||||||||||||
| 622 | # save document name if available | ||||||||||||||||||||||||||||||||||||||||||
| 623 | 4 | ▶ | if ($data =~ /^$beginToken:\s+([^\n\r]+)/i) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 624 | 4 | my $docName = $1; | |||||||||||||||||||||||||||||||||||||||||
| 625 | # remove brackets if necessary | ||||||||||||||||||||||||||||||||||||||||||
| 626 | 4 | ▶ | $docName = $1 if $docName =~ /^\((.*)\)$/; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 627 | 4 | $et->HandleTag($tagTablePtr, 'EmbeddedFileName', $docName); | |||||||||||||||||||||||||||||||||||||||||
| 628 | } | ||||||||||||||||||||||||||||||||||||||||||
| 629 | } | ||||||||||||||||||||||||||||||||||||||||||
| 630 | 8 | next; | |||||||||||||||||||||||||||||||||||||||||
| 631 | } elsif ($data =~ /^<\?xpacket begin=.{7,13}W5M0MpCehiHzreSzNTczkc9d/) { | ||||||||||||||||||||||||||||||||||||||||||
| 632 | # pick up any stray XMP data | ||||||||||||||||||||||||||||||||||||||||||
| 633 | 0 | $mode = 'XMP'; | |||||||||||||||||||||||||||||||||||||||||
| 634 | 0 | $buff = $data; | |||||||||||||||||||||||||||||||||||||||||
| 635 | 0 | undef $endToken; # no end token (just look for xpacket end) | |||||||||||||||||||||||||||||||||||||||||
| 636 | # XMP could be contained in a single line (if newlines are different) | ||||||||||||||||||||||||||||||||||||||||||
| 637 | 0 | ▶ | next unless $data =~ m{<\?xpacket end=.(w|r).\?>(\n|\r|$)}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 638 | ▶ | } elsif ($data =~ /^%%?(\w+): ?(.*)/s and $$tagTablePtr{$1}) { | |||||||||||||||||||||||||||||||||||||||||
|
Condition100%3/3
$data =~ /^%%?(\w+): ?(.*)/s and $tagTablePtr->{$1}
MC/DC100%2/2
$data =~ /^%%?(\w+): ?(.*)/s and $tagTablePtr->{$1}
$data =~ /^%%?(\w+): ?(.*)/s
$tagTablePtr->{$1}
Truth table100%3/3
A and B
A= $data =~ /^%%?(\w+): ?(.*)/sB= $tagTablePtr->{$1}
| |||||||||||||||||||||||||||||||||||||||||||
| 639 | 29 | my ($tag, $val) = ($1, $2); | |||||||||||||||||||||||||||||||||||||||||
| 640 | # only allow 'ImageData' and AI tags to have single leading '%' | ||||||||||||||||||||||||||||||||||||||||||
| 641 | 29 | ▶ | next unless $data =~ /^%(%|AI\d+_)/ or $tag eq 'ImageData'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$data =~ /^%(%|AI\d+_)/ or $tag eq "ImageData"
MC/DC0%0/2
$data =~ /^%(%|AI\d+_)/ or $tag eq "ImageData"
$data =~ /^%(%|AI\d+_)/
$tag eq "ImageData"
Truth table66%2/3
A or B
A= $data =~ /^%(%|AI\d+_)/B= $tag eq "ImageData"
| |||||||||||||||||||||||||||||||||||||||||||
| 642 | # decode comment string (reading continuation lines if necessary) | ||||||||||||||||||||||||||||||||||||||||||
| 643 | 29 | $val = DecodeComment($val, $raf, \@lines); | |||||||||||||||||||||||||||||||||||||||||
| 644 | 29 | $et->HandleTag($tagTablePtr, $tag, $val); | |||||||||||||||||||||||||||||||||||||||||
| 645 | 29 | next; | |||||||||||||||||||||||||||||||||||||||||
| 646 | ▶ | } elsif ($embedded and $data =~ /^%AI12_CompressedData/) { | |||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$embedded and $data =~ /^%AI12_CompressedData/
MC/DC0%0/2
$embedded and $data =~ /^%AI12_CompressedData/
$embedded
$data =~ /^%AI12_CompressedData/
Truth table66%2/3
A and B
A= $embeddedB= $data =~ /^%AI12_CompressedData/
| |||||||||||||||||||||||||||||||||||||||||||
| 647 | # the rest of the file is compressed | ||||||||||||||||||||||||||||||||||||||||||
| 648 | 0 | ▶ | unless (eval { require Compress::Zlib }) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 649 | 0 | $et->Warn('Install Compress::Zlib to extract compressed embedded data'); | |||||||||||||||||||||||||||||||||||||||||
| 650 | 0 | last; | |||||||||||||||||||||||||||||||||||||||||
| 651 | } | ||||||||||||||||||||||||||||||||||||||||||
| 652 | # seek back to find the start of the compressed data in the file | ||||||||||||||||||||||||||||||||||||||||||
| 653 | 0 | my $tlen = length($data) + @lines; | |||||||||||||||||||||||||||||||||||||||||
| 654 | 0 | $tlen += length $_ foreach @lines; | |||||||||||||||||||||||||||||||||||||||||
| 655 | 0 | my $backTo = $raf->Tell() - $tlen - 64; | |||||||||||||||||||||||||||||||||||||||||
| 656 | 0 | ▶ | $backTo = 0 if $backTo < 0; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 657 | 0 | ▶ | last unless $raf->Seek($backTo, 0) and $raf->Read($data, 2048); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$raf->Seek($backTo, 0) and $raf->Read($data, 2048)
MC/DC0%0/2
$raf->Seek($backTo, 0) and $raf->Read($data, 2048)
$raf->Seek($backTo, 0)
$raf->Read($data, 2048)
Truth table0%0/3
A and B
A= $raf->Seek($backTo, 0)B= $raf->Read($data, 2048)
| |||||||||||||||||||||||||||||||||||||||||||
| 658 | 0 | ▶ | last unless $data =~ s/.*?%AI12_CompressedData//; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 659 | 0 | my $inflate = Compress::Zlib::inflateInit(); | |||||||||||||||||||||||||||||||||||||||||
| 660 | 0 | ▶ | $inflate or $et->Warn('Error initializing inflate'), last; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 661 | # generate a PS-like file in memory from the compressed data | ||||||||||||||||||||||||||||||||||||||||||
| 662 | 0 | my $verbose = $et->Options('Verbose'); | |||||||||||||||||||||||||||||||||||||||||
| 663 | 0 | ▶ | if ($verbose > 1) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 664 | 0 | $et->VerboseDir('AI12_CompressedData (first 4kB)'); | |||||||||||||||||||||||||||||||||||||||||
| 665 | 0 | $et->VerboseDump(\$data); | |||||||||||||||||||||||||||||||||||||||||
| 666 | } | ||||||||||||||||||||||||||||||||||||||||||
| 667 | # remove header if it exists (Windows AI files only) | ||||||||||||||||||||||||||||||||||||||||||
| 668 | 0 | $data =~ s/^.{0,256}EndData[\x0d\x0a]+//s; | |||||||||||||||||||||||||||||||||||||||||
| 669 | 0 | my $val; | |||||||||||||||||||||||||||||||||||||||||
| 670 | 0 | for (;;) { | |||||||||||||||||||||||||||||||||||||||||
| 671 | 0 | my ($v2, $stat) = $inflate->inflate($data); | |||||||||||||||||||||||||||||||||||||||||
| 672 | 0 | ▶ | $stat == Compress::Zlib::Z_STREAM_END() and $val .= $v2, last; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 673 | 0 | ▶ | $stat != Compress::Zlib::Z_OK() and undef($val), last; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 674 | 0 | ▶ | if (defined $val) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 675 | 0 | $val .= $v2; | |||||||||||||||||||||||||||||||||||||||||
| 676 | } elsif ($v2 =~ /^%!PS/) { | ||||||||||||||||||||||||||||||||||||||||||
| 677 | 0 | $val = $v2; | |||||||||||||||||||||||||||||||||||||||||
| 678 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 679 | # add postscript header (for file recognition) if it doesn't exist | ||||||||||||||||||||||||||||||||||||||||||
| 680 | 0 | $val = "%!PS-Adobe-3.0$/" . $v2; | |||||||||||||||||||||||||||||||||||||||||
| 681 | } | ||||||||||||||||||||||||||||||||||||||||||
| 682 | 0 | ▶ | $raf->Read($data, 65536) or last; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 683 | } | ||||||||||||||||||||||||||||||||||||||||||
| 684 | 0 | ▶ | defined $val or $et->Warn('Error inflating AI compressed data'), last; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 685 | 0 | ▶ | if ($verbose > 1) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 686 | 0 | $et->VerboseDir('Uncompressed AI12 Data'); | |||||||||||||||||||||||||||||||||||||||||
| 687 | 0 | $et->VerboseDump(\$val); | |||||||||||||||||||||||||||||||||||||||||
| 688 | } | ||||||||||||||||||||||||||||||||||||||||||
| 689 | # extract information from embedded images in the uncompressed data | ||||||||||||||||||||||||||||||||||||||||||
| 690 | $val = # add PS header in case it needs one | ||||||||||||||||||||||||||||||||||||||||||
| 691 | 0 | ProcessPS($et, { DataPt => \$val }); | |||||||||||||||||||||||||||||||||||||||||
| 692 | 0 | last; | |||||||||||||||||||||||||||||||||||||||||
| 693 | } elsif ($fontTable) { | ||||||||||||||||||||||||||||||||||||||||||
| 694 | 58 | ▶ | if (defined $comment) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 695 | # extract initial comments from PostScript Font files | ||||||||||||||||||||||||||||||||||||||||||
| 696 | 10 | ▶ | if ($data =~ /^%\s+(.*?)[\x0d\x0a]/) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 697 | 4 | ▶ | $comment .= "\n" if $comment; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 698 | 4 | $comment .= $1; | |||||||||||||||||||||||||||||||||||||||||
| 699 | 4 | next; | |||||||||||||||||||||||||||||||||||||||||
| 700 | } elsif ($data !~ /^%/) { | ||||||||||||||||||||||||||||||||||||||||||
| 701 | # stop extracting comments at the first non-comment line | ||||||||||||||||||||||||||||||||||||||||||
| 702 | 2 | ▶ | $et->FoundTag('Comment', $comment) if length $comment; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 703 | 2 | undef $comment; | |||||||||||||||||||||||||||||||||||||||||
| 704 | } | ||||||||||||||||||||||||||||||||||||||||||
| 705 | } | ||||||||||||||||||||||||||||||||||||||||||
| 706 | 54 | ▶ | if ($data =~ m{^\s*/(\w+)\s*(.*)} and $$fontTable{$1}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition100%3/3
$data =~ m[^\s*/(\w+)\s*(.*)] and $fontTable->{$1}
MC/DC100%2/2
$data =~ m[^\s*/(\w+)\s*(.*)] and $fontTable->{$1}
$data =~ m[^\s*/(\w+)\s*(.*)]
$fontTable->{$1}
Truth table100%3/3
A and B
A= $data =~ m[^\s*/(\w+)\s*(.*)]B= $fontTable->{$1}
| |||||||||||||||||||||||||||||||||||||||||||
| 707 | 24 | my ($tag, $val) = ($1, $2); | |||||||||||||||||||||||||||||||||||||||||
| 708 | 24 | ▶ | if ($val =~ /^\((.*)\)/) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 709 | 10 | $val = UnescapePostScript($1); | |||||||||||||||||||||||||||||||||||||||||
| 710 | } elsif ($val =~ m{/?(\S+)}) { | ||||||||||||||||||||||||||||||||||||||||||
| 711 | 14 | $val = $1; | |||||||||||||||||||||||||||||||||||||||||
| 712 | } | ||||||||||||||||||||||||||||||||||||||||||
| 713 | 24 | $et->HandleTag($fontTable, $tag, $val); | |||||||||||||||||||||||||||||||||||||||||
| 714 | } elsif ($data =~ /^currentdict end/) { | ||||||||||||||||||||||||||||||||||||||||||
| 715 | # only extract tags from initial FontInfo dict | ||||||||||||||||||||||||||||||||||||||||||
| 716 | 2 | undef $fontTable; | |||||||||||||||||||||||||||||||||||||||||
| 717 | } | ||||||||||||||||||||||||||||||||||||||||||
| 718 | 54 | next; | |||||||||||||||||||||||||||||||||||||||||
| 719 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 720 | 311 | next; | |||||||||||||||||||||||||||||||||||||||||
| 721 | } | ||||||||||||||||||||||||||||||||||||||||||
| 722 | # extract information from buffered data | ||||||||||||||||||||||||||||||||||||||||||
| 723 | 4 | my %dirInfo = ( | |||||||||||||||||||||||||||||||||||||||||
| 724 | DataPt => \$buff, | ||||||||||||||||||||||||||||||||||||||||||
| 725 | DataLen => length $buff, | ||||||||||||||||||||||||||||||||||||||||||
| 726 | DirStart => 0, | ||||||||||||||||||||||||||||||||||||||||||
| 727 | DirLen => length $buff, | ||||||||||||||||||||||||||||||||||||||||||
| 728 | Parent => 'PostScript', | ||||||||||||||||||||||||||||||||||||||||||
| 729 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 730 | 4 | my $subTablePtr = GetTagTable("Image::ExifTool::${mode}::Main"); | |||||||||||||||||||||||||||||||||||||||||
| 731 | 4 | ▶ | unless ($et->ProcessDirectory(\%dirInfo, $subTablePtr)) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 732 | 0 | $et->Warn("Error processing $mode information in PostScript file"); | |||||||||||||||||||||||||||||||||||||||||
| 733 | } | ||||||||||||||||||||||||||||||||||||||||||
| 734 | 4 | undef $buff; | |||||||||||||||||||||||||||||||||||||||||
| 735 | 4 | undef $mode; | |||||||||||||||||||||||||||||||||||||||||
| 736 | } | ||||||||||||||||||||||||||||||||||||||||||
| 737 | 4 | ▶ | $mode = 'Document' if $endDoc and not $mode; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$endDoc and not $mode
MC/DC0%0/2
$endDoc and not $mode
$endDoc
not $mode
Truth table33%1/3
A and not(B)
A= $endDocB= not $mode
| |||||||||||||||||||||||||||||||||||||||||||
| 738 | 4 | ▶ | $mode and PSErr($et, "unterminated $mode data"); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 739 | 4 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 740 | } | ||||||||||||||||||||||||||||||||||||||||||
| 741 | |||||||||||||||||||||||||||||||||||||||||||
| 742 | #------------------------------------------------------------------------------ | ||||||||||||||||||||||||||||||||||||||||||
| 743 | # Extract information from EPS file | ||||||||||||||||||||||||||||||||||||||||||
| 744 | # Inputs: 0) ExifTool object reference, 1) dirInfo reference | ||||||||||||||||||||||||||||||||||||||||||
| 745 | # Returns: 1 if this was a valid PostScript file | ||||||||||||||||||||||||||||||||||||||||||
| 746 | sub ProcessEPS($$) | ||||||||||||||||||||||||||||||||||||||||||
| 747 | 2 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
ProcessEPS: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 748 | 2 | return ProcessPS($_[0],$_[1]); | |||||||||||||||||||||||||||||||||||||||||
| 749 | } | ||||||||||||||||||||||||||||||||||||||||||
| 750 | |||||||||||||||||||||||||||||||||||||||||||
| 751 | 29 | 1; # end | |||||||||||||||||||||||||||||||||||||||||
| 752 | |||||||||||||||||||||||||||||||||||||||||||
| 753 | |||||||||||||||||||||||||||||||||||||||||||
| 754 | __END__ | ||||||||||||||||||||||||||||||||||||||||||