diff options
author | Karl Berry <karl@freefriends.org> | 2007-08-08 17:42:44 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2007-08-08 17:42:44 +0000 |
commit | 379e709fbe9a7b8373dd3179aac29938f8af8657 (patch) | |
tree | 82db1ba2f859c7d51b73a8a881e4044749043ae0 /Build | |
parent | 80e93e76bda433b7cc628d6fc4e0e1a3b9a85bf9 (diff) |
get wordcount.sh in bin, frank 16 Jul 2007 22:13:58, debian 432034
git-svn-id: svn://tug.org/texlive/trunk@4713 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build')
-rwxr-xr-x | Build/cdbuild/ctan2tds.pl | 48 | ||||
-rwxr-xr-x | Build/cdbuild/place | 5 | ||||
-rw-r--r-- | Build/source/texk/texlive/Makefile.in | 2 | ||||
-rw-r--r-- | Build/source/texk/texlive/wordcount.sh | 72 | ||||
-rwxr-xr-x | Build/tools/tpm-ctan-check | 2 |
5 files changed, 109 insertions, 20 deletions
diff --git a/Build/cdbuild/ctan2tds.pl b/Build/cdbuild/ctan2tds.pl index 2a2184046c6..955e3c11c06 100755 --- a/Build/cdbuild/ctan2tds.pl +++ b/Build/cdbuild/ctan2tds.pl @@ -331,6 +331,7 @@ chdir $startdir || die "chdir($startdir) failed: $!"; 'vpe', "&MAKEvpe", 'vrsion', "warn \"skipping vrsion, nonfree license\n\"", 'wasy2', "&MAKEflatten", + 'wordcount', "&MAKEwordcount", 'xfor', "&MAKEflatten", 'xfrac', "&MAKEflatten", 'xkeyval', "&MAKExkeyval", @@ -1168,7 +1169,7 @@ sub xchdir my ($dir) = @_; chdir ($dir) || die "chdir($dir) failed: $!"; chomp (my $pwd = `pwd`); - print "chdir $dir (now $pwd)\n"; + print "\t CHDIR $dir (now $pwd)\n"; } @@ -1242,6 +1243,7 @@ sub MAKEcopy { sub setup { my ($ctl) = @_; + print "doing setup($ctl)...\n"; # precreate the directories we might need $DOCDIR = "$DEST/doc/$whichdocformat/$package"; &SYSTEM("mkdir -p $DOCDIR"); @@ -1258,6 +1260,7 @@ sub setup { } sub donormal { + print "doing donormal()...\n"; &setup; chdir("$DEST/doc/$whichdocformat/$package"); &buildfilelist; @@ -1510,10 +1513,10 @@ sub killfiles { # rebuild list of input files, e.g., after flattening sub buildfilelist { + print "doing buildfilelist()...\n"; opendir(DIR,'.') || die ("ERROR: cannot open directory"); @filenames =grep(!/^\.\.?$/,readdir(DIR)); closedir(DIR); - print " [file list rebuilt]\n"; } sub runmf { @@ -1565,13 +1568,14 @@ sub runfonts { sub SYSTEM { local ($job) = @_; if ($opt_test) { - print "SYSTEM: $job\n"; + print "\t SYSTEM $job\n"; } else { - print "SYSTEM: $job\n" if $opt_debug; + print "\t SYSTEM $job\n" if $opt_debug; system($job); } } + sub MAKEflatten { &setup; &xchdir ("$DEST/doc/$whichdocformat/$package"); @@ -1665,8 +1669,8 @@ sub GENMAKEhyphenation { &SYSTEM("echo $langname $hyphfile >$configfile"); } - print "\t YOU-MUST-DO $package: create texmf/tpm/hyphen-$langname.tpm\n"; - print "\t YOU-MUST-DO $package: add to texmf/tpm/collection-langsomething.tpm\n"; + print "YOU-MUST-DO! $package: create texmf/tpm/hyphen-$langname.tpm\n"; + print "YOU-MUST-DO! $package: add to texmf/tpm/collection-langsomething.tpm\n"; } sub MAKEcbcoptic { @@ -1770,7 +1774,7 @@ sub MAKEbabel { my $files = "icehyph.tex iahyphen.tex "; print "\t SPECIAL move to /tmp: $files\n"; # since not separate on CTAN &SYSTEM("cd $DEST/doc/generic/$package && mv $files /tmp"); - print "\t YOU-MUST-DO check those against texmf/tex/generic/hyphen\n"; + print "YOU-MUST-DO! check those against texmf/tex/generic/hyphen\n"; } sub MAKEbbm { @@ -1895,7 +1899,7 @@ sub MAKEmpattern { print "\t SPECIAL move mpp from doc to /tmp\n"; &SYSTEM("$MV $DEST/doc/metapost/$package/mpp /tmp"); &SYSTEM("chmod a+x /tmp/mpp"); - print "\t YOU-MUST-DO update mpp to source/.../texlive/\n"; + print "YOU-MUST-DO! update mpp to source/.../texlive/\n"; } sub MAKEpbdiagram { @@ -1915,7 +1919,7 @@ sub MAKEperltex { print "\t SPECIAL move $package.pl from doc to /tmp\n"; &SYSTEM("$MV $DEST/doc/latex/$package/$package.pl /tmp"); &SYSTEM("chmod a+x /tmp/$package.pl"); - print "\t YOU-MUST-DO update $package.pl to source/.../texlive/\n"; + print "YOU-MUST-DO! update $package.pl to source/.../texlive/\n"; } # pgf mostly is just a copy to the tex dir, but Till has a doc dir at @@ -2090,7 +2094,7 @@ sub MAKEdevanagr { print "\t SPECIAL $package: flatten\n"; &xchdir (".."); &MAKEflatten; - print "\t YOU-MUST-DO update /tmp/devnag.c and devnag.exe into Build\n"; + print "YOU-MUST-DO! update /tmp/devnag.c and devnag.exe into Build\n"; } # We don't want to flatten the templates, only the source. @@ -2128,7 +2132,7 @@ sub MAKEebong { print "\t SPECIAL $package: flatten\n"; &xchdir (".."); &MAKEflatten; - print "\t YOU-MUST-DO update /tmp/ebong.py into Build\n"; + print "YOU-MUST-DO! update /tmp/ebong.py into Build\n"; } sub MAKEfootnpag { @@ -2369,9 +2373,9 @@ sub MAKEelhyphen { &SYSTEM("mkdir -p $generichyphdir"); &SYSTEM("$MV gr*hyph*.tex $generichyphdir"); - print "\t YOU-MUST-DO $package: update texmf/tex/generic/config/language.gr.dat\n"; - print "\t YOU-MUST-DO $package: update texmf/tpm/hyphen-greek.tpm\n"; - print "\t YOU-MUST-DO $package: add to texmf/tpm/collection-langgreek.tpm\n"; + print "YOU-MUST-DO! $package: update texmf/tex/generic/config/language.gr.dat\n"; + print "YOU-MUST-DO! $package: update texmf/tpm/hyphen-greek.tpm\n"; + print "YOU-MUST-DO! $package: add to texmf/tpm/collection-langgreek.tpm\n"; } sub MAKEcatalog { @@ -2569,7 +2573,19 @@ sub MAKEvpe { &xchdir (".."); &donormal (); # - print "\t YOU-MUST-DO update /tmp/vpe into Build\n"; + print "YOU-MUST-DO! update /tmp/vpe to source/texk/texlive\n"; +} + +sub MAKEwordcount { + &xchdir ($packagedir); + # + print "\t SPECIAL $package: moving wordcount.sh to /tmp\n"; + &SYSTEM('mv wordcount.sh /tmp/'); + # + &xchdir (".."); + &donormal (); + # + print "YOU-MUST-DO! update /tmp/wordcount.sh to source/texk/texlive\n"; } sub MAKEukrhyph { @@ -2785,7 +2801,7 @@ sub MAKEpst { &SYSTEM("mv $DEST/doc/generic/$package/*cfg $DEST/tex/latex/$package"); if (-f "scripts/ps4pdf") { - print "\t YOU-MUST-DO copy scripts/ps4pdf to source/texk/tetex\n"; + print "YOU-MUST-DO! copy scripts/ps4pdf to source/texk/tetex\n"; } } diff --git a/Build/cdbuild/place b/Build/cdbuild/place index 6a1da1e3b3f..11737b258da 100755 --- a/Build/cdbuild/place +++ b/Build/cdbuild/place @@ -118,13 +118,14 @@ if (!defined($tlpold)) { chomp (@difffiles); my $sum = 0; unlink ("/tmp/pkgfiles.diff"); + my $diff_cmd = "diff --ignore-all-space -U 0"; foreach (@difffiles) { - my @foo = `diff --ignore-all-space -U 0 $M/$_ $mydir/$package/$_ >>/tmp/pkgfiles.diff`; + my @foo = `$diff_cmd $M/$_ $mydir/$package/$_ | tee -a /tmp/pkgfiles.diff`; $sum += ($#foo + 1); } my $nrcommfiles = $#difffiles + 1; print "$nrcommfiles common files, ~$sum lines different\n\n\f\n"; - #`rm -f /tmp/pkgfiles.new /tmp/pkgfiles.old`; + #`rm -f /tmp/pkgfiles.new /tmp/pkgfiles.old /tmp/pkgfiles.diff`; } diff --git a/Build/source/texk/texlive/Makefile.in b/Build/source/texk/texlive/Makefile.in index 37ff74b9674..893a196c8f7 100644 --- a/Build/source/texk/texlive/Makefile.in +++ b/Build/source/texk/texlive/Makefile.in @@ -7,7 +7,7 @@ kpse_include ../make/programs.mk LIVESCRIPTS = simpdftex \ ebong getnonfreefonts giftopng \ - pdfthumb perltex pkfix ppower4 vpe + pdfthumb perltex pkfix ppower4 vpe wordcount.sh manpgs = getnonfreefonts getnonfreefonts-sys diff --git a/Build/source/texk/texlive/wordcount.sh b/Build/source/texk/texlive/wordcount.sh new file mode 100644 index 00000000000..95a89023f9e --- /dev/null +++ b/Build/source/texk/texlive/wordcount.sh @@ -0,0 +1,72 @@ +#! /usr/bin/sh +# wordcount.sh 1.2 Copyright 2000/02/21 Michael John Downes +# This script has no restrictions on its use, distribution, or sale. +# +# This is a Unix Bourne shell script that counts the characters and +# spaces in a LaTeX document by running it through LaTeX using +# wordcount.tex, and then counting the lines in the resulting +# wordcount.log file that match a special pattern. It assumes that you +# have a program "grep" with a -c option meaning "Report the number of +# matching lines". To use perl or some other tool instead of grep, +# redefine $COUNT in some suitable way, below. +# +# The characters that are counted with this method are actual font +# characters in the page body (excluding running heads): in math, each +# subscript and superscript character is counted separately, even when +# they appear one over the other; and so are the separate combining +# pieces used to make large delimiters. Interword spaces are counted as +# separate characters, and so are the spaces around mathrel symbols in +# math formulas (equal signs and the like)---but not the spaces around +# mathbin symbols (plus, minus, and the like). +# +# You can count words by dividing the character count by 5 (or +# whatever), or by counting the occurrences of interword spaces. The +# latter method (illustrated here) is highly accurate at counting the +# actual number of words---until tables or math formulas enter the +# picture. In the case of tables, the number of words will tend to be +# overestimated because tabskip glue, counted as an interword space, +# appears on both sides of each table cell. (Not counting the tabskip +# glue at all would result in an underestimate, and the underestimate +# would tend to be slightly less accurate than the overestimate that we +# have chosen to do.) +# +# And of course, in the case of math formulas, how do you define what is +# a "word"? + +SCRIPT=`basename $0` +LOGFILE=wordcount.log +COUNT="grep -c" +LATEX=latex + +die () { + echo "$@ was apparently unsuccessful." + exit 1 +} + +no_files_msg () { + echo "$SCRIPT: At least one file name must be supplied" \ + "on the command line." + exit 1 +} + +case X$1 in + X) no_files_msg ;; + *) : ;; +esac + +for f in "$@" +do + # Since \? is not defined by LaTeX itself, this use via \csname causes + # it to be defined as \relax, and it then serves as a filename + # terminator. And within wordcount.tex if \? is found to be no longer + # undefined, certain messages are suppressed. + echo "$f" | $LATEX 'wordcount.tex\csname ?\endcsname' || die "LaTeX run" + # Count interword spaces and end-of-paragraph spaces + words=`$COUNT '3[.]0863[35]' $LOGFILE` || die "Log search" + # Count nonspace characters and interword spaces + chars=`$COUNT '3[.]0863[23]' $LOGFILE` || die "Log search" + # If you want to see what the log file looks like, comment out the + # following line: + rm $LOGFILE + echo "$f contains $chars characters and $words words." +done diff --git a/Build/tools/tpm-ctan-check b/Build/tools/tpm-ctan-check index 884d80493dd..e0e8e980bbe 100755 --- a/Build/tools/tpm-ctan-check +++ b/Build/tools/tpm-ctan-check @@ -138,7 +138,7 @@ my @WorkingTPM = qw( umthesis underlin undertilde units unitsdef unroman upquote ushort vancouver variations varindex vector velthuis verse versions vhistory visualfaq vmargin volumes vpe - wallpaper warning warpcol williams wordlike wrapfig + wallpaper warning warpcol williams wordcount wordlike wrapfig xbase xcolor xdoc xetexref xfor xfrac xifthen xkeyval xltxtra xnewcommand xoptarg xq xtab xtcapts xunicode xyling xypic-tut-pt |