From 9363e4b96190b3b5c504d34ce75baee890d46c77 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Fri, 29 Dec 2017 22:56:27 +0000 Subject: add wordcount.sh, debian bug 885341 git-svn-id: svn://tug.org/texlive/trunk@46165 c570f23f-e606-0410-a88d-b1316a301751 --- .../source/texk/texlive/linked_scripts/Makefile.am | 3 +- .../source/texk/texlive/linked_scripts/Makefile.in | 3 +- .../source/texk/texlive/linked_scripts/scripts.lst | 1 + .../texlive/linked_scripts/wordcount/wordcount.sh | 79 ++++++++++++++++++++++ Master/bin/amd64-freebsd/wordcount | 1 + Master/bin/amd64-netbsd/wordcount | 1 + Master/bin/armel-linux/wordcount | 1 + Master/bin/armhf-linux/wordcount | 1 + Master/bin/i386-cygwin/wordcount | 1 + Master/bin/i386-darwin/wordcount | 1 + Master/bin/i386-freebsd/wordcount | 1 + Master/bin/i386-linux/wordcount | 1 + Master/bin/i386-netbsd/wordcount | 1 + Master/bin/i386-solaris/wordcount | 1 + Master/bin/powerpc-darwin/wordcount | 1 + Master/bin/powerpc-linux/wordcount | 1 + Master/bin/sparc-solaris/wordcount | 1 + Master/bin/x86_64-cygwin/wordcount | 1 + Master/bin/x86_64-darwin/wordcount | 1 + Master/bin/x86_64-darwinlegacy/wordcount | 1 + Master/bin/x86_64-linux/wordcount | 1 + Master/bin/x86_64-solaris/wordcount | 1 + Master/texmf-dist/scripts/wordcount/wordcount.sh | 79 ++++++++++++++++++++++ Master/tlpkg/libexec/ctan2tds | 15 +--- Master/tlpkg/tlpsrc/wordcount.tlpsrc | 2 + 25 files changed, 184 insertions(+), 16 deletions(-) create mode 100755 Build/source/texk/texlive/linked_scripts/wordcount/wordcount.sh create mode 120000 Master/bin/amd64-freebsd/wordcount create mode 120000 Master/bin/amd64-netbsd/wordcount create mode 120000 Master/bin/armel-linux/wordcount create mode 120000 Master/bin/armhf-linux/wordcount create mode 120000 Master/bin/i386-cygwin/wordcount create mode 120000 Master/bin/i386-darwin/wordcount create mode 120000 Master/bin/i386-freebsd/wordcount create mode 120000 Master/bin/i386-linux/wordcount create mode 120000 Master/bin/i386-netbsd/wordcount create mode 120000 Master/bin/i386-solaris/wordcount create mode 120000 Master/bin/powerpc-darwin/wordcount create mode 120000 Master/bin/powerpc-linux/wordcount create mode 120000 Master/bin/sparc-solaris/wordcount create mode 120000 Master/bin/x86_64-cygwin/wordcount create mode 120000 Master/bin/x86_64-darwin/wordcount create mode 120000 Master/bin/x86_64-darwinlegacy/wordcount create mode 120000 Master/bin/x86_64-linux/wordcount create mode 120000 Master/bin/x86_64-solaris/wordcount create mode 100755 Master/texmf-dist/scripts/wordcount/wordcount.sh diff --git a/Build/source/texk/texlive/linked_scripts/Makefile.am b/Build/source/texk/texlive/linked_scripts/Makefile.am index 1d206759013..2ababe9d2ca 100644 --- a/Build/source/texk/texlive/linked_scripts/Makefile.am +++ b/Build/source/texk/texlive/linked_scripts/Makefile.am @@ -83,7 +83,8 @@ texmf_shell_scripts = \ texosquery/texosquery.sh \ texosquery/texosquery-jre5.sh \ texosquery/texosquery-jre8.sh \ - typeoutfileinfo/typeoutfileinfo.sh + typeoutfileinfo/typeoutfileinfo.sh \ + wordcount/wordcount.sh texmf_other_scripts = \ a2ping/a2ping.pl \ accfonts/mkt1font \ diff --git a/Build/source/texk/texlive/linked_scripts/Makefile.in b/Build/source/texk/texlive/linked_scripts/Makefile.in index de51dc23940..50c23d2bf7f 100644 --- a/Build/source/texk/texlive/linked_scripts/Makefile.in +++ b/Build/source/texk/texlive/linked_scripts/Makefile.in @@ -296,7 +296,8 @@ texmf_shell_scripts = \ texosquery/texosquery.sh \ texosquery/texosquery-jre5.sh \ texosquery/texosquery-jre8.sh \ - typeoutfileinfo/typeoutfileinfo.sh + typeoutfileinfo/typeoutfileinfo.sh \ + wordcount/wordcount.sh texmf_other_scripts = \ a2ping/a2ping.pl \ diff --git a/Build/source/texk/texlive/linked_scripts/scripts.lst b/Build/source/texk/texlive/linked_scripts/scripts.lst index bf1af0f21e8..b0e8852880f 100644 --- a/Build/source/texk/texlive/linked_scripts/scripts.lst +++ b/Build/source/texk/texlive/linked_scripts/scripts.lst @@ -29,6 +29,7 @@ texosquery/texosquery.sh texosquery/texosquery-jre5.sh texosquery/texosquery-jre8.sh typeoutfileinfo/typeoutfileinfo.sh +wordcount/wordcount.sh a2ping/a2ping.pl accfonts/mkt1font accfonts/vpl2ovp diff --git a/Build/source/texk/texlive/linked_scripts/wordcount/wordcount.sh b/Build/source/texk/texlive/linked_scripts/wordcount/wordcount.sh new file mode 100755 index 00000000000..8e1c80473e2 --- /dev/null +++ b/Build/source/texk/texlive/linked_scripts/wordcount/wordcount.sh @@ -0,0 +1,79 @@ +#!/bin/sh +# wordcount.sh 1.7 Copyright 2016/06/03 Michael John Downes + +# Following Michael's death, his family have requested that his TeX +# related files are made publicly available under the LPPL license. +# +# This file is available under the LaTeX Project Public License version 1 +# or (at your option) any later version. +# https://latex-project.org/lppl/ +# (LPPL maintenance status: unmaintained) +# +# 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/Master/bin/amd64-freebsd/wordcount b/Master/bin/amd64-freebsd/wordcount new file mode 120000 index 00000000000..6df28960e99 --- /dev/null +++ b/Master/bin/amd64-freebsd/wordcount @@ -0,0 +1 @@ +../../texmf-dist/scripts/wordcount/wordcount.sh \ No newline at end of file diff --git a/Master/bin/amd64-netbsd/wordcount b/Master/bin/amd64-netbsd/wordcount new file mode 120000 index 00000000000..6df28960e99 --- /dev/null +++ b/Master/bin/amd64-netbsd/wordcount @@ -0,0 +1 @@ +../../texmf-dist/scripts/wordcount/wordcount.sh \ No newline at end of file diff --git a/Master/bin/armel-linux/wordcount b/Master/bin/armel-linux/wordcount new file mode 120000 index 00000000000..6df28960e99 --- /dev/null +++ b/Master/bin/armel-linux/wordcount @@ -0,0 +1 @@ +../../texmf-dist/scripts/wordcount/wordcount.sh \ No newline at end of file diff --git a/Master/bin/armhf-linux/wordcount b/Master/bin/armhf-linux/wordcount new file mode 120000 index 00000000000..6df28960e99 --- /dev/null +++ b/Master/bin/armhf-linux/wordcount @@ -0,0 +1 @@ +../../texmf-dist/scripts/wordcount/wordcount.sh \ No newline at end of file diff --git a/Master/bin/i386-cygwin/wordcount b/Master/bin/i386-cygwin/wordcount new file mode 120000 index 00000000000..6df28960e99 --- /dev/null +++ b/Master/bin/i386-cygwin/wordcount @@ -0,0 +1 @@ +../../texmf-dist/scripts/wordcount/wordcount.sh \ No newline at end of file diff --git a/Master/bin/i386-darwin/wordcount b/Master/bin/i386-darwin/wordcount new file mode 120000 index 00000000000..6df28960e99 --- /dev/null +++ b/Master/bin/i386-darwin/wordcount @@ -0,0 +1 @@ +../../texmf-dist/scripts/wordcount/wordcount.sh \ No newline at end of file diff --git a/Master/bin/i386-freebsd/wordcount b/Master/bin/i386-freebsd/wordcount new file mode 120000 index 00000000000..6df28960e99 --- /dev/null +++ b/Master/bin/i386-freebsd/wordcount @@ -0,0 +1 @@ +../../texmf-dist/scripts/wordcount/wordcount.sh \ No newline at end of file diff --git a/Master/bin/i386-linux/wordcount b/Master/bin/i386-linux/wordcount new file mode 120000 index 00000000000..6df28960e99 --- /dev/null +++ b/Master/bin/i386-linux/wordcount @@ -0,0 +1 @@ +../../texmf-dist/scripts/wordcount/wordcount.sh \ No newline at end of file diff --git a/Master/bin/i386-netbsd/wordcount b/Master/bin/i386-netbsd/wordcount new file mode 120000 index 00000000000..6df28960e99 --- /dev/null +++ b/Master/bin/i386-netbsd/wordcount @@ -0,0 +1 @@ +../../texmf-dist/scripts/wordcount/wordcount.sh \ No newline at end of file diff --git a/Master/bin/i386-solaris/wordcount b/Master/bin/i386-solaris/wordcount new file mode 120000 index 00000000000..6df28960e99 --- /dev/null +++ b/Master/bin/i386-solaris/wordcount @@ -0,0 +1 @@ +../../texmf-dist/scripts/wordcount/wordcount.sh \ No newline at end of file diff --git a/Master/bin/powerpc-darwin/wordcount b/Master/bin/powerpc-darwin/wordcount new file mode 120000 index 00000000000..6df28960e99 --- /dev/null +++ b/Master/bin/powerpc-darwin/wordcount @@ -0,0 +1 @@ +../../texmf-dist/scripts/wordcount/wordcount.sh \ No newline at end of file diff --git a/Master/bin/powerpc-linux/wordcount b/Master/bin/powerpc-linux/wordcount new file mode 120000 index 00000000000..6df28960e99 --- /dev/null +++ b/Master/bin/powerpc-linux/wordcount @@ -0,0 +1 @@ +../../texmf-dist/scripts/wordcount/wordcount.sh \ No newline at end of file diff --git a/Master/bin/sparc-solaris/wordcount b/Master/bin/sparc-solaris/wordcount new file mode 120000 index 00000000000..6df28960e99 --- /dev/null +++ b/Master/bin/sparc-solaris/wordcount @@ -0,0 +1 @@ +../../texmf-dist/scripts/wordcount/wordcount.sh \ No newline at end of file diff --git a/Master/bin/x86_64-cygwin/wordcount b/Master/bin/x86_64-cygwin/wordcount new file mode 120000 index 00000000000..6df28960e99 --- /dev/null +++ b/Master/bin/x86_64-cygwin/wordcount @@ -0,0 +1 @@ +../../texmf-dist/scripts/wordcount/wordcount.sh \ No newline at end of file diff --git a/Master/bin/x86_64-darwin/wordcount b/Master/bin/x86_64-darwin/wordcount new file mode 120000 index 00000000000..6df28960e99 --- /dev/null +++ b/Master/bin/x86_64-darwin/wordcount @@ -0,0 +1 @@ +../../texmf-dist/scripts/wordcount/wordcount.sh \ No newline at end of file diff --git a/Master/bin/x86_64-darwinlegacy/wordcount b/Master/bin/x86_64-darwinlegacy/wordcount new file mode 120000 index 00000000000..6df28960e99 --- /dev/null +++ b/Master/bin/x86_64-darwinlegacy/wordcount @@ -0,0 +1 @@ +../../texmf-dist/scripts/wordcount/wordcount.sh \ No newline at end of file diff --git a/Master/bin/x86_64-linux/wordcount b/Master/bin/x86_64-linux/wordcount new file mode 120000 index 00000000000..6df28960e99 --- /dev/null +++ b/Master/bin/x86_64-linux/wordcount @@ -0,0 +1 @@ +../../texmf-dist/scripts/wordcount/wordcount.sh \ No newline at end of file diff --git a/Master/bin/x86_64-solaris/wordcount b/Master/bin/x86_64-solaris/wordcount new file mode 120000 index 00000000000..6df28960e99 --- /dev/null +++ b/Master/bin/x86_64-solaris/wordcount @@ -0,0 +1 @@ +../../texmf-dist/scripts/wordcount/wordcount.sh \ No newline at end of file diff --git a/Master/texmf-dist/scripts/wordcount/wordcount.sh b/Master/texmf-dist/scripts/wordcount/wordcount.sh new file mode 100755 index 00000000000..8e1c80473e2 --- /dev/null +++ b/Master/texmf-dist/scripts/wordcount/wordcount.sh @@ -0,0 +1,79 @@ +#!/bin/sh +# wordcount.sh 1.7 Copyright 2016/06/03 Michael John Downes + +# Following Michael's death, his family have requested that his TeX +# related files are made publicly available under the LPPL license. +# +# This file is available under the LaTeX Project Public License version 1 +# or (at your option) any later version. +# https://latex-project.org/lppl/ +# (LPPL maintenance status: unmaintained) +# +# 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/Master/tlpkg/libexec/ctan2tds b/Master/tlpkg/libexec/ctan2tds index d5e72a4dcd4..fea5ff113a6 100755 --- a/Master/tlpkg/libexec/ctan2tds +++ b/Master/tlpkg/libexec/ctan2tds @@ -1202,7 +1202,6 @@ chomp ($Build = `cd $Master/../Build/source && pwd`); 'winfonts', "die 'skipping, support for nonfree fonts'", 'withesis', "die 'skipping, thesis package ca.2002, wait for request'", 'wntamil', "die 'skipping, nonfree license'", - 'wordcount', "&MAKEwordcount", 'wp-conv', "die 'skipping, nonfree license'", 'wp2latex', "die 'skipping, compilation'", 'wtref', "&MAKEflatten", @@ -2911,6 +2910,7 @@ $standardttf = '\.ttf|\.TTC'; 'ulqda' => '\.pl$', 'urlbst' => 'urlbst$', 'vpe' => '\.pl$', + 'wordcount' => '\.sh$', 'wheretotrim' => '\.pl$', 'yplan' => 'yplan$', ); @@ -4825,19 +4825,6 @@ sub MAKEwadalab { &SYSTEM ("rmdir $DEST/*/$whichformat/$package 2>/dev/null"); } - -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 { chdir($packagedir) || die ("ERROR: cannot open directory"); &runjob("mkdir -p $DEST/tex/generic/ukrhyph"); diff --git a/Master/tlpkg/tlpsrc/wordcount.tlpsrc b/Master/tlpkg/tlpsrc/wordcount.tlpsrc index e69de29bb2d..aefd3a571c4 100644 --- a/Master/tlpkg/tlpsrc/wordcount.tlpsrc +++ b/Master/tlpkg/tlpsrc/wordcount.tlpsrc @@ -0,0 +1,2 @@ +binpattern f bin/${ARCH}/${PKGNAME} + -- cgit v1.2.3