texlive[67437] Build/source/texk/web2c/cwebdir: [CWEB] Run short

commits+ascherer at tug.org commits+ascherer at tug.org
Thu Jun 22 18:55:11 CEST 2023


Revision: 67437
          http://tug.org/svn/texlive?view=revision&revision=67437
Author:   ascherer
Date:     2023-06-22 18:55:11 +0200 (Thu, 22 Jun 2023)
Log Message:
-----------
[CWEB] Run short version of ctwill.test.

In total, this is "test-driven" develpment. :o)

* All three CTWILL macros (ctproofmac, cttwinxmac, and ctwimac) needed
  a few modifications. Especially cttwinxmac had a bug since CWEB 4.5.
* ctwill.test was reduced to CTWILL+tools only. It now includes a call
  of the ctwill-twinx program as well.
* ctwill-proofsort received some spit and polish. At the end, I had to
  use Unicode::Collate->sort() to get stable results from ham.tex.
  Perl standard sort (with lowercase conversion) more often than not
  flipped 'A' and 'a', resp. 'V' and 'v', in section 4 of ham.tex. Now
  the uppercase letters always come after their lowercase counterpart.

Modified Paths:
--------------
    trunk/Build/source/texk/web2c/cwebdir/ChangeLog
    trunk/Build/source/texk/web2c/cwebdir/ctproofmac.tex
    trunk/Build/source/texk/web2c/cwebdir/cttwinxmac.tex
    trunk/Build/source/texk/web2c/cwebdir/ctwill-proofsort
    trunk/Build/source/texk/web2c/cwebdir/ctwill.test
    trunk/Build/source/texk/web2c/cwebdir/ctwimac.tex

Added Paths:
-----------
    trunk/Build/source/texk/web2c/cwebdir/tests/index.tex

Modified: trunk/Build/source/texk/web2c/cwebdir/ChangeLog
===================================================================
--- trunk/Build/source/texk/web2c/cwebdir/ChangeLog	2023-06-22 14:49:33 UTC (rev 67436)
+++ trunk/Build/source/texk/web2c/cwebdir/ChangeLog	2023-06-22 16:55:11 UTC (rev 67437)
@@ -1,3 +1,12 @@
+2023-06-20  Andreas Scherer  <https://ascherer.github.io>
+
+	* ctproofmac.tex,
+	* cttwinxmac.tex,
+	* ctwimac.tex: Minor fixes, bug in TWINX macros.
+	* ctwill-proofsort: Avoid provoked user errors.
+	* ctwill.test,
+	* tests/index.tex: Shorter test suite, TWINX tested.
+
 2023-06-21  Karl Berry  <karl at freefriends.org>
 
 	* ctwill-proofsort: 'quotes' for $Revision$.

Modified: trunk/Build/source/texk/web2c/cwebdir/ctproofmac.tex
===================================================================
--- trunk/Build/source/texk/web2c/cwebdir/ctproofmac.tex	2023-06-22 14:49:33 UTC (rev 67436)
+++ trunk/Build/source/texk/web2c/cwebdir/ctproofmac.tex	2023-06-22 16:55:11 UTC (rev 67437)
@@ -115,7 +115,7 @@
   \sfcode`;=1500 \pretolerance 200 \hyphenpenalty 50 \exhyphenpenalty 50
   \noindent{\let\*=\lapstar\bf\secstar.\quad}}
 \let\startsection=\stsec
-\def\defin#1{\global\advance\ind by 2 \1\&{#1 } } % begin `define' or `format'
+\def\defin#1{\global\advance\ind by 2 \1\&{#1 }} % begin `define' or `format'
 \def\A{\note{See also section}} % xref for doubly defined section name
 \def\As{\note{See also sections}} % xref for multiply defined section name
 \def\B{\rightskip=0pt plus 100pt minus 10pt % go into C mode

Modified: trunk/Build/source/texk/web2c/cwebdir/cttwinxmac.tex
===================================================================
--- trunk/Build/source/texk/web2c/cwebdir/cttwinxmac.tex	2023-06-22 14:49:33 UTC (rev 67436)
+++ trunk/Build/source/texk/web2c/cwebdir/cttwinxmac.tex	2023-06-22 16:55:11 UTC (rev 67437)
@@ -226,7 +226,7 @@
     \let\ \, % C++ digit separator becomes a little white space
     \def\$##1{\egroup_{\rm##1}\bgroup}% suffix to constant
     \def\_{\cdot 10^{\aftergroup}}% power of ten (via dirty trick)
-    \let\~=\oct \let\^=\hex \let\\=\bin {#1}$}}%$%
+    \let\~=\oct \let\^=\hex \let\\=\bin #1}$}}%$%
 \def\U{\note{This code is used in section}} % xref for use of a section
 \def\Us{\note{This code is used in sections}} % xref for uses of a section
 \let\V=\lor % logical or

Modified: trunk/Build/source/texk/web2c/cwebdir/ctwill-proofsort
===================================================================
--- trunk/Build/source/texk/web2c/cwebdir/ctwill-proofsort	2023-06-22 14:49:33 UTC (rev 67436)
+++ trunk/Build/source/texk/web2c/cwebdir/ctwill-proofsort	2023-06-22 16:55:11 UTC (rev 67437)
@@ -8,12 +8,19 @@
 use File::Basename;
 use Getopt::Long qw(:config no_ignore_case bundling);
 use Pod::Usage;
+use Unicode::Collate;
 
 # We expect a TeX file as the single command-line parameter.
 my $progname = basename $0;
-my $usage = "$progname input_file\ntry --help if you need it.\n";
+my $usage = "Usage: $progname input_file\n";
+if (@ARGV > 1) {
+  my $first = shift @ARGV;
+  $usage .= "extra file argument(s): @ARGV\n";
+  unshift @ARGV, $first;
+}
+$usage .= "try --help if you need it.\n";
 
-die $usage unless scalar @ARGV;
+die $usage unless scalar @ARGV == 1;
 
 Getopt::Long::GetOptions(
   'help|?'  => \&help_handler,
@@ -29,7 +36,7 @@
 }
 ## version()
 sub version {
-  return '$progname $Revision$ $Date$\n';
+  return $progname.' $Revision$ $Date$'."\n";
 }
 
 my $tex = $ARGV[0];
@@ -38,6 +45,7 @@
 
 my %mini_index; # storage for index entries of a section
 my $print_index = 0; # do we collect and print a mini-index?
+my $collator = Unicode::Collate->new();
 
 # Scroll through the input file and look for blocks like
 # \mini
@@ -56,7 +64,7 @@
 		$print_index = 1;
 		%mini_index = (); # reset mini-index storage
 	} elsif ("}\\FI\n" eq $line) { # end of mini-index
-		foreach my $key (sort {"\L$a" cmp "\L$b"} keys %mini_index) {
+		foreach my $key ($collator->sort(keys %mini_index)) {
 			print $mini_index{$key};
 		}
 		$print_index = 0;

Modified: trunk/Build/source/texk/web2c/cwebdir/ctwill.test
===================================================================
--- trunk/Build/source/texk/web2c/cwebdir/ctwill.test	2023-06-22 14:49:33 UTC (rev 67436)
+++ trunk/Build/source/texk/web2c/cwebdir/ctwill.test	2023-06-22 16:55:11 UTC (rev 67437)
@@ -5,27 +5,21 @@
 
 testdir=$srcdir/cwebdir/tests
 
-#
-# (1) Test the "classic" CTWILL procedure
-#
-# Prime the pump by running CTWILL twice
-CWEBINPUTS=$testdir ./ctwill +lpdf ham ham || exit 1
-CWEBINPUTS=$testdir ./ctwill +lpdf ham ham || exit 1
+# Test CTWILL by running it twice
+CWEBINPUTS=$testdir ./ctwill ham ham || exit 1
+CWEBINPUTS=$testdir ./ctwill ham ham || exit 1
 
 # Test CTWILL-REFSORT
 ./ctwill-refsort < $testdir/ham.ref > ham.sref || exit 1
 diff ham.sref $testdir/ham.sref || exit 1
 
-#
-# (2) Test the "proofing" CTWILL procedure
-#
-CWEBINPUTS=$testdir ./ctwill +P +lpdf ham ham || exit 1
-CWEBINPUTS=$testdir ./ctwill +P +lpdf ham ham || exit 1
+# Test CTWILL-PROOFSORT
+# Perl script not available in builddir
+$testdir/../ctwill-proofsort ham.tex > ham-sorted.tex || exit 1
+diff ham-sorted.tex $testdir/ham-sorted.tex || exit 1
 
-# Test CTWILL-PROOFSORT---NOT!
-# First, it doesn't show up in Work/texk/web2c/ and
-# second, Perl complains about the unresolved $Revision$ and §Date$.
-#./ctwill-proofsort ham.tex > ham-sorted.tex || exit 1
-#diff ham-sorted.tex $testdir/ham-sorted.tex || exit 1
+# Test CTWILL-TWINX
+./ctwill-twinx ham.tex > index.tex
+diff index.tex $testdir/index.tex || exit 1
 
 exit 0

Modified: trunk/Build/source/texk/web2c/cwebdir/ctwimac.tex
===================================================================
--- trunk/Build/source/texk/web2c/cwebdir/ctwimac.tex	2023-06-22 14:49:33 UTC (rev 67436)
+++ trunk/Build/source/texk/web2c/cwebdir/ctwimac.tex	2023-06-22 16:55:11 UTC (rev 67437)
@@ -461,7 +461,7 @@
   \def\Us{\note{Used in sections}} % crossref for uses of a section
   \def\I{\par\hangindent 2em}\let\*=*
   \readsections}
-\def\readsections{\input \jobname.sscn}
+\def\readsections{\input \jobname.scn}
 \def\datethis{} \def\datecontentspage{}
 
 % To produce only a subset of pages, put the page numbers on separate

Added: trunk/Build/source/texk/web2c/cwebdir/tests/index.tex
===================================================================
--- trunk/Build/source/texk/web2c/cwebdir/tests/index.tex	                        (rev 0)
+++ trunk/Build/source/texk/web2c/cwebdir/tests/index.tex	2023-06-22 16:55:11 UTC (rev 67437)
@@ -0,0 +1,45 @@
+\input cttwinxmac
+\I\|{a}\unskip, {\sc HAM}~\[1].
+\I\\{aa}\unskip, {\sc HAM}~\[1], 5, 6, 7.
+\I\\{advance}\unskip, {\sc HAM}~\[4], 5, 7.
+\I\&{Arc}\unskip, {\sc HAM}~1.
+\I\\{arcs}\unskip, {\sc HAM}~1, 3, 5, 6.
+\I\\{argc}\unskip, {\sc HAM}~\[1], 2.
+\I\\{argv}\unskip, {\sc HAM}~\[1], 2.
+\I\\{ark}\unskip, {\sc HAM}~\[4], 5, 7, 8.
+\I\|{b}\unskip, {\sc HAM}~\[1].
+\I\\{backtrack}\unskip, {\sc HAM}~\[4], 5.
+\I\\{bb}\unskip, {\sc HAM}~\[1].
+\I\\{count}\unskip, {\sc HAM}~\[1], 9.
+\I\|{d}\unskip, {\sc HAM}~\[1].
+\I\\{deg}\unskip, {\sc HAM}~\[1], 3, 5, 6.
+\I\\{dmin}\unskip, {\sc HAM}~\[1], 3.
+\I\\{done}\unskip, {\sc HAM}~\[4], 8.
+\I\\{exit}\unskip, {\sc HAM}~2.
+\I\\{fprintf}\unskip, {\sc HAM}~2.
+\I\|{g}\unskip, {\sc HAM}~\[1].
+\I\&{Graph}\unskip, {\sc HAM}~1.
+\I\\{main}\unskip, {\sc HAM}~\[1].
+\I\\{modulus}\unskip, {\sc HAM}~\[1], 2, 9.
+\I\\{name}\unskip, {\sc HAM}~1, 9.
+\I\\{next}\unskip, {\sc HAM}~1, 3, 5, 6, 7, 8.
+\I\\{printf}\unskip, {\sc HAM}~1, 9.
+\I\\{restore}\unskip, {\sc HAM}~\[4], 5, 7.
+\I\\{restore\_all}\unskip, {\sc HAM}~\[7], 8.
+\I\\{restore\_graph}\unskip, {\sc HAM}~1, 2.
+\I\\{sscanf}\unskip, {\sc HAM}~2.
+\I\\{stderr}\unskip, {\sc HAM}~2.
+\I\|{t}\unskip, {\sc HAM}~\[1].
+\I\\{taken}\unskip, {\sc HAM}~\[3], 4, 5, 7, 8.
+\I\\{tip}\unskip, {\sc HAM}~1, 5, 6, 7.
+\I\\{tmax}\unskip, {\sc HAM}~\[1], 4, 5, 9.
+\I\\{try\_next}\unskip, {\sc HAM}~\[4], 8.
+\I\|{u}\unskip, {\sc HAM}~\[1].
+\I\|{v}\unskip, {\sc HAM}~\[1].
+\I\\{vert}\unskip, {\sc HAM}~\[4], 5, 6, 8, 9.
+\I\&{Vertex}\unskip, {\sc HAM}~1.
+\I\\{vertices}\unskip, {\sc HAM}~1, 3, 4, 8, 9.
+\I\|{x}\unskip, {\sc HAM}~\[1].
+\I\|{y}\unskip, {\sc HAM}~\[1].
+\I\|{z}\unskip, {\sc HAM}~\[1].
+\fin



More information about the tex-live-commits mailing list.