diff options
Diffstat (limited to 'Master/texmf-dist/source/latex/stex/bin/rf')
-rwxr-xr-x | Master/texmf-dist/source/latex/stex/bin/rf | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/Master/texmf-dist/source/latex/stex/bin/rf b/Master/texmf-dist/source/latex/stex/bin/rf new file mode 100755 index 00000000000..7de36042620 --- /dev/null +++ b/Master/texmf-dist/source/latex/stex/bin/rf @@ -0,0 +1,63 @@ +#!/usr/bin/perl -w + +####################################################################################### +# A tool for computing the module reuse factor for TEX files. # +# Copyright (c) 2005, Ioan Sucan, released under the Gnu General Public License (GPL) # +# see http://www.gnu.org/copyleft/gpl.html # +# $URL: svn://kwarc.eecs.iu-bremen.de/repos/kwarc/projects/content/bin/rf$ # +# $Date: 2005-06-29 23:08:10 +0200 (Wed, 29 Jun 2005) $ $Rev: 3147 $ # +####################################################################################### + +use strict; +use Getopt::Long; +use Modparse; +use Pod::Usage; + +my $input = "-", my $verbose=0, my $stop_at_end=0; +my %arg_snippath; my @snippathList; + +GetOptions("path=s" => \%arg_snippath, + "defpath=s" => \@snippathList, + "verbose" => sub { $verbose=1; }, + "stop" => sub { $stop_at_end=1; }, + "help" => sub { pod2usage(2)}); + +$input = $ARGV[0] if ($#ARGV>=0); + +$main::lc1 = 0; $main::lc2 = 0; +my $mp = Modparse->new(snippathList=>\@snippathList, + snippath=>\%arg_snippath, + stopAtEnd=>$stop_at_end, + verbose=>$verbose, + onEveryLine=>sub { + $main::lc1++; + $main::lc2++ if $_[0]->{depth}==1; }); + +$mp->execute($input); +my $f = ($main::lc2>0)?$main::lc1/$main::lc2:0; +print "Reuse factor: $f\n"; + +__END__ + + +=head1 SYNOPSIS + +rf <input filename> [options] + + This program computes the reuse factor for a .tex document + + Options: + --path XXX specify the value of \XXX (some snippath) in case it is + = somePath not defined in the processed .tex file + --defpath XXX specify which \XXX (snippath definitions) to look for + --stop stop when \end{document} is found; default is to go on + --verbose verbose on + --help this screen + + + Example usage: + ./rf slides.tex -d snippath -v + + Interpretation: + compute the reuse factor for the file slides.tex, look for definitions + of \snippath, in verbose mode |