two digit dates
[latex2e.git] / latex2e-20150101 / scripts / log2tlg
blobf8775dc19383fa79fb418154c161aa3cf383d530
1 #!/usr/local/bin/perl
3 if ($#ARGV != 0) {
4 die "Usage: log2tlg basename";
7 $BASE = shift;
10 $skipping = 0;
11 $skip_autoload = 0;
13 $LTOPDIR = $ENV{'LTOPDIR'};
16 # skip everything until START-TEST-LOG is seen
19 while (<>) {
20 /^START-TEST-LOG/ && last;
24 while (<>) {
25 # if END-TEST-LOG is seen, terminate
26 /^END-TEST-LOG/ && last;
28 # if OMIT is seen, skip until TIMO
29 if (/^OMIT/) {
30 $skipping++;
31 next;
32 } elsif (/^TIMO/) {
33 $skipping--;
34 next;
37 next if $skipping;
39 # if environment variable LTOPDIR is set, replace beginning of paths
40 if ($LTOPDIR) {
41 s#$LTOPDIR/latex2/#../../#g;
44 # s/$BASE(\.lvt)?//og;
45 s/(\.\/)?$BASE//og;
47 # if we are running the autoload test suite, the environment variable
48 # TLG_PREFIX is set
50 if ($ENV{'TLG_PREFIX'}) {
52 if ($skip_autoload) {
53 /^\)/ && ($skip_autoload = 0);
54 next;
55 } elsif (/^(.*)\(auto(err|fss1|out1|pict|tabg)\.sty$/) {
56 $skip_autoload = 1;
57 ($_ = $1) =~ s/\s+$//;
58 $_ = "$_\n";
63 # skip filedate lines
64 /[^<][0-9][0-9][0-9][0-9]\/[0-9][0-9]\/[0-9][0-9]/ && next;
66 # skip ident lines from .fd files
67 if (/\([^ ]*fd/.../^[ ]*\)/) {
68 next;
72 # skip \openin/\openout lines in web2c 7.x
73 if (/^\\open(in|out)\d+ = /) {
74 # skip empty line
75 $_ = <>;
76 next;
79 # remove messy DOS CR at end of line
80 s/\r+$//;
82 # normalise Windows \ separator to /
83 # Just look for something that looks like ( followed by path to a three letter extension
84 while (/\([^()]*\\[^()]*\..../) {
85 s/(\([^()]*)\\([^()]*\....)/$1\/$2/ ;
88 # zap ./ at begin of filename
89 s/\(\.\//\(/g;
91 # remove filename paths from full file names of the form
92 # (/path/file or (x:/path/file -> (.../file
93 s/^\((:?\/|\w:\/)(?:[^\/]+\/)+/\(...\//;
95 # remove string ",display" at the end of hboxes from displayed math
96 s/(\\hbox\(.*), display$/$1/;
98 # decision on these needed:
100 # # zap hyphenation register number
101 # s/(hyphenation register nr: )\d+/$1 <num>/;
103 # # zap \setlanguage number
104 # s/\\setlanguage\d+ /\\setlanguage<num> /;
106 # # zap "Language: number"
107 # s/Language: \d+,/Language: <num>,/;
109 # do not print empty lines
110 print if ! /^\s*$/;