~ubuntu-branches/ubuntu/jaunty/texlive-bin/jaunty-security

« back to all changes in this revision

Viewing changes to build/source/texk/tetex/e2pall

  • Committer: Bazaar Package Importer
  • Author(s): Norbert Preining
  • Date: 2008-06-26 23:14:59 UTC
  • mfrom: (2.1.30 intrepid)
  • Revision ID: james.westby@ubuntu.com-20080626231459-y02rjsrgtafu83yr
Tags: 2007.dfsg.2-3
add missing source roadmap.fig of roadmap.eps in fontinst documentation
(Closes: #482915) (urgency medium due to RC bug)
(new patch add-missing-fontinst-source)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/env perl
 
2
 
 
3
# Author: Jody Klymak <jklymak@apl.washington.edu>, publisted by a posting
 
4
#   to the pdftex mailinglist.
 
5
 
 
6
# recursively finds all your eps files.  Looks down \input{fname}.
 
7
# CAVEATS:
 
8
# 1) cannot handle \input{fname} split over more than one line.
 
9
#    1.5) cannot handle multiple \input{} or \includegraphics{} on one line.
 
10
# 2) Must be run from same directory as the Latex file.
 
11
# 3) Does not look down $TEXINPUTS or anything fancy like that...
 
12
# 4) Handling of \include is untested (though I guess its trivial)
 
13
# 5) Assumes *all* your graphics inclusions are [e]ps.  But don't
 
14
#    fret, because if they are not epstopdf dies anyhow....
 
15
# 6) Does not distinguish between percent (\%) and comment (%).
 
16
 
 
17
# Changelog:
 
18
# 20030103 -- Lachlan Andrew <lha@users.sourceforge.net>
 
19
#       * Only append '.tex' if $fname doesn't exist.
 
20
#       * Correctly handle lines with '}' after the \includegraphics{}
 
21
#       * Allow multiple extensions for graphics files.  .eps -> .ps -> none
 
22
#         (Should try them in the same order as  \includegraphics  does
 
23
#          -- given by \DeclareGraphicsExtensions{}?)
 
24
#       * Allow \include the same way as \input
 
25
#       * Allow \includegraphics{} to be split over multiple lines
 
26
#       * Check that commands begin with '\', and allow spaces before arguments
 
27
 
 
28
# EDIT these two lines for your system....
 
29
 
 
30
$Eps2PdfCom = "epstopdf";
 
31
$ThisFunCom = "e2pall";
 
32
 
 
33
$fname=$ARGV[0];
 
34
 
 
35
# check for a *.tex at the end...
 
36
if ((-f "$fname")=="" && $fname !~ /.tex$/){
 
37
    $fname = "$fname.tex";
 
38
}
 
39
 
 
40
open(TEXFILE,$fname) or die "Cannot open file $fname";
 
41
# print "Finding *.eps files in $fname\n";
 
42
 
 
43
$seekingArg = 0;
 
44
while($line=<TEXFILE>){
 
45
    # truncate $line after % sign....
 
46
    $line=~s/%.*//;
 
47
    # check for /input....
 
48
    if ($line=~/\\input *{([^}]*)}/){
 
49
        print `$ThisFunCom $1`;
 
50
    }
 
51
    # check for /include....
 
52
    if ($line=~/\\include *{([^}]*)}/){
 
53
        print `$ThisFunCom $1`;
 
54
    }
 
55
 
 
56
    $base = "";
 
57
    if ($line=~/\\includegraphics.*{([^}]*)}/){
 
58
        $base = $1;
 
59
    }
 
60
    elsif ($seekingArg==1 && ($line=~/{([^}]*)}/)){
 
61
        $base = $1;
 
62
    }
 
63
    elsif ($line=~/\\includegraphics/){
 
64
        $seekingArg = 1;
 
65
    }
 
66
    
 
67
    if ($base ne "") {
 
68
        $seekingArg = 0;
 
69
        if ((-f "$base.eps")!="") {
 
70
            $srcfile = "$base.eps";
 
71
        }
 
72
        elsif ((-f "$base.ps")!=""){
 
73
            $srcfile = "$base.ps";
 
74
        }
 
75
        else {
 
76
            $srcfile = $base;
 
77
        }
 
78
        # check that the [e]ps version is newer than the pdf version....
 
79
        if ((-M "$base.pdf")=="" || (-M "$base.pdf") >= (-M "$srcfile")){
 
80
            print "Constructing \t $base.pdf from $srcfile\n";
 
81
            print `$Eps2PdfCom $srcfile`;
 
82
        }
 
83
        else{
 
84
            print "$base.pdf \t is up to date with $srcfile\n";
 
85
        }
 
86
 
 
87
    };
 
88
}
 
89
close(TEXFILE);