2 # fixmacps: swap to sanitised appledict
4 # Copyright (C) Angus J. C. Duggan 1991-1995
5 # See file LICENSE for details.
7 $line = 0; # keep line count
10 $default = "md71_0.ps";
12 while ($_ = shift(@ARGV)) {
13 if (/^-d(ir)?$/) { $dir = shift(@ARGV); }
14 elsif (/^-n(ame)?$/) { $prefix = shift(@ARGV); }
29 } elsif (/^%%(Begin|Include)ProcSet: "?\(AppleDict md\)"? ([0-9]+) ([0-9]+)$/) {
30 local($inc, $mdv, $mdr) = ($1, $2, $3);
31 if (open(SANE
, "<$dir/$prefix${mdv}_$mdr.ps") ||
32 open(SANE
, "<$dir/$default")) {
35 $sane =~ /^%%BeginProcSet: \(AppleDict md\) ([0-9]+) ([0-9]+)$/;
36 if ($mdv == $snv && $mdr == $snr) {
37 if ( $inc eq "Include" ) {
38 print STDERR
"Inserting ProcSet \"(AppleDict md)\" $snv $snr\n";
46 print STDERR
"Substituting ProcSet \"(AppleDict md)\" $snv $snr\n";
50 print STDERR
"Unrecognised AppleDict version $mdv $mdr\n";
51 print "%!\n" if !$line;
55 print STDERR
"Can't find sanitised AppleDict\n";
56 print "%!\n" if !$line;
59 } elsif (/^%%EndProcSet/) {
62 print "%!\n" if !$line;
69 print "%!\n" if !$line;
72 } elsif (/^%%Page:/ && $nesting == 0) {
75 } elsif (/^%%BeginDocument/ || /^%%BeginBinary/ || /^%%BeginFile/) {
78 } elsif (/^%%EndDocument/ || /^%%EndBinary/ || /^%%EndFile/) {
83 if (/^\{\}mark .*rf$/) {
87 print "%!\n" if !$line;