diff options
Diffstat (limited to 'Build/source/texk')
63 files changed, 1536 insertions, 1323 deletions
diff --git a/Build/source/texk/kpathsea/ChangeLog b/Build/source/texk/kpathsea/ChangeLog index cbcee62f617..7f1108ee6c9 100644 --- a/Build/source/texk/kpathsea/ChangeLog +++ b/Build/source/texk/kpathsea/ChangeLog @@ -1,3 +1,8 @@ +2024-08-19 Karl Berry <karl@freefriends.org> + + * tex-file.c (kpathsea_name_ok) <not_ok>: avoid spurious double space + in message. + 2024-07-01 Karl Berry <karl@tug.org> * texmf.cnf (shell_escape_commands): restore extractbb, diff --git a/Build/source/texk/kpathsea/tex-file.c b/Build/source/texk/kpathsea/tex-file.c index a748920d250..b7097d4d687 100644 --- a/Build/source/texk/kpathsea/tex-file.c +++ b/Build/source/texk/kpathsea/tex-file.c @@ -1367,7 +1367,7 @@ kpathsea_name_ok (kpathsea kpse, const_string fname, const_string check_var, not_ok: /* Some test failed. */ if (!silent) - fprintf (stderr, "\n%s: Not %s %s (%s = %s; %s extended check).\n", + fprintf (stderr, "\n%s: Not %s %s (%s = %s; %sextended check).\n", kpse->invocation_name, ok_type_name[action], fname, check_var, open_choice, extended ? "" : "no "); if (expanded_fname) free ((void *) expanded_fname); diff --git a/Build/source/texk/texlive/linked_scripts/latexdiff/latexdiff-vc.pl b/Build/source/texk/texlive/linked_scripts/latexdiff/latexdiff-vc.pl index 697d1e29b76..31760ca14ca 100755 --- a/Build/source/texk/texlive/linked_scripts/latexdiff/latexdiff-vc.pl +++ b/Build/source/texk/texlive/linked_scripts/latexdiff/latexdiff-vc.pl @@ -26,6 +26,12 @@ # Detailed usage information at the end of the file # # TODO/IDEAS: - option to call external pre-processing codes +# +# version 1.3.4: +# - Enhancement: if --flatten option is used, and no bbl file is included in the version management, then latexdiff-vc will try to run bibtex to generate the bbl file. Implements the suggestion of PR #127 (contributed by github user cousteaulecommandant ) +# - Efficiency boost: use -draftmode for non-interactive preliminary runs of latex (idea from # +# - bug fix: minor fix for --only-changed that makes detection of changed pages more reliable [ PR #297 contributed by user nelijuc ] +# # version 1.3.2: # - bug fix: when setting config variables with the command lines it is now possible to use quotes to includes spaces in the value, e.g. -c LATEX="pdflatex --shell-escape" # - bug fix: --only-changes is not compatible with graphics markup. --graphics-markup=none is now set automatically @@ -71,7 +77,7 @@ use Getopt::Long ; use Pod::Usage qw/pod2usage/ ; use File::Temp qw/tempdir/ ; -use File::Basename qw/dirname/; +use File::Basename qw/dirname fileparse/; use File::Copy; use File::Path; @@ -79,8 +85,8 @@ use strict ; use warnings ; my $versionstring=<<EOF ; -This is LATEXDIFF-VC 1.3.2 - (c) 2005-2021 F J Tilmann +This is LATEXDIFF-VC 1.3.4 + (c) 2005-2024 F J Tilmann EOF # output debug and intermediate files, set to 0 in final distribution @@ -98,6 +104,8 @@ my ($configlatexdiff,@config,$config,$assign); #my $latexcmd="latex"; # latex compiler if not further identified my $vc=""; my $tempdir=tempdir(CLEANUP => 1); # generate a temp dir, which will automatically be deleted at program exit +#printf STDERR "DEBUG: tempdir $tempdir\n"; + # Variables my ($file1,$file2,$diff,$diffbase,$rootdir,$answer,$options,$infile,$append,$dirname,$cwd); my (@files,@ldoptions,@tmpfiles,@ptmpfiles,@difffiles,$extracomp); # , @@ -419,30 +427,39 @@ while ( $infile=$file2=shift @files ) { print STDERR "Working on $infile \n"; if ( scalar(@revs) == 1 ) { if ( defined($flatten) ) { - my $olddir=$tempdir . "/latexdiff-vc-$revs[0]"; - print STDERR "Checking out old dir into: $olddir (rev: $revs[0])\n"; - checkout_dir($revs[0],$olddir); - $file1=$olddir ."/".$infile; - } else { - ($file1=$infile) =~ s/\.(tex|bbl|flt)/-oldtmp-$$.$1/ ; - push @tmpfiles,$file1; - # compare file with previous version ($revs[0]="") or specified version - ### system("$diffcmd$revs[0] $infile| $patchcmd -o$file1") ; - if (system("$diffcmd$revs[0] \"$infile\" | $patchcmd -o\"$file1\"")==0 and -z $file1 ) { - # no differences detected, i.e. file is equal to current version - copy($infile,$file1) || die "copy($infile,$file1) failed: $!"; - } - } + my $olddir=$tempdir . "/latexdiff-vc-$revs[0]"; + print STDERR "Checking out old dir into: $olddir (rev: $revs[0])\n"; + checkout_dir($revs[0],$olddir,$infile); + $file1=$olddir ."/".$infile; + + # generate bibliography for new file if + if ( greptex('^[^%]*\\\\bibliography\\{',$infile) == 0) { + my ($filebase,$filedir)=fileparse($infile,".tex"); + if ( ! -e "$filedir$filebase.bbl" ) { + system("$CFG{LATEX} -draftmode -interaction=batchmode '$infile'; $CFG{BIBTEX} '$filedir$filebase'") + or die "Something went wrong in executing: $CFG{LATEX} -draftmode -interaction=batchmode '$infile'; $CFG{BIBTEX} '$filedir$filebase'" ; + } + } + } else { + ($file1=$infile) =~ s/\.(tex|bbl|flt)/-oldtmp-$$.$1/ ; + push @tmpfiles,$file1; + # compare file with previous version ($revs[0]="") or specified version + ### system("$diffcmd$revs[0] $infile| $patchcmd -o$file1") ; + if (system("$diffcmd$revs[0] \"$infile\" | $patchcmd -o\"$file1\"")==0 and -z $file1 ) { + # no differences detected, i.e. file is equal to current version + copy($infile,$file1) || die "copy($infile,$file1) failed: $!"; + } + } } elsif ( scalar(@revs) == 2 ) { if ( defined($flatten) ) { my $olddir=$tempdir . "/latexdiff-vc-$revs[0]"; print STDERR "Checking out old dir into: $olddir (rev: $revs[0])\n"; - checkout_dir($revs[0],$olddir); + checkout_dir($revs[0],$olddir,$infile); $file1=$olddir ."/".$infile; my $newdir=$tempdir . "/latexdiff-vc-$revs[1]"; print STDERR "Checking out new dir into: $newdir\n"; - checkout_dir($revs[1],$newdir); + checkout_dir($revs[1],$newdir,$infile); $file2=$newdir ."/".$infile; } else { ($file1=$infile) =~ s/\.(tex|bbl|flt)/-oldtmp-$$.$1/ ; @@ -468,7 +485,7 @@ while ( $infile=$file2=shift @files ) { } else { ($diff=$infile) =~ s/\.(tex|bbl|flt)$/$append.$1/ ; } - + # make directories if needed $dirname=dirname($diff) ; system("mkdir -p $dirname") unless ( -e $dirname ); @@ -488,13 +505,14 @@ while ( $infile=$file2=shift @files ) { die "Abort ... " ; } } + print STDERR "Running: $CFG{LATEXDIFF} $options \"$file1\" \"$file2\" > \"$diff\"\n"; unless ( system("$CFG{LATEXDIFF} $options \"$file1\" \"$file2\" > \"$diff\"") == 0 ) { print STDERR "Something went wrong in $CFG{LATEXDIFF}. Deleting $diff and abort\n" ; unlink $diff ; exit(5) }; print "Generated difference file $diff\n"; - if ( $run and !( scalar(@revs) && greptex( qr/\\document(?:class|style)/ , $diff ) ) ) { + if ( $run and !( scalar(@revs) && greptex( qr/\\document(?:class|style)/ , $diff,25) ) ) { # save filename for later processing if postscript or pdf conversion is requested and either two-file mode was used (scalar(@revs)==0) or the diff file contains documentclass statement (ie. is a root document) push @difffiles, $diff ; } @@ -519,19 +537,20 @@ foreach $diff ( @difffiles ) { if ( $run ) { print STDERR "PDF: $pdf Postscript: $postscript cwd $cwd\n" if $debug; - if ( system("grep -q \'^[^%]*\\\\bibliography{\' \"$diff\"") == 0 ) { - system("$CFG{LATEX} --interaction=batchmode \"$diff\"; $CFG{BIBTEX} \"$diffbase\";"); +# if ( system("grep -q \'^[^%]*\\\\bibliography{\' \"$diff\"") == 0 ) { + if ( greptex('^[^%]*\\\\bibliography{',$diff ) == 0 ) { + system("$CFG{LATEX} -draftmode -interaction=batchmode \"$diff\"; $CFG{BIBTEX} \"$diffbase\";"); push @ptmpfiles, "$diffbase.bbl","$diffbase.bbl" ; } # if special needs, as CHANGEBAR if ( $extracomp ) { # print "Extracomp\n"; - system("$CFG{LATEX} --interaction=batchmode \"$diff\";"); + system("$CFG{LATEX} -draftmode -interaction=batchmode \"$diff\";"); } # final compilation - system("$CFG{LATEX} --interaction=batchmode \"$diff\";"); # needed if cross-refs + system("$CFG{LATEX} -draftmode -interaction=batchmode \"$diff\";"); # needed if cross-refs system("$CFG{LATEX} \"$diff\";"); # final, with possible error messages if ( $rundvi2 ) { @@ -586,10 +605,10 @@ sub findchangedpages { my %start; open(AUX,$auxfile) or die ("Could open aux file $auxfile . System error: $!"); while (<AUX>) { - if (m/\\zref\@newlabel\{DIFchgb(\d*)\}\{.*\\abspage\{(\d*)\}\}/ ) { + if (m/\\zref\@newlabel\{DIFchgb(\d*)\}\{.*\\abspage\{(\d*)\}.*\}/ ) { $start{$1}=$2; $pages{$2}=1; } - if (m/\\zref\@newlabel\{DIFchge(\d*)\}\{.*\\abspage\{(\d*)\}\}/) { + if (m/\\zref\@newlabel\{DIFchge(\d*)\}\{.*\\abspage\{(\d*)\}.*\}/) { if (defined($start{$1})) { for ($j=$start{$1}; $j<=$2; $j++) { $pages{$j}=1; @@ -643,12 +662,14 @@ sub compresspages { return @res; } -# checkout_dir(rev,dirname) +# checkout_dir(rev,dirname, <file>) # checks out revision rev and stores it in dirname -# uses global variables: $vc, $rootdir +# If argument <file> is provided, check if this file imports a bibliography and generate it if necessary +# uses global variables: $vc, $rootdir, $CFG sub checkout_dir { - my ($rev,$dirname)=@_; + my ($rev,$dirname,$file)=@_; + my ($filebase,$filedir); unless (-e $dirname) { mkpath([ $dirname ]) or die "Cannot mkdir $dirname ." ;} if ( $vc eq "SVN" ) { system("svn checkout -r $rev $rootdir $dirname")==0 or die "Something went wrong in executing: svn checkout -r $rev $rootdir $dirname"; @@ -660,13 +681,25 @@ sub checkout_dir { } else { die "checkout_dir: only works with SVN, HG and GIT VCS system (selected: $vc)"; } + # Check if the main file needs a bbl generated + if ( defined($file) and greptex('^[^%]*\\\\bibliography\\{',$file) == 0) { + ($filebase,$filedir)=fileparse($file,".tex"); + if ( ! -e "$filedir$filebase.bbl" ){ + printf STDERR "Running $CFG{BIBTEX} to generate $filedir$filebase.bbl.\n"; + system("cd '$dirname'; $CFG{LATEX} -draftmode -interaction=batchmode '$file'; $CFG{BIBTEX} '$filedir$filebase'")==0 + or die "Something went wrong in executing: cd '$dirname'; $CFG{LATEX} -draftmode -interaction=batchmode '$file'; $CFG{BIBTEX} '$filedir$filebase'" ; + } +# else { # DEBUG +# printf STDERR "DEBUG: Skipping bbl file generation as $filedir$filebase.bbl already exists.\n" +# } #DEBUG + } } -# greptex returns 1 if regex is not matched in filename -# only the 25 first non-comment lines are scanned +# greptex($regex,$filename, <lines>) returns 1 if regex is not matched in filename +# only the first <lines> non-comment lines are scanned; by default everythin is scanned # 0 if there is a match sub greptex { - my ($regex,$filename)=@_; + my ($regex,$filename,$nlines)=@_; my ($i)=0; open (FH, $filename) or die("Couldn't open $filename: $!"); while (<FH>) { @@ -675,9 +708,9 @@ sub greptex { close(FH); return(0); } - # only scan 25 lines + # only scan <nlines> lines, if optional parameter proviede $i++; - last if $i>25 ; + last if defined($nlines) and $i>$nlines ; } close(FH); return(1); @@ -761,7 +794,7 @@ complete directory hierarchy. Optionally, a pathname F<path> can be specified, =item B<--flatten,--flatten=keep-intermediate> If combined with C<--git>, C<--svn> or C<--hg> option or the corresponding modes, check out the revisions to compare in a separate temporary directory, and then pass on option C<--flatten> to latexdiff. The directory in which C<latexdiff-vc> is invoked defines the subtree which will be checked out. -Note that if additional files are needed which are not included in the flatten procedure (package files, included graphics), they need to be accessible in the current directory. If you use bibtex, it is recommended to include the C<.bbl> file in the version management. +Note that if additional files are needed which are not included in the flatten procedure (package files, included graphics), they need to be accessible in the current directory. If you use bibtex, it is recommended to include the C<.bbl> file in the version management. From latexdiff-vc >=1.3.4 there is an attempt to create the C<.bbl> file by running bibtex in the retrieved subdirectories; note that the bibtex is run in the temporary subdirectories so any .bib or .bst files either need to be under version management, or in the global search paths for bibtex (shell environment variables C<BIBINPUTS> and C<BSTINPUTS>). The generic usage of this function is : C<latexdiff-vc --flatten -r rev1 [-r rev2] master.tex> where master.tex is the project file containing the highest level of includes etc. @@ -798,7 +831,7 @@ Available variables for latexdiff-vc: =over 8 -=item C<LATEXDIFF> latexdiff command (e.g. latexdiff-fast, latexdiff-so). This command should support the option C<--interaction=batchmode> +=item C<LATEXDIFF> latexdiff command (e.g. latexdiff-fast, latexdiff-so). This command should support the options C<-draftmode> and C<-interaction=batchmode> =item C<LATEX> latex command (e.g. pdflatex, lualatex) @@ -847,7 +880,7 @@ Show version number =back -All other options are passed on to C<latexdiff>. +All other options are passed on to C<latexdiff>. Note that it is not always easy for latexdiff to correctly assign arguments to options when short form (single letter) options are used so it is recommended to use long-form options. =head1 SEE ALSO @@ -868,7 +901,7 @@ or send them to I<tilmann -- AT -- gfz-potsdam.de>. Include the version number =head1 AUTHOR -Version 1.3.2 +Version 1.3.4a Copyright (C) 2005-2017 Frederik Tilmann This program is free software; you can redistribute it and/or modify diff --git a/Build/source/texk/texlive/linked_scripts/latexdiff/latexdiff.pl b/Build/source/texk/texlive/linked_scripts/latexdiff/latexdiff.pl index b3571d27b26..9ab8e4169bc 100755 --- a/Build/source/texk/texlive/linked_scripts/latexdiff/latexdiff.pl +++ b/Build/source/texk/texlive/linked_scripts/latexdiff/latexdiff.pl @@ -25,6 +25,21 @@ # # Note references to issue numbers are for the github repository of latexdiff: https://github.com/ftilmann/latexdiff # +# Version 1.3.4: +# New features: +# - Option to use lua-ul instead of ulem (for use with LuaLaTeX) (fix #17, #60, #188, #255, #270) +# Enhancement +# - If amsmath is detected as one of the included (based on idea in PR #263 contributed by github user xlucn +# Bug fix +# - sometimes the introduction of aux commands to show deleted lists or descriptions leaves in place empty auxiliary +# list environments, which would cause error messages (though skipping messages would result in a correct output pdf). +# These are now removed. +# - add more mboxsafecmd and safecmd commands for SIunitx to stay compatible with newer versionsof SIunitx (PR #283, fixing issue #282, contributed by github user joe6302413) +# - File added via --preamble option is no longer assumed to be ASCII, but read either with encoding as defined by --encoding option or using the encoding of the LOCALE (fixes issue #285 ) +# - multicolumn argument is now treated as text +# - when tikz-dependency package is used, \& is no longer a safe command as it has special meaning inside dependency environment. The fix is a little of a hack as really it should only be considered unsafe within dependency environment (fixes (mostly) issue #303 ) +# - listings package had trouble with non-ASCII chars. The encoding is now set (thanks to github user anka-213 for finding this). Fixes #304 +# # Version 1.3.3: # New features: # - Option --no-del to remove all deleted text (merge contributed by github user tdegeus PR #252, fixing issue #66 @@ -33,22 +48,22 @@ # - Abbreviations involving punctuations within them. They need special treatment because otherwise in some # circumstances the gnoring of white space differences in conjunction with merging according to MINWORDSBLOCK rule # could turn 'i.e.' into 'i.\PAR e.' (see https://github.com/ftilmann/latexdiff/issues/269). A few abbreviations -# are now hard-coded and treated as atomic: +# are now hard-coded and treated as atomic: # English: i.e., e.g. Deutsch: z.B. # (fixes issue #269) # - In WHOLE and COARSE math modes, now properly treat math environments with arguments such as \alignat. Fixes #251 -# - For FINE math mode, multiple improvments to the processing work flow yield more robust outcomes. In particular, changes -# to the equation type, e.g. \begin{displaymath} -> \begin{equation} without modifications now usually no longer result -# in errors. (Partially) fixes issues #235 and #244. -# - When encountering deleted math array environments such as align or eqnarray, rather than replacing them with a -# fixed replacement environment (e.g. align* or eqnarray*), an asterisk is now added to the original command, which +# - For FINE math mode, multiple improvments to the processing work flow yield more robust outcomes. In particular, changes +# to the equation type, e.g. \begin{displaymath} -> \begin{equation} without modifications now usually no longer result +# in errors. (Partially) fixes issues #235 and #244. +# - When encountering deleted math array environments such as align or eqnarray, rather than replacing them with a +# fixed replacement environment (e.g. align* or eqnarray*), an asterisk is now added to the original command, which # in amsmath (and with eqnarray) will result in the same environment but without line numbers. Config variable MATHARRREPL # is therefore (nearly) redundant, and a depracation warning is given when it is set. Reference to MATHARRREPL are have # been removed from the manual (there is one exception, when it's still being used: sometimes latexdiff can figure out # that there is a deleted array environment, but does not know which one. In this case, MATHARRREPL is still being used -# to encapsulate these parts of the source, and therefore it is still set internally. But this is a quite rare situation). +# to encapsulate these parts of the source, and therefore it is still set internally. But this is a quite rare situation). # Fixes issue #216 -# - Unlike 'array' environment, 'split' (amsmath) does not work in argument of \DIFadd or \DIFdl in UNDERLINE modes; therefore remove it from ARRENV configuration variable. +# - Unlike 'array' environment, 'split' (amsmath) does not work in argument of \DIFadd or \DIFdl in UNDERLINE modes; therefore remove it from ARRENV configuration variable. # Exclude \begin and \end in math environments in COARSE and WHOLE modes. Fixes #258. Fixes #109 # - --flatten now works for empty files. Fixes issue #242 # - improved processing of Chinese and Japanese texts in that splitting is done based on characters. Thanks to LuXu (Oliver Lew) in git for working this out. Fixes #229, fixes #145 @@ -65,7 +80,7 @@ # Bug fixes: # - fix issue #206 affecting proper markup of text commands which are not also safe cmd's and have multiple arguments # - fix issue #210 by adding \eqref (amsmath package) to the list of safe commands -# - fix bug reported in issue #168 mangled verbatim line environment +# - fix bug reported in issue #168 mangled verbatim line environment # - fix bug reported in issue #218 by replacing \hspace{0pt} after \mbox{..} auxiliary commands with \hskip0pt. # - more ways to process \frac correctly with atomic arguments (committed by julianuu PR #246 # - fix a bug in biblatex mode, which prevented proper processing of modified \textcite (see: https://tex.stackexchange.com/questions/555157/latexdiff-and-biblatex-citation-commands) @@ -74,10 +89,10 @@ # Version 1.3.1.1 # - remove spurious \n to fix error: Unknown regexp modifier "/n" at .../latexdiff line 1974, near "=~ " (see github issue #201) # -# Version 1.3.1 +# Version 1.3.1 # Bug fixes: # - remove some uninitialised variable $2 warnings in string substitution in flatten function in case included file is not found -# - add minimal postprocessing to diff processing of preamble commands (replace \RIGHTBRACE by \} ) +# - add minimal postprocessing to diff processing of preamble commands (replace \RIGHTBRACE by \} ) # - pre-processing: replace (contributed) routine take_comments_and_enter_from_frac() with take_comments_and_newline_from_frac(), which does the same thing # (remove whitespace characters and comments between the argument of \frac commands) in an easier and more robust way. In addition, it # will replace commands like \frac12 with \frac{1}{2} as pre-processing step. Fixes issue #184 @@ -95,15 +110,15 @@ # Version 1.3.0 (7 October 2018): # - treat options to \documentclass as potential package names (some packages allow implicit loading of or imply selected packages # - improved pattern matching: now allows nested angular brackets, and is no longer confused by escaped curly braces -# - improved pattern matching in COARSE mode: occasionally, the closing bracket or some other elements would be matched in an 'unnatural' way due to another sequence being more minimal in the computational sense, sometimes even causing errors due to tokens moving in or out of the scope of math environments. This is now discouraged by adding internal \DIFANCHOR commands (which are removed again in post-processing) (fixes issues reported via email by li_ruomeng . +# - improved pattern matching in COARSE mode: occasionally, the closing bracket or some other elements would be matched in an 'unnatural' way due to another sequence being more minimal in the computational sense, sometimes even causing errors due to tokens moving in or out of the scope of math environments. This is now discouraged by adding internal \DIFANCHOR commands (which are removed again in post-processing) (fixes issues reported via email by li_ruomeng . # - verbatim and lstlisting environments are marked-up with line-by-line in a similar style to non-verbatim text (requires the listing package to be installed) # (see new configuration variable VERBATIMLINEENV) (several issues and pull requests by jprotze) -# - --flatten: now supports \verbatiminput and \lstlistinput +# - --flatten: now supports \verbatiminput and \lstlistinput # - --flatten: if file is not found, do not fail, simply warn and leave command unexpanded (inspired by issue #112). Don't warn if file name contains #[0-9] as it is then most likely an argument within a command definition rather than an actual file (applies to \input, \subfile, \include commands) # - added to textcmds: \intertext # - new config variable CUSTOMDIFCMD to allow defining special versions of commands in added or deleted blocks (Pull request by github user jprotze) # - added option -no-links (mostly for use by latexdiff-vc in only-changes modes) (Pull request by github user jprotze) -# - new option --filter-script to run both input through a pre-processing script (PR jasonmccsmith #167) +# - new option --filter-script to run both input through a pre-processing script (PR jasonmccsmith #167) # new option --no-filter-stderr to hide stderr output from filter-script (potentially dangerous, as this might hide malfunctioning of filter scripts) # - --flatten now can deal with imports made using the import package {PR jasonmccsmith #173) # Bug fixes: @@ -122,12 +137,12 @@ # make environments that are treated like verbatim environments configurable (config variable VERBATIMENV) # treat lstinlne as equivalent to verb command # partially addresses issue #38 -# - refactoring: set default configuration variables in a hash, and those that correspond to lists +# - refactoring: set default configuration variables in a hash, and those that correspond to lists # - feature: option --add-to-config used to amend configuration variables, which are regex pattern lists # - bug fix: deleted figures when endfloat package is activated # - bug fix: alignat environment now always processed correctly (fix issues #65) # - bug fix: avoid processing of commands as potential files in routine init_regex_arr (fix issue #70 ) -# - minimal feature enhancement: treat '@' as allowed character in commands (strictly speaking requires prior \makeatletter statement, but always assuming it to be +# - minimal feature enhancement: treat '@' as allowed character in commands (strictly speaking requires prior \makeatletter statement, but always assuming it to be # @ a letter if it is part of a command name will usually lead to the correct behaviour (see http://tex.stackexchange.com/questions/346651/latexdiff-and-let) # - new feature/bug fix: --flatten option \endinput in included files now respected but only if \endinput stands right at the beginning of the line (issue #77) # - bug fix: flatten would incorrectly attempt to process commented out \include commands (from discussion in issue #77 ) @@ -165,7 +180,7 @@ # - introduce list UNSAFEMATHCMD, which holds list of commands which cannot be marked up with \DIFadd or \DIFdel commands (only relevant for WHOLE and COARSE math markup modes) # - new subtype LABEL which gives each change a label. This can later be used to only display pages where changes # have been made (instructions for that are put as comments into the diff'ed file) inspired by answer on http://tex.stackexchange.com/questions/166049/invisible-markers-in-pdfs-using-pdflatex -# - Configuration variables take into accout some commands from additional packages: +# - Configuration variables take into accout some commands from additional packages: # tikzpicture environment now treated as PICTUREENV, and \smallmatrix in ARRENV (amsmath) # - --flatten: support for \subfile command (subfiles package) (in response to http://tex.stackexchange.com/questions/167620/latexdiff-with-subfiles ) # - --flatten: \bibliography commands expand if corresponding bbl file present @@ -179,11 +194,11 @@ # - \% in one-letter sub/Superscripts was not converted correctly # # Version 1.0.3 -# - fix bug in add_safe_commands that made latexdiff hang on DeclareMathOperator +# - fix bug in add_safe_commands that made latexdiff hang on DeclareMathOperator # command in preamble # - \(..\) inline math expressions were not parsed correctly, if they contained a linebreak # - applied patch contributed by tomflannaghan via Berlios: [ Patch #3431 ] Adds correct handling of \left< and \right> -# - \$ is treated correctly as a literal dollar sign (thanks to Reed Cartwright and Joshua Miller for reporting this bug +# - \$ is treated correctly as a literal dollar sign (thanks to Reed Cartwright and Joshua Miller for reporting this bug # and sketching out the solution) # - \^ and \_ are correctly interpreted as accent and underlined space, respectively, not as superscript of subscript # (thanks to Wail Yahyaoui for pointing out this bug) @@ -191,19 +206,19 @@ # Version 1.0.1 - treat \big,\bigg etc. equivalently to \left and # \right - include starred version in MATHENV - apply # - flatten recursively and --flatten expansion is now -# aware of comments (thanks to Tim Connors for patch) +# aware of comments (thanks to Tim Connors for patch) # - Change to post-processing for more reliability for # deleted math environments -# - On linux systems, recognise and remove DOS style newlines +# - On linux systems, recognise and remove DOS style newlines # - Provide markup for some special preamble commands (\title, -# \author,\date, -# - configurable by setting context2cmd +# \author,\date, +# - configurable by setting context2cmd # - for styles using ulem package, remove \emph and \text.. from list of # safe commands in order to allow linebreaks within the -# highlighted sections. -# - for ulem style, now show citations by enclosing them in \mbox commands. -# This unfortunately implies linebreaks within citations no longer function, -# so this functionality can be turned off (Option --disable-citation-markup). +# highlighted sections. +# - for ulem style, now show citations by enclosing them in \mbox commands. +# This unfortunately implies linebreaks within citations no longer function, +# so this functionality can be turned off (Option --disable-citation-markup). # With --enable-citation-markup, the mbox markup is forced for other styles) # - new substyle COLOR. This is particularly useful for marking up citations # and some special post-processing is implemented to retain cite @@ -211,11 +226,11 @@ # - four different levels of math-markup # - Option --driver for choosing driver for modes employing changebar package # - accept \\* as valid command (and other commands of form \.*). Also accept -# \<nl> (backslashed newline) +# \<nl> (backslashed newline) # - some typo fixes, include commands defined in preamble as safe commands -# (Sebastian Gouezel) +# (Sebastian Gouezel) # - include compared filenames as comments as line 2 and 3 of -# the preamble (can be modified with option --label, and suppressed with +# the preamble (can be modified with option --label, and suppressed with # --no-label), option --visible-label to show files in generated pdf or dvi # at the beginning of main document # @@ -231,7 +246,7 @@ # # Version 0.4 March 06 option for fast differencing using UNIX diff command, several minor bug fixes (\par bug, improved highlighting of textcmds) # -# Version 0.3 August 05 improved parsing of displayed math, --allow-spaces +# Version 0.3 August 05 improved parsing of displayed math, --allow-spaces # option, several minor bug fixes # # Version 0.25 October 04 Fix bug with deleted equations, add math mode commands to safecmd, add | to allowed interpunctuation signs @@ -704,12 +719,13 @@ use utf8 ; use File::Spec ; + my ($algodiffversion)=split(/ /,$Algorithm::Diff::VERSION); my ($versionstring)=<<EOF ; -This is LATEXDIFF 1.3.3 (Algorithm::Diff $Algorithm::Diff::VERSION, Perl $^V) - (c) 2004-2022 F J Tilmann +This is LATEXDIFF 1.3.4 (Algorithm::Diff $Algorithm::Diff::VERSION, Perl $^V) + (c) 2004-2024 F J Tilmann EOF # Hash with defaults for configuration variables. These marked undef have default values constructed from list defined in the DATA block @@ -800,9 +816,9 @@ my $DELCMDOPEN='%DIFDELCMD < '; # To mark begin of deleted commands (must begin my $DELCMDCLOSE="%%%\n"; # To mark end of deleted commands (must end with a new line) my $AUXCMD='%DIFAUXCMD' ; # follows auxiliary commands put in by latexdiff to make difference file legal # auxiliary commands must be on a line of their own - # Note that for verbatim environment openings the %DIFAUXCMD cannot be placed in + # Note that for verbatim environment openings the %DIFAUXCMD cannot be placed in # the same line as this would mean they are shown - # so the special form "%DIFAUXCMD NEXT" is used to indicate that the next line + # so the special form "%DIFAUXCMD NEXT" is used to indicate that the next line # is an auxiliary command # Similarly "%DIFAUXCMD LAST" would indicate the auxiliary command is in previous line (not currently used) my $DELCOMMENT='DIF < '; # To mark deleted comment line @@ -813,21 +829,21 @@ my @TEXTCMDLIST=(); # array containing patterns of commands with text arguments my @TEXTCMDEXCL=(); # array containing patterns of commands without text arguments (if a pattern # matches both TEXTCMDLIST and TEXTCMDEXCL it is excluded) my @CONTEXT1CMDLIST=(); # array containing patterns of commands with text arguments (subset of text commands), - # but which cause confusion if used out of context (e.g. \caption). + # but which cause confusion if used out of context (e.g. \caption). # In deleted passages, the command will be disabled but its argument is marked up - # Otherwise they behave exactly like TEXTCMD's + # Otherwise they behave exactly like TEXTCMD's my @CONTEXT1CMDEXCL=(); # exclude list for above, but always empty my @CONTEXT2CMDLIST=(); # array containing patterns of commands with text arguments, but which fail or cause confusion # if used out of context (e.g. \title). They and their arguments will be disabled in deleted # passages my @CONTEXT2CMDEXCL=(); # exclude list for above, but always empty my @MATHTEXTCMDLIST=(); # treat like textcmd. If a textcmd is in deleted or added block, just wrap the - # whole content with \DIFadd or \DIFdel irrespective of content. This functionality + # whole content with \DIFadd or \DIFdel irrespective of content. This functionality # is useful for pseudo commands \MATHBLOCK.. into which math environments are being - # transformed -my @MATHTEXTCMDEXCL=(); # + # transformed +my @MATHTEXTCMDEXCL=(); # -# Note I need to declare this with "our" instead of "my" because later in the code I have to "local"ise these +# Note I need to declare this with "our" instead of "my" because later in the code I have to "local"ise these our @SAFECMDLIST=(); # array containing patterns of safe commands (which do not break when in the argument of DIFadd or DIFDEL) our @SAFECMDEXCL=(); my @MBOXCMDLIST=(); # patterns for commands which are in principle safe but which need to be surrounded by an \mbox @@ -892,7 +908,7 @@ $mathmarkup=COARSE; $verbose=0; $onlyadditions=0; # output debug and intermediate files, set to 0 in final distribution -$debug=0; +$debug=0; # insert preamble directly after documentclass - experimental feature, set to 0 in final distribution # Note that this failed with mini example (or other files, where packages used in latexdiff preamble # are called again with incompatible options in preamble of resulting file) @@ -915,9 +931,9 @@ END my %verbhash; Getopt::Long::Configure('bundling'); -GetOptions('type|t=s' => \$type, - 'subtype|s=s' => \$subtype, - 'floattype|f=s' => \$floattype, +GetOptions('type|t=s' => \$type, + 'subtype|s=s' => \$subtype, + 'floattype|f=s' => \$floattype, 'config|c=s' => \@configlist, 'add-to-config=s' => \@addtoconfiglist, 'preamble|p=s' => \$preamblefile, @@ -966,11 +982,11 @@ if ( $help ) { if ( $version ) { - print STDERR $versionstring ; + print STDERR $versionstring ; exit 0; } -print STDERR $versionstring if $verbose; +print STDERR $versionstring if $verbose; if (defined($showall)){ $showpreamble=$showsafe=$showtext=$showconfig=1; @@ -988,7 +1004,7 @@ if (defined($mathmarkup)) { $mathmarkup=~tr/a-z/A-Z/; if ( $mathmarkup eq 'OFF' ){ $mathmarkup=OFF; - } elsif ( $mathmarkup eq 'WHOLE' ){ + } elsif ( $mathmarkup eq 'WHOLE' ){ $mathmarkup=WHOLE; } elsif ( $mathmarkup eq 'COARSE' ){ $mathmarkup=COARSE; @@ -1091,7 +1107,7 @@ foreach $config ( @configlist ) { } } foreach $assign ( @config ) { - $assign=~ m/\s*(\w*)\s*=\s*(\S*)\s*$/ or die "Illegal assignment $assign in configuration list (must be variable=value)"; + $assign=~ m/\s*(\w*)\s*=\s*(\S*)\s*$/ or die "Illegal assignment $assign in configuration list (must be variable=value)"; exists $CONFIG{$1} or die "Unknown configuration variable $1."; $CONFIG{$1}=$2; } @@ -1128,7 +1144,7 @@ foreach $key ( keys(%CONFIG) ) { foreach $assign ( @addtoconfig ) { ###print STDERR "assign:|$assign|\n"; - $assign=~ m/\s*(\w*)\s*=\s*(\S*)\s*$/ or die "Illegal assignment $assign in configuration list (must be variable=value)"; + $assign=~ m/\s*(\w*)\s*=\s*(\S*)\s*$/ or die "Illegal assignment $assign in configuration list (must be variable=value)"; exists $CONFIG{$1} or die "Unknown configuration variable $1."; $CONFIG{$1}.=";$2"; } @@ -1143,8 +1159,8 @@ foreach ( keys(%CONFIG) ) { elsif ( $_ eq "MATHENV" ) { $MATHENV = liststringtoregex($CONFIG{$_}) ; } elsif ( $_ eq "MATHREPL" ) { $MATHREPL = $CONFIG{$_} ; } elsif ( $_ eq "MATHARRENV" ) { $MATHARRENV = liststringtoregex($CONFIG{$_}) ; } - elsif ( $_ eq "MATHARRREPL" ) { $MATHARRREPL = $CONFIG{$_} ; - print STDERR "WARNING: Setting MATHARRREPL is depracated. Generally deleted math array environments will be set to their starred varieties and the setting of MATHARREPL is ignored.\n\n" unless $MATHARRREPL =~ /eqnarray\*/ ; + elsif ( $_ eq "MATHARRREPL" ) { $MATHARRREPL = $CONFIG{$_} ; + print STDERR "WARNING: Setting MATHARRREPL is depracated. Generally deleted math array environments will be set to their starred varieties and the setting of MATHARREPL is ignored.\n\n" unless $MATHARRREPL =~ /eqnarray\*/ ; } elsif ( $_ eq "ARRENV" ) { $ARRENV = liststringtoregex($CONFIG{$_}) ; } elsif ( $_ eq "VERBATIMENV" ) { $VERBATIMENV = liststringtoregex($CONFIG{$_}) ; } @@ -1171,11 +1187,11 @@ foreach $pkg ( @packagelist ) { if ($showconfig || $showtext || $showsafe || $showpreamble) { show_configuration(); - exit 0; + exit 0; } -if ( @ARGV != 2 ) { +if ( @ARGV != 2 ) { print STDERR "2 and only 2 non-option arguments required. Write latexdiff -h to get help\n"; exit(2); } @@ -1183,7 +1199,7 @@ if ( @ARGV != 2 ) { # Are extra spaces between command arguments permissible? my $extraspace; if ($allowspaces) { - $extraspace='\s*'; + $extraspace='\s*'; } else { $extraspace=''; } @@ -1206,14 +1222,14 @@ push(@SAFECMDLIST, qr/^QLEFTBRACE$/, qr/^QRIGHTBRACE$/); # if you get "undefined control sequence MATHBLOCKmath" error, increase the maximum value in this loop for (my $i_pat = 0; $i_pat < 20; ++$i_pat){ $pat_n = '(?:[^{}]|\{'.$pat_n.'\}|\\\\\{|\\\\\})*'; - # Actually within the text body, quoted braces are replaced in pre-processing. The only place where + # Actually within the text body, quoted braces are replaced in pre-processing. The only place where # the last part of the pattern matters is when processing the arguments of context2cmds in the preamble # and these contain a \{ or \} combination, probably rare. # It should thus be fine to use the simpler version below. ### $pat_n = '(?:[^{}]|\{'.$pat_n.'\})*'; } - my $brat0 = '(?:[^\[\]]|\\\[|\\\])*'; + my $brat0 = '(?:[^\[\]]|\\\[|\\\])*'; my $brat_n = $brat0; for (my $i_pat = 0; $i_pat < 4; ++$i_pat){ $brat_n = '(?:[^\[\]]|\['.$brat_n.'\]|\\\[|\\\])*'; @@ -1230,7 +1246,7 @@ push(@SAFECMDLIST, qr/^QLEFTBRACE$/, qr/^QRIGHTBRACE$/); # could turn 'i.e.' into 'i.\PAR e.' (see https://github.com/ftilmann/latexdiff/issues/269) # English: i.e., e.g. Deutsch: z.B. my $abbreviation='(?:i\. ?e\.|e\. ?g\.|z\. ?B\.)' ; - my $number='-?\d*\.\d*'; + my $number='-?\d*\.\d*'; # word: sequence of letters or accents followed by letter my $word_cj='\p{Han}|\p{InHiragana}|\p{InKatakana}'; @@ -1258,7 +1274,7 @@ push(@SAFECMDLIST, qr/^QLEFTBRACE$/, qr/^QRIGHTBRACE$/); # inline math $....$ or \(..\) ### the commented out version is simpler but for some reason cannot cope with newline (in spite of s option) - need to include \newline explicitly ### my $math='\$(?:[^$]|\\\$)*?\$|\\\\[(].*?\\\\[)]'; - my $math='\$(?:[^$]|\\\$)*?\$|\\\\[(](?:.|\n)*?\\\\[)]'; + my $math='\$(?:[^$]|\\\$)*?\$|\\\\[(](?:.|\n)*?\\\\[)]'; ### test version (this seems to give the same results as version above) ## the current maths command cannot cope with newline within the math expression ### my $math='\$(?:[^$]|\\\$)*?\$|\\[(].*?\\[)]'; @@ -1276,7 +1292,7 @@ push(@SAFECMDLIST, qr/^QLEFTBRACE$/, qr/^QRIGHTBRACE$/); -# now we are done setting up and can start working +# now we are done setting up and can start working my ($oldfile, $newfile) = @ARGV; # check for existence of input files if ( ! -e $oldfile ) { @@ -1304,7 +1320,7 @@ my ($oldtime,$newtime,$oldlabel,$newlabel); if (defined($labels[0])) { $oldlabel=$labels[0] ; } else { - $oldtime=localtime((stat($oldfile))[9]); + $oldtime=localtime((stat($oldfile))[9]); $oldlabel="$oldfile " . " "x($oldlabel_n_spaces) . $oldtime; } if (defined($labels[1])) { @@ -1317,6 +1333,7 @@ if (defined($labels[1])) { $encoding=guess_encoding($newfile) unless defined($encoding); $encoding = "utf8" if $encoding =~ m/^utf8/i ; +print STDERR "Encoding $encoding\n" if $verbose; if (lc($encoding) eq "utf8" ) { binmode(STDOUT, ":utf8"); binmode(STDERR, ":utf8"); @@ -1400,7 +1417,7 @@ my @auxlines; my ($ulem)=0; if ( length $oldpreamble && length $newpreamble ) { - # pre-process preamble by looking for commands used in \maketitle (title, author, date etc commands) + # pre-process preamble by looking for commands used in \maketitle (title, author, date etc commands) # and marking up content with latexdiff markup @auxlines=preprocess_preamble($oldpreamble,$newpreamble); @@ -1432,7 +1449,7 @@ if (defined($graphicsmarkup)) { } else { # Default: no explicit setting in menu if ( defined $packages{"graphicx"} or defined $packages{"graphics"} ) { - $graphicsmarkup=NEWONLY; + $graphicsmarkup=NEWONLY; } else { $graphicsmarkup=NONE; } @@ -1465,7 +1482,7 @@ if ($graphicsmarkup != NONE ) { @matches=( $latexdiffpreamble =~ m/command\{\\DIFaddbeginFL}\{($pat_n)}/sg ) ; # we look at the last one of the list to take into account possible redefinition but almost always matches should have exactly one element if ( $matches[$#matches] =~ m/\\DIFaddbegin/ ) { - die "Cannot combine graphics markup with float styles defining \\DIFaddbeginFL in terms of \\DIFaddbegin. Use --graphics-markup=none option or choose a different float style."; + die "Cannot combine graphics markup with float styles defining \\DIFaddbeginFL in terms of \\DIFaddbegin. Use --graphics-markup=none option or choose a different float style."; exit 10; } ###} @@ -1479,6 +1496,11 @@ if ($graphicsmarkup != NONE ) { $ulem = ($latexdiffpreamble =~ /\\RequirePackage(?:\[$brat_n\])?\{ulem\}/ || defined $packages{"ulem"}); +# If amsmath is defined and $ulem is used for markup, redefine the \sout command to also work (mostly) in math mode +# See stack exchange https://tex.stackexchange.com/questions/20609/strikeout-in-math-mode/308647#308647 based on comment by Taylor Raine +if ( defined($packages{'amsmath'}) and $ulem ) { + $latexdiffpreamble .= join "\n",(extrapream('AMSMATHULEM'),""); +} # If listings is being used or can be found in the latexdiff search path, add to the preamble auxiliary code to enable line-by-line markup if ( defined($packages{"listings"}) or `kpsewhich listings.sty` ne "" ) { @@ -1488,7 +1510,7 @@ if ( defined($packages{"listings"}) or `kpsewhich listings.sty` ne "" ) { } my @listingDIFcode=(); my $replaced; - # note that in case user supplies preamblefile the type might not reflect well the + # note that in case user supplies preamblefile the type might not reflect well the actual markup style @listingDIFcode=extrapream("-nofail","DIFCODE_" . $type) unless defined($preamblefile); if (!(@listingDIFcode)) { # if listingDIFcode is empty try to guess a suitable one from the preamble @@ -1502,13 +1524,17 @@ if ( defined($packages{"listings"}) or `kpsewhich listings.sty` ne "" ) { @listingDIFcode=extrapream("DIFCODE_BOLD"); } } - # now splice it in + # add configuration so that listings work with utf-8 + push @listingpreamble, '\lstset{extendedchars=\true,inputencoding='.$encoding."}\n"; + + + # now splice it in $replaced=0; ###print STDERR "DEBUG: listingDIFcode: ",join("\n",@listingDIFcode),"|||\n" if $debug; - @listingpreamble=grep { + @listingpreamble=grep { # only replace if this has not been done already (use short-circuit property of and) - if (!$replaced and $_ =~ s/^.*%DIFCODE TEMPLATE.*$/join("\n",@listingDIFcode)/e ) { + if (!$replaced and $_ =~ s/^.*%DIFCODE TEMPLATE.*$/join("\n",@listingDIFcode)/e ) { ###print STDERR "DEBUG: Replaced text $_\n" if $debug; $replaced=1; 1; @@ -1538,7 +1564,7 @@ if ( length $oldpreamble && length $newpreamble ) { unshift @oldpreamble,''; @diffpreamble = linediff(\@oldpreamble, \@newpreamble); # remove dummy line again - shift @diffpreamble; + shift @diffpreamble; # add filenames, modification time and latexdiff mark defined($nolabel) or splice @diffpreamble,1,0, "%DIF LATEXDIFF DIFFERENCE FILE", @@ -1587,8 +1613,8 @@ if (defined $packages{"siunitx"} ) { # protect SI command by surrounding them with an \mbox # this is done to get around an incompatibility between the ulem and siunitx package print STDERR "siunitx package detected.\n" if $verbose ; - my $mboxcmds='SI,ang,numlist,numrange,SIlist,SIrange'; - init_regex_arr_list(\@SAFECMDLIST,'num,si'); + my $mboxcmds='SI,ang,numlist,numrange,SIlist,SIrange,qty,qtylist,qtyproduct,qtyrange,complexqty'; + init_regex_arr_list(\@SAFECMDLIST,'num,si,numproduct,unit,complexnum'); if ( $enablecitmark || ( $ulem && ! $disablecitmark )) { init_regex_arr_list(\@MBOXCMDLIST,$mboxcmds); } else { @@ -1610,7 +1636,7 @@ if (defined $packages{"cleveref"} ) { if (defined $packages{"glossaries"} ) { # protect selected command by surrounding them with an \mbox - # this is done to get around an incompatibility between ulem and glossaries package + # this is done to get around an incompatibility between ulem and glossaries package print STDERR "glossaries package detected.\n" if $verbose ; my $mboxcmds='[gG][lL][sS](?:|pl|disp|link|first|firstplural|desc|user[iv][iv]?[iv]?),[aA][cC][rR](?:long|longpl|full|fullpl),[aA][cC][lfp]?[lfp]?'; init_regex_arr_list(\@SAFECMDLIST,'[gG][lL][sS](?:(?:entry)?(?:text|plural|name|symbol)|displaynumberlist|entryfirst|entryfirstplural|entrydesc|entrydescplural|entrysymbolplural|entryuser[iv][iv]?[iv]?|entrynumberlist|entrydisplaynumberlist|entrylong|entrylongpl|entryshort|entryshortpl|entryfull|entryfullpl),[gG]lossentry(?:name|desc|symbol),[aA][cC][rR](?:short|shortpl),[aA]csp?'); @@ -1639,6 +1665,10 @@ if (defined $packages{"mhchem"} ) { # push(@MATHTEXTCMDLIST,'cee'); } +if ( defined $packages{"tikz-dependency"} ) { + init_regex_arr_ext(\@SAFECMDEXCL, 'AMPERSAND'); +} + my ( $citpat); @@ -1726,7 +1756,7 @@ print STDERR "(",exetime()," s)\n","Done.\n" if $verbose; # liststringtoregex(liststring) -# expands string with semi-colon separated list into a regular expression corresponding +# expands string with semi-colon separated list into a regular expression corresponding # matching any of the elements sub liststringtoregex { my ($liststring)=@_; @@ -1739,7 +1769,7 @@ sub liststringtoregex { } # show_configuration -# note that this is not encapsulated but uses variables from the main program +# note that this is not encapsulated but uses variables from the main program # It is provided for convenience because in the future it is planned to allow output # to be modified based on what packages are read etc - this works only if the input files are actually read # whether or not additional files are provided @@ -1766,7 +1796,7 @@ sub show_configuration { print "\nContext1 commands (last argument textual, command will be disabled in deleted passages, last argument will be shown as plain text):\n"; print_regex_arr(@CONTEXT1CMDLIST); print "\nContext2 commands (last argument textual, command and its argument will be disabled in deleted passages):\n"; - print_regex_arr(@CONTEXT2CMDLIST); + print_regex_arr(@CONTEXT2CMDLIST); print "\nExclude list of Commands with last argument not textual (overrides patterns above):\n"; print_regex_arr(@TEXTCMDEXCL); } @@ -1874,7 +1904,7 @@ sub list_packages { my %packages=(); my $pkg; - # remove comments + # remove comments $preamble=~s/(?<!\\)%.*$//mg ; while ( $preamble =~ m/\\(?:documentclass|usepackage|RequirePackage)(?:\[($brat_n)\])?\{(.*?)\}/gs ) { @@ -1979,7 +2009,7 @@ sub flatten { my ($includeonly,$dirname,$fname,$newpage,$fullfile,$filecontent,$replacement,$begline,$inputcmd,$bblfile,$subfile,$command,$verbenv,$verboptions,$ignore,$fileonly); my ($subpreamble,$subbody,$subpost); my ($subdir,$subdirfull,$importfilepath); - require File::Basename ; + require File::Basename ; ### require File::Spec ; # now this is needed even if flatten option not given $filename = File::Spec->rel2abs( $filename ) ; ($ignore, $dirname, $fileonly) = File::Spec->splitpath($filename) ; @@ -2019,15 +2049,15 @@ sub flatten { $subdirfull = (defined($3) ? File::Spec->catdir($dirname,$subdir) : $subdir); $importfilepath = File::Spec->catfile($subdirfull, $fname); - + print STDERR "importing importfilepath:", $importfilepath,"\n" if $verbose; if ( -f $importfilepath ) { # If file exists, replace input or include command with expanded input #TODO: need remove_endinput & newpage similar to other replacements inside flatten - $replacement=flatten(read_file_with_encoding($importfilepath, $encoding), $preamble,$importfilepath,$encoding); + $replacement=flatten(read_file_with_encoding($importfilepath, $encoding), $preamble,$importfilepath,$encoding); } else { # if file does not exist, do not expand include or input command (do not warn if fname contains #[0-9] as it is then likely part of a command definition - # and is not meant to be expanded directly + # and is not meant to be expanded directly print STDERR "WARNING: Could not find included file ",$importfilepath,". I will continue but not expand |$2|\n"; $replacement = $2; $replacement .= "{$subdir}{$fname} % Processed"; @@ -2036,13 +2066,13 @@ sub flatten { }/exgm; # recursively replace \\input and \\include files - $text =~ s/(^(?:[^%\n]|\\%)*)(\\input\{(.*?)\}|\\include\{(${includeonly}(?:\.tex)?)\})/{ + $text =~ s/(^(?:[^%\n]|\\%)*)(\\input\{(.*?)\}|\\include\{(${includeonly}(?:\.tex)?)\})/{ $begline=(defined($1)? $1 : "") ; $inputcmd=$2; $fname = $3 if defined($3) ; $fname = $4 if defined($4) ; $newpage=(defined($4)? " \\newpage " : "") ; - # # add tex extension unless there is a three or four letter extension already + # # add tex extension unless there is a three or four letter extension already $fname .= ".tex" unless $fname =~ m|\.\w{3,4}$|; $fullfile = File::Spec->catfile($dirname,$fname); print STDERR "DEBUG Beg of line match |$1|\n" if defined($1) && $debug ; @@ -2051,12 +2081,12 @@ sub flatten { # content of file becomes replacement value (use recursion), add \newpage if the command was include if ( -f $fullfile ) { # If file exists, replace input or include command with expanded input - $replacement=flatten(read_file_with_encoding($fullfile, $encoding), $preamble,$filename,$encoding); - $replacement = remove_endinput($replacement); + $replacement=flatten(read_file_with_encoding($fullfile, $encoding), $preamble,$filename,$encoding); + $replacement = remove_endinput($replacement); # \include always starts a new page; use explicit \newpage command to simulate this } else { # if file does not exist, do not expand include or input command (do not warn if fname contains #[0-9] as it is then likely part of a command definition - # and is not meant to be expanded directly + # and is not meant to be expanded directly print STDERR "WARNING: Could not find included file ",$fullfile,". I will continue but not expand |$inputcmd|\n" unless $fname =~ m(#[0-9]) ; $replacement = $inputcmd ; # i.e. just the original command again -> make no change file does not exist $newpage=""; @@ -2065,7 +2095,7 @@ sub flatten { }/exgm; # replace bibliography with bbl file if it exists - $text=~s/(^(?:[^%\n]|\\%)*)\\bibliography\{(.*?)\}/{ + $text=~s/(^(?:[^%\n]|\\%)*)\\bibliography\{(.*?)\}/{ if ( -f $bblfile ){ $replacement=read_file_with_encoding(File::Spec->catfile($bblfile), $encoding); } else { @@ -2077,10 +2107,10 @@ sub flatten { }/exgm; # replace subfile with contents (subfile package) - $text=~s/(^(?:[^%\n]|\\%)*)\\subfile\{(.*?)\}/{ + $text=~s/(^(?:[^%\n]|\\%)*)\\subfile\{(.*?)\}/{ $begline=(defined($1)? $1 : "") ; - $fname = $2; - # # add tex extension unless there is a three or four letter extension already + $fname = $2; + # # add tex extension unless there is a three or four letter extension already $fname .= ".tex" unless $fname =~ m|\.\w{3,4}|; print STDERR "Include file as subfile $fname\n" if $verbose; # content of file becomes replacement value (use recursion) @@ -2091,10 +2121,10 @@ sub flatten { # if file exists, expand \subfile command by contents of file $subfile=read_file_with_encoding($fullfile,$encoding) or die "Could not open included subfile ",$fullfile,": $!"; ($subpreamble,$subbody,$subpost)=splitdoc($subfile,'\\\\begin\{document\}','\\\\end\{document\}'); - ### $subfile=~s|^.*\\begin{document}||s; + ### $subfile=~s|^.*\\begin{document}||s; ### $subfile=~s|\\end{document}.*$||s; $replacement=flatten($subbody, $preamble,$fullfile,$encoding); - ### $replacement = remove_endinput($replacement); + ### $replacement = remove_endinput($replacement); } else { # if file does not exist, do not expand subfile print STDERR "WARNING: Could not find subfile ",$fullfile,". I will continue but not expand |$2|\n" unless $fname =~ m(#[0-9]) ; @@ -2105,11 +2135,11 @@ sub flatten { }/exgm; # replace \verbatiminput and \lstlistinginput - $text=~s/(^(?:[^%\n]|\\%)*)\\(verbatiminput\*?|lstinputlisting)$extraspace(\[$brat_n\])?$extraspace\{(.*?)\}/{ + $text=~s/(^(?:[^%\n]|\\%)*)\\(verbatiminput\*?|lstinputlisting)$extraspace(\[$brat_n\])?$extraspace\{(.*?)\}/{ $begline=(defined($1)? $1 : "") ; $command = $2 ; $fname = $4 ; - $verboptions = defined($3)? $3 : "" ; + $verboptions = defined($3)? $3 : "" ; if ($command eq 'verbatiminput' ) { $verbenv = "verbatim" ; } elsif ($command eq 'verbatiminput*' ) { @@ -2118,7 +2148,7 @@ sub flatten { $verbenv = "lstlisting" ; } else { die "Internal errorL Unexpected verbatim input type $command.\n"; - } + } print STDERR "DEBUG Beg of line match |$begline|\n" if $debug ; print STDERR "Include file $fname verbatim\n" if $verbose; print STDERR "DEBUG looking for file ",File::Spec->catfile($dirname,$fname), "\n" if $debug; @@ -2150,8 +2180,8 @@ sub print_regex_arr { # if $type is a filename, it will read the file instead of reading from the appendix # otherwise it will screen appendix for line "%DIF $TYPE" and copy everything up to line # '%DIF END $TYPE' (where $TYPE is upcased version of $type) -# extrapream('-nofail',$type) will---instead of failing---simply return nothing if -# it does not find the matching line in a appendix (do not use -nofail option with multiple types!) +# extrapream('-nofail',$type) will---instead of failing---simply return nothing if +# it does not find the matching line in appendix (do not use -nofail option with multiple types!) sub extrapream { my @types=@_; my ($type,$arg); @@ -2168,14 +2198,20 @@ sub extrapream { $type=$arg; $copy=0; if ( -f $type || lc $type eq '/dev/null' ) { - open (FILE,$type) or die "Cannot open preamble file $type: $!"; print STDERR "Reading preamble file $type\n" if $verbose ; + open (FILE,$type) or die "Cannot open preamble file $type: $!"; + if (defined($encoding)) { + binmode(FILE,":encoding($encoding)"); + } else { + require Encode::Locale; + binmode(FILE,":encoding(locale)"); + } while (<FILE>) { chomp ; if ( $_ =~ m/%DIF PREAMBLE/ ) { - push (@retval,"$_"); + push (@retval,"$_"); } else { - push (@retval,"$_ %DIF PREAMBLE"); + push (@retval,"$_ %DIF PREAMBLE"); } } } else { # not (-f $type) @@ -2187,9 +2223,9 @@ sub extrapream { my $data_start = tell DATA; while (<DATA>) { if ( m/^%DIF $type/ ) { - $copy=1; + $copy=1; } elsif ( m/^%DIF END $type/ ) { - last; + last; } chomp; push (@retval,"$_ %DIF PREAMBLE") if $copy; @@ -2229,7 +2265,7 @@ sub splitdoc { $pos=pos $rest; $part2=substr($rest,0,$pos-length($2)); $part3=substr($rest,$pos); - } + } else { die "$word1 and $word2 not in the correct order or not present as a pair." ; } @@ -2301,7 +2337,7 @@ sub splitlatex { my $leadin=$1; length($string)>0 or return ($leadin); - my @retval=($string =~ m/$pat/osg); + my @retval=($string =~ m/$pat/osg); if (length($string) != length(join("",@retval))) { print STDERR "\nWARNING: Inconsistency in length of input string and parsed string:\n This often indicates faulty or non-standard latex code.\n In many cases you can ignore this and the following warning messages.\n Note that character numbers in the following are counted beginning after \\begin{document} and are only approximate." unless $ignorewarnings; @@ -2345,17 +2381,17 @@ sub splitlatex { # pass1( \@seq1,\@seq2) # Look for differences between seq1 and seq2. -# Where an common-subsequence block is flanked by deleted or appended blocks, +# Where an common-subsequence block is flanked by deleted or appended blocks, # and is shorter than $MINWORDSBLOCK words it is appended -# to the last deleted or appended word. If the block contains tokens other than words +# to the last deleted or appended word. If the block contains tokens other than words # or punctuation it is not merged. # Deleted or appended block consisting of words and safe commands only are # also merged, to prevent break-up in pass2 (after previous isolated words have been removed) -# If there are commands with textual arguments (e.g. \caption) both in corresponding -# appended and deleted blocks split them such that the command and opening bracket -# are one token, then the rest is split up following standard rules, and the closing +# If there are commands with textual arguments (e.g. \caption) both in corresponding +# appended and deleted blocks split them such that the command and opening bracket +# are one token, then the rest is split up following standard rules, and the closing # bracket is a separate token, ie. turn -# "\caption{This is a textual argument}" into +# "\caption{This is a textual argument}" into # ("\caption{","This ","is ","a ","textual ","argument","}") # No return value. Destructively changes sequences sub pass1 { @@ -2384,15 +2420,15 @@ sub pass1 { my $adddiscard = sub { if ($cnt > 0 ) { $matblkcnt++; - # just after an unchanged block + # just after an unchanged block # print STDERR "Unchanged block $cnt, $last1,$last2 \n"; - if ($cnt < $MINWORDSBLOCK + if ($cnt < $MINWORDSBLOCK && $cnt==scalar ( - grep { /^$wpat/ || ( /^\\((?:[`'^"~=.]|[\w\d@*]+))((?:\[$brat_n\]|\{$pat_n\})*)/o - && iscmd($1,\@SAFECMDLIST,\@SAFECMDEXCL) + grep { /^$wpat/ || ( /^\\((?:[`'^"~=.]|[\w\d@*]+))((?:\[$brat_n\]|\{$pat_n\})*)/o + && iscmd($1,\@SAFECMDLIST,\@SAFECMDEXCL) && scalar(@dummy=split(" ",$2))<3 ) } @$block) ) { - # merge identical blocks shorter than $MINWORDSBLOCK + # merge identical blocks shorter than $MINWORDSBLOCK # and only containing ordinary words # with preceding different word # We cannot carry out this merging immediately as this @@ -2400,23 +2436,23 @@ sub pass1 { # the algorithm, instead we store in @$todo where we have to merge push(@$todo, [ $last1,$last2,$cnt,@$block ]); } - $block = []; + $block = []; $cnt=0; $last1=-1; $last2=-1; } }; my $discard=sub { $deltokcnt++; &$adddiscard; #($_[0],$_[1]); push(@$delblock,[ $seq1->[$_[0]],$_[0] ]); - $last1=$_[0] }; + $last1=$_[0] }; my $add = sub { $addtokcnt++; &$adddiscard; #($_[0],$_[1]); push(@$addblock,[ $seq2->[$_[1]],$_[1] ]); - $last2=$_[1] }; + $last2=$_[1] }; my $match = sub { $mattokcnt++; if ($cnt==0) { # first word of matching sequence after changed sequence or at beginning of word sequence - $deltextblocks = extracttextblocks($delblock); + $deltextblocks = extracttextblocks($delblock); $delblkcnt++ if scalar @$delblock; $addtextblocks = extracttextblocks($addblock); $addblkcnt++ if scalar @$addblock; @@ -2432,7 +2468,7 @@ sub pass1 { ### Algorithm::Diff 1.19 $matchindex=Algorithm::Diff::_longestCommonSubsequence($delcmds,$addcmds, 0, sub { $_[0]->[0] } ); } else { - ### Algorithm::Diff 1.15 + ### Algorithm::Diff 1.15 $matchindex=Algorithm::Diff::_longestCommonSubsequence($delcmds,$addcmds, sub { $_[0]->[0] } ); } @@ -2463,11 +2499,11 @@ sub pass1 { my ($index,$block,$cnt)=@{ shift(@$addtextblocks) }; push(@$todo, [-1,$index,$cnt,@$block]); } - + $addblock=[]; $delblock=[]; } - push(@$block,$seq2->[$_[1]]); + push(@$block,$seq2->[$_[1]]); $cnt++ }; my $keyfunc = sub { join(" ",split(" ",shift())) }; @@ -2475,7 +2511,7 @@ sub pass1 { traverse_sequences($seq1,$seq2, { MATCH=>$match, DISCARD_A=>$discard, DISCARD_B=>$add }, $keyfunc ); - # now carry out the merging/splitting. Refer to elements relative from + # now carry out the merging/splitting. Refer to elements relative from # the end (with negative indices) as these offsets don't change before the instruction is executed # cnt>0: merged small unchanged groups with previous changed blocks # cnt==-1: split textual commands into components @@ -2490,7 +2526,7 @@ sub pass1 { } } - if ($verbose) { + if ($verbose) { print STDERR "\n"; print STDERR " $mattokcnt matching tokens in $matblkcnt blocks.\n"; print STDERR " $deltokcnt discarded tokens in $delblkcnt blocks.\n"; @@ -2500,10 +2536,10 @@ sub pass1 { # extracttextblocks(\@blockindex) -# $blockindex has the following format -# [ [ token1, index1 ], [token2, index2],.. ] -# where index refers to the index in the original old or new word sequence -# Returns: reference to an array of the form +# $blockindex has the following format +# [ [ token1, index1 ], [token2, index2],.. ] +# where index refers to the index in the original old or new word sequence +# Returns: reference to an array of the form # [[ $index, $textblock, $cnt ], .. # where $index index of block to be merged # $textblock contains all the words to be merged with the word at $index (but does not contain this word) @@ -2511,7 +2547,7 @@ sub pass1 { # # requires: iscmd # -sub extracttextblocks { +sub extracttextblocks { my $block=shift; my ($i,$token,$index); my $textblock=[]; @@ -2521,13 +2557,13 @@ sub extracttextblocks { # we redefine locally $extraspace (shadowing the global definition) to capture command sequences with intervening spaces no matter what the global setting # this is done so we can capture those commands with a predefined number of arguments without having to introduce them again explicitly here - my $extraspace='\s*'; + my $extraspace='\s*'; for ($i=0;$i< scalar @$block;$i++) { ($token,$index)=@{ $block->[$i] }; # store pure text blocks - if ($token =~ /$wpat/ || ( $token =~/^\\((?:[`'^"~=.]|[\w\d@\*]+))((?:${extraspace}\[$brat_n\]${extraspace}|${extraspace}\{$pat_n\})*)/ - && iscmd($1,\@SAFECMDLIST,\@SAFECMDEXCL) + if ($token =~ /$wpat/ || ( $token =~/^\\((?:[`'^"~=.]|[\w\d@\*]+))((?:${extraspace}\[$brat_n\]${extraspace}|${extraspace}\{$pat_n\})*)/ + && iscmd($1,\@SAFECMDLIST,\@SAFECMDEXCL) && !iscmd($1,\@TEXTCMDLIST,\@TEXTCMDEXCL))) { # we have text or a command which can be treated as text if ($last<0) { @@ -2535,7 +2571,7 @@ sub extracttextblocks { $last=$index; } else { # add to pure-text block - push(@$textblock, $token); + push(@$textblock, $token); } } else { # it is not text @@ -2556,29 +2592,29 @@ sub extracttextblocks { # extractcommands( \@blockindex ) -# $blockindex has the following format -# [ [ token1, index1 ], [token2, index2],.. ] -# where index refers to the index in the original old or new word sequence -# Returns: reference to an array of the form -# [ [ "\cmd1", index, "\cmd1[optarg]{arg1}{", "arg2" ,"} " ],.. -# where index is just taken from input array -# command must have a textual argument as last argument -# -# requires: iscmd -# -sub extractcommands { +# $blockindex has the following format +# [ [ token1, index1 ], [token2, index2],.. ] +# where index refers to the index in the original old or new word sequence +# Returns: reference to an array of the form +# [ [ "\cmd1", index, "\cmd1[optarg]{arg1}{", "arg2" ,"} " ],.. +# where index is just taken from input array +# command must have a textual argument as last argument +# +# requires: iscmd +# +sub extractcommands { my $block=shift; my ($i,$token,$index,$cmd,$open,$mid,$closing); my $retval=[]; # we redefine locally $extraspace (shadowing the global definition) to capture command sequences with intervening spaces no matter what the global setting # this is done so we can capture those commands with a predefined number of arguments without having to introduce them again explicitly here - my $extraspace='\s*'; + my $extraspace='\s*'; for ($i=0;$i< scalar @$block;$i++) { ($token,$index)=@{ $block->[$i] }; # check if token is an alphanumeric command sequence with at least one non-optional argument - # \cmd[...]{...}{last argument} + # \cmd[...]{...}{last argument} # Capturing in the following results in these associations # $1: \cmd[...]{...}{ # $2: \cmd @@ -2586,7 +2622,7 @@ sub extractcommands { # $4: } + trailing spaces if ( ( $token =~ m/^(\\([\w\d\*]+)(?:${extraspace}\[$brat_n\]|${extraspace}\{$pat_n\})*${extraspace}\{)($pat_n)(\}\s*)$/so ) && iscmd($2,\@TEXTCMDLIST,\@TEXTCMDEXCL) ) { - print STDERR "DEBUG EXTRACTCOMMANDS Match |$1|$2|$3|$4|$index \n" if $debug; + print STDERR "DEBUG EXTRACTCOMMANDS Match |$1|$2|$3|$4|$index \n" if $debug; # push(@$retval,[ $2,$index,$1,$3,$4 ]); ($cmd,$open,$mid,$closing) = ($2,$1,$3,$4) ; $closing =~ s/\}/\\RIGHTBRACE/ ; @@ -2597,7 +2633,7 @@ sub extractcommands { } # iscmd($cmd,\@regexarray,\@regexexcl) checks -# return 1 if $cmd matches any of the patterns in the +# return 1 if $cmd matches any of the patterns in the # array $@regexarray, and none of the patterns in \@regexexcl, otherwise return 0 sub iscmd { my ($cmd,$regexar,$regexexcl)=@_; @@ -2605,7 +2641,7 @@ sub iscmd { ### print STDERR "DEBUG: iscmd($cmd)=" if $debug; foreach $pat ( @$regexar ) { if ( $cmd =~ m/^${pat}$/ ) { - $ret=1 ; + $ret=1 ; last; } } @@ -2621,13 +2657,13 @@ sub iscmd { # pass2( \@seq1,\@seq2) -# Look for differences between seq1 and seq2. +# Look for differences between seq1 and seq2. # Mark begin and end of deleted and appended sequences with tags $DELOPEN and $DELCLOSE # and $ADDOPEN and $ADDCLOSE, respectively, however exclude { } & and all comands, unless # they match an element of the whitelist (SAFECMD) # For words in TEXTCMD but not in SAFECMD, enclose interior with $ADDOPEN and $ADDCLOSE brackets -# Deleted comment lines are marked with %DIF < -# Added comment lines are marked with %DIF > +# Deleted comment lines are marked with %DIF < +# Added comment lines are marked with %DIF > sub pass2 { my $seq1 = shift ; my $seq2 = shift ; @@ -2659,7 +2695,7 @@ sub pass2 { $addhunk = []; } push(@$retval,$seq2->[$_[1]]) }; - + my $keyfunc = sub { join(" ",split(" ",shift())) }; traverse_sequences($seq1,$seq2, { MATCH=>$match, DISCARD_A=>$discard, DISCARD_B=>$add }, $keyfunc ); @@ -2668,7 +2704,7 @@ sub pass2 { push @$retval,marktags($ADDMARKOPEN,$ADDMARKCLOSE,$ADDOPEN,$ADDCLOSE,"","",$ADDCOMMENT,$addhunk) if scalar @$addhunk; - if ($verbose) { + if ($verbose) { print STDERR "\n"; print STDERR " $mattokcnt matching tokens. \n"; print STDERR " $deltokcnt discarded tokens in $delblkcnt blocks.\n"; @@ -2690,7 +2726,7 @@ sub marktags { my (@argtext); my $retval=[]; my $noncomment=0; - my $cmd=-1; # -1 at beginning 0: last token written is a ordinary word + my $cmd=-1; # -1 at beginning 0: last token written is a ordinary word # 1: last token written is a command # for keeping track whether we are just in a command sequence or in a word sequence my $cmdcomment= ($opencmd =~ m/^%/); # Flag to indicate whether opencmd is a comment (i.e. if we intend to simply comment out changed commands) @@ -2706,31 +2742,31 @@ sub marktags { # we redefine locally $extraspace (shadowing the global definition) to capture command sequences with intervening spaces no matter what the global setting # this is done so we can capture those commands with a predefined number of arguments without having to introduce them again explicitly here - my $extraspace_mt='\s*'; + my $extraspace_mt='\s*'; foreach (@$block) { - $word=$_; + $word=$_; if ( $word =~ s/^%/%$comment/ ) { # a comment if ($cmd==1) { push (@$retval,$closecmd) ; $cmd=-1; } - push (@$retval,$word); + push (@$retval,$word); next; } if ( $word =~ m/^\s*$/ ) { ### print STDERR "DEBUG MARKTAGS: whitespace detected |$word| cmdcom |$cmdcomment| |$opencmd|\n" if $debug; # a sequence of white-space characters - this should only ever happen for the first element of block. - # in deleted block, omit, otherwise just copy it in + # in deleted block, omit, otherwise just copy it in if ( ! $cmdcomment) { # ignore in deleted blocks push(@$retval,$word); } next; } if (! $noncomment) { - push (@$retval,$openmark); + push (@$retval,$openmark); $noncomment=1; } # negative lookahead pattern (?!) in second clause is put in to avoid matching \( .. \) patterns @@ -2740,7 +2776,7 @@ sub marktags { # word is a command or other significant token (not in SAFECMDLIST) ## same conditions as in subroutine extractcommand: # check if token is an alphanumeric command sequence with at least one non-optional argument - # \cmd[...]{...}{last argument} + # \cmd[...]{...}{last argument} # Capturing in the following results in these associations # $1: \cmd[...]{...}{ # $2: cmd @@ -2757,11 +2793,11 @@ sub marktags { # Condition 3: But if we are in a deleted block ($cmdcomment=1) and # $2 (the command) is in context2, just treat it as an ordinary command (i.e. comment it open with $opencmd) # Because we do not want to disable this command - # here we do not use $opencmd and $closecmd($opencmd is empty) + # here we do not use $opencmd and $closecmd($opencmd is empty) print STDERR "DEBUG: Detected text |$word| but not safe command \$2: $2 \$3: $3\n." if $debug; if ($cmd==1) { push (@$retval,$closecmd) ; - } elsif ($cmd==0) { + } elsif ($cmd==0) { push (@$retval,$close) ; } $command=$1; $commandword=$2; $closingbracket=$4; @@ -2777,16 +2813,16 @@ sub marktags { # for latexrevise push (@$retval,$command,"%\n{$AUXCMD\n",marktags("","",$open,$close,$opencmd,$closecmd,$comment,\@argtext),$closingbracket); } elsif ( iscmd($commandword,,\@MATHTEXTCMDLIST, \@MATHTEXTCMDEXCL) ) { - # MATHBLOCK pseudo command: consider all commands safe, except & and \\, \begin and \end and a few package sprcific one (look at UNSAFEMATHCMD definition) - # Keep these commands even in deleted blocks, hence set $opencmd and $closecmd (5th and 6th argument of marktags) to + # MATHBLOCK pseudo command: consider all commands safe, except & and \\, \begin and \end and a few package sprcific one (look at UNSAFEMATHCMD definition) + # Keep these commands even in deleted blocks, hence set $opencmd and $closecmd (5th and 6th argument of marktags) to # "" - local @SAFECMDLIST=(".*"); + local @SAFECMDLIST=(".*"); local @SAFECMDEXCL=('\\','\\\\',@UNSAFEMATHCMD); push(@$retval,$command,marktags("","",$open,$close,"","",$comment,\@argtext)#@argtext ,$closingbracket); } else { # normal textcmd or context1cmd in an added block - push (@$retval,$command,marktags("","",$open,$close,$opencmd,$closecmd,$comment,\@argtext),$closingbracket); + push (@$retval,$command,marktags("","",$open,$close,$opencmd,$closecmd,$comment,\@argtext),$closingbracket); } push (@$retval,$AUXCMD,"\n") if $cmdcomment ; $cmd=-1 ; @@ -2872,10 +2908,10 @@ sub take_comments_and_newline_from_frac() { # names or labels but it does not matter because they are converted back in the postprocessing step # Returns: leading white space removed in step 1 sub preprocess { - for (@_) { + for (@_) { - # change in \verb and similar commands - note that I introduce an extra space here so that the + # change in \verb and similar commands - note that I introduce an extra space here so that the # already hashed variants do not trigger again # transform \lstinline{...} # s/\\lstinline(\[$brat0\])?(\{(?:.*?)\})/"\\DIFlstinline". $1 ."{". tohash(\%verbhash,"$2") ."}"/esg; @@ -2905,7 +2941,7 @@ sub preprocess { 1 while s/(?<!\\)_(\s*{($pat_n)})/\\SUBSCRIPT$1/g ; # Convert ^n into \SUPERSCRIPTNB{n} and ^{nnn} into \SUPERSCRIPT{nn} 1 while s/(?<!\\)\^(\s*([^{\\\s]|\\\w+))/\\SUPERSCRIPTNB{$1}/g ; - 1 while s/(?<!\\)\^(\s*{($pat_n)})/\\SUPERSCRIPT$1/g ; + 1 while s/(?<!\\)\^(\s*{($pat_n)})/\\SUPERSCRIPT$1/g ; # Convert \sqrt{n} into \SQRT{n} and \sqrt nn into SQRTNB{nn} 1 while s/(?<!\\)\\sqrt(\s*([^{\\\s]|\\\w+))/\\SQRTNB{$1}/g ; 1 while s/(?<!\\)\\sqrt(\s*{($pat_n)})/\\SQRT$1/g ; @@ -2925,16 +2961,16 @@ sub preprocess { if ( $mathmarkup != FINE ) { # DIFANCHORARRB and DIFANCHORARRE, DIFANCHORMATHB and DIFANCHORMATHE markers are inserted here to encourage the matching algorithm # to always match up the closing brace. Otherwise sometimes one ends up with a situation where - # the closing brace is deleted and added at another point. The deleted closing brace is then + # the closing brace is deleted and added at another point. The deleted closing brace is then # prevented by a %DIFDELCMD, leading to material leaking in or out of the math environment. # The anchors are removed in post-processing again. (note that they are simple text to cause least amount of complications - # Admittedly, this is something of a hack and will not always work. If it does not, then one needs to + # Admittedly, this is something of a hack and will not always work. If it does not, then one needs to # resort to WHOLE or FINE, or NONE math mode processing. s/\\begin\{($ARRENV)}(.*?)\\end\{\1}/\\ARRAYBLOCK$1\{$2\\DIFANCHORARRB \}\\DIFANCHORARRE /sg; take_comments_and_newline_from_frac(); - # Convert Math environments with arguments + # Convert Math environments with arguments s/\\begin\{($MATHENV|$MATHARRENV|SQUAREBRACKET)\}((?:\[$brat_n\])|(?:\{$pat_n\}))+(.*?)\\end\{\1\}/\\MATHBLOCK$1\[$2\]\{$3\\DIFANCHORMATHB \}\\DIFANCHORMATHE /sg; # Convert Math environments without arguments s/\\begin\{($MATHENV|$MATHARRENV|SQUAREBRACKET)\}(.*?)\\end\{\1\}/\\MATHBLOCK$1\{$2\\DIFANCHORMATHB \}\\DIFANCHORMATHE /sg; @@ -2948,7 +2984,7 @@ sub preprocess { # $expanded=linecomment($string) #preface all lines with verbatim marker (usually DIFVRB) -sub linecomment { +sub linecomment { my @verbatimlines=split("\n",$_[0]); # the first line needs special treatment - we do want to retain optional arguments as is but wrap the remainder also with VERBCOMMENT ### print STDERR "DEBUG: before verbatimlines[0] = ",$verbatimlines[0],"\n"; @@ -2958,7 +2994,7 @@ sub linecomment { } # $simple=reverselinecomment($env $string) -# remove DIFVRB comments but leave changed lines marked +# remove DIFVRB comments but leave changed lines marked sub reverselinecomment { my ($environment, $verbatimtext)=@_; ### print STDERR "DEBUG REVERSELINECOMMENT input: $environment,|$verbatimtext|\n" if $debug; @@ -2973,7 +3009,7 @@ sub reverselinecomment { $verbatimtext =~ s/\\DIFdelend //g; $verbatimtext =~ s/$DELCMDOPEN.*//g; - # remove DIFVRB mark + # remove DIFVRB mark $verbatimtext=~ s/%$VERBCOMMENT//g; # remove part of the markup in changed lines @@ -3064,7 +3100,7 @@ sub writedebugfile { # * Remove STOP token from the end # * Replace \RIGHTBRACE by } # * If option --no-del is set delete all deleted blocks -# 1. Check all deleted blocks: +# 1. Check all deleted blocks: # a.where a deleted block contains a matching \begin and # \end environment (these will be disabled by a %DIFDELCMD statements), for selected environments enable # these commands again (such that for example displayed math in a deleted equation @@ -3085,14 +3121,14 @@ sub writedebugfile { # For added blocks: # c. If in-line math mode contains array environment, enclose the whole environment in \mbox'es # d. place \cite commands in mbox'es (for UNDERLINE style) -# +# # 2. If math-mode COARSE,WHOLE or NONE option set: Convert \MATHBLOCKmath{..} commands back to environments # # Convert all PICTUREblock{..} commands back to the appropriate environments # 3. Convert DIFadd, DIFdel, DIFaddbegin , ... into FL varieties # within floats (currently recognised float environments: plate,table,figure # plus starred varieties). -# 4. Remove empty %DIFDELCMD < lines +# 4. Remove empty %DIFDELCMD < lines # 4. Convert \begin{SQUAREBRACKET} \end{SQUAREBRACKET} into \[ \] # Convert \begin{DOLLARDOLLAR} \end{DOLLARDOLLAR} into $$ $$ # 5. Convert \SUPERSCRIPTNB{n} into ^n and \SUPERSCRIPT{nn} into ^{nnn} @@ -3105,7 +3141,7 @@ sub writedebugfile { # 4, undo renaming of the \begin, \end,{,} in comments # Change \QLEFTBRACE, \QRIGHTBRACE,\AMPERSAND to \{,\},\& # -# Note have to manually synchronize substitution commands below and +# Note have to manually synchronize substitution commands below and # DIF.. command names in the header sub postprocess { my ($begin,$len,$float,$delblock,$addblock); ### $cnt @@ -3117,7 +3153,7 @@ sub postprocess { my (@itemargs, $itemarg); - for (@_) { + for (@_) { # change $'s in comments to something harmless 1 while s/(%.*)\$/$1DOLLARDIF/mg ; @@ -3127,7 +3163,7 @@ sub postprocess { # the only way to get these is as %DIFDELCMD < \RIGHTBRACE construction # This essentially marks closing right braces of MATHBLOCK environments, which did not get matched # up. This case should be rare, so I just leave this in the diff file output. Not really elegant - # but can still be dealt with later if it results in problems. + # but can still be dealt with later if it results in problems. s/%DIFDELCMD < \\RIGHTBRACE/%DIFDELCMD < \\MBLOCKRIGHTBRACE/g ; # Replace \RIGHTBRACE by } s/\\RIGHTBRACE/}/g; @@ -3155,7 +3191,7 @@ sub postprocess { $len=length($&); $begin=pos($_) - $len; $delblock=$&; - ### A much simpler method for math replacement might follow this strategy (can recycle part of the commands below for following + ### A much simpler method for math replacement might follow this strategy (can recycle part of the commands below for following ### this strategy: ### 1. a Insert aux commands \begin{MATHMODE} or \end{MATHMODE} for all deleted commands opening or closing displayed math mode ### b Insert aux commands \begin{MATHARRMODE} or \end{MATHARRMODE} for all deleted commands opening or closing math array mode @@ -3181,14 +3217,14 @@ sub postprocess { ###0.5: $delblock=~ s/(?<!${AUXCMD}\n)(\%DIFDELCMD < \s*\\end\{((?:$MATHENV)|SQUAREBRACKET)\}\s*?(?:$DELCMDCLOSE|\n))(.*?[^\n]?)\n?(?<!${AUXCMD}\n)(\%DIFDELCMD < \s*\\begin\{\2\})/\\end{MATHMODE}$AUXCMD\n$1$3\n\\begin{MATHMODE}$AUXCMD\n$4/sg; $delblock=~ s/(?<!${AUXCMD}\n)(\%DIFDELCMD < \h*\\end\{((?:$MATHENV)|SQUAREBRACKET)\}.*?(?:$DELCMDCLOSE|\n))(.*?[^\n]?)\n?(?<!${AUXCMD}\n)(\%DIFDELCMD < \h*\\begin\{\2\})/\\end\{MATHMODE\}$AUXCMD\n$1$3\n\\begin\{MATHMODE\}$AUXCMD\n$4/sg; - # now look for unpaired %DIFDELCMD < \begin{MATHENV}; if found add \begin{$MATHREPL} and insert \end{$MATHREPL} + # now look for unpaired %DIFDELCMD < \begin{MATHENV}; if found add \begin{$MATHREPL} and insert \end{$MATHREPL} # just before end of block; again we use look-behind assertion to avoid matching constructions which have already been converted if ($delblock=~ s/(?<!${AUXCMD}\n)(\%DIFDELCMD < \h*\\begin\{((?:$MATHENV)|SQUAREBRACKET)\}\s*?(?:$DELCMDCLOSE|\n))/$1\\begin{$MATHREPL}$AUXCMD\n/sg ) { ### print STDERR "BINGO: begin block: \nBefore: |" . substr($_,$begin,$len) . "|\n" if $debug ; $delblock =~ s/(\\DIFdelend$)/\\end{$MATHREPL}$AUXCMD\n$1/s ; ### print STDERR "After: |" . $delblock . "|\n\n" if $debug ; } - # now look for unpaired %DIFDELCMD < \end{MATHENV}; if found add \end{MATHMODE} and insert \begin{MATHMODE} + # now look for unpaired %DIFDELCMD < \end{MATHENV}; if found add \end{MATHMODE} and insert \begin{MATHMODE} # just before end of block; again we use look-behind assertion to avoid matching constructions which have already been converted if ($delblock=~ s/(?<!${AUXCMD}\n)(\%DIFDELCMD < \h*\\end\{((?:$MATHENV)|SQUAREBRACKET)\}\s*?(?:$DELCMDCLOSE|\n))/$1\\end\{MATHMODE\}$AUXCMD\n/sg ) { ### print STDERR "BINGO: end block:\nBefore: |" . substr($_,$begin,$len) . "|\n" if $debug; @@ -3211,15 +3247,15 @@ sub postprocess { $delblock=~ s/(?<!${AUXCMD}\n)(\%DIFDELCMD < \h*\\end\{($MATHARRENV)\}\s*?(?:$DELCMDCLOSE|\n))(.*?[^\n]?)\n?(?<!${AUXCMD}\n)(\%DIFDELCMD < \h*\\begin\{\2\})/\\end{MATHMODE}$AUXCMD\n$1$3\n\\begin{MATHMODE}$AUXCMD\n$4/sg; ### print STDERR "STEP1: |" . $delblock . "|\n\n" if $debug ; - # now look for unpaired %DIFDELCMD < \begin{MATHARRENV}; if found add \begin{$MATHARRREPL} and insert \end{$MATHARRREPL} + # now look for unpaired %DIFDELCMD < \begin{MATHARRENV}; if found add \begin{$MATHARRREPL} and insert \end{$MATHARRREPL} # just before end of block; again we use look-behind assertion to avoid matching constructions which have already been converted if ($delblock=~ s/(?<!${AUXCMD}\n)(\%DIFDELCMD < \h*\\begin\{($MATHARRENV)\}(.*?)(?:$DELCMDCLOSE|\n))/$1\\begin{$2*}$3$AUXCMD\n/sg ) { $arrenv=$2; - $delblock =~ s/(\\DIFdelend$)/\\end{$arrenv*}}$AUXCMD\n$1/s ; + $delblock =~ s/(\\DIFdelend$)/\\end{$arrenv*}$AUXCMD\n$1/s ; } ### print STDERR "STEP2: |" . $delblock . "|\n\n" if $debug ; - # now look for unpaired %DIFDELCMD < \end{MATHENV}; if found add \end{MATHMODE} and insert \begin{MATHMODE} + # now look for unpaired %DIFDELCMD < \end{MATHENV}; if found add \end{MATHMODE} and insert \begin{MATHMODE} # just before end of block; again we use look-behind assertion to avoid matching constructions which have already been converted if ($delblock=~ s/(?<!${AUXCMD}\n)(\%DIFDELCMD < \h*\\end\{($MATHARRENV)\}\s*?(?:$DELCMDCLOSE|\n))/$1\\end{MATHMODE}$AUXCMD\n/sg ) { $delblock =~ s/(\\DIFdelend$)/\\begin{MATHMODE}$AUXCMD\n$1/s ; @@ -3237,7 +3273,7 @@ sub postprocess { ### $eqarrayblock=~ s/(\%DIFDELCMD < \s*(\&|\\\\)\s*?(?:$DELCMDCLOSE|\n))/$1$2$AUXCMD\n/sg ; $eqarrayblock =~ s/(\%DIFDELCMD < (.*?(?:\&|\\\\).*)(?:$DELCMDCLOSE|\n))/ # The pattern captures comments with at least one of & or \\ - @symbols= split(m@((?:&|\\\\)\s*)@,$2); # extract & and \\ and other material from sequence + @symbols= split(m@((?:&|\\\\)\s*)@,$2); # extract & and \\ and other material from sequence @symbols= grep ( m@&|\\\\\s*@, @symbols); # select & and \\ (and subsequent spaces) "$1@symbols$AUXCMD\n" /eg ; @@ -3250,7 +3286,7 @@ sub postprocess { } elsif ( $mathmarkup == COARSE || $mathmarkup == WHOLE ) { # Convert MATHBLOCKmath commands to their uncounted numbers (e.g. convert equation -> displaymath # (environments defined in $MATHENV will be replaced by $MATHREPL, and environments in $MATHARRENV - # will be replaced by their starred variety + # will be replaced by their starred variety $delblock=~ s/\\MATHBLOCK($MATHENV)((?:\[$brat_n\])?)\{($pat_n)\}/\\MATHBLOCK$MATHREPL$2\{$3\}/sg; $delblock=~ s/\\MATHBLOCK($MATHARRENV)((?:\[$brat_n\])?)\{($pat_n)\}/\\MATHBLOCK$1\*$2\{$3\}/sg; } @@ -3264,10 +3300,10 @@ sub postprocess { print STDERR "DELBLOCK after maths processing: |" . $delblock . "|\n\n" if $debug ; - # Reinstate completely deleted list environments. note that items within the + # Reinstate completely deleted list environments. note that items within the # environment will still be commented out. They will be restored later $delblock=~ s/(\%DIFDELCMD < \s*\\begin\{($LISTENV)\}\s*?(?:\n|$DELCMDCLOSE))(.*?)(\%DIFDELCMD < \s*\\end\{\2\})/{ - ### # block within the search; replacement environment + ### # block within the search; replacement environment ### "$1\\begin{$2}$AUXCMD\n". restore_item_commands($3). "\n\\end{$2}$AUXCMD\n$4"; "$1\\begin{$2}$AUXCMD\n$3\n\\end{$2}$AUXCMD\n$4"; }/esg; @@ -3301,7 +3337,7 @@ sub postprocess { ### if ($CITE2CMD) { ###### ${extraspace}(?:\[$brat0\]${extraspace}){0,2}\{$pat_n\})) .*?%%%\n ### $delblock=~s/($DELCMDOPEN\s*\\($CITE2CMD)(.*)$DELCMDCLOSE)/ - ### # Replacement code + ### # Replacement code ### {my ($aux,$all); ### $aux=$all=$1; ### $aux=~s#\n?($DELCMDOPEN|$DELCMDCLOSE)##g; @@ -3311,7 +3347,7 @@ sub postprocess { ### if ($CITECMD) { ###### $delblock=~s/(\\($CITECMD)${extraspace}(?:\[$brat0\]${extraspace}){0,2}\{$pat_n\})(\s*)/\\mbox{$AUXCMD\n$1\n}$AUXCMD\n/msg ; ### $delblock=~s/(\\($CITECMD)${extraspace}(?:<$abrat0>${extraspace})?(?:\[$brat0\]${extraspace}){0,2}\{$pat_n\})(\s*)/\\mbox{$AUXCMD\n$1\n}$AUXCMD\n/msg ; - ### } + ### } # if MBOXINLINEMATH is set, protect inlined math environments with an extra mbox @@ -3319,7 +3355,7 @@ sub postprocess { # note additional \newline after command is omitted from output if right at the end of deleted block (otherwise a spurious empty line is generated) $delblock=~s/($math)(?:[\s\n]*)?/\\mbox{$AUXCMD\n$1\n}$AUXCMD\n/sg; } - ###if ( defined($packages{"listings"} and $latexdiffpreamble =~ /\\RequirePackage(?:\[$brat_n\])?\{color\}/)) { + ###if ( defined($packages{"listings"} and $latexdiffpreamble =~ /\\RequirePackage(?:\[$brat_n\])?\{color\}/)) { ### # change included verbatim environments ### $delblock =~ s/\\DIFverb\{/\\DIFDIFdelverb\{/g; ### $delblock =~ s/\\DIFlstinline/\\DIFDIFdellstinline/g; @@ -3361,7 +3397,7 @@ sub postprocess { ##$addblock=~s/($math)/\\mbox{$AUXCMD\n$1\n}$AUXCMD\n/sg; $addblock=~s/($math)(?:[\s\n]*)?/\\mbox{$AUXCMD\n$1\n}$AUXCMD\n/sg; } - ###if ( defined($packages{"listings"} and $latexdiffpreamble =~ /\\RequirePackage(?:\[$brat0\])?\{color\}/)) { + ###if ( defined($packages{"listings"} and $latexdiffpreamble =~ /\\RequirePackage(?:\[$brat0\])?\{color\}/)) { # mark added verbatim commands $addblock =~ s/\\DIFverb/\\DIFDIFaddverb/g; $addblock =~ s/\\DIFlstinline/\\DIFDIFaddlstinline/g; @@ -3379,11 +3415,11 @@ sub postprocess { pos = $begin + length($addblock); } - # Go through whole text, and by counting list environment commands, find out when we are within a list environment. + # Go through whole text, and by counting list environment commands, find out when we are within a list environment. # Within those restore deleted \item commands - @textparts=split /(?<!$DELCMDOPEN)(\\(?:begin|end)\{$LISTENV\})/ ; + @textparts=split /(?<!$DELCMDOPEN)(\\(?:begin|end)\{$LISTENV\})/ ; @liststack=(); - @newtextparts=map { + @newtextparts=map { ### print STDERR ":::::::: $_\n"; if ( ($listtype) = m/^\\begin\{($LISTENV)\}$/ ) { print STDERR "DEBUG: postprocess \\begin{$listtype}\n" if $debug; @@ -3399,7 +3435,7 @@ sub postprocess { } else { print STDERR "DEBUG: postprocess \@liststack=(",join(",",@liststack),")\n" if $debug; if (scalar @liststack > 0 ) { - # we are within a list environment and should replace all item commands + # we are within a list environment and should replace all item commands $_=restore_item_commands($_); } # else: we are outside a list environment and do not need to do anything @@ -3412,17 +3448,17 @@ sub postprocess { # Replace MATHMODE environments from step 1a above by the correct Math environment and remove unncessary pairings - + if ( $mathmarkup == FINE ) { # look for AUXCMD math-mode pairs which have only comments (or empty lines between them), and remove the added commands # \begin{..} ... \end{..} pairs - s/\\begin\{((?:$MATHENV)|(?:$MATHARRENV)|SQUAREBRACKET|MATHMODE)\}$AUXCMD\n((?:\s*%.[^\n]*\n)*)\\end\{\1\}$AUXCMD\n/$2/sg; + s/\\begin\{((?:$MATHENV)|(?:$MATHARRENV)|SQUAREBRACKET|MATHMODE)\}$AUXCMD\n((?:\s*%.[^\n]*\n)*)\\end\{\1\}$AUXCMD\n/$2/sg; # \end{..} .... \begin{..} pairs - s/\\end\{((?:$MATHENV)|(?:$MATHARRENV)|SQUAREBRACKET|MATHMODE)\}$AUXCMD\n((?:\s*%.[^\n]*\n)*)\\begin\{\1\}$AUXCMD\n/$2/sg; + s/\\end\{((?:$MATHENV)|(?:$MATHARRENV)|SQUAREBRACKET|MATHMODE)\}$AUXCMD\n((?:\s*%.[^\n]*\n)*)\\begin\{\1\}$AUXCMD\n/$2/sg; writedebugfile($_,'postprocess15'); # The next line is complicated. The negative look-ahead insertion makes sure that no \end{$MATHENV} (or other mathematical - # environments) are between the \begin{$MATHENV} and \end{MATHMODE} commands. This is necessary as the minimal matching + # environments) are between the \begin{$MATHENV} and \end{MATHMODE} commands. This is necessary as the minimal matching # is not globally minimal but only 'locally' (matching is beginning from the left side of the string) # [NB: Do not be tempted to prettify the expression with /x modified. It seems this is applied after strings are expanded so will ignore spaces in strings 1 while s/(?<!$DELCMDOPEN)\\begin\{((?:$MATHENV)|(?:$MATHARRENV)|SQUAREBRACKET)}((?:${DELCMDOPEN}[^\n]*|.(?!(?:\\end\{(?:(?:$MATHENV)|(?:$MATHARRENV)|SQUAREBRACKET)}|\\begin\{MATHMODE})))*?)\\end\{MATHMODE}/\\begin{$1}$2\\end{$1}/s; @@ -3497,7 +3533,7 @@ sub postprocess { # remove empty DIFCMD < lines s/^\Q${DELCMDOPEN}\E\n//msg; - # Expand hashes of verb and verbatim environments + # Expand hashes of verb and verbatim environments s/${DELCMDOPEN}\\($VERBATIMENV)\{([-\d]*?)\}/"${DELCMDOPEN}\\begin{${1}}".fromhash(\%verbhash,$2,$DELCMDOPEN)."${DELCMDOPEN}\\end{${1}}"/esg; # revert changes to verbatim environments for line diffs (and add code to mark up changes) (note negative look behind assertions to not leak out of DIFDELCMD comments) # Example: @@ -3523,8 +3559,8 @@ sub postprocess { ((?:\%\Q$DELCOMMENT$VERBCOMMENT\E[^\n]*?\n)*) # Deleted \end command of verbatim environment. Note that the type is forced to match the opening. Captures: $5: Whole deleted environment (previous way this line was written: (\Q$DELCMDOPEN\E\\end\{\2\}(?:\n|\s|\Q$DELCMDOPEN\E)*\Q$DELCMDCLOSE\E) (\Q$DELCMDOPEN\E\\end\{\2\}) - / # Substitution part - $1 # Leave expression as is + / # Substitution part + $1 # Leave expression as is . "$AUXCMD NEXT\n" # Mark the following line as an auxiliary command . "" # reinstate the original environment without options . reverselinecomment($2, "$3$4") # modify the body to change the markup; reverselinecomment parses for options @@ -3533,7 +3569,7 @@ sub postprocess { /esgx; # Modifiers of substitution command writedebugfile($_,'postprocess2'); # where changes have occurred in verbatim environment, change verbatim to DIFverbatim to allow mark-up - # (I use the presence of optional paramater to verbatim environment as the marker - normal verbatim + # (I use the presence of optional paramater to verbatim environment as the marker - normal verbatim # environment does not take optional arguments) s/(?<!$DELCMDOPEN)\\begin\{(verbatim[*]?)\}(\[$brat_n\].*?)\\end\{\1\}/\\begin{DIF$1}$2\\end{DIF$1}/sg; @@ -3547,7 +3583,7 @@ sub postprocess { # convert remaining PAR commands (which are preceded by non-white space characters, usually "}" ($ADDCLOSE) s/\\PAR\n/\n\n/sg; - # package specific processing: + # package specific processing: if ( defined($packages{"endfloat"})) { #endfloat: make sure \begin{figure} and \end{figure} are always # on a line by themselves, similarly for table environment @@ -3560,12 +3596,16 @@ sub postprocess { s/^((?:[^%]+)\\(?:begin|end)\{(?:figure|table)\}(?:\[[a-zA-Z]+\])?)(.+)((?:%.*)?)$/$1\n$2$3/mg; } - # Convert '\PERCENTAGE ' back into '\%' (the final question mark catches a special situation where due to a latter pre-processing step the ' ' becomes separated + # Remove empty auxiliary LISTENV (sometmes these are generated if list environment occurs within the argument of a deleted comment) + # (slightly hacky but I could not see an easy way to see if in argument of another command when this extra markup is added) + s/\\begin\{($LISTENV)\}$AUXCMD\n((?:\s*\%[^\n]*\n)*\n?)\\end\{\1\}$AUXCMD\n/$2\n/msg ; + + # Convert '\PERCENTAGE ' back into '\%' (the final question mark catches a special situation where due to a latter pre-processing step the ' ' becomes separated s/\\PERCENTAGE ?/\\%/g; - # Convert '\DOLLAR ' back into '\$' + # Convert '\DOLLAR ' back into '\$' s/\\DOLLAR /\\\$/g; - # undo renaming of the \begin and \end,{,} and dollars in comments + # undo renaming of the \begin and \end,{,} and dollars in comments # although we only renamed $ in comments to DOLLARDIFF, we might have lost the % in unchanged verbatim blocks, so rename all s/DOLLARDIF/\$/g; @@ -3583,7 +3623,7 @@ sub postprocess { # Convert \SQRT{n} into \sqrt{n} and \SQRTNB{nn} into \sqrt nn 1 while s/\\SQRT(\s*\{($pat_n)\})/\\sqrt$1/g ; 1 while s/\\SQRTNB\{(\s*$pat0)\}/\\sqrt$1/g ; - + 1 while s/(%.*)\\CFRAC (.*)$/$1\\frac$2/mg ; 1 while s/(%.*)\\CRIGHTBRACE (.*)$/$1\}$2/mg ; 1 while s/(%.*)\\CLEFTBRACE (.*)$/$1\{$2/mg ; @@ -3594,7 +3634,7 @@ sub postprocess { s/\\QRIGHTBRACE /\\\}/sg; s/\\AMPERSAND /\\&/sg; # Highlight added inline verbatim commands if possible - if ( $latexdiffpreamble =~ /\\RequirePackage(?:\[$brat_n\])?\{color\}/ ) { + if ( $latexdiffpreamble =~ /\\RequirePackage(?:\[$brat_n\])?\{color\}/ ) { # wrap added verb commands with color commands s/\\DIFDIFadd((?:verb\*?|lstinline(?:\[$brat_n\])?)\{[-\d]*?\}[\s\n]*)/\{\\color{blue}$AUXCMD\n\\DIF$1%\n\}$AUXCMD\n/sg; s/\\DIFDIFdel((?:verb\*?|lstinline(?:\[$brat_n\])?)\{[-\d]*?\}[\s\n]*$AUXCMD)/\{\\color{red}${AUXCMD}\n\\DIF$1\n\}${AUXCMD}/sg; @@ -3609,8 +3649,8 @@ sub postprocess { # finally add the comment to the ones not having an optional argument before ###s/\\DIFaddlstinline(?!\[)/\\lstinline\n[basicstyle=\\color{blue}]$AUXCMD\n/g; - return; } + return; } # $out = restore_item_commands($listenviron) @@ -3634,13 +3674,13 @@ sub restore_item_commands { # @auxlines=preprocess_preamble($oldpreamble,$newpreamble); - # pre-process preamble by looking for commands used in \maketitle (title, author, date etc commands) - # the list of commands is defined in CONTEXT2CMD - # if found then use a bodydiff to mark up content, and replace the corresponding commands + # pre-process preamble by looking for commands used in \maketitle (title, author, date etc commands) + # the list of commands is defined in CONTEXT2CMD + # if found then use a bodydiff to mark up content, and replace the corresponding commands # in both preambles by marked up version to 'fool' the linediff (such that only body is marked up). # A special case are e.g. author commands being added (or removed) # 1. If commands are added, then the entire content is marked up as new, but also the lines are marked as new in the linediff - # 2. If commands are removed, then the linediff will mark the line as deleted. The program returns + # 2. If commands are removed, then the linediff will mark the line as deleted. The program returns # with $auxlines a text to be appended at the end of the preamble, which shows the respective fields as deleted sub preprocess_preamble { my ($oldpreambleref,$newpreambleref)=(\$_[0],\$_[1]) ; @@ -3662,7 +3702,7 @@ EOF $titlecmd = "(?:".join("|",@CONTEXT2CMDLIST).")"; # as context2cmdlist is stored as regex, e.g. ((?-xism:^title$), we need to remove ^- fo # resue in a more complex regex - $titlecmd =~ s/[\$\^]//g; + $titlecmd =~ s/[\$\^]//g; # make sure to not match on comment lines: $titlecmdpat=qr/^(?:[^%\n]|\\%)*(\\($titlecmd)$extraspace(?:\[($brat_n)\])?(?:\{($pat_n)\}))/ms; ###print STDERR "DEBUG:",$titlecmdpat,"\n"; @@ -3688,7 +3728,7 @@ EOF $cmd=shift @newtitlecommands; $optarg=shift @newtitlecommands; $arg=shift @newtitlecommands; - + if ( defined($newhash{$cmd})) { warn "$cmd is used twice in preamble of new file. Reverting to pure line diff mode for preamble.\n"; print STDERR $warnmsgdetail; @@ -3715,7 +3755,7 @@ EOF } $argnew=$newhash{$cmd}->[2]; $argdiff="{" . join("",bodydiff($argold,$argnew)) ."}"; - # Replace \RIGHTBRACE by } + # Replace \RIGHTBRACE by } $argdiff =~ s/\\RIGHTBRACE/}/g; if ( length $optargnew ) { @@ -3730,7 +3770,7 @@ EOF $optargdiff=""; } ### print STDERR "DEBUG s/\\Q$newhash{$cmd}->[0]\\E/\\$cmd$optargdiff$argdiff/s\n"; - # Note: \Q and \E force literal interpretation of what it between them but allow + # Note: \Q and \E force literal interpretation of what it between them but allow # variable interpolation, such that e.g. \title matches just that and not TAB-itle $$newpreambleref=~s/\Q$newhash{$cmd}->[0]\E/\\$cmd$optargdiff$argdiff/s; # replace this in old preamble if necessary @@ -3770,7 +3810,7 @@ EOF #%< old deleted line(s) #%DIF ------- #%DIF mmann-nn -#new appended line %< +#new appended line %< #%DIF ------- # Future extension: mark change explicitly # Assumes: traverse_sequence traverses deletions before insertions in changed sequences @@ -3782,9 +3822,9 @@ sub linediff { my $block = []; my $retseq = []; my @begin=('','',''); # dummy initialisation - my $instring ; + my $instring ; - my $discard = sub { @begin=('d',$_[0],$_[1]) unless scalar @$block ; + my $discard = sub { @begin=('d',$_[0],$_[1]) unless scalar @$block ; push(@$block, "%DIF < " . $seq1->[$_[0]]) }; my $add = sub { if (! scalar @$block) { @begin=('a',$_[0],$_[1]) ;} @@ -3799,12 +3839,12 @@ sub linediff { $instring = sprintf "%%DIF %da%d-%d",$begin[1],$begin[2],$_[1]-1; } elsif ( $begin[0] eq 'c' ) { $instring = sprintf "%%DIF %sc%s", - ($begin[1]==$_[0]-1) ? "$begin[1]" : $begin[1]."-".($_[0]-1) , + ($begin[1]==$_[0]-1) ? "$begin[1]" : $begin[1]."-".($_[0]-1) , ($begin[2]==$_[1]-1) ? "$begin[2]" : $begin[2]."-".($_[1]-1) ; } else { $instring = sprintf "%%DIF %d%s%d",$begin[1],$begin[0],$begin[2]; } - push @$retseq, $instring,@$block, "%DIF -------" ; - $block = []; + push @$retseq, $instring,@$block, "%DIF -------" ; + $block = []; } push @$retseq, $seq2->[$_[1]] }; @@ -3812,7 +3852,7 @@ sub linediff { my $keyfunc = sub { join(" ",split(" ",shift())) }; traverse_sequences($seq1,$seq2, { MATCH=>$match, DISCARD_A=>$discard, DISCARD_B=>$add }, $keyfunc ); - push @$retseq, @$block if scalar @$block; + push @$retseq, @$block if scalar @$block; return wantarray ? @$retseq : $retseq ; } @@ -3822,23 +3862,23 @@ sub linediff { # init_regex_arr_data(\@array,"TOKEN INIT") # scans DATA file handel for line "%% TOKEN INIT" line # then appends each line not beginning with % into array (as a quoted regex) -# This is used for command lists and configuration variables, but the processing is slightly -# different: +# This is used for command lists and configuration variables, but the processing is slightly +# different: # For lists, the regular expression is extended to include beginning (^) and end ($) markers, to require full-string matching # For configuration variables (and all others), simply an unadorned list is copied sub init_regex_arr_data { my ($arr,$token)=@_; my $copy=0; my ($mode); - if ($token =~ m/COMMANDS/ ) { - $mode=0; # Reading command list + if ($token =~ m/COMMANDS/ ) { + $mode=0; # Reading command list } else { $mode=1; # Reading configuration variables } while (<DATA>) { if ( m/^%%BEGIN $token\s*$/ ) { - $copy=1; + $copy=1; next; } elsif ( m/^%%END $token\s*$/ ) { last; } @@ -3919,17 +3959,18 @@ sub exetime { sub usage { - print STDERR <<"EOF"; + print STDERR <<"EOF"; Usage: $0 [options] old.tex new.tex > diff.tex -Compares two latex files and writes tex code to stdout, which has the same format as new.tex but +Compares two latex files and writes tex code to stdout, which has the same format as new.tex but has all changes relative to old.tex marked up or commented. Note that old.tex and new.tex need to -be real files (not pipes or similar) as they are opened twice. +be real files (not pipes or similar) as they are opened twice. --type=markupstyle -t markupstyle Add code to preamble for selected markup style - Available styles: UNDERLINE CTRADITIONAL TRADITIONAL CFONT FONTSTRIKE INVISIBLE + Available styles: UNDERLINE CTRADITIONAL TRADITIONAL CFONT FONTSTRIKE INVISIBLE CHANGEBAR CCHANGEBAR CULINECHBAR CFONTCHBAR BOLD PDFCOMMENT + LUAUNDERLINE [ Default: UNDERLINE ] --subtype=markstyle @@ -3940,7 +3981,7 @@ be real files (not pipes or similar) as they are opened twice. * LABEL subtype is deprecated --floattype=markstyle --f markstyle Add code to preamble for selected style which +-f markstyle Add code to preamble for selected style which replace standard marking and markup commands within floats (e.g., marginal remarks cause an error within floats so marginal marking can be disabled thus) @@ -3949,11 +3990,11 @@ be real files (not pipes or similar) as they are opened twice. --encoding=enc -e enc Specify encoding of old.tex and new.tex. Typical encodings are - ascii, utf8, latin1, latin9. A list of available encodings can be - obtained by executing + ascii, utf8, latin1, latin9. A list of available encodings can be + obtained by executing perl -MEncode -e 'print join ("\\n",Encode->encodings( ":all" )) ;' [Default encoding is utf8 unless the first few lines of the preamble contain - an invocation "\\usepackage[..]{inputenc} in which case the + an invocation "\\usepackage[..]{inputenc} in which case the encoding chosen by this command is asssumed. Note that ASCII (standard latex) is a subset of utf8] @@ -3970,22 +4011,22 @@ be real files (not pipes or similar) as they are opened twice. --exclude-safecmd=exclude-file --exclude-safecmd="cmd1,cmd2,..." --A exclude-file +-A exclude-file --replace-safecmd=replace-file --append-safecmd=append-file --append-safecmd="cmd1,cmd2,..." -a append-file Exclude from, replace or append to the list of regex - matching commands which are safe to use within the + matching commands which are safe to use within the scope of a \\DIFadd or \\DIFdel command. The file must contain one Perl-RegEx per line (Comment lines beginning with # or % are ignored). A literal comma within the comma-separated list must be - escaped thus "\\,", Note that the RegEx needs to match the whole of + escaped thus "\\,", Note that the RegEx needs to match the whole of the token, i.e., /^regex\$/ is implied and that the initial "\\" of the command is not included. The --exclude-safecmd - and --append-safecmd options can be combined with the --replace-safecmd + and --append-safecmd options can be combined with the --replace-safecmd option and can be used repeatedly to add cumulatively to the lists. ---exclude-textcmd=exclude-file +--exclude-textcmd=exclude-file --exclude-textcmd="cmd1,cmd2,..." -X exclude-file --replace-textcmd=replace-file @@ -4001,7 +4042,7 @@ be real files (not pipes or similar) as they are opened twice. Replace or append to the list of regex matching commands whose last argument is text but which require a particular context to work, e.g. \\caption will only work within a figure - or table. These commands behave like text commands, except when + or table. These commands behave like text commands, except when they occur in a deleted section, when they are disabled, but their argument is shown as deleted text. @@ -4011,7 +4052,7 @@ be real files (not pipes or similar) as they are opened twice. As corresponding commands for context1. The only difference is that context2 commands are completely disabled in deleted sections, including their arguments. - context2 commands are also the only commands in the preamble, whose argument will + context2 commands are also the only commands in the preamble, whose argument will be processed in word-by-word mode (which only works, if they occur no more than once in the preamble). @@ -4020,15 +4061,15 @@ be real files (not pipes or similar) as they are opened twice. --append-mboxsafecmd=append-file --append-mboxsafecmd="cmd1,cmd2,..." Define safe commands, which additionally need to be protected by encapsulating - in an \\mbox{..}. This is sometimes needed to get around incompatibilities + in an \\mbox{..}. This is sometimes needed to get around incompatibilities between external packages and the ulem package, which is used for highlighting in the default style UNDERLINE as well as CULINECHBAR CFONTSTRIKE - + --config var1=val1,var2=val2,... -c var1=val1,.. Set configuration variables. --c configfile Available variables: +-c configfile Available variables: ARRENV (RegEx) COUNTERCMD (RegEx) FLOATENV (RegEx) @@ -4047,15 +4088,15 @@ be real files (not pipes or similar) as they are opened twice. --add-to-config varenv1=pattern1,varenv2=pattern2 For configuration variables containing a regular expression (essentially those ending - in ENV, and COUNTERCMD) this provides an alternative way to modify the configuration + in ENV, and COUNTERCMD) this provides an alternative way to modify the configuration variables. Instead of setting the complete pattern, with this option it is possible to add an alternative pattern. varenv must be one of the variables listed above that take a regular - expression as argument, and pattern is any regular expression (which might need to be + expression as argument, and pattern is any regular expression (which might need to be protected from the shell by quotation). Several patterns can be added at once by using semi-colons to separate them, e.g. --add-to-config "LISTENV=myitemize;myenumerate,COUNTERCMD=endnote" --packages=pkg1,pkg2,.. - Tell latexdiff that .tex file is processed with the packages in list + Tell latexdiff that .tex file is processed with the packages in list loaded. This is normally not necessary if the .tex file includes the preamble, as the preamble is automatically scanned for \\usepackage commands. Use of the --packages option disables automatic scanning, so if for any @@ -4076,57 +4117,57 @@ be real files (not pipes or similar) as they are opened twice. --show-all Show all of the above - NB For all --show commands, no old.tex or new.tex file needs to be given, and no + NB For all --show commands, no old.tex or new.tex file needs to be given, and no differencing takes place. Other configuration options: --allow-spaces Allow spaces between bracketed or braced arguments to commands - [Default requires arguments to directly follow each other without + [Default requires arguments to directly follow each other without intervening spaces] --math-markup=level Determine granularity of markup in displayed math environments: Possible values for level are (both numerical and text labels are acceptable): - off or 0: suppress markup for math environments. Deleted equations will not - appear in diff file. This mode can be used if all the other modes + off or 0: suppress markup for math environments. Deleted equations will not + appear in diff file. This mode can be used if all the other modes cause invalid latex code. whole or 1: Differencing on the level of whole equations. Even trivial changes - to equations cause the whole equation to be marked changed. This - mode can be used if processing in coarse or fine mode results in + to equations cause the whole equation to be marked changed. This + mode can be used if processing in coarse or fine mode results in invalid latex code. coarse or 2: Detect changes within equations marked up with a coarse - granularity; changes in equation type (e.g.displaymath to equation) + granularity; changes in equation type (e.g.displaymath to equation) appear as a change to the complete equation. This mode is recommended for situations where the content and order of some equations are still being changed. [Default] fine or 3: Detect small change in equations and mark up and fine granularity. This mode is most suitable, if only minor changes to equations are - expected, e.g. correction of typos. + expected, e.g. correction of typos. --graphics-markup=level Change highlight style for graphics embedded with \\includegraphics commands Possible values for level: none,off or 0: no highlighting for figures new-only or 1: surround newly added or changed figures with a blue frame [Default] - both or 2: highlight new figures with a blue frame and show deleted figures + both or 2: highlight new figures with a blue frame and show deleted figures at reduced scale, and crossed out with a red diagonal cross. Use configuration variable SCALEDELGRAPHICS to set size of deleted figures. - Note that changes to the optional parameters will make the figure appear as changed + Note that changes to the optional parameters will make the figure appear as changed to latexdiff, and this figure will thus be highlighted. In some circumstances "Misplaced \\noalign" errors can occur if there are certain types - of changes in tables. In this case please use option --graphics-markup=none as a - work-around. + of changes in tables. In this case please use option --graphics-markup=none as a + work-around. ---no-del Suppress deleted text from the diff. It is similar in effect to the BOLD style, +--no-del Suppress deleted text from the diff. It is similar in effect to the BOLD style, but the deleted text ist not just invisible in the output, it is also not included in the - diff text file. This can be more robust than just making it invisible. + diff text file. This can be more robust than just making it invisible. ---disable-citation-markup ---disable-auto-mbox Suppress citation markup and markup of other vulnerable commands in styles +--disable-citation-markup +--disable-auto-mbox Suppress citation markup and markup of other vulnerable commands in styles using ulem (UNDERLINE,FONTSTRIKE, CULINECHBAR) (the two options are identical and are simply aliases) --enable-citation-markup ---enforce-auto-mbox Protect citation commands and other vulnerable commands in changed sections +--enforce-auto-mbox Protect citation commands and other vulnerable commands in changed sections with \\mbox command, i.e. use default behaviour for ulem package for other packages (the two options are identical and are simply aliases) @@ -4142,14 +4183,14 @@ Miscellaneous options --no-label Suppress inclusion of old and new file names as comment in output file ---visible-label Include old and new filenames (or labels set with --label option) as +--visible-label Include old and new filenames (or labels set with --label option) as visible output --flatten Replace \\input and \\include commands within body by the content of the files in their argument. If \\includeonly is present in the - preamble, only those files are expanded into the document. However, - no recursion is done, i.e. \\input and \\include commands within - included sections are not expanded. The included files are assumed to + preamble, only those files are expanded into the document. However, + no recursion is done, i.e. \\input and \\include commands within + included sections are not expanded. The included files are assumed to be located in the same directories as the old and new master files, respectively, making it possible to organise files into old and new directories. --flatten is applied recursively, so inputted files can contain further @@ -4172,7 +4213,7 @@ Miscellaneous options -h Show this help text. --ignore-warnings Suppress warnings about inconsistencies in length between input - and parsed strings and missing characters. + and parsed strings and missing characters. --verbose -V Output various status information to stderr during processing. @@ -4184,10 +4225,10 @@ Internal options: These options are mostly for automated use by latexdiff-vc. They can be used directly, but the API should be considered less stable than for the other options. ---no-links Suppress generation of hyperreferences, used for minimal diffs +--no-links Suppress generation of hyperreferences, used for minimal diffs (option --only-changes of latexdiff-vc). EOF - exit 0; + exit 0; } =head1 NAME @@ -4213,8 +4254,8 @@ be real files (not pipes or similar) as they are opened twice (unless C<--encodi The program treats the preamble differently from the main document. Differences between the preambles are found using line-based differencing (similarly to the Unix diff command, but ignoring white -spaces). A comment, "S<C<%DIF E<gt>>>" is appended to each added line, i.e. a -line present in C<new.tex> but not in C<old.tex>. Discarded lines +spaces). A comment, "S<C<%DIF E<gt>>>" is appended to each added line, i.e. a +line present in C<new.tex> but not in C<old.tex>. Discarded lines are deactivated by prepending "S<C<%DIF E<lt>>>". Changed blocks are preceded by comment lines giving information about line numbers in the original files. Where there are insignificant differences, the resulting file C<diff.tex> will be similar to @@ -4267,7 +4308,7 @@ curly braces immediately following a command (i.e. a sequence of letters beginning with a backslash) are arguments for that command. As a restriction to condition 1 above it is thus necessary to surround all arguments with curly braces, and to not insert -extraneous spaces. For example, write +extraneous spaces. For example, write \section{\textem{This is an emphasized section title}} @@ -4299,7 +4340,7 @@ but the choice is yours. Any markup within the environment will be removed, and generally everything within the environment will just be taken from the new file. -It is also possible to difference files which do not have a preamble. +It is also possible to difference files which do not have a preamble. In this case, the file is processed in the main document mode, but the definitions of the markup commands are not inserted. @@ -4317,7 +4358,7 @@ the scope of C<\DIFadd>. Added comments are marked by prepending Within deleted blocks text is highlighted with C<\DIFdel>. Deleted comments are marked by prepending "S<C<%DIF E<lt> >>". Non-safe command -and curly braces within deleted blocks are commented out with +and curly braces within deleted blocks are commented out with "S<C<%DIFDELCMD E<lt> >>". @@ -4327,7 +4368,7 @@ and curly braces within deleted blocks are commented out with =head2 Preamble The following options determine the visual markup style by adding the appropriate -command definitions to the preamble. See the end of this section for a description of +command definitions to the preamble. See the end of this section for a description of available styles. =over 4 @@ -4337,15 +4378,16 @@ B<-t markupstyle> Add code to preamble for selected markup style. This option defines C<\DIFadd> and C<\DIFdel> commands. -Available styles: +Available styles: -C<UNDERLINE CTRADITIONAL TRADITIONAL CFONT FONTSTRIKE INVISIBLE -CHANGEBAR CCHANGEBAR CULINECHBAR CFONTCHBAR BOLD PDFCOMMENT> +C<UNDERLINE CTRADITIONAL TRADITIONAL CFONT FONTSTRIKE INVISIBLE +CHANGEBAR CCHANGEBAR CULINECHBAR CFONTCHBAR BOLD PDFCOMMENT +LUAUNDERLINE> [ Default: C<UNDERLINE> ] =item B<--subtype=markstyle> or -B<-s markstyle> +B<-s markstyle> Add code to preamble for selected style for bracketing commands (e.g. to mark changes in margin). This option defines @@ -4358,27 +4400,27 @@ Available styles: C<SAFE MARGIN COLOR DVIPSCOL ZLABEL ONLYCHANGEDPAGE (LABEL)*> =item B<--floattype=markstyle> or B<-f markstyle> -Add code to preamble for selected style which +Add code to preamble for selected style which replace standard marking and markup commands within floats (e.g., marginal remarks cause an error within floats -so marginal marking can be disabled thus). This option defines all +so marginal marking can be disabled thus). This option defines all C<\DIF...FL> commands. Available styles: C<FLOATSAFE TRADITIONALSAFE IDENTICAL> [ Default: C<FLOATSAFE> ] -=item B<--encoding=enc> or +=item B<--encoding=enc> or B<-e enc> Specify encoding of old.tex and new.tex. Typical encodings are -C<ascii>, C<utf8>, C<latin1>, C<latin9>. A list of available encodings can be -obtained by executing +C<ascii>, C<utf8>, C<latin1>, C<latin9>. A list of available encodings can be +obtained by executing C<perl -MEncode -e 'print join ("\n",Encode->encodings( ":all" )) ;' > If this option is used, then old.tex, new.tex are only opened once. [Default encoding is utf8 unless the first few lines of the preamble contain -an invocation C<\usepackage[..]{inputenc}> in which case the +an invocation C<\usepackage[..]{inputenc}> in which case the encoding chosen by this command is asssumed. Note that ASCII (standard latex) is a subset of utf8] @@ -4395,7 +4437,7 @@ C<\DIFaddbeginFL, \DIFaddendFL, \DIFaddFL{..}, (If this option is set B<-t>, B<-s>, and B<-f> options are ignored.) -=item B<--packages=pkg1,pkg2,..> +=item B<--packages=pkg1,pkg2,..> Tell latexdiff that .tex file is processed with the packages in list loaded. This is normally not necessary if the .tex file includes the @@ -4406,13 +4448,13 @@ The following packages trigger special behaviour: =over 8 -=item C<endfloat> +=item C<endfloat> Ensure that C<\begin{figure}> and C<\end{figure}> always appear by themselves on a line. =item C<hyperref> -Change name of C<\DIFadd> and C<\DIFdel> commands to C<\DIFaddtex> and C<\DIFdeltex> and +Change name of C<\DIFadd> and C<\DIFdel> commands to C<\DIFaddtex> and C<\DIFdeltex> and define new C<\DIFadd> and C<\DIFdel> commands, which provide a wrapper for these commands, using them for the text but not for the link defining command (where any markup would cause errors). @@ -4464,17 +4506,17 @@ B<-A exclude-file> or B<--exclude-safecmd="cmd1,cmd2,..."> =item B<--replace-safecmd=replace-file> -=item B<--append-safecmd=append-file> or +=item B<--append-safecmd=append-file> or B<-a append-file> or B<--append-safecmd="cmd1,cmd2,..."> Exclude from, replace or append to the list of regular expressions (RegEx) -matching commands which are safe to use within the +matching commands which are safe to use within the scope of a C<\DIFadd> or C<\DIFdel> command. The file must contain one Perl-RegEx per line (Comment lines beginning with # or % are -ignored). Note that the RegEx needs to match the whole of +ignored). Note that the RegEx needs to match the whole of the token, i.e., /^regex$/ is implied and that the initial -"\" of the command is not included. -The B<--exclude-safecmd> and B<--append-safecmd> options can be combined with the -B<--replace-safecmd> +"\" of the command is not included. +The B<--exclude-safecmd> and B<--append-safecmd> options can be combined with the -B<--replace-safecmd> option and can be used repeatedly to add cumulatively to the lists. B<--exclude-safecmd> and B<--append-safecmd> can also take a comma separated list as input. If a @@ -4487,7 +4529,7 @@ B<-X exclude-file> or B<--exclude-textcmd="cmd1,cmd2,..."> =item B<--replace-textcmd=replace-file> -=item B<--append-textcmd=append-file> or +=item B<--append-textcmd=append-file> or B<-x append-file> or B<--append-textcmd="cmd1,cmd2,..."> Exclude from, replace or append to the list of regular expressions @@ -4495,7 +4537,7 @@ matching commands whose last argument is text. See entry for B<--exclude-safecmd> directly above for further details. -=item B<--replace-context1cmd=replace-file> +=item B<--replace-context1cmd=replace-file> =item B<--append-context1cmd=append-file> or @@ -4504,11 +4546,11 @@ entry for B<--exclude-safecmd> directly above for further details. Replace or append to the list of regex matching commands whose last argument is text but which require a particular context to work, e.g. C<\caption> will only work within a figure -or table. These commands behave like text commands, except when +or table. These commands behave like text commands, except when they occur in a deleted section, when they are disabled, but their argument is shown as deleted text. -=item B<--replace-context2cmd=replace-file> +=item B<--replace-context2cmd=replace-file> =item B<--append-context2cmd=append-file> or @@ -4518,9 +4560,9 @@ As corresponding commands for context1. The only difference is that context2 commands are completely disabled in deleted sections, including their arguments. -context2 commands are also the only commands in the preamble, whose argument will be processed in +context2 commands are also the only commands in the preamble, whose argument will be processed in word-by-word mode (which only works, if they occur no more than once in the preamble). The algorithm currently cannot cope with repeated context2 commands in the preamble, as they occur e.g. for the C<\author> argument in some journal styles (not in the standard styles, though -If such a repetition is detected, the whole preamble will be processed in line-by-line mode. In such a case, use C<--replace-context2cmd> option to just select the commands, which should be processed and are not used repeatedly in the preamble. +If such a repetition is detected, the whole preamble will be processed in line-by-line mode. In such a case, use C<--replace-context2cmd> option to just select the commands, which should be processed and are not used repeatedly in the preamble. @@ -4529,7 +4571,7 @@ If such a repetition is detected, the whole preamble will be processed in line-b =item B<--append-mboxsafecmd=append-file> or B<--append-mboxsafecmd="cmd1,cmd2,..."> Define safe commands, which additionally need to be protected by encapsulating -in an C<\mbox{..}>. This is sometimes needed to get around incompatibilities +in an C<\mbox{..}>. This is sometimes needed to get around incompatibilities between external packages and the ulem package, which is used for highlighting in the default style UNDERLINE as well as CULINECHBAR CFONTSTRIKE @@ -4543,7 +4585,7 @@ in the default style UNDERLINE as well as CULINECHBAR CFONTSTRIKE Set configuration variables. The option can be repeated to set different variables (as an alternative to the comma-separated list). -Available variables (see below for further explanations): +Available variables (see below for further explanations): C<ARRENV> (RegEx) @@ -4573,10 +4615,10 @@ C<SCALEDELGRAPHICS> (Float) =item B<--add-to-config varenv1=pattern1,varenv2=pattern2,...> For configuration variables, which are a regular expression (essentially those ending -in ENV, COUNTERCMD and CUSTOMDIFCMD, see list above) this option provides an alternative way to modify the configuration +in ENV, COUNTERCMD and CUSTOMDIFCMD, see list above) this option provides an alternative way to modify the configuration variables. Instead of setting the complete pattern, with this option it is possible to add an alternative pattern. C<varenv> must be one of the variables listed above that take a regular -expression as argument, and pattern is any regular expression (which might need to be +expression as argument, and pattern is any regular expression (which might need to be protected from the shell by quotation). Several patterns can be added at once by using semi-colons to separate them, e.g. C<--add-to-config "LISTENV=myitemize;myenumerate,COUNTERCMD=endnote"> @@ -4596,7 +4638,7 @@ Show values of configuration variables. Combine all --show commands. -NB For all --show commands, no C<old.tex> or C<new.tex> file needs to be specified, and no +NB For all --show commands, no C<old.tex> or C<new.tex> file needs to be specified, and no differencing takes place. =back @@ -4613,29 +4655,29 @@ might get lumpeded with preceding commands) so should only be used if the default produces erroneous results. (Default requires arguments to directly follow each other without intervening spaces). -=item B<--math-markup=level> +=item B<--math-markup=level> -Determine granularity of markup in displayed math environments: +Determine granularity of markup in displayed math environments: Possible values for level are (both numerical and text labels are acceptable): -C<off> or C<0>: suppress markup for math environments. Deleted equations will not -appear in diff file. This mode can be used if all the other modes +C<off> or C<0>: suppress markup for math environments. Deleted equations will not +appear in diff file. This mode can be used if all the other modes cause invalid latex code. C<whole> or C<1>: Differencing on the level of whole equations. Even trivial changes -to equations cause the whole equation to be marked changed. This -mode can be used if processing in coarse or fine mode results in +to equations cause the whole equation to be marked changed. This +mode can be used if processing in coarse or fine mode results in invalid latex code. C<coarse> or C<2>: Detect changes within equations marked up with a coarse -granularity; changes in equation type (e.g.displaymath to equation) +granularity; changes in equation type (e.g.displaymath to equation) appear as a change to the complete equation. This mode is recommended for situations where the content and order of some equations are still being changed. [Default] C<fine> or C<3>: Detect small change in equations and mark up at fine granularity. This mode is most suitable, if only minor changes to equations are -expected, e.g. correction of typos. +expected, e.g. correction of typos. =item B<--graphics-markup=level> @@ -4647,33 +4689,33 @@ C<none>, C<off> or C<0>: no highlighting for figures C<new-only> or C<1>: surround newly added or changed figures with a blue frame [Default if graphicx package loaded] -C<both> or C<2>: highlight new figures with a blue frame and show deleted figures at reduced +C<both> or C<2>: highlight new figures with a blue frame and show deleted figures at reduced scale, and crossed out with a red diagonal cross. Use configuration variable SCALEDELGRAPHICS to set size of deleted figures. -Note that changes to the optional parameters will make the figure appear as changed +Note that changes to the optional parameters will make the figure appear as changed to latexdiff, and this figure will thus be highlighted. In some circumstances "Misplaced \noalign" error can occur if there are certain types -of changes in tables. In this case please use C<--graphics-markup=none> as a -work-around. +of changes in tables. In this case please use C<--graphics-markup=none> as a +work-around. -=item B<--no-del> +=item B<--no-del> -Suppress deleted text from the diff. It is similar in effect to the BOLD style, -but the deleted text ist not just invisible in the output, it is also not included in the diff text file. -This can be more robust than just making it invisible. +Suppress deleted text from the diff. It is similar in effect to the BOLD style, +but the deleted text ist not just invisible in the output, it is also not included in the diff text file. +This can be more robust than just making it invisible. =item B<--disable-citation-markup> or B<--disable-auto-mbox> -Suppress citation markup and markup of other vulnerable commands in styles +Suppress citation markup and markup of other vulnerable commands in styles using ulem (UNDERLINE,FONTSTRIKE, CULINECHBAR) (the two options are identical and are simply aliases) =item B<--enable-citation-markup> or B<--enforce-auto-mbox> -Protect citation commands and other vulnerable commands in changed sections +Protect citation commands and other vulnerable commands in changed sections with C<\mbox> command, i.e. use default behaviour for ulem package for other packages (the two options are identical and are simply aliases) @@ -4719,18 +4761,18 @@ Suppress inclusion of old and new file names as comment in output file =item B<--visible-label> -Include old and new filenames (or labels set with C<--label> option) as +Include old and new filenames (or labels set with C<--label> option) as visible output. =item B<--flatten> Replace C<\input> and C<\include> commands within body by the content of the files in their argument. If C<\includeonly> is present in the -preamble, only those files are expanded into the document. However, -no recursion is done, i.e. C<\input> and C<\include> commands within -included sections are not expanded. The included files are assumed to +preamble, only those files are expanded into the document. However, +no recursion is done, i.e. C<\input> and C<\include> commands within +included sections are not expanded. The included files are assumed to be located in the same directories as the old and new master files, -respectively, making it possible to organise files into old and new directories. +respectively, making it possible to organise files into old and new directories. --flatten is applied recursively, so inputted files can contain further C<\input> statements. Also handles files included by the import package (C<\import> and C<\subimport>), and C<\subfile> command. @@ -4777,7 +4819,7 @@ Suppress generation of hyperreferences, used for minimal diffs (option --only-ch =back -=head2 Predefined styles +=head2 Predefined styles =head2 Major types @@ -4790,9 +4832,14 @@ The major type determine the markup of plain text and some selected latex comman Added text is wavy-underlined and blue, discarded text is struck out and red (Requires color and ulem packages). Overstriking does not work in displayed math equations such that deleted parts of equation are underlined, not struck out (this is a shortcoming inherent to the ulem package). +=item C<LUAUNDERLINE> + +Added text is underlined and blue, discarded text is struck out and red +(Requires lua-ul package + LuaLaTeX). + =item C<CTRADITIONAL> -Added text is blue and set in sans-serif, and a red footnote is created for each discarded +Added text is blue and set in sans-serif, and a red footnote is created for each discarded piece of text. (Requires color package) =item C<TRADITIONAL> @@ -4833,13 +4880,13 @@ Added text is set in bold face, discarded is not shown. (also see --no-del optio =item C<PDFCOMMENT> -The pdfcomment package is used to underline new text, and mark deletions with a PDF comment. Note that this markup might appear differently or not at all based on the pdf viewer used. The viewer with best support for pdf markup is probably acroread. This style is only recommended if the number of differences is small. +The pdfcomment package is used to underline new text, and mark deletions with a PDF comment. Note that this markup might appear differently or not at all based on the pdf viewer used. The viewer with best support for pdf markup is probably acroread. This style is only recommended if the number of differences is small. =back =head2 Subtypes -The subtype defines the commands that are inserted at the begin and end of added or discarded blocks, irrespectively of whether these blocks contain text or commands (Defined commands: C<\DIFaddbegin, \DIFaddend, \DIFdelbegin, \DIFdelend>) +The subtype defines the commands that are inserted at the begin and end of added or discarded blocks, irrespectively of whether these blocks contain text or commands (Defined commands: C<\DIFaddbegin, \DIFaddend, \DIFdelbegin, \DIFdelend>) =over 10 @@ -4857,7 +4904,7 @@ from the intended position. An alternative way of marking added passages in blue, and deleted ones in red. (It is recommeneded to use instead the main types to effect colored markup, -although in some cases coloring with dvipscol can be more complete, for example +although in some cases coloring with dvipscol can be more complete, for example with citation commands). =item C<DVIPSCOL> @@ -4872,12 +4919,12 @@ although in some cases coloring with dvipscol can be more complete). can be used to highlight only changed pages, but requires post-processing. It is recommend to not call this option manually but use C<latexdiff-vc> with C<--only-changes> option. Alternatively, use the script given within preamble of diff files made using this style. -=item C<ONLYCHANGEDPAGE> +=item C<ONLYCHANGEDPAGE> also highlights changed pages, without the need for post-processing, but might not work reliably if there is floating material (figures, tables). -=item C<LABEL> +=item C<LABEL> is similar to C<ZLABEL>, but does not need the zref package and works less reliably (deprecated). @@ -4885,7 +4932,7 @@ is similar to C<ZLABEL>, but does not need the zref package and works less relia =head2 Float Types -Some of the markup used in the main text might cause problems when used within +Some of the markup used in the main text might cause problems when used within floats (e.g. figures or tables). For this reason alternative versions of all markup commands are used within floats. The float type defines these alternative commands. @@ -4912,7 +4959,7 @@ Make no difference between the main text and floats. =item C<ARRENV> -If a match to C<ARRENV> is found within an inline math environment within a deleted or added block, then the inlined math +If a match to C<ARRENV> is found within an inline math environment within a deleted or added block, then the inlined math is surrounded by C<\mbox{>...C<}>. This is necessary as underlining does not work within inlined array environments. [ Default: C<ARRENV>=S<C<(?:array|[pbvBV]matrix)> > @@ -4932,9 +4979,9 @@ C<|subsubsection|paragraph|subparagraph)> ] This option is for advanced users and allows definition of special versions of commands, which do not work as safe commands. Commands in C<CUSTOMDIFCMD> that occur in added or deleted blocks will be given an ADD or DEL prefix. -The prefixed versions of the command must be defined in the preamble, either by putting them +The prefixed versions of the command must be defined in the preamble, either by putting them in the preamble of at least the new file, or by creating a custom preamble file (Option --preamble). -For example the command C<\blindtext> (from package blindtext) does not interact well with underlining, so that +For example the command C<\blindtext> (from package blindtext) does not interact well with underlining, so that for the standard markup type, it is not satisfactory to define it as a safe command. Instead, a customised versions without underlining can be defined in the preamble: @@ -4948,7 +4995,7 @@ and then latexdiff should be invoked with the option C<-c CUSTOMDIFCMD=blindtext =item C<FLOATENV> -Environments whose name matches the regular expression in C<FLOATENV> are +Environments whose name matches the regular expression in C<FLOATENV> are considered floats. Within these environments, the I<latexdiff> markup commands are replaced by their FL variaties. @@ -4997,17 +5044,17 @@ If C<--graphics-markup=both> is chosen, C<SCALEDELGRAPHICS> is the factor, by wh =item C<VERBATIMENV> -RegEx describing environments like verbatim, whose contents should be taken verbatim. The content of these environments will not be processed in any way: +RegEx describing environments like verbatim, whose contents should be taken verbatim. The content of these environments will not be processed in any way: deleted content is commented out, new content is not marked up [ Default: S<C<comment> > ] =item C<VERBATIMLINEENV> -RegEx describing environments like verbatim, whose contents should be taken verbatim. The content of environments described by VERBATIMLINEENV are compared in +RegEx describing environments like verbatim, whose contents should be taken verbatim. The content of environments described by VERBATIMLINEENV are compared in line mode, and changes are marked up using the listings package. The markup style is set based on the chosen mains markup type (Option -t), or on an analysis of the preamble. -Note that "listings.sty" must be installed. If this file is not found the fallback solution is to +Note that "listings.sty" must be installed. If this file is not found the fallback solution is to treat VERBATIMLINEENV environments treated exactly the same way as VERBATIMENV environments. [ Default: S<C<(?:verbatim[*]?|lstlisting> > ] @@ -5018,30 +5065,40 @@ treat VERBATIMLINEENV environments treated exactly the same way as VERBATIMENV e =over 10 -=item Citations result in overfull boxes +=item Changed citations result in overfull boxes There is an incompatibility between the C<ulem> package, which C<latexdiff> uses for underlining and striking out in the UNDERLINE style, -the default style, and the way citations are generated. In order to be able to mark up citations properly, they are enclosed with an C<\mbox> -command. As mboxes cannot be broken across lines, this procedure frequently results in overfull boxes, possibly obscuring the content as it extends beyond the right margin. The same occurs for some other packages (e.g., siunitx). If this is a problem, you have two possibilities. +the default style, and the way citations are generated. In order to be able to mark up citations properly, they are enclosed with an C<\mbox> +command. As mboxes cannot be broken across lines, this procedure frequently results in overfull boxes, possibly obscuring the content as it extends beyond the right margin. The same occurs for some other packages (e.g., siunitx). If this is a problem, you have several possibilities. 1. Use C<CFONT> type markup (option C<-t CFONT>): If this markup is chosen, then changed citations are no longer marked up -with the wavy line (additions) or struck out (deletions), but are still highlighted in the appropriate color, and deleted text is shown with a different font. Other styles not using the C<ulem> package will also work. +with the wavy line (additions) or struck out (deletions), but are still highlighted in the appropriate color, and deleted text is shown with a different font. Other styles not using the C<ulem> package will also work. 2. Choose option C<--disable-citation-markup> which turns off the marking up of citations: deleted citations are no longer shown, and -added citations are shown without markup. (This was the default behaviour of latexdiff at versions 0.6 and older) - +added citations are shown without markup. (This was the default behaviour of latexdiff at versions 0.6 and older). For custom packages you can define the commands which need to be protected by C<\mbox> with C<--append-mboxsafecmd> and C<--excludemboxsafecmd> options (submit your lists of command as feature request at github page to set the default behaviour of future versions, see section 6) -=item Changes in complicated mathematical equations result in latex processing errors +3. If you are using luatex >= 1.12.0 you can use option LUAUNDERLINE that uses lua-ul instead of ulem for underlining, which does not have this problem (experimental feature). + +=item Changes in complicated mathematical equations result in latex processing errors. + +Try option C<--math-markup=whole>. If even that fails, you can turn off mark up for equations with C<--math-markup=off>. -Try options C<--math-markup=whole>. If even that fails, you can turn off mark up for equations with C<--math-markup=off>. +=item Deleted parts in equations are not struck out but underlined. -=item How can I just show the pages where changes had been made +This is a limitation of the ulem package that implements the strike-out. If you use the amsmath package, then the strike-out command is redefined in such a way that deleted passages are wrapped with C<\text> command; adding C<\usepackage{amsmath}> to your preamble will trigger this behaviour. (If amsmath is not included directly, but imported by another package, latexdiff will not be able to detect its availability; in this case you can give latexdiff a hint with option C<--packages=amsmath>. -Use options -C<-s ZLABEL> (some postprocessing required) or C<-s ONLYCHANGEDPAGE>. C<latexdiff-vc --ps|--pdf> with C<--only-changes> option takes care of + +=item How can I just show the pages where changes had been made? + +Use options C<--s ZLABEL> (some postprocessing required) or C<-s ONLYCHANGEDPAGE>. C<latexdiff-vc --ps|--pdf> with C<--only-changes> option takes care of the post-processing for you (requires zref package to be installed). +=item The character encoding breaks when running latexdiff from powershell. + +This problem is not limited to C<latexdiff> and has to do with the default settings of C<powershell> in Windows. It is recommended to use C<cmd> instead. + =back =head1 BUGS @@ -5054,13 +5111,13 @@ different numbers of inter-argument spaces are treated as significant. =back -Please submit bug reports using the issue tracker of the github repository page I<https://github.com/ftilmann/latexdiff.git>, +Please submit bug reports using the issue tracker of the github repository page I<https://github.com/ftilmann/latexdiff.git>, or send them to I<tilmann -- AT -- gfz-potsdam.de>. Include the version number of I<latexdiff> (from comments at the top of the source or use B<--version>). If you come across latex files that are error-free and conform to the specifications set out above, and whose differencing still does not result in error-free latex, please send me those files, ideally edited to only contain the -offending passage as long as that still reproduces the problem. If your +offending passage as long as that still reproduces the problem. If your file relies on non-standard class files, you must include those. I will not look at examples where I have trouble to latex the original files. @@ -5071,24 +5128,24 @@ L<latexrevise>, L<latexdiff-vc> =head1 PORTABILITY I<latexdiff> does not make use of external commands and thus should run -on any platform supporting Perl 5.6 or higher. If files with encodings +on any platform supporting Perl 5.6 or higher. If files with encodings other than ASCII or UTF-8 are processed, Perl 5.8 or higher is required. The standard version of I<latexdiff> requires installation of the Perl package -C<Algorithm::Diff> (available from I<www.cpan.org> - +C<Algorithm::Diff> (available from I<www.cpan.org> - I<http://search.cpan.org/~nedkonz/Algorithm-Diff-1.15>) but a stand-alone version, I<latexdiff-so>, which has this package inlined, is available, too. I<latexdiff-fast> requires the I<diff> command to be present. =head1 AUTHOR -Version 1.3.3 -Copyright (C) 2004-2022 Frederik Tilmann +Version 1.3.4 +Copyright (C) 2004-2024 Frederik Tilmann This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License Version 3 -Contributors of fixes and additions: V. Kuhlmann, J. Paisley, N. Becker, T. Doerges, K. Huebner, +Contributors of fixes and additions: V. Kuhlmann, J. Paisley, N. Becker, T. Doerges, K. Huebner, T. Connors, Sebastian Gouezel and many others. Thanks to the many people who sent in bug reports, feature suggestions, and other feedback. @@ -5359,13 +5416,14 @@ value underline sqrt (SUPER|SUB)SCRIPT -%%END TEXT COMMANDS +%%END TEXT COMMANDS %%BEGIN CONTEXT1 COMMANDS % Regex matching commands with a text argument (leave out the \), which will fail out of context. These commands behave like text commands, except when they occur in a deleted section, where they are disabled, but their argument is shown as deleted text. caption subcaption -%%END CONTEXT1 COMMANDS +multicolumn +%%END CONTEXT1 COMMANDS %%BEGIN CONTEXT2 COMMANDS % Regex matching commands with a text argument (leave out the \), which will fail out of context. As corresponding commands for context1. The only difference is that context2 commands are completely disabled in deleted sections, including their arguments. @@ -5373,7 +5431,7 @@ title author date institute -%%END CONTEXT2 COMMANDS +%%END CONTEXT2 COMMANDS %% CONFIGURATION variabe defaults %%BEGIN LISTENV CONFIG @@ -5451,9 +5509,16 @@ verbatim[*]? \RequirePackage[normalem]{ulem} \RequirePackage{color}\definecolor{RED}{rgb}{1,0,0}\definecolor{BLUE}{rgb}{0,0,1} \providecommand{\DIFadd}[1]{{\protect\color{blue}\uwave{#1}}} -\providecommand{\DIFdel}[1]{{\protect\color{red}\sout{#1}}} +\providecommand{\DIFdel}[1]{{\protect\color{red}\sout{#1}}} %DIF END UNDERLINE PREAMBLE +%DIF LUAUNDERLINE PREAMBLE +\RequirePackage{lua-ul} +\RequirePackage{color}\definecolor{RED}{rgb}{1,0,0}\definecolor{BLUE}{rgb}{0,0,1} +\providecommand{\DIFadd}[1]{{\protect\color{blue}\underLine{#1}}} +\providecommand{\DIFdel}[1]{{\protect\color{red}\strikeThrough{#1}}} +%DIF END LUAUNDERLINE PREAMBLE + %DIF CTRADITIONAL PREAMBLE \RequirePackage{color}\definecolor{RED}{rgb}{1,0,0}\definecolor{BLUE}{rgb}{0,0,1} \RequirePackage[stable]{footmisc} @@ -5625,7 +5690,7 @@ verbatim[*]? % To show only pages with changes (dvips/dvipdf) % latex diff.tex % latex diff.tex -% dvips -pp `perl -lne 'if (m/\\newlabel{DIFchg[be]\d*}{{.*}{(.*)}}/) { print $1 }' diff.aux | uniq | tr -s \\n ','` diff.dvi +% dvips -pp `perl -lne 'if (m/\\newlabel{DIFchg[be]\d*}{{.*}{(.*)}}/) { print $1 }' diff.aux | uniq | tr -s \\n ','` diff.dvi \typeout{Check comments in preamble of output for instructions how to show only pages where changes have been made} \usepackage[user,abspage]{zref} \newcount\DIFcounterb @@ -5645,10 +5710,10 @@ verbatim[*]? \RequirePackage{etoolbox} \RequirePackage{zref} % redefine label command to write immediately to aux file - page references will be lost -\makeatletter \let\oldlabel\label% Store \label -\renewcommand{\label}[1]{% Update \label to write to the .aux immediately -\zref@wrapper@immediate{\oldlabel{#1}}} -\makeatother +\makeatletter \let\oldlabel\label% Store \label +\renewcommand{\label}[1]{% Update \label to write to the .aux immediately +\zref@wrapper@immediate{\oldlabel{#1}}} +\makeatother \newbool{DIFkeeppage} \newbool{DIFchange} \boolfalse{DIFkeeppage} @@ -5666,7 +5731,7 @@ verbatim[*]? \providecommand{\DIFmodend}{\global\booltrue{DIFkeeppage}\global\boolfalse{DIFchange}} %DIF END ONLYCHANGEDPAGE PREAMBLE -%% FLOAT TYPES +%% FLOAT TYPES %DIF FLOATSAFE PREAMBLE \providecommand{\DIFaddFL}[1]{\DIFadd{#1}} @@ -5698,7 +5763,7 @@ verbatim[*]? %DIF END TRADITIONALSAFE PREAMBLE % see: -% http://tex.stackexchange.com/questions/47351/can-i-redefine-a-command-to-contain-itself +% http://tex.stackexchange.com/questions/47351/can-i-redefine-a-command-to-contain-itself %DIF HIGHLIGHTGRAPHICS PREAMBLE \RequirePackage{settobox} @@ -5744,6 +5809,15 @@ verbatim[*]? %% SPECIAL PACKAGE PREAMBLE COMMANDS +%% Redefine strike out command to wrap in text box if amsmath is used and markup style with ulem is used +%DIF AMSMATHULEM PREAMBLE +\makeatletter +\let\sout@orig\sout +\renewcommand{\sout}[1]{\ifmmode\text{\sout@orig{\ensuremath{#1}}}\else\sout@orig{#1}\fi} +\makeatother +%DIF END AMSMATHULEM PREAMBLE + + % Standard \DIFadd and \DIFdel are redefined as \DIFaddtex and \DIFdeltex % when hyperref package is included. %DIF HYPERREF PREAMBLE @@ -5846,7 +5920,7 @@ verbatim[*]? %DIF END DIFCODE_BOLD %DIF DIFCODE_PDFCOMMENT - + moredelim=[il][\color{white}\tiny]{\%DIF\ <\ }, moredelim=[il][\sffamily\bfseries]{\%DIF\ >\ } %DIF END DIFCODE_PDFCOMMENT diff --git a/Build/source/texk/texlive/linked_scripts/luafindfont/luafindfont.lua b/Build/source/texk/texlive/linked_scripts/luafindfont/luafindfont.lua index a1d554b5aee..f77f913a7d6 100755 --- a/Build/source/texk/texlive/linked_scripts/luafindfont/luafindfont.lua +++ b/Build/source/texk/texlive/linked_scripts/luafindfont/luafindfont.lua @@ -1,6 +1,6 @@ #!/usr/bin/env texlua -- --- $Id: luafindfont.lua 735 2023-06-22 19:12:29Z herbert $ +-- $Id: luafindfont.lua 961 2024-08-25 16:47:59Z herbert $ ----------------------------------------------------------------------- -- FILE: luafindfont.lua -- DESCRIPTION: search for fonts in the database @@ -8,7 +8,7 @@ -- AUTHOR: Herbert Voß (C) 2023-06-21 ----------------------------------------------------------------------- luafindfont = luafindfont or { } - local version = 0.13 + local version = 0.14 luafindfont.version = version --[[ @@ -31,6 +31,7 @@ Report bugs to hvoss@tug.org ]] +-- equivilant with ConTeXt, e.g. times -- mtxrun --script font --list --name --all --pattern=times kpse.set_program_name("luatex") @@ -38,8 +39,6 @@ local f = kpse.find_file("lualibs.lua") require("lualibs") -- all part of LuaTeX ---require("luafindfont-utflib") - if #arg == 0 then print("I need at least one argument or option! Will exit ...") os.exit() @@ -282,6 +281,13 @@ function compareEntries(f1, f2) end end +function centerText(text, width) + if text == nil then return "" end + local spaces = math.floor((width-string.len(text))/2) + local len = string.len(text) + return ((" "):rep(spaces)..text..(" "):rep(spaces)) +end + local fontData = {} local fontListFile = getFileLocation() if fontListFile == "" then @@ -375,20 +381,38 @@ if l_max[3] > maxStrLength then l_max[3] = maxStrLength end local minChars = 26 local Fontname = "Filename" local Path = "Path" -local SymbolicName = "Symbolic name" +local SymbolicName = "Symbolic" local lfdNr = "No." if (font_str ~= "*") and not noSymbolicNames then if args_xetex > 0 then - print(string.format("%5s %"..l_max[1].."s %"..l_max[2].."s %"..l_max[3].."s".."%4s",lfdNr,Fontname,SymbolicName,Path,"X")) +-- print(string.format("%5s %"..l_max[1].."s %"..l_max[2].."s %"..l_max[3].."s".."%4s",lfdNr,Fontname,SymbolicName,Path,"X")) + io.write(string.format("%5s",lfdNr)) + io.write(centerText(Fontname,l_max[1])) + io.write(centerText(SymbolicName,l_max[2])) + io.write(centerText(Path,l_max[3])) + print("X") else - print(string.format("%5s %"..l_max[1].."s %"..l_max[2].."s %"..l_max[3].."s",lfdNr,Fontname,SymbolicName,Path)) +-- print(string.format("%5s %"..l_max[1].."s %"..l_max[2].."s %"..l_max[3].."s",lfdNr,Fontname,SymbolicName,Path)) + io.write(string.format("%5s",lfdNr)) + io.write(centerText(Fontname,l_max[1])) + io.write(centerText(SymbolicName,l_max[2])) + print(centerText(Path,l_max[3])) end else if args_xetex > 0 then - print(string.format("%5s %"..l_max[1].."s %"..l_max[3].."s".."%4s",lfdNr,Fontname,Path,"X")) +-- print(string.format("%5s %"..l_max[1].."s %"..l_max[3].."s".."%4s",lfdNr,Fontname,Path,"X")) + io.write(string.format("%5s",lfdNr)) + io.write(centerText(Fontname,l_max[1])) + io.write(centerText(SymbolicName,l_max[2])) + io.write(centerText(Path,l_max[3])) + print("X") else - print(string.format("%5s %"..l_max[1].."s %"..l_max[3].."s",lfdNr,Fontname,Path)) +-- print(string.format("%5s %"..l_max[1].."s %"..l_max[3].."s",lfdNr,Fontname,Path)) + io.write(string.format("%5s",lfdNr)) + io.write(centerText(Fontname,l_max[1])) + io.write(centerText(SymbolicName,l_max[2])) + print(centerText(Path,l_max[3])) end end diff --git a/Build/source/texk/texlive/linked_scripts/pagelayout/pagelayoutapi b/Build/source/texk/texlive/linked_scripts/pagelayout/pagelayoutapi index be034baaa7c..1232ae3ab74 100755 --- a/Build/source/texk/texlive/linked_scripts/pagelayout/pagelayoutapi +++ b/Build/source/texk/texlive/linked_scripts/pagelayout/pagelayoutapi @@ -13,7 +13,7 @@ # LaTeX version 2008/05/04 or later. # -version=1.1.0 +version=1.1.1 _convert() { turbo=$1 diff --git a/Build/source/texk/texlive/linked_scripts/pagelayout/textestvis b/Build/source/texk/texlive/linked_scripts/pagelayout/textestvis index 8ddcde77e15..8120a7ba1f5 100755 --- a/Build/source/texk/texlive/linked_scripts/pagelayout/textestvis +++ b/Build/source/texk/texlive/linked_scripts/pagelayout/textestvis @@ -13,7 +13,7 @@ # LaTeX version 2008/05/04 or later. # -version=1.1.0 +version=1.1.1 OK="$( tput setaf 2 )•$( tput sgr0 )" FAILED="$( tput setaf 1 )$( tput bold )x$( tput sgr0 )" @@ -122,13 +122,13 @@ test() { fi fi - magick convert -density $2 -quiet $tmpdir/$name.pdf $tmpdir/$name.png + magick -density $2 -quiet $tmpdir/$name.pdf $tmpdir/$name.png if [ -f "$tmpdir/$name.png" ]; then mv $tmpdir/$name.png $tmpdir/$name-0.png fi if [ -f "$name.approved.pdf" ]; then - magick convert -density $2 -quiet $name.approved.pdf $tmpdir/$name.approved.png + magick -density $2 -quiet $name.approved.pdf $tmpdir/$name.approved.png if [ -f "$tmpdir/$name.approved.png" ]; then mv $tmpdir/$name.approved.png $tmpdir/$name.approved-0.png fi @@ -311,11 +311,11 @@ compare() { spacer="" if [ -f "$filea" ]; then if [ -f "$fileb" ]; then - magick convert -density $1 -quiet $filea $tmpdir/$basenamea.png + magick -density $1 -quiet $filea $tmpdir/$basenamea.png if [ -f "$tmpdir/$basenamea.png" ]; then mv $tmpdir/$basenamea.png $tmpdir/$basenamea-0.png fi - magick convert -density $1 -quiet $fileb $tmpdir/$basenameb.png + magick -density $1 -quiet $fileb $tmpdir/$basenameb.png if [ -f "$tmpdir/$basenameb.png" ]; then mv $tmpdir/$basenameb.png $tmpdir/$basenameb-0.png fi diff --git a/Build/source/texk/web2c/ChangeLog b/Build/source/texk/web2c/ChangeLog index c9203566413..402e118fae2 100644 --- a/Build/source/texk/web2c/ChangeLog +++ b/Build/source/texk/web2c/ChangeLog @@ -1,3 +1,26 @@ +2024-08-31 Andreas Scherer <https://ascherer.github.io> + + * vftovp.ch: Fix sorting order of new named sections. + +2024-08-23 Andreas Scherer <https://ascherer.github.io> + + * gftopk.ch, + * gftype.ch, + * pktogf.ch, + * pktype.ch: Fix a few spaces. + +2024-08-21 Andreas Scherer <https://ascherer.github.io> + + * weav-twill.ch: Prime the title page. + +2024-08-16 Andreas Scherer <https://ascherer.github.io> + + * showstream.ch: Restore section numbering as far as possible. + +2024-08-12 Andreas Scherer <https://ascherer.github.io> + + * ctangleboot.cin: CWEB 4.12 release. + 2024-07-14 Andreas Scherer <https://ascherer.github.io> * mft.ch: Preserve Metafont logo on title page. diff --git a/Build/source/texk/web2c/ctangleboot.cin b/Build/source/texk/web2c/ctangleboot.cin index eefec8569c5..3483628ef0c 100644 --- a/Build/source/texk/web2c/ctangleboot.cin +++ b/Build/source/texk/web2c/ctangleboot.cin @@ -28,7 +28,7 @@ /*:5*/ #line 67 "cwebdir/ctangle.w" -#define banner "This is CTANGLE, Version 4.11" \ +#define banner "This is CTANGLE, Version 4.12" \ \ #define _(s) gettext(s) \ diff --git a/Build/source/texk/web2c/cwebdir/ChangeLog b/Build/source/texk/web2c/cwebdir/ChangeLog index cb927407354..7bb17212989 100644 --- a/Build/source/texk/web2c/cwebdir/ChangeLog +++ b/Build/source/texk/web2c/cwebdir/ChangeLog @@ -1,3 +1,58 @@ +2024-08-12 Andreas Scherer <https://ascherer.github.io> + + * Makefile + * comm-{mac,mini,ql,w2c}.ch + * comm-w2c.h + * common.h + * common.w + * ctang-{bs,pc,ql,vms,w2c,w32}.ch + * ctangle.c + * ctangle.w + * ctwill-w2c.ch + * cweav-{bs,pc,ql,vms,w2c,w32}.ch + * cweave.w + * cwebman-w2c.ch + * cwebman.tex + * po/cweb-tl.pot + * po/cweb.pot + * po/de/cweb-tl.po + * po/de/cweb.po + * po/it/cweb.po + * prod-{cweave,twill}.w + * prod.w: CWEB 4.12 release. + +2024-08-10 Andreas Scherer <https://ascherer.github.io> + + * cwebacromac.tex, + * cwebmac.tex, + * texinputs/icwebmac.tex, + * texinputs/pdfctproofmac.tex, + * texinputs/pdfctwimac.tex: Apply new scanning macros. + +2024-08-08 Andreas Scherer <https://ascherer.github.io> + + * comm-mini.ch, + * comm-w2c.ch: Demote 'Extensions' and subsections. + +2024-08-07 Andreas Scherer <https://ascherer.github.io> + + * comm-mini.ch, + * comm-w2c.ch: The Index is not an Extension. + +2024-08-06 Andreas Scherer <https://ascherer.github.io> + + * cwebacromac.tex, + * cwebmac.tex, + * cwebman.tex, + * texinputs/pdfctproofmac.tex, + * texinputs/pdfctwimac.tex: Refine PDF-related macros. + +2024-08-02 Andreas Scherer <https://ascherer.github.io> + + * ctwill-w2c.ch, + * cweav-w2c.ch, + * cweave.w: Remove unused 'kludge'. + 2024-07-26 Andreas Scherer <https://ascherer.github.io> * cwebmac.tex: Reshuffle '\note' macro. diff --git a/Build/source/texk/web2c/cwebdir/Makefile b/Build/source/texk/web2c/cwebdir/Makefile index 28ea97d5540..a11936f9894 100644 --- a/Build/source/texk/web2c/cwebdir/Makefile +++ b/Build/source/texk/web2c/cwebdir/Makefile @@ -1,6 +1,6 @@ # This file is part of CWEB. # It is distributed WITHOUT ANY WARRANTY, express or implied. -# Version 4.11 --- December 2023 +# Version 4.12 --- August 2024 # Copyright (C) 1987,1990,1993,2000 Silvio Levy and Donald E. Knuth @@ -216,6 +216,6 @@ tarball: tar zcvhf /tmp/cweb.tgz $(ALL) examples ctan: - git archive -o ~/cweb-4.11.zip --prefix=cweb/ cweb-4.11 + git archive -o ~/cweb-4.12.zip --prefix=cweb/ cweb-4.12 make PDF=pdf usermanual - cd ..; zip -r ~/cweb-4.11.zip cweb/cwebman.pdf + cd ..; zip -r ~/cweb-4.12.zip cweb/cwebman.pdf diff --git a/Build/source/texk/web2c/cwebdir/comm-mac.ch b/Build/source/texk/web2c/cwebdir/comm-mac.ch index 79b1ec945e8..1540a9a4e21 100644 --- a/Build/source/texk/web2c/cwebdir/comm-mac.ch +++ b/Build/source/texk/web2c/cwebdir/comm-mac.ch @@ -4,9 +4,9 @@ No changes to CTANGLE or CWEAVE are needed. (Contributed 13 Oct 2000 by AndPio@aol.com; slightly edited by Don Knuth) @x in limbo, change the title page document to specify Mac version - \centerline{(Version 4.11)} + \centerline{(Version 4.12)} @y - \centerline{(Version 4.11 for MacOS)} + \centerline{(Version 4.12 for MacOS)} @z @x section 23: Make input_ln accept \n, \r, \n\r, or \r\n as line endings diff --git a/Build/source/texk/web2c/cwebdir/comm-mini.ch b/Build/source/texk/web2c/cwebdir/comm-mini.ch index d1bd623b2a2..adf9fc0c28e 100644 --- a/Build/source/texk/web2c/cwebdir/comm-mini.ch +++ b/Build/source/texk/web2c/cwebdir/comm-mini.ch @@ -1,9 +1,9 @@ Limbo. @x -\def\title{Common code for CTANGLE and CWEAVE (4.11 [\TeX~Live])} +\def\title{Common code for CTANGLE and CWEAVE (4.12 [\TeX~Live])} @y -\def\title{COMMON (4.11 [\TeX~Live])} +\def\title{COMMON (4.12 [\TeX~Live])} \def\contentspagenumber{0} @z diff --git a/Build/source/texk/web2c/cwebdir/comm-ql.ch b/Build/source/texk/web2c/cwebdir/comm-ql.ch index 44cc39ec45f..8510fc093a2 100644 --- a/Build/source/texk/web2c/cwebdir/comm-ql.ch +++ b/Build/source/texk/web2c/cwebdir/comm-ql.ch @@ -10,24 +10,24 @@ ex <dev_>cc;'-v -h -c -=500000 -DCWEBINPUTS=flp2_ common_c' @x \def\v{\char'174} % vertical (|) in typewriter font -\def\title{Common code for CTANGLE and CWEAVE (Version 4.11)} +\def\title{Common code for CTANGLE and CWEAVE (Version 4.12)} \def\topofcontents{\null\vfill \centerline{\titlefont Common code for {\ttitlefont CTANGLE} and {\ttitlefont CWEAVE}} \vskip 15pt - \centerline{(Version 4.11)} + \centerline{(Version 4.12)} \vfill} \def\botofcontents{\vfill \noindent @y \def\v{\char'174} % vertical (|) in typewriter font -\def\title{Common code for CTANGLE and CWEAVE (QL Version 4.11)} +\def\title{Common code for CTANGLE and CWEAVE (QL Version 4.12)} \def\topofcontents{\null\vfill \centerline{\titlefont Common code for {\ttitlefont CTANGLE} and {\ttitlefont CWEAVE}} \vskip 15pt - \centerline{(Version 4.11)} + \centerline{(Version 4.12)} \vfill} \def\botofcontents{\vfill \noindent diff --git a/Build/source/texk/web2c/cwebdir/comm-w2c.ch b/Build/source/texk/web2c/cwebdir/comm-w2c.ch index 4035a633ffb..f0d5b6a8034 100644 --- a/Build/source/texk/web2c/cwebdir/comm-w2c.ch +++ b/Build/source/texk/web2c/cwebdir/comm-w2c.ch @@ -17,16 +17,16 @@ @q Please send comments, suggestions, etc. to tex-k@@tug.org. @> @x [0.0] l.25 -\def\title{Common code for CTANGLE and CWEAVE (Version 4.11)} +\def\title{Common code for CTANGLE and CWEAVE (Version 4.12)} @y \def\Kpathsea/{{\mc KPATHSEA\spacefactor1000}} \ifacro\sanitizecommand\Kpathsea{KPATHSEA}\fi -\def\title{Common code for CTANGLE and CWEAVE (4.11 [\TeX~Live])} +\def\title{Common code for CTANGLE and CWEAVE (4.12 [\TeX~Live])} @z @x [0.0] l.30 - \centerline{(Version 4.11)} + \centerline{(Version 4.12)} @y - \centerline{(Version 4.11 [\TeX~Live])} + \centerline{(Version 4.12 [\TeX~Live])} @z @x [0.0] l.32 @@ -616,21 +616,21 @@ else { @x [9.85] l.1286 @* Index. @y -@** Extensions to {\tentex CWEB}. The following sections introduce new or +@* Extensions to {\tentex CWEB}. The following sections introduce new or improved features that have been created by numerous contributors over the course of a quarter century. Care has been taken to keep the original section numbering intact, so this new material should nicely integrate with the original ``\&{85.~Index}.'' -@* Language setting. This global variable is set by the argument of the +@*1 Language setting. This global variable is set by the argument of the `\.{+l}' (or `\.{-l}') command-line option. @<Global var...@>= const char *use_language=""; /* prefix of \.{cwebmac.tex} in \TEX/ output */ -@* User communication. The |scan_args| and |cb_show_banner| routines and the +@*1 User communication. The |scan_args| and |cb_show_banner| routines and the |bindtextdomain| argument string need a few extra variables. @d max_banner 50 @@ -647,7 +647,7 @@ string texmf_locale;@/ #endif char separators[]=SEPARATORS; -@* Temporary file output. Most \CEE/ projects are controlled by a \.{Makefile} +@*1 Temporary file output. Most \CEE/ projects are controlled by a \.{Makefile} that automatically takes care of the temporal dependencies between the different source modules. It may be convenient that \.{CWEB} doesn't create new output for all existing files, when there are only changes to some of them. Thus the @@ -696,7 +696,7 @@ if(check_file) fclose(check_file); if(strlen(check_file_name)) /* Delete the temporary file in case of a break */ remove(check_file_name); -@* Internationalization. If translation catalogs for your personal +@*1 Internationalization. If translation catalogs for your personal \.{LANGUAGE} are installed at the appropriate place, \.{CTANGLE} and \.{CWEAVE} will talk to you in your favorite language. Catalog \.{cweb} contains all strings from ``plain \.{CWEB},'' catalog \.{cweb-tl} contains a few extra @@ -759,7 +759,7 @@ free(texmf_locale); textdomain("cweb"); /* the majority of |"strings"| come from ``plain \.{CWEB}'' */ @.cweb.mo@> -@* File lookup with \Kpathsea/. The \.{CTANGLE} and \.{CWEAVE} programs from +@*1 File lookup with \Kpathsea/. The \.{CTANGLE} and \.{CWEAVE} programs from the original \.{CWEB} package use the compile-time default directory or the value of the environment variable \.{CWEBINPUTS} as an alternative place to be searched for files, if they could not be found in the current directory. @@ -816,7 +816,7 @@ numbers. Debugging output is always written to |stderr|, and begins with the string `\.{kdebug:}'. -@* System dependent changes. The most volatile stuff comes at the very end. +@*1 System dependent changes. The most volatile stuff comes at the very end. Modules for dealing with help messages and version info. diff --git a/Build/source/texk/web2c/cwebdir/comm-w2c.h b/Build/source/texk/web2c/cwebdir/comm-w2c.h index c2743c1a388..154371c4fa7 100644 --- a/Build/source/texk/web2c/cwebdir/comm-w2c.h +++ b/Build/source/texk/web2c/cwebdir/comm-w2c.h @@ -2,7 +2,7 @@ % This program by Silvio Levy and Donald E. Knuth % is based on a program by Knuth. % It is distributed WITHOUT ANY WARRANTY, express or implied. -% Version 4.11 --- December 2023 (works also with later versions) +% Version 4.12 --- August 2024 (works also with later versions) % Copyright (C) 1987,1990,1993 Silvio Levy and Donald E. Knuth diff --git a/Build/source/texk/web2c/cwebdir/common.h b/Build/source/texk/web2c/cwebdir/common.h index 97fda82e75a..2e02af934f4 100644 --- a/Build/source/texk/web2c/cwebdir/common.h +++ b/Build/source/texk/web2c/cwebdir/common.h @@ -2,7 +2,7 @@ % This program by Silvio Levy and Donald E. Knuth % is based on a program by Knuth. % It is distributed WITHOUT ANY WARRANTY, express or implied. -% Version 4.11 --- December 2023 (works also with later versions) +% Version 4.12 --- August 2024 (works also with later versions) % Copyright (C) 1987,1990,1993 Silvio Levy and Donald E. Knuth diff --git a/Build/source/texk/web2c/cwebdir/common.w b/Build/source/texk/web2c/cwebdir/common.w index 88932f3118b..1c077736bb2 100644 --- a/Build/source/texk/web2c/cwebdir/common.w +++ b/Build/source/texk/web2c/cwebdir/common.w @@ -2,7 +2,7 @@ % This program by Silvio Levy and Donald E. Knuth % is based on a program by Knuth. % It is distributed WITHOUT ANY WARRANTY, express or implied. -% Version 4.11 --- December 2023 +% Version 4.12 --- August 2024 % Copyright (C) 1987,1990,1993,2000 Silvio Levy and Donald E. Knuth @@ -22,12 +22,12 @@ \def\v{\char'174} % vertical (|) in typewriter font -\def\title{Common code for CTANGLE and CWEAVE (Version 4.11)} +\def\title{Common code for CTANGLE and CWEAVE (Version 4.12)} \def\topofcontents{\null\vfill \centerline{\titlefont Common code for {\ttitlefont CTANGLE} and {\ttitlefont CWEAVE}} \vskip 15pt - \centerline{(Version 4.11)} + \centerline{(Version 4.12)} \vfill} \def\botofcontents{\vfill \noindent diff --git a/Build/source/texk/web2c/cwebdir/ctang-bs.ch b/Build/source/texk/web2c/cwebdir/ctang-bs.ch index c70a87fe1d0..234f41039e0 100644 --- a/Build/source/texk/web2c/cwebdir/ctang-bs.ch +++ b/Build/source/texk/web2c/cwebdir/ctang-bs.ch @@ -17,12 +17,12 @@ by using "huge" pointers. The ``banner line'' defined here should be changed whenever \.{CTANGLE} is modified. -@d banner "This is CTANGLE (Version 4.11)" +@d banner "This is CTANGLE (Version 4.12)" @y The ``banner line'' defined here should be changed whenever \.{CTANGLE} is modified. -@d banner "This is CTANGLE (Version 4.11pc/big)" +@d banner "This is CTANGLE (Version 4.12pc/big)" @z diff --git a/Build/source/texk/web2c/cwebdir/ctang-pc.ch b/Build/source/texk/web2c/cwebdir/ctang-pc.ch index 3e6e7ac5ef2..61db92aa7e4 100644 --- a/Build/source/texk/web2c/cwebdir/ctang-pc.ch +++ b/Build/source/texk/web2c/cwebdir/ctang-pc.ch @@ -9,9 +9,9 @@ that allows >64K arrays. If you need lots of bytes and toks, try the alternate change files with -bs suffix instead of -pc. @x section 1 -@d banner "This is CTANGLE (Version 4.11)" +@d banner "This is CTANGLE (Version 4.12)" @y -@d banner "This is CTANGLE (Version 4.11pc)" +@d banner "This is CTANGLE (Version 4.12pc)" @z @x section 17 @d max_bytes 100000 /* the number of bytes in identifiers, diff --git a/Build/source/texk/web2c/cwebdir/ctang-ql.ch b/Build/source/texk/web2c/cwebdir/ctang-ql.ch index 8072aff51ab..41831c850d9 100644 --- a/Build/source/texk/web2c/cwebdir/ctang-ql.ch +++ b/Build/source/texk/web2c/cwebdir/ctang-ql.ch @@ -7,15 +7,15 @@ ex <dev_>cc;"-v -h -c -=500000 ctangle_c" @x -\def\title{CTANGLE (Version 4.11)} +\def\title{CTANGLE (Version 4.12)} @y -\def\title{CTANGLE (QL Version 4.11)} +\def\title{CTANGLE (QL Version 4.12)} @z @x section 1 -@d banner "This is CTANGLE (Version 4.11)" +@d banner "This is CTANGLE (Version 4.12)" @y -@d banner "This is CTANGLE (QL Version 4.11)" +@d banner "This is CTANGLE (QL Version 4.12)" @z @x diff --git a/Build/source/texk/web2c/cwebdir/ctang-vms.ch b/Build/source/texk/web2c/cwebdir/ctang-vms.ch index 2c4df3bf60e..7f142df49a7 100644 --- a/Build/source/texk/web2c/cwebdir/ctang-vms.ch +++ b/Build/source/texk/web2c/cwebdir/ctang-vms.ch @@ -10,9 +10,9 @@ created: (these changes not necessary for initial bootstrapping) @x section 1 (01-FEB-1992 ST) -@d banner "This is CTANGLE (Version 4.11)" +@d banner "This is CTANGLE (Version 4.12)" @y -@d banner "This is CTANGLE (VAX/VMS Version 4.11)" +@d banner "This is CTANGLE (VAX/VMS Version 4.12)" @z @x section 5 (01-FEB-1992 ST) diff --git a/Build/source/texk/web2c/cwebdir/ctang-w2c.ch b/Build/source/texk/web2c/cwebdir/ctang-w2c.ch index 177daac7ab2..61eea96a0de 100644 --- a/Build/source/texk/web2c/cwebdir/ctang-w2c.ch +++ b/Build/source/texk/web2c/cwebdir/ctang-w2c.ch @@ -17,15 +17,15 @@ @q Please send comments, suggestions, etc. to tex-k@@tug.org. @> @x [0.0] l.30 -\def\title{CTANGLE (Version 4.11)} +\def\title{CTANGLE (Version 4.12)} @y -\def\title{CTANGLE (Version 4.11 [\TeX~Live])} +\def\title{CTANGLE (Version 4.12 [\TeX~Live])} @z @x [0.0] l.34 - \centerline{(Version 4.11)} + \centerline{(Version 4.12)} @y - \centerline{(Version 4.11 [\TeX~Live])} + \centerline{(Version 4.12 [\TeX~Live])} @z @x [0.0] l.36 @@ -41,9 +41,9 @@ @z @x [1.1] l.64 -@d banner "This is CTANGLE (Version 4.11)" +@d banner "This is CTANGLE (Version 4.12)" @y -@d banner "This is CTANGLE, Version 4.11" +@d banner "This is CTANGLE, Version 4.12" /* will be extended by the \TeX~Live |versionstring| */ @z diff --git a/Build/source/texk/web2c/cwebdir/ctang-w32.ch b/Build/source/texk/web2c/cwebdir/ctang-w32.ch index c0384b48881..2a5c6f11868 100644 --- a/Build/source/texk/web2c/cwebdir/ctang-w32.ch +++ b/Build/source/texk/web2c/cwebdir/ctang-w32.ch @@ -4,9 +4,9 @@ This is the change file for CWEB's CTANGLE under Win32 Changes necessary for compiling with Borland C/C++ @x section 1 -@d banner "This is CTANGLE (Version 4.11)" +@d banner "This is CTANGLE (Version 4.12)" @y -@d banner "This is CTANGLE (Version 4.11win32)" +@d banner "This is CTANGLE (Version 4.12win32)" @z @x section 24 diff --git a/Build/source/texk/web2c/cwebdir/ctangle.c b/Build/source/texk/web2c/cwebdir/ctangle.c index 58e37b27b41..d1cf6c67694 100644 --- a/Build/source/texk/web2c/cwebdir/ctangle.c +++ b/Build/source/texk/web2c/cwebdir/ctangle.c @@ -15,7 +15,7 @@ /*:5*/ #line 67 "ctangle.w" -#define banner "This is CTANGLE (Version 4.11)" \ +#define banner "This is CTANGLE (Version 4.12)" \ #define ctangle false #define cweave true \ diff --git a/Build/source/texk/web2c/cwebdir/ctangle.w b/Build/source/texk/web2c/cwebdir/ctangle.w index 37b09e7fc02..b42595baa9e 100644 --- a/Build/source/texk/web2c/cwebdir/ctangle.w +++ b/Build/source/texk/web2c/cwebdir/ctangle.w @@ -2,7 +2,7 @@ % This program by Silvio Levy and Donald E. Knuth % is based on a program by Knuth. % It is distributed WITHOUT ANY WARRANTY, express or implied. -% Version 4.11 --- December 2023 +% Version 4.12 --- August 2024 % Copyright (C) 1987,1990,1993,2000 Silvio Levy and Donald E. Knuth @@ -27,11 +27,11 @@ \mathchardef\RA="3221 % right arrow \mathchardef\BA="3224 % double arrow -\def\title{CTANGLE (Version 4.11)} +\def\title{CTANGLE (Version 4.12)} \def\topofcontents{\null\vfill \centerline{\titlefont The {\ttitlefont CTANGLE} processor} \vskip 15pt - \centerline{(Version 4.11)} + \centerline{(Version 4.12)} \vfill} \def\botofcontents{\vfill \noindent @@ -61,7 +61,7 @@ Joachim Schrod, Lee Wittenberg, and others who have contributed improvements. The ``banner line'' defined here should be changed whenever \.{CTANGLE} is modified. -@d banner "This is CTANGLE (Version 4.11)" +@d banner "This is CTANGLE (Version 4.12)" @c @<Include files@>@/ diff --git a/Build/source/texk/web2c/cwebdir/ctwill-w2c.ch b/Build/source/texk/web2c/cwebdir/ctwill-w2c.ch index 70616695efb..664254dee08 100644 --- a/Build/source/texk/web2c/cwebdir/ctwill-w2c.ch +++ b/Build/source/texk/web2c/cwebdir/ctwill-w2c.ch @@ -34,38 +34,38 @@ \datethis % Put timestamp before section 1 @z -@x [0.0] l.35 -\def\title{CWEAVE (Version 4.11)} +@x [0.0] l.34 +\def\title{CWEAVE (Version 4.12)} @y \def\Kpathsea/{{\mc KPATHSEA\spacefactor1000}} \ifacro\sanitizecommand\Kpathsea{KPATHSEA}\fi -\def\title{CTWILL (Version 4.11 [\TeX~Live])} +\def\title{CTWILL (Version 4.12 [\TeX~Live])} @z -@x [0.0] l.37 +@x [0.0] l.36 \centerline{\titlefont The {\ttitlefont CWEAVE} processor} @y \centerline{\titlefont The {\ttitlefont CTWILL} processor} @z -@x [0.0] l.39 - \centerline{(Version 4.11)} +@x [0.0] l.38 + \centerline{(Version 4.12)} @y - \centerline{(Version 4.11 [\TeX~Live])} + \centerline{(Version 4.12 [\TeX~Live])} @z -@x [0.0] l.41 +@x [0.0] l.40 \def\botofcontents{\vfill @y \def\covernote{\vbox{% @z -@x [0.0] l.54 +@x [0.0] l.53 } @y }} @z -@x [1.1] l.59 +@x [1.1] l.58 This is the \.{CWEAVE} program by Silvio Levy and Donald E. Knuth, based on \.{WEAVE} by Knuth. We are thankful to Steve Avery, @@ -77,7 +77,7 @@ Crusius, and others who have contributed improvements. The ``banner line'' defined here should be changed whenever \.{CWEAVE} is modified. -@d banner "This is CWEAVE (Version 4.11)" +@d banner "This is CWEAVE (Version 4.12)" @y This is the \.{CTWILL} program by D. E. Knuth, based on \.{CWEAVE} by Silvio Levy and D.~E. Knuth. It is also based on @@ -101,29 +101,29 @@ Until then, \.{CWEAVE}'s sequence of sections will be preserved. The ``banner line'' defined here should be changed whenever \.{CTWILL} is modified. The version number parallels the corresponding version of \.{CWEAVE}. -@d banner "This is CTWILL, Version 4.11" +@d banner "This is CTWILL, Version 4.12" /* will be extended by the \TeX~Live |versionstring| */ @z -@x [1.2] l.94 +@x [1.2] l.93 program=cweave; @y program=ctwill; @z -@x [1.2] l.98 +@x [1.2] l.97 if (show_banner) puts(banner); /* print a ``banner line'' */ @y if (show_banner) cb_show_banner(); /* print a ``banner line'' */ @z -@x [1.3] l.112 +@x [1.3] l.111 @i common.h @y @i comm-w2c.h @z -@x [2.21] l.183 +@x [2.21] l.182 turned on during the first phase. @<Private...@>= @@ -132,19 +132,19 @@ static boolean change_exists; /* has any section changed? */ turned on during the first phase---NOT! @z -@x [2.23] l.217 +@x [2.23] l.216 @ @d max_refs 30000 /* number of cross-references; must be less than 65536 */ @y @ @d max_refs 65535 /* number of cross-references; must be less than 65536 */ @z -@x [2.25] l.246 +@x [2.25] l.245 @d append_xref(c) if (xref_ptr==xmem_end) overflow("cross-reference"); @y @d append_xref(c) if (xref_ptr==xmem_end) overflow(_("cross-reference")); @z -@x [2.30] l.337 +@x [2.30] l.336 @d max_toks 30000 /* number of symbols in \CEE/ texts being parsed; must be less than 65536 */ @d max_texts 8000 /* number of phrases in \CEE/ texts being parsed; @@ -156,14 +156,14 @@ turned on during the first phase---NOT! must be less than 10240 */ @z -@x [2.32] l.357 +@x [2.32] l.356 @ Here are the two procedures needed to complete |id_lookup|: @y @ Here are the two procedures needed to complete |id_lookup|: @s perm_meaning int @z -@x [2.32] l.374 +@x [2.32] l.373 p->xref=(void *)xmem; @y p->xref=(void *)xmem; @@ -177,7 +177,7 @@ turned on during the first phase---NOT! } @z -@x [2.33] l.377 +@x [2.33] l.376 @ And here's a small helper function to simplify the code. @d update_node(p) (p)->xref=(void *)xref_ptr @@ -188,7 +188,7 @@ turned on during the first phase---NOT! @d get_meaning(p) (p)-name_dir+cur_meaning @z -@x [2.34] l.436 +@x [2.34] l.435 id_lookup("extern",NULL,int_like); @y @# @@ -196,7 +196,7 @@ ext_loc=id_lookup("extern",NULL,int_like)-name_dir; @# @z -@x [2.34] l.449 +@x [2.34] l.448 id_lookup("int",NULL,raw_int); @y @# @@ -204,7 +204,7 @@ int_loc=id_lookup("int",NULL,raw_int)-name_dir; @# @z -@x [3.36] l.544 +@x [3.36] l.543 @d ord 0207 /* control code for `\.{@@'}' */ @d join 0210 /* control code for `\.{@@\&}' */ @d thin_space 0211 /* control code for `\.{@@,}' */ @@ -248,7 +248,7 @@ int_loc=id_lookup("int",NULL,raw_int)-name_dir; @d new_section 0235 /* control code for `\.{@@\ }' and `\.{@@*}' */ @z -@x [3.38] l.587 +@x [3.38] l.586 ccode['\'']=ord; @y ccode['\'']=ord; @@ -256,7 +256,7 @@ ccode['$']=meaning; ccode['%']=temp_meaning; ccode['-']=suppress; ccode['r']=ccode['R']=right_start; @z -@x [3.40] l.608 +@x [3.40] l.607 static eight_bits skip_TeX(void); @ @c @@ -269,7 +269,7 @@ part of all meanings. @c @z -@x [3.41] l.614 +@x [3.41] l.613 if (loc>limit && get_line()==false) return; @y if (loc>limit && get_line()==false) return; @@ -279,44 +279,44 @@ part of all meanings. } @z -@x [4.43] l.670 +@x [4.43] l.669 \yskip\hang |xref_roman|, |xref_wildcard|, |xref_typewriter|, |TeX_string|, @y \yskip\hang |xref_roman|, |xref_wildcard|, |xref_typewriter|, |TeX_string|, |meaning|, |suppress|, @z -@x [4.46] l.731 +@x [4.46] l.730 @d right_preproc 0217 /* ends a preprocessor command */ @y @d right_preproc 0223 /* ends a preprocessor command */ @z -@x [4.57] l.888 +@x [4.57] l.887 err_print("! String didn't end"); loc=limit; break; @y err_print(_("! String didn't end")); loc=limit; break; @z -@x [4.57] l.892 +@x [4.57] l.891 err_print("! Input ended in middle of string"); loc=buffer; break; @y err_print(_("! Input ended in middle of string")); loc=buffer; break; @z -@x [4.57] l.911 +@x [4.57] l.910 printf("%s","\n! String too long: "); @y printf("%s",_("\n! String too long: ")); @z -@x [4.59] l.930 +@x [4.59] l.929 case translit_code: err_print("! Use @@l in limbo only"); continue; @y case translit_code: err_print(_("! Use @@l in limbo only")); continue; @z -@x [4.59] l.932 +@x [4.59] l.931 case underline: xref_switch=def_flag; continue; @y case underline: xref_switch=def_flag; continue; @@ -324,38 +324,38 @@ part of all meanings. case right_start: right_start_switch=true; continue; @z -@x [4.59] l.938 +@x [4.59] l.937 case xref_roman: case xref_wildcard: case xref_typewriter: case noop: @y case xref_roman: case xref_wildcard: case xref_typewriter: case noop: case meaning: case suppress: @z -@x [4.62] l.968 +@x [4.62] l.967 err_print("! Input ended in section name"); @y err_print(_("! Input ended in section name")); @z -@x [4.62] l.981 +@x [4.62] l.980 printf("%s","\n! Section name too long: "); @y printf("%s",_("\n! Section name too long: ")); @z -@x [4.63] l.995 +@x [4.63] l.994 err_print("! Section name didn't end"); break; @y err_print(_("! Section name didn't end")); break; @z -@x [4.63] l.999 +@x [4.63] l.998 err_print("! Control codes are forbidden in section name"); break; @y err_print(_("! Control codes are forbidden in section name")); break; @z -@x [4.64] l.1009 +@x [4.64] l.1008 skip_restricted(void) { @y @@ -363,19 +363,19 @@ skip_restricted(void) { int c=ccode[(eight_bits)*(loc-1)]; @z -@x [4.64] l.1016 +@x [4.64] l.1015 err_print("! Control text didn't end"); loc=limit; @y err_print(_("! Control text didn't end")); loc=limit; @z -@x [4.64] l.1021 +@x [4.64] l.1020 err_print("! Control codes are forbidden in control text"); @y err_print(_("! Control codes are forbidden in control text")); @z -@x [4.64] l.1022 +@x [4.64] l.1021 @.Control codes are forbidden...@> @y @.Control codes are forbidden...@> @@ -383,68 +383,68 @@ skip_restricted(void) else if (c==suppress && phase==2) @<Suppress mini-index entry@>@; @z -@x [4.66] l.1036 +@x [4.66] l.1035 if (loc>=limit) err_print("! Verbatim string didn't end"); @y if (loc>=limit) err_print(_("! Verbatim string didn't end")); @z -@x [5.68] l.1061 +@x [5.68] l.1060 skip_limbo(); change_exists=false; @y skip_limbo(); @<Give a default title to the program, if necessary@>@; @z -@x [5.68] l.1064 +@x [5.68] l.1063 changed_section[section_count]=change_exists; /* the index changes if anything does */ @y @z -@x [5.70] l.1073 +@x [5.70] l.1072 if (++section_count==max_sections) overflow("section number"); @y if (++section_count==max_sections) overflow(_("section number")); @z -@x [5.70] l.1074 +@x [5.70] l.1073 changed_section[section_count]=changing; /* it will become |true| if any line changes */ @y @z -@x [5.70] l.1083 +@x [5.70] l.1082 if (changed_section[section_count]) change_exists=true; @y @z -@x [5.74] l.1162 +@x [5.74] l.1161 case translit_code: err_print("! Use @@l in limbo only"); continue; @y case translit_code: err_print(_("! Use @@l in limbo only")); continue; @z -@x [5.74] l.1167 +@x [5.74] l.1166 case xref_roman: case xref_wildcard: case xref_typewriter: @y case xref_roman: case xref_wildcard: case xref_typewriter: case meaning: case suppress: @z -@x [5.79] l.1249 +@x [5.79] l.1248 err_print("! Missing left identifier of @@s"); @y err_print(_("! Missing left identifier of @@s")); @z -@x [5.79] l.1254 +@x [5.79] l.1253 err_print("! Missing right identifier of @@s"); @y err_print(_("! Missing right identifier of @@s")); @z -@x [5.82] l.1302 +@x [5.82] l.1301 printf("%s","\n! Never defined: <"); print_section_name(p); putchar('>'); mark_harmless(); @y @@ -452,7 +452,7 @@ if (loc>=limit) err_print(_("! Verbatim string didn't end")); print_section_name(p); putchar('>'); mark_harmless(); @z -@x [5.82] l.1308 +@x [5.82] l.1307 printf("%s","\n! Never used: <"); print_section_name(p); putchar('>'); mark_harmless(); @y @@ -460,7 +460,7 @@ if (loc>=limit) err_print(_("! Verbatim string didn't end")); print_section_name(p); putchar('>'); mark_harmless(); @z -@x [6.89] l.1397 +@x [6.89] l.1396 @ In particular, the |finish_line| procedure is called near the very beginning of phase two. We initialize the output variables in a slightly tricky way so that the first line of the output file will be @@ -494,7 +494,7 @@ tex_puts(proofing?"ctproofma":"ctwima"); *out_ptr='c'; @z -@x [6.90] l.1414 +@x [6.90] l.1413 @d out(c) {if (out_ptr>=out_buf_end) break_out(); *(++out_ptr)=c;} @y @d out(c) @@ -508,102 +508,102 @@ tex_puts(proofing?"ctproofma":"ctwima"); } @z -@x [6.94] l.1462 +@x [6.94] l.1461 printf("\n! Line had to be broken (output l. %d):\n",out_line); @y printf(_("\n! Line had to be broken (output l. %d):\n"),out_line); @z -@x [6.95] l.1471 +@x [6.95] l.1470 |def_flag|, so it cannot have more than five decimal digits. If the section is changed, we output `\.{\\*}' just after the number. @y |def_flag|, so it cannot have more than five decimal digits. @z -@x [6.96] l.1485 +@x [6.96] l.1484 if (changed_section[n]) out_str("\\*"); @.\\*@> @y @z -@x [7.99] l.1543 +@x [7.99] l.1542 default: err_print("! Double @@ should be used in limbo"); @y case right_start: right_start_switch=true; break; default: err_print(_("! Double @@ should be used in limbo")); @z -@x [7.101] l.1585 +@x [7.101] l.1584 @d app_tok(c) {if (tok_ptr+2>tok_mem_end) overflow("token"); *(tok_ptr++)=c;} @y @d app_tok(c) {if (tok_ptr+2>tok_mem_end) overflow(_("token")); *(tok_ptr++)=c;} @z -@x [7.101] l.1597 +@x [7.101] l.1596 err_print("! Input ended in mid-comment"); @y err_print(_("! Input ended in mid-comment")); @z -@x [7.101] l.1602 +@x [7.101] l.1601 if (bal>1) err_print("! Missing } in comment"); @y if (bal>1) err_print(_("! Missing } in comment")); @z -@x [7.101] l.1618 +@x [7.101] l.1617 else {err_print("! Extra } in comment"); @y else {err_print(_("! Extra } in comment")); @z -@x [7.102] l.1630 +@x [7.102] l.1629 if (bal>1) err_print("! Missing } in comment"); @y if (bal>1) err_print(_("! Missing } in comment")); @z -@x [7.103] l.1638 +@x [7.103] l.1637 err_print("! Illegal use of @@ in comment"); @y err_print(_("! Illegal use of @@ in comment")); @z -@x [8.106] l.1755 +@x [8.106] l.1754 @d attr_head 69 /* denotes beginning of attribute */ @y @d attr_head 69 /* denotes beginning of attribute */ @d title 70 /* program name or header name in a ``meaning'' */ @z -@x [8.110] l.2129 +@x [8.110] l.2128 @i prod.w @y @i prod-twill.w @z -@x [9.113] l.2179 +@x [9.113] l.2178 static scrap scrap_info[max_scraps]; /* memory array for scraps */ @y static scrap scrap_info[max_scraps]; /* memory array for scraps */ static scrap null_scrap; /* a scrap with empty translation */ @z -@x [9.114] l.2188 +@x [9.114] l.2187 @ @<Set init...@>= @y @ @<Set init...@>= null_scrap.trans=&tok_start[0]; @z -@x [9.116] l.2249 +@x [9.116] l.2248 update_terminal(); @y puts("|"); update_terminal(); @z -@x [9.124] l.2560 +@x [9.124] l.2559 the |for| loop below. @c @@ -618,7 +618,7 @@ static token_pointer tok_loc; /* where the first identifier appears */ @# @z -@x [9.124] l.2568 +@x [9.124] l.2567 token_pointer tok_loc; /* pointer to |tok_value| */ if ((tok_loc=find_first_ident(p->trans))<=operator_found) return; /* this should not happen */ @@ -626,12 +626,12 @@ static token_pointer tok_loc; /* where the first identifier appears */ if (tok_loc<=operator_found) return; /* this should not happen */ @z -@x [9.125] l.2597 +@x [9.125] l.2596 token_pointer tok_loc; /* where the first identifier appears */ @y @z -@x [9.128] l.2651 +@x [9.128] l.2650 @<Cases for |exp|@>= if (cat1==lbrace || cat1==int_like || cat1==decl) { make_underlined(pp); big_app(dindent); big_app1(pp); @@ -646,7 +646,7 @@ if(cat1==lbrace || cat1==int_like || cat1==decl) { } @z -@x [9.128] l.2666 +@x [9.128] l.2665 make_underlined (pp); squash(pp,2,tag,-1,7); @y make_underlined (pp); @@ -657,7 +657,7 @@ if(cat1==lbrace || cat1==int_like || cat1==decl) { squash(pp,2,tag,-1,7); @z -@x [9.138] l.2755 +@x [9.138] l.2754 @ @<Cases for |decl_head|@>= if (cat1==comma) { big_app2(pp); app(opt); app('9'); reduce(pp,2,decl_head,-1,33); @@ -700,7 +700,7 @@ else if (cat1==int_like || cat1==lbrace || cat1==decl) { else if (cat1==semi) squash(pp,2,decl,-1,39); @z -@x [9.139] l.2777 +@x [9.139] l.2776 @ @<Cases for |decl|@>= if (cat1==decl) { big_app1_insert(pp,force); reduce(pp,2,decl,-1,40); @@ -719,13 +719,13 @@ else if (cat1==stmt || cat1==function) { } @z -@x [9.141] l.2803 +@x [9.141] l.2802 make_underlined(pp+1); make_reserved(pp+1); @y make_underlined(pp+1); make_reserved(pp+1); make_ministring(pp+1); @z -@x [9.143] l.2834 +@x [9.143] l.2833 @ @<Cases for |fn_decl|@>= if (cat1==decl) { big_app1_insert(pp,force); reduce(pp,2,fn_decl,0,51); @@ -748,14 +748,14 @@ else if (cat1==stmt) { } @z -@x [9.153] l.2938 +@x [9.153] l.2937 big_app1_insert(pp,dindent); reduce(pp,2,fn_decl,0,73); @y big_app1(pp); if (indent_param_decl) big_app(dindent); big_app1(pp+1); reduce(pp,2,fn_decl,0,73); @z -@x [9.156] l.2964 +@x [9.156] l.2963 big_app1_insert(pp, (cat1==decl || cat1==function) ? big_force : force_lines ? force : break_space); reduce(pp,2,cat1,-1,76); @y @@ -764,7 +764,7 @@ else if (cat1==stmt) { ( force_lines ? force : break_space ) ); reduce(pp,2,cat1,-1,76); @z -@x [9.158] l.2972 +@x [9.158] l.2971 if (cat1==define_like) make_underlined(pp+2); @y if (cat1==define_like) { /* \#\&{define} is analogous to \&{extern} */ @@ -776,7 +776,7 @@ if (cat1==define_like) { /* \#\&{define} is analogous to \&{extern} */ } @z -@x [9.167] l.3069 +@x [9.167] l.3068 if (cat1==prelangle) reduce(pp+1,0,langle,1,100); else reduce(pp,0,exp,-2,101); @y @@ -784,13 +784,13 @@ if (cat1==prelangle) reduce(pp+1,0,langle,1,121); else reduce(pp,0,exp,-2,122); @z -@x [9.168] l.3074 +@x [9.168] l.3073 big_app1_insert(pp,' '); reduce(pp,2,else_like,-2,102); @y big_app1_insert(pp,' '); reduce(pp,2,else_like,-2,123); @z -@x [9.173] l.3106 +@x [9.173] l.3105 @ @<Cases for |typedef_like|@>= if ((cat1==int_like || cat1==cast) && (cat2==comma || cat2==semi)) reduce(pp+1,0,exp,-1,115); @@ -826,56 +826,56 @@ if (cat1==decl_head) { (cat3==semi || cat3==comma)) reduce(pp+2,0,exp,1,202); @z -@x [9.186] l.3293 +@x [9.186] l.3292 overflow("token"); @y overflow(_("token")); @z -@x [9.186] l.3297 +@x [9.186] l.3296 overflow("text"); @y overflow(_("text")); @z -@x [9.190] l.3352 +@x [9.190] l.3351 if (tok_ptr+6>tok_mem_end) overflow("token"); @y if (tok_ptr+6>tok_mem_end) overflow(_("token")); @z -@x [9.191] l.3358 +@x [9.191] l.3357 printf("\nIrreducible scrap sequence in section %d:",(int)section_count); @y printf(_("\nIrreducible scrap sequence in section %d:"),(int)section_count); @z -@x [9.192] l.3368 +@x [9.192] l.3367 printf("\nTracing after l. %d:\n",cur_line); mark_harmless(); @y printf(_("\nTracing after l. %d:\n"),cur_line); mark_harmless(); @z -@x [10.196] l.3454 +@x [10.196] l.3453 case ignore: case xref_roman: case xref_wildcard: @y case ignore: case xref_roman: case xref_wildcard: case meaning: case suppress: @z -@x [10.197] l.3500 +@x [10.197] l.3499 overflow("scrap/token/text"); @y overflow(_("scrap/token/text")); @z -@x [10.199] l.3585 +@x [10.199] l.3584 else err_print("! Double @@ should be used in strings"); @y else err_print(_("! Double @@ should be used in strings")); @z -@x [10.202] l.3650 +@x [10.202] l.3649 else app_scrap(p->ilk,maybe_math); } } @@ -886,62 +886,62 @@ if (cat1==decl_head) { @<Flag the usage of this identifier, for the mini-index@>@; @z -@x [10.203] l.3668 +@x [10.203] l.3667 if (next_control!='|') err_print("! Missing '|' after C text"); @y if (next_control!='|') err_print(_("! Missing '|' after C text")); @z -@x [10.204] l.3683 +@x [10.204] l.3682 to \.{\\PB}. Although \.{cwebmac} ignores \.{\\PB}, other macro packages @y to \.{\\PB}. Although \.{ctwimac} ignores \.{\\PB}, other macro packages @z -@x [10.205] l.3713 +@x [10.205] l.3712 app(tok_flag+(int)(p-tok_start)); @y app(tok_flag+(int)(p-tok_start)); app(inserted); @z -@x [11.211] l.3809 +@x [11.211] l.3808 if (stack_ptr==stack_end) overflow("stack"); @y if (stack_ptr==stack_end) overflow(_("stack")); @z -@x [11.224] l.4132 +@x [11.224] l.4131 printf("%s","\n! Illegal control code in section name: <"); @y printf("%s",_("\n! Illegal control code in section name: <")); @z -@x [11.225] l.4147 +@x [11.225] l.4146 printf("%s","\n! C text in section name didn't end: <"); @y printf("%s",_("\n! C text in section name didn't end: <")); @z -@x [11.225] l.4159 +@x [11.225] l.4158 if (j>buffer+long_buf_size-3) overflow("buffer"); @y if (j>buffer+long_buf_size-3) overflow(_("buffer")); @z -@x [11.226] l.4167 +@x [11.226] l.4166 if (j>buffer+long_buf_size-4) overflow("buffer"); @y if (j>buffer+long_buf_size-4) overflow(_("buffer")); @z -@x [12.227] l.4182 +@x [12.227] l.4181 if (show_progress) printf("%s","\nWriting the output file..."); @y if (show_progress) printf("%s",_("\nWriting the output file...")); @z -@x [12.227] l.4184 +@x [12.227] l.4183 section_count=0; format_visible=true; copy_limbo(); @y temp_switch=false; temp_meaning_ptr=temp_meaning_stack; @@ -949,7 +949,7 @@ temp_switch=false; temp_meaning_ptr=temp_meaning_stack; section_count=0; format_visible=true; right_start_switch=false; copy_limbo(); @z -@x [12.229] l.4213 +@x [12.229] l.4212 static boolean group_found=false; /* has a starred section occurred? */ @ @<Translate the current section@>= { @@ -966,12 +966,12 @@ static boolean temp_switch; /* has `\.{@@\%}' occurred recently? */ top_usage=usage_sentinel; @z -@x [12.231] l.4231 +@x [12.231] l.4230 If the section has changed, we put \.{\\*} just after the section number. @y @z -@x [12.231] l.4234 +@x [12.231] l.4233 if (*(loc-1)!='*') out_str("\\M"); @y if (*(loc-1)!='*') { @@ -983,7 +983,7 @@ if (*(loc-1)!='*') { } @z -@x [12.231] l.4249 +@x [12.231] l.4248 @.\\N@> @y @.\\N@> @@ -993,14 +993,14 @@ if (*(loc-1)!='*') { } @z -@x [12.231] l.4256 +@x [12.231] l.4255 out('{'); out_section(section_count); out('}'); @y out('{'); out_section(section_count); out('}'); flush_buffer(out_ptr,false,false); @z -@x [12.232] l.4264 +@x [12.232] l.4263 case '@@': out('@@'); break; @y case '@@': out('@@'); break; @@ -1008,26 +1008,26 @@ flush_buffer(out_ptr,false,false); case right_start: right_start_switch=true; break; @z -@x [12.232] l.4267 +@x [12.232] l.4266 case section_name: loc-=2; next_control=get_next(); /* skip to \.{@@>} */ @y case meaning: case suppress: case section_name: loc-=2; next_control=get_next(); /* reprocess */ @z -@x [12.232] l.4269 +@x [12.232] l.4268 err_print("! TeX string should be in C text only"); break; @y err_print(_("! TeX string should be in C text only")); break; @z -@x [12.232] l.4275 +@x [12.232] l.4274 err_print("! You can't do that in TeX text"); break; @y err_print(_("! You can't do that in TeX text")); break; @z -@x [12.233] l.4289 +@x [12.233] l.4288 outer_parse(); finish_C(format_visible); format_visible=true; doing_format=false; } @@ -1039,20 +1039,20 @@ flush_buffer(out_ptr,false,false); } @z -@x [12.236] l.4341 +@x [12.236] l.4340 @<Start a macro...@>= { @y @<Start a macro...@>= { is_macro=true; @z -@x [12.236] l.4347 +@x [12.236] l.4346 err_print("! Improper macro definition"); @y err_print(_("! Improper macro definition")); @z -@x [12.236] l.4348 +@x [12.236] l.4347 @.Improper macro definition@> else { app('$'); app_cur_id(false); @@ -1064,7 +1064,7 @@ flush_buffer(out_ptr,false,false); def_diff=(*loc!='('); @z -@x [12.236] l.4360 +@x [12.236] l.4359 } @=/* otherwise fall through */@>@; default: err_print("! Improper macro definition"); break; @y @@ -1072,7 +1072,7 @@ flush_buffer(out_ptr,false,false); default: err_print(_("! Improper macro definition")); break; @z -@x [12.237] l.4370 +@x [12.237] l.4369 @ @<Start a format...@>= { doing_format=true; @y @@ -1081,25 +1081,25 @@ flush_buffer(out_ptr,false,false); is_macro=false; @z -@x [12.237] l.4387 +@x [12.237] l.4386 if (scrap_ptr!=scrap_info+2) err_print("! Improper format definition"); @y if (scrap_ptr!=scrap_info+2) err_print(_("! Improper format definition")); @z -@x [12.240] l.4422 +@x [12.240] l.4421 err_print("! You need an = sign after the section name"); @y err_print(_("! You need an = sign after the section name")); @z -@x [12.241] l.4444 +@x [12.241] l.4443 err_print("! You can't do that in C text"); @y err_print(_("! You can't do that in C text")); @z -@x [12.246] l.4514 +@x [12.246] l.4513 out_str("\\fi"); finish_line(); @.\\fi@> @y @@ -1110,13 +1110,13 @@ out_str("}\\FI"); finish_line(); @.\\FI@> @z -@x [13.247] l.4535 +@x [13.247] l.4534 if (show_progress) printf("%s","\nWriting the index..."); @y if (show_progress) printf("%s",_("\nWriting the index...")); @z -@x [13.247] l.4537 +@x [13.247] l.4536 if (change_exists) { @<Tell about changed sections@>@; finish_line(); flush_buffer(out_buf,false,false); @@ -1125,32 +1125,32 @@ out_str("}\\FI"); finish_line(); @y @z -@x [13.247] l.4546 +@x [13.247] l.4545 fatal("! Cannot open index file ",idx_file_name); @y fatal(_("! Cannot open index file "),idx_file_name); @z -@x [13.247] l.4558 +@x [13.247] l.4557 fatal("! Cannot open section file ",scn_file_name); @y fatal(_("! Cannot open section file "),scn_file_name); @z -@x [13.247] l.4570 +@x [13.247] l.4569 fclose(active_file); @y fclose(active_file); active_file=tex_file=NULL; if (check_for_change) @<Update the result when it has changed@>@; @z -@x [13.247] l.4573 +@x [13.247] l.4572 printf("%s","Done."); @y printf("%s",_("Done.")); @z -@x [13.249] l.4581 +@x [13.249] l.4580 the index section itself. @<Tell about changed sections@>= @@ -1169,13 +1169,13 @@ out('.'); the index section itself---NOT! @z -@x [13.257] l.4725 +@x [13.257] l.4724 if (sort_ptr>=scrap_info_end) overflow("sorting"); @y if (sort_ptr>=scrap_info_end) overflow(_("sorting")); @z -@x [13.262] l.4770 +@x [13.262] l.4769 @ @<Output the name...@>= switch (cur_name->ilk) {@+char *p; /* index into |byte_mem| */@+@t}\6{\4@> @y @@ -1186,20 +1186,20 @@ rest of the job. Compare this code with section |@<Mini-output...@>|. switch (cur_name->ilk) { @z -@x [13.262] l.4772 +@x [13.262] l.4771 case normal: case func_template: @y case normal: @z -@x [13.262] l.4774 +@x [13.262] l.4773 else {@+boolean all_caps=true;@+@t}\6{@> @y else {@+boolean all_caps=true;@+char *p; /* index into |byte_mem| */ @+@t}\6{@> @z -@x [13.262] l.4789 +@x [13.262] l.4788 case roman: not_an_identifier: out_name(cur_name,false); goto name_done; case custom: out_str("$\\"); @@ -1214,13 +1214,13 @@ not_an_identifier: out_name(cur_name,false); goto name_done; @.\\\$@> @z -@x [13.262] l.4799 +@x [13.262] l.4798 out_name(cur_name,true); @y out_name(cur_name,proofing); @z -@x [13.269] l.4862 +@x [13.269] l.4861 puts("\nMemory usage statistics:"); @.Memory usage statistics:@> printf("%td names (out of %ld)\n",@^system dependencies@> @@ -1269,7 +1269,7 @@ out_name(cur_name,proofing); (ptrdiff_t)(max_sort_ptr-scrap_info),(long)max_scraps); @z -@x [14.270] l.4884 +@x [14.270] l.4883 @** Index. @y @q Section 270. @> diff --git a/Build/source/texk/web2c/cwebdir/cweav-bs.ch b/Build/source/texk/web2c/cwebdir/cweav-bs.ch index c2f3214c793..458a0a7e60c 100644 --- a/Build/source/texk/web2c/cwebdir/cweav-bs.ch +++ b/Build/source/texk/web2c/cwebdir/cweav-bs.ch @@ -20,12 +20,12 @@ This file contributed by Barry Schwartz, trashman@crud.mn.org, 28 Jun 94. The ``banner line'' defined here should be changed whenever \.{CWEAVE} is modified. -@d banner "This is CWEAVE (Version 4.11)" +@d banner "This is CWEAVE (Version 4.12)" @y The ``banner line'' defined here should be changed whenever \.{CWEAVE} is modified. -@d banner "This is CWEAVE (Version 4.11pc/big)" +@d banner "This is CWEAVE (Version 4.12pc/big)" @z diff --git a/Build/source/texk/web2c/cwebdir/cweav-pc.ch b/Build/source/texk/web2c/cwebdir/cweav-pc.ch index 165b8a54eeb..ae1fb9f45c7 100644 --- a/Build/source/texk/web2c/cwebdir/cweav-pc.ch +++ b/Build/source/texk/web2c/cwebdir/cweav-pc.ch @@ -11,9 +11,9 @@ that allows >64K arrays. (If you need lots more bytes, try the alternate change files that have -bs in their name instead of -pc.) @x section 1 -@d banner "This is CWEAVE (Version 4.11)" +@d banner "This is CWEAVE (Version 4.12)" @y -@d banner "This is CWEAVE (Version 4.11pc)" +@d banner "This is CWEAVE (Version 4.12pc)" @z @x section 17 diff --git a/Build/source/texk/web2c/cwebdir/cweav-ql.ch b/Build/source/texk/web2c/cwebdir/cweav-ql.ch index 31bd6138a29..fd369064deb 100644 --- a/Build/source/texk/web2c/cwebdir/cweav-ql.ch +++ b/Build/source/texk/web2c/cwebdir/cweav-ql.ch @@ -7,15 +7,15 @@ ex <dev_>cc;"-v -h -c =500000 cweave_c" @x -\def\title{CWEAVE (Version 4.11)} +\def\title{CWEAVE (Version 4.12)} @y -\def\title{CWEAVE (QL Version 4.11)} +\def\title{CWEAVE (QL Version 4.12)} @z @x section 1 -@d banner "This is CWEAVE (Version 4.11)" +@d banner "This is CWEAVE (Version 4.12)" @y -@d banner "This is CWEAVE (QL Version 4.11)" +@d banner "This is CWEAVE (QL Version 4.12)" @z @x diff --git a/Build/source/texk/web2c/cwebdir/cweav-vms.ch b/Build/source/texk/web2c/cwebdir/cweav-vms.ch index b944f838153..f4630f98661 100644 --- a/Build/source/texk/web2c/cwebdir/cweav-vms.ch +++ b/Build/source/texk/web2c/cwebdir/cweav-vms.ch @@ -13,9 +13,9 @@ modified: (also modified by Don Knuth to keep version numbers uptodate) @x section 1 (01-FEB-1992 ST) -@d banner "This is CWEAVE (Version 4.11)" +@d banner "This is CWEAVE (Version 4.12)" @y -@d banner "This is CWEAVE (VAX/VMS Version 4.11)" +@d banner "This is CWEAVE (VAX/VMS Version 4.12)" @z @x section 5 (01-FEB-1992 ST) diff --git a/Build/source/texk/web2c/cwebdir/cweav-w2c.ch b/Build/source/texk/web2c/cwebdir/cweav-w2c.ch index 73b9ab4b2c9..6d350fc405a 100644 --- a/Build/source/texk/web2c/cwebdir/cweav-w2c.ch +++ b/Build/source/texk/web2c/cwebdir/cweav-w2c.ch @@ -16,62 +16,62 @@ @q Please send comments, suggestions, etc. to tex-k@@tug.org. @> -@x [0.0] l.35 -\def\title{CWEAVE (Version 4.11)} +@x [0.0] l.34 +\def\title{CWEAVE (Version 4.12)} @y -\def\title{CWEAVE (Version 4.11 [\TeX~Live])} +\def\title{CWEAVE (Version 4.12 [\TeX~Live])} @z -@x [0.0] l.39 - \centerline{(Version 4.11)} +@x [0.0] l.38 + \centerline{(Version 4.12)} @y - \centerline{(Version 4.11 [\TeX~Live])} + \centerline{(Version 4.12 [\TeX~Live])} @z -@x [0.0] l.41 +@x [0.0] l.40 \def\botofcontents{\vfill @y \def\covernote{\vbox{% @z -@x [0.0] l.54 +@x [0.0] l.53 } @y }}\datecontentspage @z -@x [1.1] l.70 -@d banner "This is CWEAVE (Version 4.11)" +@x [1.1] l.69 +@d banner "This is CWEAVE (Version 4.12)" @y -@d banner "This is CWEAVE, Version 4.11" +@d banner "This is CWEAVE, Version 4.12" /* will be extended by the \TeX~Live |versionstring| */ @z -@x [1.2] l.98 +@x [1.2] l.97 if (show_banner) puts(banner); /* print a ``banner line'' */ @y if (show_banner) cb_show_banner(); /* print a ``banner line'' */ @z -@x [1.3] l.112 +@x [1.3] l.111 @i common.h @y @i comm-w2c.h @z -@x [2.23] l.217 +@x [2.23] l.216 @ @d max_refs 30000 /* number of cross-references; must be less than 65536 */ @y @ @d max_refs 65535 /* number of cross-references; must be less than 65536 */ @z -@x [2.25] l.246 +@x [2.25] l.245 @d append_xref(c) if (xref_ptr==xmem_end) overflow("cross-reference"); @y @d append_xref(c) if (xref_ptr==xmem_end) overflow(_("cross-reference")); @z -@x [2.30] l.337 +@x [2.30] l.336 @d max_toks 30000 /* number of symbols in \CEE/ texts being parsed; must be less than 65536 */ @d max_texts 8000 /* number of phrases in \CEE/ texts being parsed; @@ -83,97 +83,97 @@ must be less than 10240 */ @z -@x [4.57] l.888 +@x [4.57] l.887 err_print("! String didn't end"); loc=limit; break; @y err_print(_("! String didn't end")); loc=limit; break; @z -@x [4.57] l.892 +@x [4.57] l.891 err_print("! Input ended in middle of string"); loc=buffer; break; @y err_print(_("! Input ended in middle of string")); loc=buffer; break; @z -@x [4.57] l.911 +@x [4.57] l.910 printf("%s","\n! String too long: "); @y printf("%s",_("\n! String too long: ")); @z -@x [4.59] l.930 +@x [4.59] l.929 case translit_code: err_print("! Use @@l in limbo only"); continue; @y case translit_code: err_print(_("! Use @@l in limbo only")); continue; @z -@x [4.62] l.968 +@x [4.62] l.967 err_print("! Input ended in section name"); @y err_print(_("! Input ended in section name")); @z -@x [4.62] l.981 +@x [4.62] l.980 printf("%s","\n! Section name too long: "); @y printf("%s",_("\n! Section name too long: ")); @z -@x [4.63] l.995 +@x [4.63] l.994 err_print("! Section name didn't end"); break; @y err_print(_("! Section name didn't end")); break; @z -@x [4.63] l.999 +@x [4.63] l.998 err_print("! Control codes are forbidden in section name"); break; @y err_print(_("! Control codes are forbidden in section name")); break; @z -@x [4.64] l.1016 +@x [4.64] l.1015 err_print("! Control text didn't end"); loc=limit; @y err_print(_("! Control text didn't end")); loc=limit; @z -@x [4.64] l.1021 +@x [4.64] l.1020 err_print("! Control codes are forbidden in control text"); @y err_print(_("! Control codes are forbidden in control text")); @z -@x [4.66] l.1036 +@x [4.66] l.1035 if (loc>=limit) err_print("! Verbatim string didn't end"); @y if (loc>=limit) err_print(_("! Verbatim string didn't end")); @z -@x [5.70] l.1073 +@x [5.70] l.1072 if (++section_count==max_sections) overflow("section number"); @y if (++section_count==max_sections) overflow(_("section number")); @z -@x [5.74] l.1162 +@x [5.74] l.1161 case translit_code: err_print("! Use @@l in limbo only"); continue; @y case translit_code: err_print(_("! Use @@l in limbo only")); continue; @z -@x [5.79] l.1249 +@x [5.79] l.1248 err_print("! Missing left identifier of @@s"); @y err_print(_("! Missing left identifier of @@s")); @z -@x [5.79] l.1254 +@x [5.79] l.1253 err_print("! Missing right identifier of @@s"); @y err_print(_("! Missing right identifier of @@s")); @z -@x [5.82] l.1302 +@x [5.82] l.1301 printf("%s","\n! Never defined: <"); print_section_name(p); putchar('>'); mark_harmless(); @y @@ -181,7 +181,7 @@ if (loc>=limit) err_print(_("! Verbatim string didn't end")); print_section_name(p); putchar('>'); mark_harmless(); @z -@x [5.82] l.1308 +@x [5.82] l.1307 printf("%s","\n! Never used: <"); print_section_name(p); putchar('>'); mark_harmless(); @y @@ -189,7 +189,7 @@ if (loc>=limit) err_print(_("! Verbatim string didn't end")); print_section_name(p); putchar('>'); mark_harmless(); @z -@x [6.89] l.1397 +@x [6.89] l.1396 @ In particular, the |finish_line| procedure is called near the very beginning of phase two. We initialize the output variables in a slightly tricky way so that the first line of the output file will be @@ -218,61 +218,61 @@ tex_puts("cwebma"); *out_ptr='c'; @z -@x [6.94] l.1462 +@x [6.94] l.1461 printf("\n! Line had to be broken (output l. %d):\n",out_line); @y printf(_("\n! Line had to be broken (output l. %d):\n"),out_line); @z -@x [7.99] l.1543 +@x [7.99] l.1542 default: err_print("! Double @@ should be used in limbo"); @y default: err_print(_("! Double @@ should be used in limbo")); @z -@x [7.101] l.1585 +@x [7.101] l.1584 @d app_tok(c) {if (tok_ptr+2>tok_mem_end) overflow("token"); *(tok_ptr++)=c;} @y @d app_tok(c) {if (tok_ptr+2>tok_mem_end) overflow(_("token")); *(tok_ptr++)=c;} @z -@x [7.101] l.1597 +@x [7.101] l.1596 err_print("! Input ended in mid-comment"); @y err_print(_("! Input ended in mid-comment")); @z -@x [7.101] l.1602 +@x [7.101] l.1601 if (bal>1) err_print("! Missing } in comment"); @y if (bal>1) err_print(_("! Missing } in comment")); @z -@x [7.101] l.1618 +@x [7.101] l.1617 else {err_print("! Extra } in comment"); @y else {err_print(_("! Extra } in comment")); @z -@x [7.102] l.1630 +@x [7.102] l.1629 if (bal>1) err_print("! Missing } in comment"); @y if (bal>1) err_print(_("! Missing } in comment")); @z -@x [7.103] l.1638 +@x [7.103] l.1637 err_print("! Illegal use of @@ in comment"); @y err_print(_("! Illegal use of @@ in comment")); @z -@x [8.110] l.2129 +@x [8.110] l.2128 @i prod.w @y @i prod-cweave.w @z -@x [9.128] l.2651 +@x [9.128] l.2650 @<Cases for |exp|@>= if (cat1==lbrace || cat1==int_like || cat1==decl) { make_underlined(pp); big_app(dindent); big_app1(pp); @@ -286,7 +286,7 @@ if(cat1==lbrace || cat1==int_like || cat1==decl) { } @z -@x [9.138] l.2755 +@x [9.138] l.2754 @ @<Cases for |decl_head|@>= if (cat1==comma) { big_app2(pp); app(opt); app('9'); reduce(pp,2,decl_head,-1,33); @@ -328,7 +328,7 @@ else if (cat1==int_like || cat1==lbrace || cat1==decl) { else if (cat1==semi) squash(pp,2,decl,-1,39); @z -@x [9.139] l.2777 +@x [9.139] l.2776 @ @<Cases for |decl|@>= if (cat1==decl) { big_app1_insert(pp,force); reduce(pp,2,decl,-1,40); @@ -347,7 +347,7 @@ else if (cat1==stmt || cat1==function) { } @z -@x [9.143] l.2834 +@x [9.143] l.2833 @ @<Cases for |fn_decl|@>= if (cat1==decl) { big_app1_insert(pp,force); reduce(pp,2,fn_decl,0,51); @@ -370,14 +370,14 @@ else if (cat1==stmt) { } @z -@x [9.153] l.2938 +@x [9.153] l.2937 big_app1_insert(pp,dindent); reduce(pp,2,fn_decl,0,73); @y big_app1(pp); if (indent_param_decl) big_app(dindent); big_app1(pp+1); reduce(pp,2,fn_decl,0,73); @z -@x [9.156] l.2964 +@x [9.156] l.2963 big_app1_insert(pp, (cat1==decl || cat1==function) ? big_force : force_lines ? force : break_space); reduce(pp,2,cat1,-1,76); @y @@ -386,109 +386,109 @@ else if (cat1==stmt) { ( force_lines ? force : break_space ) ); reduce(pp,2,cat1,-1,76); @z -@x [9.186] l.3293 +@x [9.186] l.3292 overflow("token"); @y overflow(_("token")); @z -@x [9.186] l.3297 +@x [9.186] l.3296 overflow("text"); @y overflow(_("text")); @z -@x [9.190] l.3352 +@x [9.190] l.3351 if (tok_ptr+6>tok_mem_end) overflow("token"); @y if (tok_ptr+6>tok_mem_end) overflow(_("token")); @z -@x [9.191] l.3358 +@x [9.191] l.3357 printf("\nIrreducible scrap sequence in section %d:",(int)section_count); @y printf(_("\nIrreducible scrap sequence in section %d:"),(int)section_count); @z -@x [9.192] l.3368 +@x [9.192] l.3367 printf("\nTracing after l. %d:\n",cur_line); mark_harmless(); @y printf(_("\nTracing after l. %d:\n"),cur_line); mark_harmless(); @z -@x [10.197] l.3500 +@x [10.197] l.3499 overflow("scrap/token/text"); @y overflow(_("scrap/token/text")); @z -@x [10.199] l.3585 +@x [10.199] l.3584 else err_print("! Double @@ should be used in strings"); @y else err_print(_("! Double @@ should be used in strings")); @z -@x [10.203] l.3668 +@x [10.203] l.3667 if (next_control!='|') err_print("! Missing '|' after C text"); @y if (next_control!='|') err_print(_("! Missing '|' after C text")); @z -@x [11.211] l.3809 +@x [11.211] l.3808 if (stack_ptr==stack_end) overflow("stack"); @y if (stack_ptr==stack_end) overflow(_("stack")); @z -@x [11.224] l.4132 +@x [11.224] l.4131 printf("%s","\n! Illegal control code in section name: <"); @y printf("%s",_("\n! Illegal control code in section name: <")); @z -@x [11.225] l.4147 +@x [11.225] l.4146 printf("%s","\n! C text in section name didn't end: <"); @y printf("%s",_("\n! C text in section name didn't end: <")); @z -@x [11.225] l.4159 +@x [11.225] l.4158 if (j>buffer+long_buf_size-3) overflow("buffer"); @y if (j>buffer+long_buf_size-3) overflow(_("buffer")); @z -@x [11.226] l.4167 +@x [11.226] l.4166 if (j>buffer+long_buf_size-4) overflow("buffer"); @y if (j>buffer+long_buf_size-4) overflow(_("buffer")); @z -@x [12.227] l.4182 +@x [12.227] l.4181 if (show_progress) printf("%s","\nWriting the output file..."); @y if (show_progress) printf("%s",_("\nWriting the output file...")); @z -@x [12.232] l.4269 +@x [12.232] l.4268 err_print("! TeX string should be in C text only"); break; @y err_print(_("! TeX string should be in C text only")); break; @z -@x [12.232] l.4275 +@x [12.232] l.4274 err_print("! You can't do that in TeX text"); break; @y err_print(_("! You can't do that in TeX text")); break; @z -@x [12.236] l.4347 +@x [12.236] l.4346 err_print("! Improper macro definition"); @y err_print(_("! Improper macro definition")); @z -@x [12.236] l.4360 +@x [12.236] l.4359 } @=/* otherwise fall through */@>@; default: err_print("! Improper macro definition"); break; @y @@ -496,62 +496,62 @@ if (show_progress) printf("%s",_("\nWriting the output file...")); default: err_print(_("! Improper macro definition")); break; @z -@x [12.237] l.4387 +@x [12.237] l.4386 if (scrap_ptr!=scrap_info+2) err_print("! Improper format definition"); @y if (scrap_ptr!=scrap_info+2) err_print(_("! Improper format definition")); @z -@x [12.240] l.4422 +@x [12.240] l.4421 err_print("! You need an = sign after the section name"); @y err_print(_("! You need an = sign after the section name")); @z -@x [12.241] l.4444 +@x [12.241] l.4443 err_print("! You can't do that in C text"); @y err_print(_("! You can't do that in C text")); @z -@x [13.247] l.4535 +@x [13.247] l.4534 if (show_progress) printf("%s","\nWriting the index..."); @y if (show_progress) printf("%s",_("\nWriting the index...")); @z -@x [13.247] l.4546 +@x [13.247] l.4545 fatal("! Cannot open index file ",idx_file_name); @y fatal(_("! Cannot open index file "),idx_file_name); @z -@x [13.247] l.4558 +@x [13.247] l.4557 fatal("! Cannot open section file ",scn_file_name); @y fatal(_("! Cannot open section file "),scn_file_name); @z -@x [13.247] l.4570 +@x [13.247] l.4569 fclose(active_file); @y fclose(active_file); active_file=tex_file=NULL; if (check_for_change) @<Update the result when it has changed@>@; @z -@x [13.247] l.4573 +@x [13.247] l.4572 printf("%s","Done."); @y printf("%s",_("Done.")); @z -@x [13.257] l.4725 +@x [13.257] l.4724 if (sort_ptr>=scrap_info_end) overflow("sorting"); @y if (sort_ptr>=scrap_info_end) overflow(_("sorting")); @z -@x [13.269] l.4862 +@x [13.269] l.4861 puts("\nMemory usage statistics:"); @.Memory usage statistics:@> printf("%td names (out of %ld)\n",@^system dependencies@> @@ -595,7 +595,7 @@ if (check_for_change) @<Update the result when it has changed@>@; (ptrdiff_t)(max_sort_ptr-scrap_info),(long)max_scraps); @z -@x [14.270] l.4884 +@x [14.270] l.4883 @** Index. @y @** Extensions to {\tentex CWEB}. The following sections introduce new or diff --git a/Build/source/texk/web2c/cwebdir/cweav-w32.ch b/Build/source/texk/web2c/cwebdir/cweav-w32.ch index 1bf1471e18e..2f9a2127ac5 100644 --- a/Build/source/texk/web2c/cwebdir/cweav-w32.ch +++ b/Build/source/texk/web2c/cwebdir/cweav-w32.ch @@ -2,9 +2,9 @@ This is the change file for CWEB's CWEAVE under Win32 (Contributed by Fabrice Popineau, February 2002) @x section 1 -@d banner "This is CWEAVE (Version 4.11)" +@d banner "This is CWEAVE (Version 4.12)" @y -@d banner "This is CWEAVE (Version 4.11win32)" +@d banner "This is CWEAVE (Version 4.12win32)" @z @x section 32 diff --git a/Build/source/texk/web2c/cwebdir/cweave.w b/Build/source/texk/web2c/cwebdir/cweave.w index 808d46cc7eb..627fa1fa815 100644 --- a/Build/source/texk/web2c/cwebdir/cweave.w +++ b/Build/source/texk/web2c/cwebdir/cweave.w @@ -2,7 +2,7 @@ % This program by Silvio Levy and Donald E. Knuth % is based on a program by Knuth. % It is distributed WITHOUT ANY WARRANTY, express or implied. -% Version 4.11 --- December 2023 +% Version 4.12 --- August 2024 % Copyright (C) 1987,1990,1993,2000 Silvio Levy and Donald E. Knuth @@ -27,16 +27,15 @@ \def\dleft{[\![} \def\dright{]\!]} % double brackets \mathchardef\RA="3221 % right arrow \mathchardef\BA="3224 % double arrow -\def\({} % ) kludge for alphabetizing certain section names \def\TeXxstring{\\{\TEX/\_string}} \def\skipxTeX{\\{skip\_\TEX/}} \def\copyxTeX{\\{copy\_\TEX/}} -\def\title{CWEAVE (Version 4.11)} +\def\title{CWEAVE (Version 4.12)} \def\topofcontents{\null\vfill \centerline{\titlefont The {\ttitlefont CWEAVE} processor} \vskip 15pt - \centerline{(Version 4.11)} + \centerline{(Version 4.12)} \vfill} \def\botofcontents{\vfill \noindent @@ -67,7 +66,7 @@ Crusius, and others who have contributed improvements. The ``banner line'' defined here should be changed whenever \.{CWEAVE} is modified. -@d banner "This is CWEAVE (Version 4.11)" +@d banner "This is CWEAVE (Version 4.12)" @c @<Include files@>@/ diff --git a/Build/source/texk/web2c/cwebdir/cwebacromac.tex b/Build/source/texk/web2c/cwebdir/cwebacromac.tex index f8462d06a37..3e8baad77c1 100644 --- a/Build/source/texk/web2c/cwebdir/cwebacromac.tex +++ b/Build/source/texk/web2c/cwebdir/cwebacromac.tex @@ -1,6 +1,8 @@ % hypertext macros for CWEB listings (in addition to cwebmac.tex) -% Version 2.0 --- May 2024 +% Used in cwebmac.tex, pdfctwimac.tex, pdfproofmac.tex +% Version 3.0 --- August 2024 \ifx\ifacrohint\undefined\endinput\fi % these are not standalone macros + \ifluatex % LuaTeX is almost like pdfTeX \protected\def\pdfliteral {\pdfextension literal} \protected\def\pdfstartlink {\pdfextension startlink\space} @@ -15,7 +17,6 @@ \let\pdfoutput=\outputmode \fi % end of LuaTeX->pdfTeX redirection macros -% Used in cwebmac.tex, pdfctwimac.tex, pdfproofmac.tex \def\tocpages{1} % Most programs have one-page Table-of-Contents \def\startpdf{\def\pagemode{/PageMode /UseOutlines} \ifnum\contentspagenumber=0 \advance \pageno by -\tocpages @@ -24,9 +25,53 @@ \else \twodigits=\pageno \pageno=\contentspagenumber \advance \pageno by \tocpages \advance \twodigits by -\pageno \def\pagelabels{/PageLabels << /Nums [ 0 << /S/D/St \the\pageno >> - \the\twodigits << /S/D/St \contentspagenumber >> ] >>} \fi + \the\twodigits << /S/D/St \contentspagenumber >> ] >>} + \fi \ifpdflua\pdfcatalog{\pagemode\space\pagelabels} - \else \special{pdf: docview << \pagemode\space\pagelabels >>}\fi} + \else\special{pdf: docview << \pagemode\space\pagelabels >>}\fi} +\ifacrohint\def\digits{\pdflink{\the\countA}\scan} +\else\def\digits{{\the\countA}\scan}\fi +\def\scan#1{\begingroup + \ifx!#1% exit on exclamation point + \else\ifx,#1,\space\aftergroup\scan % insert ,\space}\scan ... + \else\ifx\[#1\aftergroup#1% insert }\[... + \else\ifx\*#1\aftergroup\lapstar\aftergroup\scan % insert }\lapstar\scan ... + \else\ifnum`#1>`9#1\aftergroup\scan % insert #1}\scan ... + \else\ifnum`#1<`0#1\aftergroup\scan % insert #1}\scan ... + \else + \afterassignment\digits \aftergroup\countA + \aftergroup#1% insert }\countA=#1...\digits ... + \fi\fi\fi\fi\fi \fi + \endgroup} + +% Local variables; there are a few externals like '\toksA' and '\countA' +\newtoks\toksB \newtoks\toksC \newtoks\toksD \newtoks\toksF \newtoks\sanitizer +\newif\iftokprocessed \newif\ifTnum \newif\ifinstr \newif\ifhavenum + +\ifacrohint % Common macros for \ifacro and \ifhint to create \pdflink's +\def\pdfnote#1.{\setbox0=\hbox{\toksA={#1.}\toksB={}\maketoks}\the\toksA} +\def\firstsecno#1.{\setbox0=\hbox{\toksA={#1.}\toksB={}% + \def\makenote{\addtokens\toksB{\the\toksC}\def\makenote{\let\space\empty + \toksC={}\toksD={}}\makenote}\maketoks}} +\def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks} +\def\poptoks#1#2|ENDTOKS|{\let\first=#1\toksD={#1}\toksA={#2}% + \ifcat\noexpand\first0\countB=`#1\else\countB=0\fi} +\def\maketoks{\expandafter\poptoks\the\toksA|ENDTOKS|% + \let\next=\maketoks % continue processing by default + \ifnum\countB>`9 \countB=0 \fi + \ifnum\countB<`0 + \ifhavenum\makenote\fi + \ifx\first.\let\next=\maketoksdone % fullstop + \else \addtokens\toksB{\the\toksD} \ifx\first,\addtokens\toksB{\space}\fi + \fi + \else \addtokens\toksC{\the\toksD}\global\havenumtrue + \fi + \next +} +\def\makenote{\addtokens\toksB + {\noexpand\pdflink{\the\toksC}}\toksC={}\global\havenumfalse} +\def\maketoksdone{\edef\st{\global\noexpand\toksA={\the\toksB}}\st} +\fi % End of common pdf/hint macros \ifacro % The following are general pdf macros \def\thewidth{\the\wd0 \space} @@ -34,13 +79,14 @@ \def\thedepth{\the\dp\strutbox\space} \ifpdflua \ifx\pdfannotlink\undefined\let\pdfannotlink\pdfstartlink\fi% for pdfTeX 0.14 - \def\pdflink#1#2{\hbox{\pdfannotlink height \theheight depth \thedepth + \def\pdflink#1{\hbox{\pdfannotlink height \theheight depth \thedepth attr{/Border [0 0 0]} goto num #1 \Blue #1\Black\pdfendlink}} % changed 3.69 -\else\def\pdflink#1#2{\setbox0=\hbox{\special{pdf: bc [ \pdflinkcolor ]}{#1}% +\else\def\pdflink#1{\setbox0=\hbox{\special{pdf: bc [ \pdflinkcolor ]}{#1}% \special{pdf: ec}}\special{pdf: ann width \thewidth height \theheight - depth \thedepth << /Type /Annot /Subtype /Link - /Border [0 0 0] /A << /S /GoTo /D (#2) >> >>}\box0\relax}\fi -\def\sanitizecommand#1#2{\addtokens\usersanitizer + depth \thedepth << /Type /Annot /Subtype /Link /Border [0 0 0] + /A << /S /GoTo /D (\romannumeral#1) >> >>}\box0\relax} +\fi +\def\sanitizecommand#1#2{\addtokens\sanitizer {\noexpand\dosanitizecommand\noexpand#1{#2}}} \def\dosanitizecommand#1#2{\ifx\nxt#1\addF{#2}\fi} @@ -49,7 +95,8 @@ \catcode`\[=12 \catcode`\]=12 \catcode`\{=1 \catcode`\}=2 \catcode`\~=12 \def\tildechar{~} \catcode`\~=13 \catcode`\|=0 |catcode`|\=12 |def|bschar{\} |catcode`|\=0 \catcode`\|=12 -\def\makeoutlinetoks{\Tnumfalse\afterassignment\makeolproctok\let\nxt= } +\def\makeoutlinetoks{\toksF={}\Tnumfalse + \afterassignment\makeolproctok\let\nxt= } \def\makeolnexttok{\afterassignment\makeolproctok\let\nxt= } \def\makeolgobbletok{\afterassignment\makeolnexttok\let\nxt= } \def\addF#1{\addtokens\toksF{#1}\tokprocessedtrue} @@ -64,7 +111,7 @@ \else\if\noexpand\nxt\relax % we have a control sequence; is it one we know? \ifx\nxt~\addF\space \else\ifx\nxt\onespace\addF\space - \else\the\usersanitizer + \else\the\sanitizer \iftokprocessed\else\makeolproctokctli \iftokprocessed\else\makeolproctokctlii \iftokprocessed\else\makeolproctokctliii % if not recognised, skip it @@ -141,48 +188,19 @@ \fi\fi\fi\fi\fi } \def\outlinedone{\edef\outlinest{\global\noexpand\toksE={\the\toksF}}% - \outlinest\let\outlinedone=\relax} + \outlinest\let\outlinedone=\relax\outlinedone} \fi % End of pdf macros \ifhint -% The following uses HINT primitives to implement: +% The following top level macros use HINT primitives to implement: % \HINThome to mark the position of the home page % \HINTlabel to attach a label to the top of a section % \HINTlink to link a section number to the section label % \HINTcontents to produce an 'outline' item -% These are the top level HINT macros that are used in this file -% No HINT primitives are used directly. \def\HINThome{\HINTdest name {HINT.home}% \HINToutline goto name {HINT.home} depth 1 {Table of Contents}} \def\HINTlabel{{\let\*=\empty\HINTdest num \secstar top}} -\def\HINTlink#1#2{\HINTstartlink goto num #1 {#1}\HINTendlink}% #2 not used ??? +\def\HINTlink#1{\HINTstartlink goto num #1 {#1}\HINTendlink} \def\HINTcontents#1#2#3{\HINToutline goto num #3 depth #2 {#1}} \let\pdflink=\HINTlink \fi % End of HINT macros - -% Common macros for \ifacro and \ifhint -\ifacrohint -\def\pdfnote#1.{\setbox0=\hbox{\toksA={#1.}\toksB={}\maketoks}\the\toksA} -\def\firstsecno#1.{\setbox0=\hbox{\toksA={#1.}\toksB={}% - \def\makenote{\addtokens\toksB{\the\toksC}\def\makenote{\toksD={} - \toksC={}\let\space\empty}\makenote}\maketoks}} -\def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks} -\def\poptoks#1#2|ENDTOKS|{\let\first=#1\toksD={#1}% - \ifcat\noexpand\first0\countB=`#1\else\countB=0\fi\toksA={#2}} -\def\maketoks{\expandafter\poptoks\the\toksA|ENDTOKS|% - \ifnum\countB>`9 \countB=0 \fi - \ifnum\countB<`0 - \ifnum0=\countC\else\makenote\fi - \ifx\first.\let\next=\maketoksdone\else - \let\next=\maketoks - \addtokens\toksB{\the\toksD} - \ifx\first,\addtokens\toksB{\space}\fi - \fi - \else \addtokens\toksC{\the\toksD}\global\countC=1\let\next=\maketoks - \fi - \next -} -\def\makenote{\addtokens\toksB - {\noexpand\pdflink{\the\toksC}{\romannumeral\the\toksC}}\toksC={}\global\countC=0} -\def\maketoksdone{\edef\st{\global\noexpand\toksA={\the\toksB}}\st} -\fi % End of common macros diff --git a/Build/source/texk/web2c/cwebdir/cwebmac.tex b/Build/source/texk/web2c/cwebdir/cwebmac.tex index f9891daf1bc..a46dc4b782f 100644 --- a/Build/source/texk/web2c/cwebdir/cwebmac.tex +++ b/Build/source/texk/web2c/cwebdir/cwebmac.tex @@ -1,12 +1,9 @@ % standard macros for CWEB listings (in addition to plain.tex) -% Version 4.12 --- July 2024 +% Version 4.12 --- August 2024 \ifx\renewenvironment\undefined\else\endinput\fi % LaTeX will use other macros \xdef\fmtversion{\fmtversion+CWEB4.12} \chardef\cwebversion=4 \chardef\cwebrevision=12 -\let\:=\. % preserve a way to get the dot accent - % (all other accents will still work as usual) - \parskip 0pt % no stretch between paragraphs \parindent 1em % for paragraphs and for the first line of C text @@ -28,9 +25,10 @@ \def\CPLUSPLUS/{{\mc C\PP\spacefactor1000}} \def\Cee{\CEE/} % for backward compatibility \def\Cpp{\CPLUSPLUS/} % for backward compatibility -\def\9#1{} - % with this definition of \9 you can say @:sort key}{TeX code@> - % to alphabetize an index entry by the sort key but format with the TeX code +\def\9#1{} % with this definition of \9 you can say @:sort key}{TeX code@> + % to alphabetize an index entry by the sort key but format with the TeX code +\let\:=\. % preserve a way to get the dot accent + % (all other accents will still work as usual) \def\\#1{\leavevmode\hbox{\it#1\/\kern.05em}} % italic type for identifiers \def\|#1{\leavevmode\hbox{$#1$}} % one-letter identifiers look better this way @@ -114,11 +112,9 @@ \def\?{\mathrel?} \def\,{\relax\ifmmode\mskip\thinmuskip\else\thinspace\fi} -\newtoks\toksA \newtoks\toksB \newtoks\toksC \newtoks\toksD -\newtoks\toksE \newtoks\toksF \newtoks\usersanitizer +\newtoks\toksA \newtoks\toksE \newcount\countA \countA=0 \newcount\countB \countB=0 -\newcount\countC \countC=0 \newcount\countD \countD=0 -\newif\iftokprocessed \newif\ifTnum \newif\ifinstr +\newcount\countNOS \countNOS=0 {\def\\{\global\let\spacechar= }\\ } % Here we decide the output format, depending on the TeX engine in use: @@ -135,7 +131,7 @@ \def\Black{\pdfliteral{0 g 0 G}} % use rgb colors for direct PDF output too \def\Blue{\pdfliteral{\pdflinkcolor\space rg \pdflinkcolor\space RG}} \fi -\ifacrohint \input cwebacromac \fi % load hypertext macros +\input cwebacromac % load hypertext macros \def\pdfURL#1#2{\ifpdf \ifpdflua\pdfannotlink height \theheight depth \thedepth attr {/Border [0 0 0]} user { /Type /Annot /Subtype /Link /A << /S /URI /URI (#2) >>}\Blue #1\Black \pdfendlink % changed in 3.69 @@ -187,7 +183,7 @@ \outer\def\M#1{\MN{#1}\ifon\vfil\penalty-100\vfilneg % beginning of section \vskip\intersecskip\startsection\ignorespaces} \outer\def\N#1#2#3.{% beginning of starred section - \ifacro{\toksF={}\makeoutlinetoks#3\outlinedone\outlinedone}\fi + \ifacro{\makeoutlinetoks#3\outlinedone}\fi \gdepth=#1\gtitle={#3}\MN{#2}% \ifon\ifnum#1<\secpagedepth \vfil\eject % force page break if depth is small \else\vfil\penalty-100\vfilneg\vskip\intersecskip\fi\fi @@ -241,9 +237,8 @@ \def\oct{\hbox{$^\circ$\kern-.1em\it\aftergroup\?\aftergroup}} % CWEB style \def\hex{\hbox{$^{\scriptscriptstyle\#}$\tt\aftergroup}} % CWEB style \def\bin{\hbox{$^{\scriptscriptstyle b}$\tt\aftergroup}} % new in CWEB 4.3 -\def\vb#1{\leavevmode\hbox{\kern2pt\vrule\vtop{\vbox{\hrule - \hbox{\strut\kern2pt\.{#1}\kern2pt}} - \hrule}\vrule\kern2pt}} % verbatim string +\def\vb#1{\leavevmode\hbox{\kern2pt\vrule\vtop{\vbox{\hrule\hbox{\strut + \kern2pt\.{#1}\kern2pt}}\hrule}\vrule\kern2pt}} % verbatim string \def\p#1{\cdot 2^{#1}} % power of two (hex exponent) \def\onmaybe{\let\ifon=\maybe} \let\maybe=\iftrue @@ -318,9 +313,7 @@ \vsize=\pageheight \advance\vsize by -\ht\sbox % the remaining height \hsize=.5\pagewidth \advance\hsize by -10pt % column width for the index (20pt between cols) - \ifhint\else - \parfillskip 0pt plus .6\hsize % try to avoid almost empty lines - \fi + \ifhint\else\parfillskip 0pt plus .6\hsize\fi % avoid almost empty lines \def\lr{L} % this tells whether the left or right column is next \output{\if L\lr\global\setbox\lbox=\page \gdef\lr{R} \else\normaloutput{\vbox to\pageheight{\box\sbox\vss @@ -329,9 +322,9 @@ \message{Index:} \parskip 0pt plus .5pt \outer\def\I##1, ##2.{\par\hangindent2em\noindent##1:\kern1em - \ifacrohint\pdfnote##2.\else##2\fi.} % index entry - \def\[##1]{$\underline{##1}$} % underlined index item - \rm \rightskip0pt plus 2.5em \tolerance 10000 \let\*=\lapstar + \scan##2!.} % index entry + \def\[##1]{$\underline{\scan##1!}$\scan} % underlined index item + \rm \rightskip0pt plus 2.5em \tolerance 10000 \hyphenpenalty 10000 \parindent0pt \readindex} \def\fin{\par\vfill\eject % this is done when we are ending the index @@ -354,23 +347,21 @@ \ifacro \def\outsecname{Names of the sections} \let\Xpdf\X % \ifpdflua \makebookmarks \pdfdest name {NOS} fitb % in versions < 3.68 \ifpdflua \pdfdest name {NOS} fith % changed in version 3.69 - \pdfoutline goto name {NOS} count -\the\countD {\outsecname} - \def\X##1:##2\X{\Xpdf##1:##2\X \firstsecno##1.% - {\toksF={}\makeoutlinetoks##2\outlinedone\outlinedone}% - \pdfoutline goto num \the\toksA \expandafter{\the\toksE}} + \pdfoutline goto name {NOS} count -\the\countNOS {\outsecname} \else \special{pdf: outline -1 << /Title (\outsecname) - /Dest [ @thispage /FitH @ypos ] >>} - \def\X##1:##2\X{\Xpdf##1:##2\X \firstsecno##1.% - {\toksF={}\makeoutlinetoks##2\outlinedone\outlinedone}% - \special{pdf: outline 0 << /Title (\the\toksE) - /A << /S /GoTo /D (\romannumeral\the\toksA) >> >>}} - \fi\fi + /Dest [ @thispage /FitH @ypos ] >>}\fi + \def\X##1:##2\X{\Xpdf##1:##2\X \firstsecno##1.% + {\makeoutlinetoks##2\outlinedone}% + \ifpdflua \pdfoutline goto num \the\toksA \expandafter{\the\toksE} + \else \special{pdf: outline 0 << /Title (\the\toksE) + /A << /S /GoTo /D (\romannumeral\the\toksA) >> >>}\fi} + \fi % \ifacro \readsections} \def\makebookmarks{\let\ZZ=\writebookmarkline \readcontents\relax} \def\countsections{\message{Number of named sections:} - {\def\I{\global\advance\countD by 1}\def\X##1\X{\relax} + {\def\I{\global\advance\countNOS by 1}\def\X##1\X{\relax} \def\Q##1.{\relax}\def\Qs##1.{\relax}\def\U##1.{\relax}\def\Us##1.{\relax} - \readsections\relax}\message{\the\countD}} + \readsections\relax}\message{\the\countNOS}} \def\expnumber#1{\expandafter\ifx\csname#1\endcsname\relax 0% \else \csname#1\endcsname \fi} % Petr Olsak's macros from texinfo.tex \def\advancenumber#1{\countA=\expnumber{#1}\relax \advance\countA by1 @@ -396,9 +387,9 @@ \line{\consetup{#2}#1 \rm\leaders\hbox to .5em{.\hfil}\hfil \ \ifhint - \HINTlink{#3}{\romannumeral#3}% No page numbers in HINT + \HINTlink{#3}% No page numbers in HINT \HINTcontents{#1}{#2}{#3}% - \else\ifacro\pdflink{#3}{\romannumeral#3}\else#3\fi + \else\ifacro\pdflink{#3}\else#3\fi \hbox to3em{\hss#4}\fi}} \def\consetup#1{\ifcase#1 \bf % depth -1 (@**) \or % depth 0 (@*) diff --git a/Build/source/texk/web2c/cwebdir/cwebman-w2c.ch b/Build/source/texk/web2c/cwebdir/cwebman-w2c.ch index 9e7bceb20e2..ad478b81019 100644 --- a/Build/source/texk/web2c/cwebdir/cwebman-w2c.ch +++ b/Build/source/texk/web2c/cwebdir/cwebman-w2c.ch @@ -94,17 +94,17 @@ @z @x l.34 -\def\runninghead{{\ninett CWEB} USER MANUAL (VERSION 4.11)} +\def\runninghead{{\ninett CWEB} USER MANUAL (VERSION 4.12)} @y \def\Kpathsea/{{\mc KPATHSEA\spacefactor1000}} -\def\runninghead{{\ninett CWEB} USER MANUAL (Version 4.11 [\TeX~Live])} +\def\runninghead{{\ninett CWEB} USER MANUAL (Version 4.12 [\TeX~Live])} @z @x l.48 -\vskip 18pt\centerline{(Version 4.11 --- December 2023)} +\vskip 18pt\centerline{(Version 4.12 --- August 2024)} @y -\vskip 18pt\centerline{(Version 4.11 --- December 2023)% -\footnote*{This document describes the extended \.{CWEB} (Version 4.11 [\TeX~Live]).}} +\vskip 18pt\centerline{(Version 4.12 --- August 2024)% +\footnote*{This document describes the extended \.{CWEB} (Version 4.12 [\TeX~Live]).}} @z @x l.79 @@ -347,9 +347,9 @@ And here's what the same excerpt looks like when typeset. @z @x l.1613 - \.{ { }\\vskip 15pt \\centerline\{(Version 4.11)\}{ }\\vfill\}}\cr}$$ + \.{ { }\\vskip 15pt \\centerline\{(Version 4.12)\}{ }\\vfill\}}\cr}$$ @y - \.{ { }\\vskip 15pt \\centerline\{(Version 4.11)\}{ }\\vfill\}}\cr}$$ + \.{ { }\\vskip 15pt \\centerline\{(Version 4.12)\}{ }\\vfill\}}\cr}$$ @z @x l.1728 diff --git a/Build/source/texk/web2c/cwebdir/cwebman.tex b/Build/source/texk/web2c/cwebdir/cwebman.tex index c4bc660df3b..25654a53172 100644 --- a/Build/source/texk/web2c/cwebdir/cwebman.tex +++ b/Build/source/texk/web2c/cwebdir/cwebman.tex @@ -31,7 +31,7 @@ \def\lheader{\mainfont\the\pageno\hfill\sc\runninghead\hfill} \def\rheader{\hfill\sc\runninghead\hfill\mainfont\the\pageno} -\def\runninghead{{\ninett CWEB} USER MANUAL (VERSION 4.11)} +\def\runninghead{{\ninett CWEB} USER MANUAL (VERSION 4.12)} % This verbatim mode assumes that ! marks are !! in the text being copied. \def\verbatim{\begingroup @@ -45,7 +45,7 @@ \null\vfill \centerline{\titlefont The {\ttitlefont CWEB} System of Structured Documentation} -\vskip 18pt\centerline{(Version 4.11 --- December 2023)} +\vskip 18pt\centerline{(Version 4.12 --- August 2024)} \vskip 24pt \centerline{\authorfont Donald E. Knuth and Silvio Levy} \vfill @@ -1527,9 +1527,9 @@ features needed by the output of \.{CWEAVE}. \printmacs{\empty} \vskip6pt \baselineskip12pt -\noindent And here comes the file that extends \.{cwebmac.tex} in order to -support the ``hypertext'' features needed by the enhanced \TEX/ engines when -processing the output of \.{CWEAVE}. +\noindent And here comes the file \.{cwebacromac.tex} that extends +\.{cwebmac.tex} in order to support the ``hypertext'' features needed +by the enhanced \TEX/ engines when processing the output of \.{CWEAVE}. \vskip6pt \baselineskip9pt \printmacs{acro} @@ -1610,7 +1610,7 @@ $$\lpile{\.{\\def\\topofcontents\{\\null\\vfill}\cr \.{ { }\\titlefalse \% include headline on the contents page}\cr \.{ { }\\def\\rheader\{\\mainfont The \{\\tt CWEAVE\}{ }processor\\hfil\}}\cr \.{ { }\\centerline\{\\titlefont The \{\\ttitlefont CWEAVE\}{ }processor\}}\cr - \.{ { }\\vskip 15pt \\centerline\{(Version 4.11)\}{ }\\vfill\}}\cr}$$ + \.{ { }\\vskip 15pt \\centerline\{(Version 4.12)\}{ }\\vfill\}}\cr}$$ Redefining \.{\\rheader}, which is the headline for right-hand pages, suffices in this case to put the desired information at the top of the contents page. diff --git a/Build/source/texk/web2c/cwebdir/po/cweb-tl.pot b/Build/source/texk/web2c/cwebdir/po/cweb-tl.pot index 19c348da56a..9ba80115a93 100644 --- a/Build/source/texk/web2c/cwebdir/po/cweb-tl.pot +++ b/Build/source/texk/web2c/cwebdir/po/cweb-tl.pot @@ -6,9 +6,9 @@ #, fuzzy msgid "" msgstr "" -"Project-Id-Version: CWEBbin 2023\n" +"Project-Id-Version: CWEBbin 2024\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-12-02 13:08+0100\n" +"POT-Creation-Date: 2024-08-12 13:10+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" @@ -30,15 +30,15 @@ msgid "%s: Need one to three file arguments.\n" msgstr "" #: ctang-texlive.ch:39 -msgid "This is CTANGLE, Version 4.11" +msgid "This is CTANGLE, Version 4.12" msgstr "" #: ctwill-texlive.ch:39 -msgid "This is CTWILL, Version 4.11" +msgid "This is CTWILL, Version 4.12" msgstr "" #: cweav-texlive.ch:39 -msgid "This is CWEAVE, Version 4.11" +msgid "This is CWEAVE, Version 4.12" msgstr "" #: comm-texlive.ch:512 diff --git a/Build/source/texk/web2c/cwebdir/po/cweb.pot b/Build/source/texk/web2c/cwebdir/po/cweb.pot index 8db3c5a3168..f451101937c 100644 --- a/Build/source/texk/web2c/cwebdir/po/cweb.pot +++ b/Build/source/texk/web2c/cwebdir/po/cweb.pot @@ -523,15 +523,15 @@ msgid "Sorting:" msgstr "" #: ctang-i18n.ch:17 -msgid "This is CTANGLE (Version 4.11 [CWEBbin 2023])" +msgid "This is CTANGLE (Version 4.12 [CWEBbin 2024])" msgstr "" #: cweav-twill.ch:61 -msgid "This is CTWILL (Version 4.11 [CWEBbin 2023])" +msgid "This is CTWILL (Version 4.12 [CWEBbin 2024])" msgstr "" #: cweav-i18n.ch:17 cweav-twill.ch:42 -msgid "This is CWEAVE (Version 4.11 [CWEBbin 2023])" +msgid "This is CWEAVE (Version 4.12 [CWEBbin 2024])" msgstr "" #: cweav-i18n.ch:301 cweav-i18n.ch:309 diff --git a/Build/source/texk/web2c/cwebdir/po/de/cweb-tl.po b/Build/source/texk/web2c/cwebdir/po/de/cweb-tl.po index 7d875bdd177..b1412747cbf 100644 --- a/Build/source/texk/web2c/cwebdir/po/de/cweb-tl.po +++ b/Build/source/texk/web2c/cwebdir/po/de/cweb-tl.po @@ -1,14 +1,14 @@ # International version of CWEB (CWEBbin, TeXLive). -# Copyright (C) 2023 Andreas Scherer et al. +# Copyright (C) 2024 Andreas Scherer et al. # This file is distributed under the same license as the CWEB package. # Andreas Scherer <https://ascherer.github.io>. # msgid "" msgstr "" -"Project-Id-Version: CWEBbin 2023\n" +"Project-Id-Version: CWEBbin 2024\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-12-02 13:10+0100\n" -"PO-Revision-Date: 2023-12-02 13:10+0100\n" +"POT-Creation-Date: 2024-08-12 13:10+0200\n" +"PO-Revision-Date: 2024-08-12 13:10+0200\n" "Last-Translator: Andreas Scherer <andreas_github@freenet.de>\n" "Language-Team: German\n" "Language: de\n" @@ -33,16 +33,16 @@ msgid "%s: Need one to three file arguments.\n" msgstr "%s: Benötige ein bis drei Dateiargumente.\n" #: ctang-texlive.ch:39 -msgid "This is CTANGLE, Version 4.11" -msgstr "Dies ist CTANGLE, Version 4.11" +msgid "This is CTANGLE, Version 4.12" +msgstr "Dies ist CTANGLE, Version 4.12" #: ctwill-texlive.ch:39 -msgid "This is CTWILL, Version 4.11" -msgstr "Dies ist CTWILL, Version 4.11" +msgid "This is CTWILL, Version 4.12" +msgstr "Dies ist CTWILL, Version 4.12" #: cweav-texlive.ch:39 -msgid "This is CWEAVE, Version 4.11" -msgstr "Dies ist CWEAVE, Version 4.11" +msgid "This is CWEAVE, Version 4.12" +msgstr "Dies ist CWEAVE, Version 4.12" #: comm-texlive.ch:512 #, c-format diff --git a/Build/source/texk/web2c/cwebdir/po/de/cweb.po b/Build/source/texk/web2c/cwebdir/po/de/cweb.po index f93952f9a06..0b459e1b01b 100644 --- a/Build/source/texk/web2c/cwebdir/po/de/cweb.po +++ b/Build/source/texk/web2c/cwebdir/po/de/cweb.po @@ -603,16 +603,16 @@ msgid "Sorting:" msgstr "Sortieren:" #: ctang-i18n.ch:17 -msgid "This is CTANGLE (Version 4.11 [CWEBbin 2023])" -msgstr "Dies ist CTANGLE (Version 4.11 [CWEBbin 2023])" +msgid "This is CTANGLE (Version 4.12 [CWEBbin 2024])" +msgstr "Dies ist CTANGLE (Version 4.12 [CWEBbin 2024])" #: cweav-twill.ch:61 -msgid "This is CTWILL (Version 4.11 [CWEBbin 2023])" -msgstr "Dies ist CTWILL (Version 4.11 [CWEBbin 2023])" +msgid "This is CTWILL (Version 4.12 [CWEBbin 2024])" +msgstr "Dies ist CTWILL (Version 4.12 [CWEBbin 2024])" #: cweav-i18n.ch:17 cweav-twill.ch:42 -msgid "This is CWEAVE (Version 4.11 [CWEBbin 2023])" -msgstr "Dies ist CWEAVE (Version 4.11 [CWEBbin 2023])" +msgid "This is CWEAVE (Version 4.12 [CWEBbin 2024])" +msgstr "Dies ist CWEAVE (Version 4.12 [CWEBbin 2024])" #: cweav-i18n.ch:301 cweav-i18n.ch:309 msgid "buffer" diff --git a/Build/source/texk/web2c/cwebdir/po/it/cweb.po b/Build/source/texk/web2c/cwebdir/po/it/cweb.po index a171f020d28..2cf95a994d3 100644 --- a/Build/source/texk/web2c/cwebdir/po/it/cweb.po +++ b/Build/source/texk/web2c/cwebdir/po/it/cweb.po @@ -1,14 +1,14 @@ # International version of CWEB (CWEBbin, TeXLive). -# Copyright (C) 2023 Andreas Scherer et al. +# Copyright (C) 2024 Andreas Scherer et al. # This file is distributed under the same license as the CWEB package. # Andreas Scherer <https://ascherer/github.io>. # msgid "" msgstr "" -"Project-Id-Version: CWEBbin 2023\n" +"Project-Id-Version: CWEBbin 2024\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-12-02 13:10+0100\n" -"PO-Revision-Date: 2023-12-02 13:10+0100\n" +"POT-Creation-Date: 2024-08-12 13:10+0200\n" +"PO-Revision-Date: 2024-08-12 13:10+0200\n" "Last-Translator: Andreas Scherer <andreas_github@freenet.de>\n" "Language-Team: Italian\n" "Language: it\n" @@ -598,16 +598,16 @@ msgid "Sorting:" msgstr "Ordinamento:" #: ctang-i18n.ch:17 -msgid "This is CTANGLE (Version 4.11 [CWEBbin 2023])" -msgstr "Questo è CTANGLE (Versione 4.11 [CWEBbin 2023])" +msgid "This is CTANGLE (Version 4.12 [CWEBbin 2024])" +msgstr "Questo è CTANGLE (Versione 4.12 [CWEBbin 2024])" #: cweav-i18n.ch:17 -msgid "This is CWEAVE (Version 4.11 [CWEBbin 2023])" -msgstr "Questo è CWEAVE (Versione 4.11 [CWEBbin 2023])" +msgid "This is CWEAVE (Version 4.12 [CWEBbin 2024])" +msgstr "Questo è CWEAVE (Versione 4.12 [CWEBbin 2024])" #: cweav-twill.ch:68 -msgid "This is CTWILL (Version 4.11 [CWEBbin 2023])" -msgstr "Questo è CTWILL (Versione 4.11 [CWEBbin 2023])" +msgid "This is CTWILL (Version 4.12 [CWEBbin 2024])" +msgstr "Questo è CTWILL (Versione 4.12 [CWEBbin 2024])" #: cweav-i18n.ch:301 cweav-i18n.ch:309 msgid "buffer" diff --git a/Build/source/texk/web2c/cwebdir/prod-cweave.w b/Build/source/texk/web2c/cwebdir/prod-cweave.w index 6c75760fa2f..e7939716b72 100644 --- a/Build/source/texk/web2c/cwebdir/prod-cweave.w +++ b/Build/source/texk/web2c/cwebdir/prod-cweave.w @@ -2,7 +2,7 @@ % This program by Silvio Levy and Donald E. Knuth % is based on a program by Knuth. % It is distributed WITHOUT ANY WARRANTY, express or implied. -% Version 4.11 --- December 2023 +% Version 4.12 --- August 2024 % @ Here is a table of all the productions. Each production that combines two or more consecutive scraps implicitly inserts a {\tt \$} diff --git a/Build/source/texk/web2c/cwebdir/prod-twill.w b/Build/source/texk/web2c/cwebdir/prod-twill.w index 63ebdb4893d..c1b67aedc90 100644 --- a/Build/source/texk/web2c/cwebdir/prod-twill.w +++ b/Build/source/texk/web2c/cwebdir/prod-twill.w @@ -2,7 +2,7 @@ % This program by Silvio Levy and Donald E. Knuth % is based on a program by Knuth. % It is distributed WITHOUT ANY WARRANTY, express or implied. -% Version 4.11 --- December 2023 +% Version 4.12 --- August 2024 % @ Here is a table of all the productions. Each production that combines two or more consecutive scraps implicitly inserts a {\tt \$} diff --git a/Build/source/texk/web2c/cwebdir/prod.w b/Build/source/texk/web2c/cwebdir/prod.w index b0da3ddce5f..851c5ffe234 100644 --- a/Build/source/texk/web2c/cwebdir/prod.w +++ b/Build/source/texk/web2c/cwebdir/prod.w @@ -2,7 +2,7 @@ % This program by Silvio Levy and Donald E. Knuth % is based on a program by Knuth. % It is distributed WITHOUT ANY WARRANTY, express or implied. -% Version 4.11 --- December 2023 +% Version 4.12 --- August 2024 % @ Here is a table of all the productions. Each production that combines two or more consecutive scraps implicitly inserts a {\tt \$} diff --git a/Build/source/texk/web2c/cwebdir/texinputs/dcwebmac.tex b/Build/source/texk/web2c/cwebdir/texinputs/dcwebmac.tex index 09e222d3c3a..dd8b43bea93 100644 --- a/Build/source/texk/web2c/cwebdir/texinputs/dcwebmac.tex +++ b/Build/source/texk/web2c/cwebdir/texinputs/dcwebmac.tex @@ -28,7 +28,7 @@ % Version 3.64 [p21] --- Andreas Scherer, Octobre 2005 % Version 3.64 [p22] --- Andreas Scherer, March 2016 % Version 4.9 --- Andreas Scherer, June 2022 -% Version 4.12 --- Andreas Scherer, May 2024 +% Version 4.12 --- Andreas Scherer, August 2024 \ifx\undefined\botofcontents\input cwebmac.tex\fi diff --git a/Build/source/texk/web2c/cwebdir/texinputs/fcwebmac.tex b/Build/source/texk/web2c/cwebdir/texinputs/fcwebmac.tex index 82d67edb1a5..ff0c0b30bd9 100644 --- a/Build/source/texk/web2c/cwebdir/texinputs/fcwebmac.tex +++ b/Build/source/texk/web2c/cwebdir/texinputs/fcwebmac.tex @@ -28,7 +28,7 @@ % Version 3.64 [p21] --- Andreas Scherer, October 2005 % Version 3.64 [p22] --- Andreas Scherer, March 2016 % Version 4.9 --- Andreas Scherer, June 2022 -% Version 4.12 --- Andreas Scherer, May 2024 +% Version 4.12 --- Andreas Scherer, August 2024 % french translations --- Denis Roegel, 18 September 1994 diff --git a/Build/source/texk/web2c/cwebdir/texinputs/icwebmac.tex b/Build/source/texk/web2c/cwebdir/texinputs/icwebmac.tex index 5f2e7d3a45a..cbb5696984e 100644 --- a/Build/source/texk/web2c/cwebdir/texinputs/icwebmac.tex +++ b/Build/source/texk/web2c/cwebdir/texinputs/icwebmac.tex @@ -28,7 +28,7 @@ % Version 3.64 [p21] --- Andreas Scherer, October 2005 % Version 3.64 [p22] --- Andreas Scherer, March 2016 % Version 4.9 --- Andreas Scherer, June 2022 -% Version 4.12 --- Andreas Scherer, May 2024 +% Version 4.12 --- Andreas Scherer, August 2024 \ifx\undefined\botofcontents\input cwebmac.tex\fi @@ -73,7 +73,7 @@ \def\inx{\par\vskip6pt plus 1fil % we are beginning the index \def\page{\box255 } \normalbottom \write\cont{} % ensure that the contents file isn't empty - \write\cont{\catcode `\noexpand\@=12\relax} % \makeatother + \write\cont{\catcode `\noexpand\@=12\relax} % \makeatother \closeout\cont % the contents information has been fully gathered \output{\ifpagesaved\normaloutput{\box\sbox}\lheader\rheader\fi \global\setbox\sbox=\page \global\pagesavedtrue \mark{\topmark}} @@ -82,9 +82,7 @@ \vsize=\pageheight \advance\vsize by -\ht\sbox % the remaining height \hsize=.5\pagewidth \advance\hsize by -10pt % column width for the index (20pt between cols) - \ifhint\else - \parfillskip 0pt plus .6\hsize % try to avoid almost empty lines - \fi + \ifhint\else\parfillskip 0pt plus .6\hsize\fi % avoid almost empty lines \def\lr{L} % this tells whether the left or right column is next \output{\if L\lr\global\setbox\lbox=\page \gdef\lr{R} \else\normaloutput{\vbox to\pageheight{\box\sbox\vss @@ -93,9 +91,9 @@ \message{Indice Analitico:} \parskip 0pt plus .5pt \outer\def\I##1, ##2.{\par\hangindent2em\noindent##1:\kern1em - \ifacrohint\pdfnote##2.\else##2\fi.} % index entry - \def\[##1]{$\underline{##1}$} % underlined index item - \rm \rightskip0pt plus 2.5em \tolerance 10000 \let\*=\lapstar + \scan##2!.} % index entry + \def\[##1]{$\underline{\scan##1!}$\scan} % underlined index item + \rm \rightskip0pt plus 2.5em \tolerance 10000 \hyphenpenalty 10000 \parindent0pt \readindex} \def\fin{\par\vfill\eject % this is done when we are ending the index diff --git a/Build/source/texk/web2c/cwebdir/texinputs/pdfctproofmac.tex b/Build/source/texk/web2c/cwebdir/texinputs/pdfctproofmac.tex index f41ad4d6334..4079d5f704b 100644 --- a/Build/source/texk/web2c/cwebdir/texinputs/pdfctproofmac.tex +++ b/Build/source/texk/web2c/cwebdir/texinputs/pdfctproofmac.tex @@ -1,5 +1,5 @@ % standard macros for CWEB listings (in addition to plain.tex) -% Version 4.12 --- May 2024 +% Version 4.12 --- August 2024 % modified for proofs in CTWILL % modified for PDF/HINT output with 'tex "\let\pdf+' or '{hi|lua|pdf|xe}tex' % This file is not copyrighted and can be used freely. @@ -14,15 +14,6 @@ \font\ninerm=cmr9 \let\mc=\ninerm % medium caps -\def\CEE/{{\mc C\spacefactor1000}} -\def\UNIX/{{\mc U\kern-.05emNIX\spacefactor1000}} -\def\TEX/{\TeX} -\def\CPLUSPLUS/{{\mc C\PP\spacefactor1000}} -\def\Cee{\CEE/} % for backward compatibility -\def\Cpp{\CPLUSPLUS/} % for backward compatibility -\def\9#1{} - % with this definition of \9 you can say @:sort key}{TeX code@> - % to alphabetize an index entry by the sort key but format with the TeX code \font\eightrm=cmr8 \let\sc=\eightrm % small caps (NOT a caps-and-small-caps font) \let\mainfont=\tenrm @@ -33,6 +24,16 @@ \font\tentex=cmtex10 % TeX extended character set (used in strings) \fontdimen7\tentex=0pt % no double space after sentences +\def\CEE/{{\mc C\spacefactor1000}} +\def\UNIX/{{\mc U\kern-.05emNIX\spacefactor1000}} +\def\TEX/{\TeX} +\def\CPLUSPLUS/{{\mc C\PP\spacefactor1000}} +\def\Cee{\CEE/} % for backward compatibility +\def\Cpp{\CPLUSPLUS/} % for backward compatibility +\def\9#1{} + % with this definition of \9 you can say @:sort key}{TeX code@> + % to alphabetize an index entry by the sort key but format with the TeX code + \def\\#1{\leavevmode\hbox{\it#1\/\kern.05em}} % italic type for identifiers \def\|#1{\leavevmode\hbox{$#1$}} % one-letter identifiers look better this way \def\{\leavevmode\hbox{\bf @@ -116,11 +117,9 @@ \def\note#1#2.{\Y\noindent{\hangindent2em% \baselineskip10pt\eightrm#1~\ifacrohint{\pdfnote#2.}\else#2\fi.\par}} -\newtoks\toksA \newtoks\toksB \newtoks\toksC \newtoks\toksD -\newtoks\toksE \newtoks\toksF \newtoks\usersanitizer +\newtoks\toksA \newtoks\toksE \newcount\countA \countA=0 \newcount\countB \countB=0 -\newcount\countC \countC=0 \newcount\countD \countD=0 -\newif\iftokprocessed \newif\ifTnum \newif\ifinstr +\newcount\countNOS \countNOS=0 {\def\\{\global\let\spacechar= }\\ } % Here we decide the output format, depending on the TeX engine in use: @@ -137,7 +136,7 @@ \def\Black{\pdfliteral{0 g 0 G}} % use rgb colors for direct PDF output too \def\Blue{\pdfliteral{\pdflinkcolor\space rg \pdflinkcolor\space RG}} \fi -\ifacrohint \input cwebacromac \fi % load hypertext macros +\input cwebacromac % load hypertext macros \def\pdfURL#1#2{\ifpdf \ifpdflua\pdfannotlink height \theheight depth \thedepth attr {/Border [0 0 0]} user { /Type /Annot /Subtype /Link /A << /S /URI /URI (#2) >>}\Blue #1\Black \pdfendlink % changed in 3.69 @@ -187,7 +186,7 @@ \outer\def\M#1{\MN{#1}\ifon\vfil\penalty-100\vfilneg % beginning of section \vskip\intersecskip\startsection\ignorespaces} \outer\def\N#1#2#3.{% beginning of starred section - \ifpdf{\toksF={}\makeoutlinetoks#3\outlinedone\outlinedone}\fi + \ifpdf{\makeoutlinetoks#3\outlinedone}\fi \gdepth=#1\gtitle={#3}\MN{#2}% \ifon\ifnum#1<\secpagedepth \vfil\eject % force page break if depth is small \else\vfil\penalty-100\vfilneg\vskip\intersecskip\fi\fi @@ -327,18 +326,16 @@ \newbox\lbox % lefthand column in the index \def\inx{\par\vskip6pt plus 1fil % we are beginning the index \write\cont{} % ensure that the contents file isn't empty - \write\cont{\catcode `\noexpand\@=12\relax} % \makeatother + \write\cont{\catcode `\noexpand\@=12\relax} % \makeatother \closeout\cont % the contents information has been fully gathered \output{\ifpagesaved\normaloutput{\box\sbox}\lheader\rheader\fi - \global\setbox\sbox=\page \global\pagesavedtrue} + \global\setbox\sbox=\page \global\pagesavedtrue \mark{\topmark}} \pagesavedfalse \eject % eject the page-so-far and predecessors \setbox\sbox\vbox{\unvbox\sbox} % take it out of its box \vsize=\pageheight \advance\vsize by -\ht\sbox % the remaining height \hsize=.5\pagewidth \advance\hsize by -10pt % column width for the index (20pt between cols) - \ifhint\else - \parfillskip 0pt plus .6\hsize % try to avoid almost empty lines - \fi + \ifhint\else\parfillskip 0pt plus .6\hsize\fi % avoid almost empty lines \def\lr{L} % this tells whether the left or right column is next \output{\if L\lr\global\setbox\lbox=\page \gdef\lr{R} \else\normaloutput{\vbox to\pageheight{\box\sbox\vss @@ -347,9 +344,9 @@ \message{Index:} \parskip 0pt plus .5pt \outer\def\I##1, ##2.{\par\hangindent2em\noindent##1:\kern1em - \ifacrohint\pdfnote##2.\else##2\fi.} % index entry - \def\[##1]{$\underline{##1}$} % underlined index item - \rm \rightskip0pt plus 2.5em \tolerance 10000 \let\*=\lapstar + \scan##2!.} % index entry + \def\[##1]{$\underline{\scan##1!}$\scan} % underlined index item + \rm \rightskip0pt plus 2.5em \tolerance 10000 \hyphenpenalty 10000 \parindent0pt \readindex} \def\fin{\par\vfill\eject % this is done when we are ending the index @@ -370,23 +367,21 @@ \def\I{\par\hangindent 2em}\let\*=* \ifpdf \def\outsecname{Names of the sections} \let\Xpdf\X \ifpdflua \pdfdest name {NOS} fith - \pdfoutline goto name {NOS} count -\the\countD {\outsecname} - \def\X##1:##2\X{\Xpdf##1:##2\X \firstsecno##1.% - {\toksF={}\makeoutlinetoks##2\outlinedone\outlinedone}% - \pdfoutline goto num \the\toksA \expandafter{\the\toksE}} + \pdfoutline goto name {NOS} count -\the\countNOS {\outsecname} \else \special{pdf: outline -1 << /Title (\outsecname) - /Dest [ @thispage /FitH @ypos ] >>} - \def\X##1:##2\X{\Xpdf##1:##2\X \firstsecno##1.% - {\toksF={}\makeoutlinetoks##2\outlinedone\outlinedone}% - \special{pdf: outline 0 << /Title (\the\toksE) - /A << /S /GoTo /D (\romannumeral\the\toksA) >> >>}} - \fi\fi + /Dest [ @thispage /FitH @ypos ] >>}\fi + \def\X##1:##2\X{\Xpdf##1:##2\X \firstsecno##1.% + {\makeoutlinetoks##2\outlinedone}% + \ifpdflua \pdfoutline goto num \the\toksA \expandafter{\the\toksE} + \else \special{pdf: outline 0 << /Title (\the\toksE) + /A << /S /GoTo /D (\romannumeral\the\toksA) >> >>}\fi} + \fi % \ifacro \readsections} \def\makebookmarks{\let\ZZ=\writebookmarkline \readcontents\relax} \def\countsections{\message{Number of named sections:} - {\def\I{\global\advance\countD by 1}\def\X##1\X{\relax} + {\def\I{\global\advance\countNOS by 1}\def\X##1\X{\relax} \def\Q##1.{\relax}\def\Qs##1.{\relax}\def\U##1.{\relax}\def\Us##1.{\relax} - \readsections\relax}\message{\the\countD}} + \readsections\relax}\message{\the\countNOS}} \def\expnumber#1{\expandafter\ifx\csname#1\endcsname\relax 0% \else \csname#1\endcsname \fi} % Petr Olsak's macros from texinfo.tex \def\advancenumber#1{\countA=\expnumber{#1}\relax \advance\countA by1 @@ -412,17 +407,14 @@ \line{\consetup{#2}#1 \rm\leaders\hbox to .5em{.\hfil}\hfil \ \ifhint - \HINTlink{#3}{\romannumeral#3}% No page numbers in HINT + \HINTlink{#3}% No page numbers in HINT \HINTcontents{#1}{#2}{#3}% - \else\ifacro\pdflink{#3}{\romannumeral#3}\else#3\fi + \else\ifacro\pdflink{#3}\else#3\fi \hbox to3em{\hss#4}\fi}} \def\consetup#1{\ifcase#1 \bf % depth -1 (@**) \or % depth 0 (@*) \or \hskip2em % depth 1 (@*1) - \or \hskip4em % depth 2 (@*2) - \or \hskip6em % depth 3 (@*3) - \or \hskip8em % depth 4 (@*4) - \or \hskip10em % depth 5 (@*5) + \or \hskip4em \or \hskip6em \or \hskip8em \or \hskip10em % depth 2,3,4,5 \else \hskip12em \fi} % depth 6 or more \def\noinx{\let\inx=\end} % no indexes or table of contents \def\nosecs{\let\FIN=\fin \def\fin{\let\parfillskip=\end \FIN}} diff --git a/Build/source/texk/web2c/cwebdir/texinputs/pdfctwimac.tex b/Build/source/texk/web2c/cwebdir/texinputs/pdfctwimac.tex index 2a0499949e6..d1278cac3bf 100644 --- a/Build/source/texk/web2c/cwebdir/texinputs/pdfctwimac.tex +++ b/Build/source/texk/web2c/cwebdir/texinputs/pdfctwimac.tex @@ -1,5 +1,5 @@ % standard macros for CWEB listings (in addition to plain.tex) -% Version 4.12 --- May 2024 +% Version 4.12 --- August 2024 % modified for pages produced by CTWILL % further modified for page size of the MMIXware book % modified for PDF output with 'tex "\let\pdf+' or '{lua|pdf|xe}tex' @@ -26,15 +26,6 @@ \font\ninerm=cmr9 \let\mc=\ninerm % medium caps -\def\CEE/{{\mc C\spacefactor1000}} -\def\UNIX/{{\mc U\kern-.05emNIX\spacefactor1000}} -\def\TEX/{\TeX} -\def\CPLUSPLUS/{{\mc C\PP\spacefactor1000}} -\def\Cee{\CEE/} % for backward compatibility -\def\Cpp{\CPLUSPLUS/} % for backward compatibility -\def\9#1{} - % with this definition of \9 you can say @:sort key}{TeX code@> - % to alphabetize an index entry by the sort key but format with the TeX code \font\eightrm=cmr8 \font\sixrm=cmr6 \font\ninei=cmmi9 @@ -146,6 +137,16 @@ \font\titlefont=cmr7 scaled\magstep4 % title on the contents page \font\ttitlefont=cmtt10 scaled\magstep2 % typewriter type in title +\def\CEE/{{\mc C\spacefactor1000}} +\def\UNIX/{{\mc U\kern-.05emNIX\spacefactor1000}} +\def\TEX/{\TeX} +\def\CPLUSPLUS/{{\mc C\PP\spacefactor1000}} +\def\Cee{\CEE/} % for backward compatibility +\def\Cpp{\CPLUSPLUS/} % for backward compatibility +\def\9#1{} + % with this definition of \9 you can say @:sort key}{TeX code@> + % to alphabetize an index entry by the sort key but format with the TeX code + \def\\#1{\leavevmode\hbox{\it#1\/\kern.05em}} % italic type for identifiers \def\|#1{\leavevmode\hbox{$#1$}} % one-letter identifiers look better this way \def\{\leavevmode\hbox{\bf @@ -228,11 +229,9 @@ \Y\noindent{\hangindent2\em\baselineskip10pt% \eightrm#1~\ifacro{\pdfnote#2.}\else#2\fi.\par}} -\newtoks\toksA \newtoks\toksB \newtoks\toksC \newtoks\toksD -\newtoks\toksE \newtoks\toksF \newtoks\usersanitizer +\newtoks\toksA \newtoks\toksE \newcount\countA \countA=0 \newcount\countB \countB=0 -\newcount\countC \countC=0 \newcount\countD \countD=0 -\newif\iftokprocessed \newif\ifTnum \newif\ifinstr +\newcount\countNOS \countNOS=0 {\def\\{\global\let\spacechar= }\\ } % Here we decide the output format, depending on the TeX engine in use: @@ -253,7 +252,7 @@ \def\Black{\pdfliteral{0 g 0 G}} % use rgb colors for direct PDF output too \def\Blue{\pdfliteral{\pdflinkcolor\space rg \pdflinkcolor\space RG}} \fi -\ifacrohint \input cwebacromac \fi % load hypertext macros +\input cwebacromac % load hypertext macros \def\lapstar{\rlap{*}} \def\stsec{\tenpoint\rightskip=0pt % get out of C mode (cf. \B) @@ -301,7 +300,7 @@ \outer\def\NN{\ifvoid\partialpage\leftfalse \else\ifdim\ht\partialpage<\pageht \lefttrue\else\leftfalse\fi\fi\NNN} \outer\def\NNN#1#2#3.{% beginning of starred section - \ifacro{\toksF={}\makeoutlinetoks#3\outlinedone\outlinedone}\fi + \ifacro{\makeoutlinetoks#3\outlinedone}\fi \gdepth=#1\gtitle={#3}\def\secno{#2}\xdef\secstar{#2} \ifleft \flushout \gdef\rlhead{\let\i=I\uppercase{\ignorespaces#3}} % running left headline @@ -334,7 +333,7 @@ \def\T#1{\leavevmode % octal, hex or decimal constant \hbox{$\def\?{\kern.2em}%$% \let\ \, % C++ digit separator becomes a little white space - \def\$##1{\egroup_{\rm##1}\bgroup}% suffix to constant + \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}$}}%$% \def\U{\note{This code is used in section}} % xref for use of a section @@ -543,22 +542,20 @@ \def\outsecname{Names of the sections} \ifpdflua \makebookmarks \countsections \pdfdest name {NOS} fith - \pdfoutline goto name {NOS} count -\the\countD {\outsecname} - \def\X##1:##2\X{\firstsecno##1.% - {\toksF={}\makeoutlinetoks##2\outlinedone\outlinedone}% - \pdfoutline goto num \the\toksA \expandafter{\the\toksE}} + \pdfoutline goto name {NOS} count -\the\countNOS {\outsecname} \else \special{pdf: outline -1 << /Title (\outsecname) - /Dest [ @thispage /FitH @ypos ] >>} - \def\X##1:##2\X{\firstsecno##1.% - {\toksF={}\makeoutlinetoks##2\outlinedone\outlinedone}% - \special{pdf: outline 0 << /Title (\the\toksE) - /A << /S /GoTo /D (\romannumeral\the\toksA) >> >>}} - \fi \readsections \fi} + /Dest [ @thispage /FitH @ypos ] >>}\fi + \def\X##1:##2\X{\firstsecno##1.% + {\makeoutlinetoks##2\outlinedone}% + \ifpdflua \pdfoutline goto num \the\toksA \expandafter{\the\toksE} + \else \special{pdf: outline 0 << /Title (\the\toksE) + /A << /S /GoTo /D (\romannumeral\the\toksA) >> >>}\fi} + \readsections \fi} \def\makebookmarks{\let\ZZ=\writebookmarkline \readcontents\relax} \def\countsections{\message{Number of named sections:} - {\def\I{\global\advance\countD by 1}\def\X##1\X{\relax} + {\def\I{\global\advance\countNOS by 1}\def\X##1\X{\relax} \def\Q##1.{\relax}\def\Qs##1.{\relax}\def\U##1.{\relax}\def\Us##1.{\relax} - \readsections\relax}\message{\the\countD}} + \readsections\relax}\message{\the\countNOS}} \def\writebookmarkline#1#2#3#4#5{{% \let\(=\let \let\)=\let \let\[=\let \let\]=\let \let\/=\let \pdfoutline goto num #3 count -\expnumber{chunk#2.#3} {#5}}} @@ -579,7 +576,7 @@ %\def\contentsline#1#2#3#4#5{\ifnum#2=0 \smallbreak\fi %\line{\consetup{#2}#1 %\rm\leaders\hbox to .5em{.\hfil}\hfil - %\ \ifacro\pdflink{#3}{\romannumeral#3}\else#3\fi\hbox to3em{\hss#4}}} + %\ \ifacro\pdflink{#3}\else#3\fi\hbox to3em{\hss#4}}} %\def\consetup#1{\ifcase#1 \bf % depth -1 (@**) %\or % depth 0 (@*) %\or \hskip2em % depth 1 (@*1) diff --git a/Build/source/texk/web2c/gftopk.ch b/Build/source/texk/web2c/gftopk.ch index 1afa9119ef7..62af338db8e 100644 --- a/Build/source/texk/web2c/gftopk.ch +++ b/Build/source/texk/web2c/gftopk.ch @@ -82,7 +82,7 @@ begin @<Labels...@>=final_end; @y @ This module is deleted, because it is only useful for -a non-local goto, which we can't use in C. +a non-local |goto|\unskip, which we can't use in C. @z @x [6] Dynamic allocation of |row| array. diff --git a/Build/source/texk/web2c/gftype.ch b/Build/source/texk/web2c/gftype.ch index 49d7bf6b3e0..2e51550240a 100644 --- a/Build/source/texk/web2c/gftype.ch +++ b/Build/source/texk/web2c/gftype.ch @@ -78,7 +78,7 @@ begin @<Labels...@>=final_end; @y @ This module is deleted, because it is only useful for -a non-local goto, which we can't use in C. +a non-local |goto|\unskip, which we can't use in C. Instead, we define parameters settable at runtime. diff --git a/Build/source/texk/web2c/hitexdir/hitex.w b/Build/source/texk/web2c/hitexdir/hitex.w index 7351c672e2d..cad0605c82f 100644 --- a/Build/source/texk/web2c/hitexdir/hitex.w +++ b/Build/source/texk/web2c/hitexdir/hitex.w @@ -224,7 +224,6 @@ @s alpha_file int @s byte_file int @s word_file int -@s int8_t int @s uint8_t int @s int16_t int @s uint16_t int @@ -250,13 +249,9 @@ @s line normal @s to do -\def\contentspagenumber{0} -\def\tocpages{3} % HiTeX has a long ToC -\pageno=\contentspagenumber \advance \pageno by \tocpages - @* Introduction. This is Hi\TeX, a program derived from \TeX, extending its capabilities -using \eTeX\ and \Prote, and adding functions common to other engines from +using \eTeX and \Prote, and adding functions common to other engines from the \TeX\ Live distribution. Hi\TeX\ writes output files in the \HINT\ file format. Like \TeX, it is a document compiler intended to produce typesetting of high @@ -380,7 +375,7 @@ known as `\Prote'. @d Prote_banner "This is Prote, Version " Prote_version_string /*printed when \Prote\ starts*/ @# -@d banner "This is HiTeX, Version 3.141592653"@| +@d banner "This is HiTeX, Version 3.141592653" eTeX_version_string"-"HINT_VERSION_STRING" "TL_VERSION /*printed when \TeX\ starts*/ @@ -436,7 +431,7 @@ portions of the program. The program starts with inserting header files and occassionaly a function must be placed before declaring \TeX's macros, because the function -uses identifiers that \TeX\ will declare as macros. +uses identifiers that \TeX will declare as macros. @p @<Header files and function declarations@>@; @h @@ -447,7 +442,7 @@ enum {@+@<Constants in the outer block@>@+}; @# static void initialize(void) /*this procedure gets things started properly*/ {@+@<Local variables for initialization@>@; - @<Initialize whatever \TeX\ might access@>@; + @<Initialize whatever \TeX\ might access@>; } @# @<Basic printing procedures@>@; @<Error handling procedures@>@; @@ -634,7 +629,7 @@ because some fussy \PASCAL\ compilers will complain about redundant labels. @d negate(A) A=-A /*change the sign of a variable*/ @d loop @+while (true) @+ /*repeat over and over until a |goto| happens*/ @f loop else - /*\.{WEB}'s |loop| acts like `\ignorespaces|while true do|\unskip'*/ + /*\.{WEB}'s |else| acts like `\ignorespaces|while true do|\unskip'*/ @d do_nothing /*empty statement*/ @d empty 0 /*symbolic name for a null constant*/ @@ -1334,7 +1329,7 @@ while (j < str_start[s+1]) result=true; not_found: return result; } -@#@<Declare \Prote\ procedures for strings@>@; +@t\4@>@<Declare \Prote\ procedures for strings@>@; @ The initial values of |str_pool|, |str_start|, |pool_ptr|, and |str_ptr| are computed by the \.{INITEX} program, based in part @@ -1425,8 +1420,6 @@ declaration. @<Forward declarations@>= static int s_no(const char *str); -@ (Empty section to keep numbering intact.) - @* On-line and off-line printing. Messages that are sent to a user's terminal and to the transcript-log file are produced by several `|print|' procedures. These procedures will @@ -1498,10 +1491,8 @@ for terminal output, and it is possible to adhere to those conventions by changing |wterm|, |wterm_ln|, and |wterm_cr| in this section. @^system dependencies@> -@s sizeof x - @<Basic printing procedures@>= -#define @[put(F)@] @[fwrite(&((F).d),sizeof((F).d),1,(F).f)@] +#define @[put(F)@] @[fwrite(&((F).d)@],@[sizeof((F).d),1,(F).f)@]@; #define @[get(F)@] @[fread(&((F).d),sizeof((F).d),1,(F).f)@] #define @[pascal_close(F)@] @[fclose((F).f)@] @@ -1708,8 +1699,8 @@ if (n < 0) } } } -do {dig[k]=n%10;n=n/10;incr(k); -} while (!(n==0)); +@/do@+{dig[k]=n%10;n=n/10;incr(k); +}@+ while (!(n==0)); print_the_digs(k); } @@ -1727,8 +1718,8 @@ print_char('0'+(n%10)); /*prints a positive integer in hexadecimal form*/ {@+int k; /*index to current digit; we assume that $0\le n<16^{22}$*/ k=0;print_char('"'); -do {dig[k]=n%16;n=n/16;incr(k); -} while (!(n==0)); +@/do@+{dig[k]=n%16;n=n/16;incr(k); +}@+ while (!(n==0)); print_the_digs(k); } @@ -1804,7 +1795,7 @@ $$\vbox{\halign{#\hfil\cr |help3("This is the first line of my offer to help.")|\cr |("This is the second line. I'm trying to")|\cr |("explain the best way for you to proceed.");|\cr -|error();|\cr}}$$ +|error;|\cr}}$$ A two-line help message would be given using |help2|, etc.; these informal helps should use simple vocabulary that complements the words used in the official error message that was printed. (Outside the U.S.A., the help @@ -2010,6 +2001,7 @@ case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': if (deletions_allowed) @<Delete \(c)|c-"0"| tokens and |goto resume|@>@;@+break; +@t\4\4@>@; #ifdef @!DEBUG case 'D': {@+debug_help();goto resume;@+} #endif @@ -2102,8 +2094,8 @@ show_context();goto resume; else{@+if (help_ptr==0) help2("Sorry, I don't know how to help in this situation.",@/ @t\kern1em@>"Maybe you should try asking a human?"); - do {decr(help_ptr);print(help_line[help_ptr]);print_ln(); - } while (!(help_ptr==0)); + @/do@+{decr(help_ptr);print(help_line[help_ptr]);print_ln(); + }@+ while (!(help_ptr==0)); } help4("Sorry, I already gave what help I could...",@/ "Maybe you should try asking a human?",@/ @@ -2272,7 +2264,7 @@ positions from the right end of a binary computer word. @<Types...@>= typedef int scaled; /*this type is used for scaled integers*/ -typedef uint32_t nonnegative_integer; /*$0\le x<2^{31}$*/ +typedef int32_t nonnegative_integer; /*$0\le x<2^{31}$*/ typedef int8_t small_number; /*this type is self-explanatory*/ @ The following function is used to create a scaled integer from a given decimal @@ -2310,9 +2302,9 @@ if (s < 0) print_int(s/unity); /*print the integer part*/ print_char('.'); s=10*(s%unity)+5;delta=10; -do {if (delta > unity) s=s+0100000-50000; /*round the last digit*/ +@/do@+{if (delta > unity) s=s+0100000-50000; /*round the last digit*/ print_char('0'+(s/unity));s=10*(s%unity);delta=delta*10; -} while (!(s <= delta)); +}@+ while (!(s <= delta)); } @ Physical sizes that a \TeX\ user specifies for portions of documents are @@ -2429,7 +2421,7 @@ computing at most 1095 distinct values, but that is plenty. @d inf_bad 10000 /*infinitely bad value*/ -@p @<Declare \Prote\ arithmetic routines@>@; +@p @<Declare \Prote\ arithmetic routines@>@/ static halfword badness(scaled @!t, scaled @!s) /*compute badness, given |t >= 0|*/ {@+int r; /*approximation to $\alpha t/s$, where $\alpha^3\approx 100\cdot2^{18}$*/ @@ -2464,16 +2456,12 @@ routines cited there must be modified to allow negative glue ratios.) @d unfix(A) ((double)(A)) /*convert from |glue_ratio| to type |double|*/ @d fix(A) ((glue_ratio)(A)) /*convert from |double| to type |glue_ratio|*/ @d float_constant(A) ((double)(A)) /*convert |int| constant to |double|*/ -@# -@d perror e@&r@&r@&o@&r /* this is a \.{CWEB} coding trick: */ -@f perror error /* `\&{perror}' will be equivalent to `\&{error}' */ -@f error x /* but `|error|' will not be treated as a reserved word */ @<Types...@>= #if __SIZEOF_FLOAT__==4 typedef float float32_t; #else -#perror @=float type must have size 4@> +#error @=float type must have size 4@> #endif typedef float @!glue_ratio; /*one-word representation of a glue expansion factor*/ @@ -2583,29 +2571,25 @@ typedef uint16_t quarterword; /*1/4 of a word*/ typedef int32_t halfword; /*1/2 of a word*/ typedef int8_t two_choices; /*used when there are two variants in a record*/ typedef int8_t four_choices; /*used when there are four variants in a record*/ -@# -typedef struct { +typedef struct { @;@/ halfword @!rh; union { halfword @!lh; struct { quarterword @!b0;quarterword @!b1;} ; };} two_halves; -@# -typedef struct { +typedef struct { @;@/ quarterword @!b0; quarterword @!b1; quarterword @!b2; quarterword @!b3; } four_quarters; -@# -typedef struct { +typedef struct { @;@/ union { int @!i; glue_ratio @!gr; two_halves @!hh; four_quarters @!qqqq; };} memory_word; -@# typedef struct {@+FILE *f;@+memory_word@,d;@+} word_file; @ When debugging, we may want to print a |memory_word| without knowing @@ -2788,11 +2772,11 @@ one-word nodes that starts at position |p|. {@+pointer @!q, @!r; /*list traversers*/ if (p!=null) {@+r=p; - do {q=r;r=link(r); + @/do@+{q=r;r=link(r); #ifdef @!STAT decr(dyn_used); #endif - } while (!(r==null)); /*now |q| is the last node on the list*/ + }@+ while (!(r==null)); /*now |q| is the last node on the list*/ link(q)=avail;avail=p; } } @@ -2837,11 +2821,11 @@ pointer @!q; /*the node physically after node |p|*/ int @!r; /*the newly allocated node, or a candidate for this honor*/ int @!t; /*temporary register*/ restart: p=rover; /*start at some free node in the ring*/ -do {@<Try to allocate within node |p| and its physical successors, and +@/do@+{@<Try to allocate within node |p| and its physical successors, and |goto found| if allocation was possible@>; @^inner loop@> p=rlink(p); /*move to the next node in the ring*/ -} while (!(p==rover)); /*repeat until the whole list has been traversed*/ +}@+ while (!(p==rover)); /*repeat until the whole list has been traversed*/ if (s==010000000000) {@+return max_halfword; } @@ -3334,7 +3318,7 @@ current \.{\\lineskip}. pointer @!q; /*the glue specification*/ p=get_node(small_node_size);type(p)=glue_node;subtype(p)=n+1; leader_ptr(p)=null;@/ -q=@[@<Current |mem| equivalent of glue parameter number |n|@>@]; +q=@<Current |mem| equivalent of glue parameter number |n|@>@t@>; glue_ptr(p)=q;incr(glue_ref_count(q)); return p; } @@ -3374,8 +3358,6 @@ kerns inserted from font information or math mode calculations) or |explicit| (for kerns inserted from non-math accents) or |mu_glue| (for kerns inserted from \.{\\mkern} specifications in math formulas). -@s explicit true - @d kern_node 11 /*|type| of a kern node*/ @d explicit 1 /*|subtype| of kern nodes from \.{\\kern} and \.{\\/}*/ @d acc_kern 2 /*|subtype| of kern nodes from accents*/ @@ -3591,7 +3573,7 @@ done1: @ @<Check variable-size...@>= p=rover;q=null;clobbered=false; -do {if ((p >= lo_mem_max)||(p < mem_min)) clobbered=true; +@/do@+{if ((p >= lo_mem_max)||(p < mem_min)) clobbered=true; else if ((rlink(p) >= lo_mem_max)||(rlink(p) < mem_min)) clobbered=true; else if (!(is_empty(p))||(node_size(p) < 2)||@| (p+node_size(p) > lo_mem_max)||@|(llink(rlink(p))!=p)) clobbered=true; @@ -3608,7 +3590,7 @@ for (q=p; q<=p+node_size(p)-1; q++) /*mark all locations free*/ is_free[q]=true; } q=p;p=rlink(p); -} while (!(p==rover)); +}@+ while (!(p==rover)); done2: @ @<Check flags...@>= @@ -3703,13 +3685,13 @@ while (p > mem_min) {@+if ((font(p) < font_base)||(font(p) > font_max)) print_char('*'); @.*\relax@> - else@<Print the font identifier for |font(p)|@>@; + else@<Print the font identifier for |font(p)|@>; print_char(' ');font_in_short_display=font(p); } print_ASCII(qo(character(p))); } } - else@<Print a short indication of the contents of node |p|@>@; + else@<Print a short indication of the contents of node |p|@>; p=link(p); } } @@ -3742,7 +3724,7 @@ its reference count, and one to print a rule dimension. {@+if (p > mem_end) print_esc("CLOBBERED."); else{@+if ((font(p) < font_base)||(font(p) > font_max)) print_char('*'); @.*\relax@> - else@<Print the font identifier for |font(p)|@>@; + else@<Print the font identifier for |font(p)|@>; print_char(' ');print_ASCII(qo(character(p))); } } @@ -3882,7 +3864,7 @@ else switch (type(p)) { case disc_node: @<Display discretionary |p|@>@;@+break; case mark_node: @<Display mark |p|@>@;@+break; case adjust_node: @<Display adjustment |p|@>@;@+break; - @/@t\4@>@<Cases of |show_node_list| that arise in mlists only@>@; + @t\4@>@<Cases of |show_node_list| that arise in mlists only@>@; default:print("Unknown node type!"); } @@ -4081,7 +4063,7 @@ specification is being withdrawn. } @p static void delete_glue_ref(pointer @!p) /*|p| points to a glue specification*/ -fast_delete_glue_ref(p)@; +fast_delete_glue_ref(p) static void delete_xdimen_ref(pointer @!p) /*|p| points to a xdimen specification*/ {@+if (p==null) return; if (xdimen_ref_count(p)==null) free_node(p, xdimen_node_size); @@ -4122,7 +4104,7 @@ while (p!=null) flush_node_list(post_break(p)); } @+break; case adjust_node: flush_node_list(adjust_ptr(p));@+break; - @/@t\4@>@<Cases of |flush_node_list| that arise in mlists only@>@; + @t\4@>@<Cases of |flush_node_list| that arise in mlists only@>@; default:confusion("flushing"); @:this can't happen flushing}{\quad flushing@> } @/ @@ -5022,7 +5004,7 @@ else switch (chr_code) { case every_vbox_loc: print_esc("everyvbox");@+break; case every_job_loc: print_esc("everyjob");@+break; case every_cr_loc: print_esc("everycr");@+break; - @/@t\4@>@<Cases of |assign_toks| for |print_cmd_chr|@>@; + @/@<Cases of |assign_toks| for |print_cmd_chr|@>@/ default:print_esc("errhelp"); } @+break; @@ -5350,7 +5332,7 @@ case right_hyphen_min_code: print_esc("righthyphenmin");@+break; case holding_inserts_code: print_esc("holdinginserts");@+break; case error_context_lines_code: print_esc("errorcontextlines");@+break; case tracing_stack_levels_code: print_esc("tracingstacklevels");@+break; -@/@t\4@>@<Cases for |print_param|@>@; +@/@<Cases for |print_param|@>@/ default:print("[unknown integer parameter!]"); } } @@ -5503,7 +5485,6 @@ defined by |SOURCE_DATE_EPOCH|. @^reference time@> @^system dependencies@> \TeX\ Live calls |tl_now| to obtain the current time as a |tm| structure. -@s tm int @p static void fix_date_and_time(void) {@+ struct tm *t=tl_now(); time=sys_time= t->tm_hour*60+t->tm_min;/*minutes since midnight*/ @@ -5707,9 +5688,8 @@ print_char('=');print_scaled(eqtb[n].sc);print("pt"); @ Here is a procedure that displays the contents of |eqtb[n]| symbolically. -@p @<Declare the procedure called |print_cmd_chr|@>@; +@p @t\4@>@<Declare the procedure called |print_cmd_chr|@>@;@/ #ifdef @!STAT -@+@t}\6\4\4{@> static void show_eqtb(pointer @!n) {@+if (n < active_base) print_char('?'); /*this can't happen*/ else if (n < glue_base) @<Show equivalent |n|, in region 1 or 2@>@; @@ -5834,10 +5814,10 @@ found: return p; @ @<Insert a new control...@>= {@+if (text(p) > 0) - {@+do {if (hash_is_full) overflow("hash size", hash_size); + {@+@/do@+{if (hash_is_full) overflow("hash size", hash_size); @:TeX capacity exceeded hash size}{\quad hash size@> decr(hash_used); - } while (!(text(hash_used)==0)); /*search for an empty location in |hash|*/ + }@+ while (!(text(hash_used)==0)); /*search for an empty location in |hash|*/ next(p)=hash_used;p=hash_used; } str_room(l);d=cur_length; @@ -6055,7 +6035,7 @@ case end_group: print_esc("endgroup");@+break; case ex_space: print_esc(" ");@+break; case expand_after: switch (chr_code) { case 0: print_esc("expandafter");@+break; -@/@t\4@>@<Cases of |expandafter| for |print_cmd_chr|@>@; +@/@<Cases of |expandafter| for |print_cmd_chr|@>@/ } @+break; /*there are no other cases*/ case halign: print_esc("halign");@+break; case hrule: print_esc("hrule");@+break; @@ -6075,17 +6055,17 @@ case no_expand: print_esc("noexpand");@+break; case non_script: print_esc("nonscript");@+break; case omit: print_esc("omit");@+break; case radical: print_esc("radical");@+break; -case read_to_cs: if (chr_code==0) print_esc("read"); - else @<Cases of |read| for |print_cmd_chr|@>;@+break; +case read_to_cs: if (chr_code==0) print_esc("read") + @<Cases of |read| for |print_cmd_chr|@>;@+break; case relax: print_esc("relax");@+break; case set_box: print_esc("setbox");@+break; case set_prev_graf: print_esc("prevgraf");@+break; case set_shape: switch (chr_code) { case par_shape_loc: print_esc("parshape");@+break; - @/@t\4@>@<Cases of |set_shape| for |print_cmd_chr|@>@; + @<Cases of |set_shape| for |print_cmd_chr|@>@;@/ } @+break; /*there are no other cases*/ -case the: if (chr_code==0) print_esc("the"); - else @<Cases of |the| for |print_cmd_chr|@>;@+break; +case the: if (chr_code==0) print_esc("the") + @<Cases of |the| for |print_cmd_chr|@>;@+break; case toks_register: @<Cases of |toks_register| for |print_cmd_chr|@>@;@+break; case vadjust: print_esc("vadjust");@+break; case valign: print_esc("valign");@+break; @@ -6106,7 +6086,7 @@ Meanwhile, this is a convenient place to catch up on something we were unable to do before the hash table was defined: @<Print the font identifier for |font(p)|@>= -printn_esc(font_id_text(font(p))); +printn_esc(font_id_text(font(p))) @* Saving and restoring equivalents. The nested structure provided by `$\.{\char'173}\ldots\.{\char'175}$' groups @@ -6291,7 +6271,7 @@ case shape_ref: {@+q=equiv_field(w); /*we need to free a \.{\\parshape} block*/ if (q!=null) free_node(q, info(q)+info(q)+1); } @+break; /*such a block is |2 n+1| words long, where |n==info(q)|*/ case box_ref: flush_node_list(equiv_field(w));@+break; -@/@t\4@>@<Cases for |eq_destroy|@>@; +@/@<Cases for |eq_destroy|@>@/ default:do_nothing; } } @@ -6329,7 +6309,7 @@ the call, since |eq_save| makes the necessary test. #ifdef @!STAT #define assign_trace(A, B) if (tracing_assigns > 0) restore_trace(A, B); #else -#define assign_trace(A, B) @[@] +#define assign_trace(A, B) #endif static void eq_define(pointer @!p, quarterword @!t, halfword @!e) @@ -6834,7 +6814,7 @@ case endv: print("end of alignment template");@+break; case spacer: chr_cmd("blank space ")@;@+break; case letter: chr_cmd("the letter ")@;@+break; case other_char: chr_cmd("the character ")@;@+break; -@/@t\4@>@<Cases of |print_cmd_chr| for symbolic printing of primitives@>@; +@t\4@>@<Cases of |print_cmd_chr| for symbolic printing of primitives@>@/ default:print("[unknown command code!]"); } } @@ -7572,7 +7552,7 @@ actions. in_open=0;open_parens=0;max_buf_stack=0; grp_stack[0]=0;if_stack[0]=null; param_ptr=0;max_param_stack=0; -first=buf_size;do {buffer[first]=0;decr(first);} while (!(first==0)); +first=buf_size;@/do@+{buffer[first]=0;decr(first);}@+ while (!(first==0)); scanner_status=normal;warning_index=null;first=1; state=new_line;start=1;index=0;line=0;name=0; force_eof=false; @@ -7783,7 +7763,7 @@ and set |state:=mid_line|@>@;@+break; any_state_plus(sup_mark): @<If this |sup_mark| starts an expanded character like~\.{\^\^A} or~\.{\^\^df}, then |goto reswitch|, otherwise set |state:=mid_line|@>@;@+break; any_state_plus(invalid_char): @<Decry the invalid character and |goto restart|@>@; -@/@t\4@>@<Handle situations involving spaces, braces, changes of state@>@; +@t\4@>@<Handle situations involving spaces, braces, changes of state@>@; default:do_nothing; } @@ -7942,8 +7922,8 @@ the buffer left two or three places. } @ @<Scan ahead in the buffer...@>= -{@+do {cur_chr=buffer[k];cat=cat_code(cur_chr);incr(k); -} while (!((cat!=letter)||(k > limit))); +{@+@/do@+{cur_chr=buffer[k];cat=cat_code(cur_chr);incr(k); +}@+ while (!((cat!=letter)||(k > limit))); @<If an expanded...@>; if (cat!=letter) decr(k); /*now |k| points to first nonletter*/ @@ -8188,7 +8168,7 @@ case top_bot_mark: @<Insert the \(a)appropriate mark text into the scanner@>@;@+ case expand_after: switch (cur_chr) { case 0: @<Expand the token after the next token@>@;@+break; case 1: @<Negate a boolean conditional and |goto reswitch|@>@;@+break; -@/@t\4@>@<Cases for |expandafter|@>@; +@/@<Cases for |expandafter|@>@/ } @+break; /*there are no other cases*/ case no_expand: @<Suppress expansion of the next token@>@;@+break; case cs_name: @<Manufacture a control sequence name@>@;@+break; @@ -8252,9 +8232,9 @@ the variables |p| and |q| are reserved for token-list building. @ @<Manufacture a control...@>= {@+r=get_avail();p=r; /*head of the list of characters*/ incr(incsname_state); -do {get_x_token(); +@/do@+{get_x_token(); if (cur_cs==0) store_new_token(cur_tok); -} while (!(cur_cs!=0)); +}@+ while (!(cur_cs!=0)); if (cur_cmd!=end_cs_name) @<Complain about missing \.{\\endcsname}@>; decr(incsname_state); @<Look up the characters of list |r| in the hash table, and set |cur_cs|@>; @@ -8312,15 +8292,15 @@ primitive("endinput", input, 1);@/ @!@:end\_input\_}{\.{\\endinput} primitive@> @ @<Cases of |print_cmd_chr|...@>= -case input: if (chr_code==0) print_esc("input"); - else @<Cases of |input| for |print_cmd_chr|@>@; +case input: if (chr_code==0) print_esc("input") + @/@<Cases of |input| for |print_cmd_chr|@>;@/ else print_esc("endinput");@+break; @ @<Initiate or terminate input...@>= -if (cur_chr==1) force_eof=true; -else @<Cases for |input|@>@; +if (cur_chr==1) force_eof=true +@/@<Cases for |input|@>;@/ else if (name_in_progress) insert_relax(); -else start_input(); +else start_input() @ Sometimes the expansion looks too far ahead, so we want to insert a harmless \.{\\relax} into the user's input. @@ -8530,7 +8510,7 @@ a string that will delimit the next parameter. {@+scanner_status=matching;unbalance=0; long_state=eq_type(cur_cs); if (long_state >= outer_call) long_state=long_state-2; -do {link(temp_head)=null; +@/do@+{link(temp_head)=null; if ((info(r) > match_token+255)||(info(r) < match_token)) s=null; else{@+match_chr=info(r)-match_token;s=link(r);r=s; p=temp_head;m=0; @@ -8538,7 +8518,7 @@ else{@+match_chr=info(r)-match_token;s=link(r);r=s; @<Scan a parameter until its delimiter string has been found; or, if |s=null|, simply scan the delimiter string@>;@/ /*now |info(r)| is a token whose command code is either |match| or |end_match|*/ -} while (!(info(r)==end_match_token)); +}@+ while (!(info(r)==end_match_token)); } @ If |info(r)| is a |match| or |end_match| command, it cannot be equal to @@ -8638,7 +8618,7 @@ the rules. if (s!=r) if (s==null) @<Report an improper use of the macro and abort@>@; else{@+t=s; - do {store_new_token(info(t));incr(m);u=link(t);v=s; + @/do@+{store_new_token(info(t));incr(m);u=link(t);v=s; loop@+{@+if (u==r) if (cur_tok!=info(v)) goto done; else{@+r=link(v);goto resume; @@ -8647,7 +8627,7 @@ if (s!=r) u=link(u);v=link(v); } done: t=link(t); - } while (!(t==r)); + }@+ while (!(t==r)); r=s; /*at this point, no tokens are recently matched*/ } @@ -8739,7 +8719,8 @@ if (cur_cmd!=left_brace) } @ @<Get the next non-blank non-relax non-call token@>= -do get_x_token(); while (!((cur_cmd!=spacer)&&(cur_cmd!=relax))) +@/do@+{get_x_token(); +}@+ while (!((cur_cmd!=spacer)&&(cur_cmd!=relax))) @ The |scan_optional_equals| routine looks for an optional `\.=' sign preceded by optional spaces; `\.{\\relax}' is not ignored here. @@ -8750,7 +8731,8 @@ if (cur_tok!=other_token+'=') back_input(); } @ @<Get the next non-blank non-call token@>= -do get_x_token(); while (!(cur_cmd!=spacer)) +@/do@+{get_x_token(); +}@+ while (!(cur_cmd!=spacer)) @ In case you are getting bored, here is a slightly less trivial routine: Given a string of lowercase letters, like `\.{pt}' or `\.{plus}' or @@ -8809,9 +8791,9 @@ have to declare |scan_int| as a |forward| procedure. A few other procedures are also declared at this point. @p static void scan_int(void); /*scans an integer value*/ -@#@<Declare procedures that scan restricted classes of integers@>@; -@<Declare \eTeX\ procedures for scanning@>@; -@<Declare procedures that scan font-related stuff@>@; +@t\4\4@>@<Declare procedures that scan restricted classes of integers@>@; +@t\4\4@>@<Declare \eTeX\ procedures for scanning@>@; +@t\4\4@>@<Declare procedures that scan font-related stuff@>@; @ \TeX\ doesn't know exactly what to expect when |scan_something_internal| begins. For example, an integer or dimension or glue value could occur @@ -9009,9 +8991,9 @@ primitive("badness", last_item, badness_code); @ @<Cases of |print_cmd_chr|...@>= case set_aux: if (chr_code==vmode) print_esc("prevdepth"); @+else print_esc("spacefactor");@+break; -case set_page_int: if (chr_code==0) print_esc("deadcycles"); -else @<Cases of |set_page_int| for |print_cmd_chr|@>@; -else print_esc("insertpenalties");@+break; +case set_page_int: if (chr_code==0) print_esc("deadcycles") +@/@<Cases of |set_page_int| for |print_cmd_chr|@>;@/ +@+else print_esc("insertpenalties");@+break; case set_box_dimen: if (chr_code==width_offset) print_esc("wd"); else if (chr_code==height_offset) print_esc("ht"); else print_esc("dp");@+break; @@ -9020,7 +9002,7 @@ case last_item: switch (chr_code) { case dimen_val: print_esc("lastkern");@+break; case glue_val: print_esc("lastskip");@+break; case input_line_no_code: print_esc("inputlineno");@+break; - @/@t\4@>@<Cases of |last_item| for |print_cmd_chr|@>@; + @/@<Cases of |last_item| for |print_cmd_chr|@>@/ default:print_esc("badness"); } @+break; @@ -9042,8 +9024,8 @@ else if (m==vmode) else scanned_result(space_factor, int_val) @ @<Fetch the |dead_cycles| or the |insert_penalties|@>= -{@+if (m==0) cur_val=dead_cycles; -else @<Cases for `Fetch the |dead_cycles| or the |insert_penalties|'@>@; +{@+if (m==0) cur_val=dead_cycles +@/@<Cases for `Fetch the |dead_cycles| or the |insert_penalties|'@>;@/ else cur_val=insert_penalties; cur_val_level=int_val; } @@ -9094,14 +9076,14 @@ else if (m >= input_line_no_code) if (m >= eTeX_glue) @<Process an expression and |return|@>@; else if (m >= eTeX_dim) {@+switch (m) { - @/@t\4@>@<Cases for fetching a dimension value@>@; + @/@<Cases for fetching a dimension value@>@/ } /*there are no other cases*/ cur_val_level=dimen_val; } else{@+switch (m) { case input_line_no_code: cur_val=line;@+break; case badness_code: cur_val=last_badness;@+break; - @/@t\4@>@<Cases for fetching an integer value@>@; + @/@<Cases for fetching an integer value@>@/ } /*there are no other cases*/ cur_val_level=int_val; } @@ -9326,11 +9308,11 @@ if (negative) negate(cur_val); @ @<Get the next non-blank non-sign token...@>= negative=false; -do {@<Get the next non-blank non-call token@>; +@/do@+{@<Get the next non-blank non-call token@>; if (cur_tok==other_token+'-') {@+negative=!negative;cur_tok=other_token+'+'; } -} while (!(cur_tok!=other_token+'+')); +}@+ while (!(cur_tok!=other_token+'+')) @ A space is ignored after an alphabetic character constant, so that such constants behave like numeric ones. @@ -9451,7 +9433,7 @@ int @!f; /*numerator of a fraction whose denominator is $2^{16}$*/ f=0;arith_error=false;cur_order=normal;negative=false; cur_hfactor=cur_vfactor=0; if (!shortcut) - {@+@<Get the next non-blank non-sign...@>@; + {@+@<Get the next non-blank non-sign...@>; if ((cur_cmd >= min_internal)&&(cur_cmd <= max_internal)) @<Fetch an internal dimension and |goto attach_sign|, or fetch an internal integer@>@; @@ -9690,7 +9672,7 @@ most of the work has already been done. bool negative; /*should the answer be negated?*/ pointer @!q; /*new glue specification*/ bool @!mu; /*does |level==mu_val|?*/ -mu=(level==mu_val);@<Get the next non-blank non-sign...@>@; +mu=(level==mu_val);@<Get the next non-blank non-sign...@>; if ((cur_cmd >= min_internal)&&(cur_cmd <= max_internal)) {@+scan_something_internal(level, negative); if (cur_val_level >= glue_val) @@ -9870,7 +9852,7 @@ case convert: switch (chr_code) { case font_name_code: print_esc("fontname");@+break; case job_name_code: print_esc("jobname");@+break; case eTeX_revision_code: print_esc("eTeXrevision");@+break; - @/@t\4@>@<Cases of |convert| for |print_cmd_chr|@>@; + @/@<Cases of |convert| for |print_cmd_chr|@>@/ } @+break; @ The procedure |conv_toks| uses |str_toks| to insert the token list @@ -9901,7 +9883,7 @@ case string_code: case meaning_code: {@+save_scanner_status=scanner_status; case font_name_code: scan_font_ident();@+break; case job_name_code: if (job_name==0) open_log_file();@+break; case eTeX_revision_code: do_nothing;@+break; -@/@t\4@>@<Cases of `Scan the argument for command |c|'@>@; +@/@<Cases of `Scan the argument for command |c|'@>@/ } /*there are no other cases*/ @ @<Print the result of command |c|@>= @@ -9919,7 +9901,7 @@ case font_name_code: {@+printn(font_name[cur_val]); } @+break; case eTeX_revision_code: print(eTeX_revision);@+break; case job_name_code: printn(job_name);@+break; -@/@t\4@>@<Cases of `Print the result of command |c|'@>@; +@/@<Cases of `Print the result of command |c|'@>@/ } /*there are no other cases*/ @ Now we can't postpone the difficulties any longer; we must bravely tackle @@ -10095,13 +10077,13 @@ p=def_ref; /*the reference count*/ store_new_token(end_match_token); if ((n < 0)||(n > 15)) m=16;@+else m=n; s=align_state;align_state=1000000; /*disable tab marks, etc.*/ -do @<Input and store tokens from the next line of the file@>@; -while (!(align_state==1000000)); +@/do@+{@<Input and store tokens from the next line of the file@>; +}@+ while (!(align_state==1000000)); cur_val=def_ref;scanner_status=normal;align_state=s; } @ @<Input and store tokens from the next line of the file@>= -{begin_file_reading();name=m+1; +begin_file_reading();name=m+1; if (read_open[m]==closed) @<Input for \.{\\read} from the terminal@>; else if (read_open[m]==just_open) @<Input the first line of |read_file[m]|@>@; else@<Input the next line of |read_file[m]|@>; @@ -10114,12 +10096,12 @@ loop@+{@+get_token(); if (cur_tok==0) goto done; /*|cur_cmd==cur_chr==0| will occur at the end of the line*/ if (align_state < 1000000) /*unmatched `\.\}' aborts the line*/ - {@+do get_token(); while (!(cur_tok==0)); + {@+@/do@+{get_token();}@+ while (!(cur_tok==0)); align_state=1000000;goto done; } store_new_token(cur_tok); } -done: end_file_reading();} +done: end_file_reading() @ Here we input on-line into the |buffer| array, prompting the user explicitly if |n >= 0|. The value of |n| is set negative so that additional prompts @@ -10237,7 +10219,7 @@ switch (chr_code%unless_code) { case if_true_code: print_esc("iftrue");@+break; case if_false_code: print_esc("iffalse");@+break; case if_case_code: print_esc("ifcase");@+break; - @/@t\4@>@<Cases of |if_test| for |print_cmd_chr|@>@; + @/@<Cases of |if_test| for |print_cmd_chr|@>@/ default:print_esc("if"); } } @+break; @@ -10418,7 +10400,7 @@ case if_eof_code: {@+scan_four_bit_int();b=(read_open[cur_val]==closed); } @+break; case if_true_code: b=true;@+break; case if_false_code: b=false;@+break; -@/@t\4@>@<Cases for |conditional|@>@; +@/@<Cases for |conditional|@>@/ case if_case_code: @<Select the appropriate case and |return| or |goto common_ending|@>; } /*there are no other cases*/ @@ -10795,7 +10777,6 @@ static str_number b_make_name_string(byte_file *f) {@+return make_name_string(); } #ifdef @!INIT -@+@t}\6\4\4{@> static str_number w_make_name_string(word_file *f) {@+return make_name_string(); } @@ -11549,8 +11530,8 @@ that do not do local optimization. @ Font parameters are referred to as |slant(f)|, |space(f)|, etc. -@d param_end(A) @[param_base[A]].sc@] -@d param(A) @[font_info[A+param_end@] +@d param_end(A) param_base[A]].sc +@d param(A) font_info[A+param_end @d slant param(slant_code) /*slant to the right, per unit distance upward*/ @d space param(space_code) /*normal space between words*/ @d space_stretch param(space_stretch_code) /*stretch between words*/ @@ -11954,11 +11935,11 @@ if (cur_val==fmem_ptr) } @ @<Increase the number of parameters...@>= -{@+do {if (fmem_ptr==font_mem_size) +{@+@/do@+{if (fmem_ptr==font_mem_size) overflow("font memory", font_mem_size); @:TeX capacity exceeded font memory}{\quad font memory@> font_info[fmem_ptr].sc=0;incr(fmem_ptr);incr(font_params[f]); -} while (!(n==font_params[f])); +}@+ while (!(n==font_params[f])); cur_val=fmem_ptr-1; /*this equals |param_base[f]+font_params[f]|*/ } @@ -13002,7 +12983,7 @@ entering a new level of recursion. In effect, the values of |save_h| and |save_v| on \TeX's run-time stack correspond to the values of |h| and |v| that a \.{DVI}-reading program will push onto its coordinate stack. -@p @<Declare procedures needed in |hlist_out|, |vlist_out|@>@t@>@; +@p @t\4@>@<Declare procedures needed in |hlist_out|, |vlist_out|@>@t@>@/ static void hlist_out(void) /*output an |hlist_node| box*/ {@+ scaled base_line; /*the baseline coordinate for this box*/ @@ -13044,13 +13025,13 @@ reaching a non-|char_node|. The program uses the fact that |set_char_0==0|. @<Output node |p| for |hlist_out|...@>= reswitch: if (is_char_node(p)) {@+synch_h;synch_v; - do {f=font(p);c=character(p); + @/do@+{f=font(p);c=character(p); if (f!=dvi_f) @<Change font |dvi_f| to |f|@>; if (c >= qi(128)) dvi_out(set1); dvi_out(qo(c));@/ cur_h=cur_h+char_width(f, char_info(f, c)); p=link(p); - } while (!(!is_char_node(p))); + }@+ while (!(!is_char_node(p))); dvi_h=cur_h; } else@<Output the non-|char_node| |p| for |hlist_out| and move to the next @@ -13355,7 +13336,7 @@ ready for the |ship_out| routine that gets them started in the first place. @p static void ship_out(pointer @!p) /*output the box |p|*/ {@+ execute_output(p); -@<Flush the box from memory...@>@; +flush_node_list(p); } @ @<Flush the box from memory, showing statistics if requested@>= @@ -13921,20 +13902,21 @@ if (last_badness > vbadness) @ When a box is being appended to the current vertical list, the baselineskip calculation is handled by the |append_to_vlist| routine. -@p static void append_to_vlist(pointer @!b) -{ @+bool height_known; +@p static void append_to_vlist(pointer @!b)@t\2\2@>@/ +{ bool height_known;@t\1@>@/ height_known=(type(b)==hlist_node || type(b)==vlist_node ||@| (type(b)==whatsit_node && subtype(b)==hset_node));@/ if (prev_depth > ignore_depth && height_known)@/ - {@+scaled d; /*deficiency of space between baselines*/ + {@+scaled d;@t\1@> /*deficiency of space between baselines*/ pointer @!p; /*a new glue node*/ - d=width(baseline_skip)-prev_depth-height(b); + {@+d=width(baseline_skip)-prev_depth-height(b); if (d < line_skip_limit) p=new_param_glue(line_skip_code); else{@+p=new_skip_param(baseline_skip_code); width(temp_ptr)=d; /*|temp_ptr==glue_ptr(p)|*/ } link(tail)=p;tail=p; -} @+ else @+if (prev_depth<=unknown_depth || prev_depth>ignore_depth ) @/ + }@+ +} @+ else @+if (prev_depth<=unknown_depth || prev_depth>ignore_depth )@t\2@>@/ {@+pointer p; p=new_baseline_node(baseline_skip, line_skip, line_skip_limit); link(tail)= p;tail= p; @@ -14576,12 +14558,12 @@ be probed in increasing order of height. @<Look at the variants of |(z,x)|; set |f| and |c|...@>= if ((z!=0)||(x!=min_quarterword)) {@+z=z+s+16; - do {z=z-16;g=fam_fnt(z); + @/do@+{z=z-16;g=fam_fnt(z); if (g!=null_font) @<Look at the list of characters starting with |x| in font |g|; set |f| and |c| whenever a better character is found; |goto found| as soon as a large enough variant is encountered@>; - } while (!(z < 16)); + }@+ while (!(z < 16)); } @ @<Look at the list of characters starting with |x|...@>= @@ -14971,8 +14953,8 @@ case rel_noad: case close_noad: case punct_noad: @<Convert \(a)a final |bin_noad| to an |ord_noad|@>; if (type(q)==right_noad) goto done_with_noad; } @+break; -@/@t\4@>@<Cases for noads that can follow a |bin_noad|@>@; -@/@t\4@>@<Cases for nodes that can appear in an mlist, after which we |goto +@t\4@>@<Cases for noads that can follow a |bin_noad|@>@; +@t\4@>@<Cases for nodes that can appear in an mlist, after which we |goto done_with_node|@>@; default:confusion("mlist1"); @:this can't happen mlist1}{\quad mlist1@> @@ -15732,7 +15714,8 @@ is not a penalty node or a |rel_noad| or absent entirely. @<Append any |new_hlist| entries for |q|, and any appropriate penalties@>= if (new_hlist(q)!=null) {@+link(p)=new_hlist(q); - do p=link(p); while (!(link(p)==null)); + @/do@+{p=link(p); + }@+ while (!(link(p)==null)); } if (penalties) if (link(q)!=null) if (pen < inf_penalty) {@+r_type=type(link(q)); @@ -15957,7 +15940,7 @@ good start. This mostly involves scanning the preamble and putting its information into the preamble list. @^preamble@> -@p @<Declare the procedure called |get_preamble_token|@>@; +@p @t\4@>@<Declare the procedure called |get_preamble_token|@>@t@>@/ static void align_peek(void);@/ static void normal_paragraph(void);@/ static void init_align(void) @@ -16145,7 +16128,8 @@ started, or finishes off the alignment. static void align_peek(void) {@+ restart: align_state=1000000; -do get_x_or_protected(); while (!(cur_cmd!=spacer)); +@/do@+{get_x_or_protected(); +}@+ while (!(cur_cmd!=spacer)); if (cur_cmd==no_align) {@+scan_left_brace();new_save_level(no_align_group); if (mode==-vmode) normal_paragraph(); @@ -16164,7 +16148,7 @@ from internal vertical mode to restricted horizontal mode or vice versa. The |space_factor| and |prev_depth| are not used on this semantic level, but we clear them to zero just to be tidy. -@p @<Declare the procedure called |init_span|@>@; +@p @t\4@>@<Declare the procedure called |init_span|@>@t@>@/ static void init_row(void) {@+push_nest();mode=(-hmode-vmode)-mode; if (mode==-hmode) space_factor=0;@+else prev_depth=0; @@ -16257,7 +16241,8 @@ if (extra_info(cur_align)!=span_code) init_span(p); } align_state=1000000; -do get_x_or_protected(); while (!(cur_cmd!=spacer)); +@/do@+{get_x_or_protected(); +}@+ while (!(cur_cmd!=spacer)); cur_align=p; init_col();return false; } @@ -16351,8 +16336,8 @@ link(end_span)=max_quarterword+1;info(end_span)=null; @ @<Update width entry for spanned columns@>= {@+q=cur_span; -do {incr(n);q=link(link(q)); -} while (!(q==cur_align)); +@/do@+{incr(n);q=link(link(q)); +}@+ while (!(q==cur_align)); if (n > max_quarterword) confusion("256 spans"); /*this can happen, but won't*/ @^system dependencies@> @:this can't happen 256 spans}{\quad 256 spans@> @@ -16409,9 +16394,21 @@ unsave(); /*that |align_group| was for the whole alignment*/ if (nest[nest_ptr-1].mode_field==mmode) o=display_indent; else o=0; @<Go through the preamble list, determining the column widths and changing -the alignrecords to dummy unset boxes@>@; +the alignrecords to dummy unset boxes@>; if (x) -{ /*Handle an alignment that depends on |hsize| or |vsize|*/ +{ @<Handle an alignment that depends on |hsize| or |vsize|@>@; + pop_alignment(); +} +else +{ @<Package the preamble list, to determine the actual tabskip glue amounts, + and let |p| point to this prototype box@>; + @<Set the glue in all the unset boxes of the current list@>; + flush_node_list(p);pop_alignment(); +} +@<Insert the \(c)current list into its environment@>; +} @/ +@t\4@>@<Declare the procedure called |align_peek|@>@; +@ @<Handle an alignment that depends on |hsize| or |vsize|@>= pointer r=get_node(align_node_size); save_ptr=save_ptr-2;pack_begin_line=-mode_line; @@ -16423,18 +16420,6 @@ if (x) align_v(r)= (mode!=-vmode); link(head)=r; tail=r; pack_begin_line=0; - pop_alignment(); -} -else -{ @<Package the preamble list, to determine the actual tabskip glue amounts, - and let |p| point to this prototype box@>; - @<Set the glue in all the unset boxes of the current list@>; - flush_node_list(p);pop_alignment(); -} -@<Insert the \(c)current list into its environment@>; -} -@# -@t\4@>@<Declare the procedure called |align_peek|@>@; @ It's time now to dismantle the preamble list and to compute the column widths. Let $w_{ij}$ be the maximum of the natural widths of all entries @@ -16461,7 +16446,7 @@ value is changed to zero and so is the next tabskip. @<Go through the preamble list,...@>= q=link(preamble); -do {flush_list(u_part(q));flush_list(v_part(q)); +@/do@+{flush_list(u_part(q));flush_list(v_part(q)); p=link(link(q)); if (width(q)==null_flag) @<Nullify |width(q)| and the tabskip glue following this column@>; @@ -16475,7 +16460,7 @@ glue_stretch(q)=0;glue_shrink(q)=0; if (width(q)>max_dimen) x=true; #endif q=p; -} while (!(q==null)); +}@+ while (!(q==null)) @ @<Nullify |width(q)| and the tabskip glue following this column@>= {@+width(q)=0;r=link(q);s=glue_ptr(r); @@ -16487,7 +16472,7 @@ if (s!=zero_glue) @ Merging of two span-node lists is a typical exercise in the manipulation of linearly linked data structures. The essential invariant in the following -|do {| loop is that we want to dispense with node |r|, in |q|'s list, +|@/do@+{| loop is that we want to dispense with node |r|, in |q|'s list, and |u| is its successor; all nodes of |p|'s list up to and including |s| have been processed, and the successor of |s| matches |r| or precedes |r| or follows |r|, according as |link(r)==n| or |link(r) > n| or |link(r) < n|. @@ -16495,7 +16480,7 @@ or follows |r|, according as |link(r)==n| or |link(r) > n| or |link(r) < n|. @<Merge the widths...@>= {@+t=width(q)+width(glue_ptr(link(q))); r=info(q);s=end_span;info(s)=p;n=min_quarterword+1; -do {width(r)=width(r)-t;u=info(r); +@/do@+{width(r)=width(r)-t;u=info(r); while (link(r) > n) {@+s=info(s);n=link(info(s))+1; } @@ -16506,7 +16491,7 @@ else{@+if (width(r) > width(info(s))) width(info(s))=width(r); free_node(r, span_node_size); } r=u; -} while (!(r==end_span)); +}@+ while (!(r==end_span)); } @ Now the preamble list has been converted to a list of alternating unset @@ -16523,12 +16508,12 @@ if (mode==-vmode) p=hpack(preamble, saved(1), saved_hfactor(1), saved_vfactor(1), saved(0));overfull_rule=rule_save; } else{@+q=link(preamble); - do {height(q)=width(q);width(q)=0;q=link(link(q)); - } while (!(q==null)); + @/do@+{height(q)=width(q);width(q)=0;q=link(link(q)); + }@+ while (!(q==null)); p=vpack(preamble, saved(1), saved_hfactor(1), saved_vfactor(1), saved(0)); q=link(preamble); - do {width(q)=height(q);height(q)=0;q=link(link(q)); - } while (!(q==null)); + @/do@+{width(q)=height(q);height(q)=0;q=link(link(q)); + }@+ while (!(q==null)); } pack_begin_line=0 @@ -16566,9 +16551,9 @@ else{@+type(q)=vlist_node;height(q)=height(p); glue_order(q)=glue_order(p);glue_sign(q)=glue_sign(p); glue_set(q)=glue_set(p);shift_amount(q)=o; r=link(list_ptr(q));s=link(list_ptr(p)); -do {@<Set the glue in node |r| and change it from an unset node@>; +@/do@+{@<Set the glue in node |r| and change it from an unset node@>; r=link(link(r));s=link(link(s)); -} while (!(r==null)); +}@+ while (!(r==null)); } @ A box made from spanned columns will be followed by tabskip glue nodes and @@ -16900,7 +16885,7 @@ k=1 to 6 do cur_active_width[k]=cur_active_width[k]+mem[q+k].sc|};$$ and we want to do this without the overhead of |for| loops. The |do_all_six| macro makes such six-tuples convenient. -@d do_all_six(A) A(1);A(2);A(3);A(4);A(5);A(6)@; +@d do_all_six(A) A(1);A(2);A(3);A(4);A(5);A(6) @<Glob...@>= static scaled @!active_width0[6], *const @!active_width = @!active_width0-1; @@ -17058,7 +17043,7 @@ loop@+{@+resume: r=link(prev_r); @<If node |r| is of type |delta_node|, update |cur_active_width|, set |prev_r| and |prev_prev_r|, then |goto resume|@>; @<If a line number class has ended, create new active nodes for the best -feasible breaks in that class; then |return| if |r==last_active|, otherwise +feasible breaks in that class; then |return| if |r=last_active|, otherwise compute the new |line_width|@>; @<Consider the demerits for a line from |r| to |cur_p|; deactivate node |r| if it should no longer be active; then |goto resume| if a line from @@ -17811,10 +17796,10 @@ character node. @<Advance \(c)|cur_p| to the node following the present string...@>= {@+prev_p=cur_p; -do {f=font(cur_p); +@/do@+{f=font(cur_p); act_width=act_width+char_width(f, char_info(f, character(cur_p))); cur_p=link(cur_p); -} while (!(!is_char_node(cur_p))); +}@+ while (!(!is_char_node(cur_p))); } @ When node |cur_p| is a glue node, we look at |prev_p| to see whether or not @@ -17839,9 +17824,9 @@ only character nodes, kern nodes, box nodes, rule nodes, and ligature nodes. @<Try to break after a discretionary fragment...@>= {@+s=pre_break(cur_p);disc_width=0; if (s==null) try_break(ex_hyphen_penalty, hyphenated); -else{@+do {@<Add the width of node |s| to |disc_width|@>; +else{@+@/do@+{@<Add the width of node |s| to |disc_width|@>; s=link(s); - } while (!(s==null)); + }@+ while (!(s==null)); act_width=act_width+disc_width; try_break(hyphen_penalty, hyphenated); act_width=act_width-disc_width; @@ -17919,11 +17904,11 @@ if (link(active)!=last_active) @ @<Find an active node...@>= r=link(active);fewest_demerits=awful_bad; -do {if (type(r)!=delta_node) if (total_demerits(r) < fewest_demerits) +@/do@+{if (type(r)!=delta_node) if (total_demerits(r) < fewest_demerits) {@+fewest_demerits=total_demerits(r);best_bet=r; } r=link(r); -} while (!(r==last_active)); +}@+ while (!(r==last_active)); best_line=line_number(best_bet) @ The adjustment for a desired looseness is a slightly more complicated @@ -17933,7 +17918,7 @@ looseness calculation, independently of the other segments. @<Find the best active node...@>= {@+r=link(active);actual_looseness=0; -do {if (type(r)!=delta_node) +@/do@+{if (type(r)!=delta_node) {@+line_diff=line_number(r)-best_line; if (((line_diff < actual_looseness)&&(looseness <= line_diff))||@| ((line_diff > actual_looseness)&&(looseness >= line_diff))) @@ -17946,7 +17931,7 @@ do {if (type(r)!=delta_node) } } r=link(r); -} while (!(r==last_active)); +}@+ while (!(r==last_active)); best_line=line_number(best_bet); } @@ -17981,14 +17966,14 @@ quarterword @!t; /*used for replacement counts in discretionary nodes*/ int @!pen; /*use when calculating penalties between lines*/ halfword @!cur_line; /*the current line number being justified*/ @<Reverse the links of the relevant passive nodes, setting |cur_p| to the -first breakpoint@>@; +first breakpoint@>; cur_line=prev_graf+1; -do {@<Justify the line ending at breakpoint |cur_p|, and append it to the +@/do@+{@<Justify the line ending at breakpoint |cur_p|, and append it to the current vertical list, together with associated penalties and other insertions@>; incr(cur_line);cur_p=next_break(cur_p); if (cur_p!=null) if (!post_disc_break) @<Prune unwanted nodes at the beginning of the next line@>; -} while (!(cur_p==null)); +}@+ while (!(cur_p==null)); if ((cur_line!=best_line)||(link(temp_head)!=null)) confusion("line breaking"); @:this can't happen line breaking}{\quad line breaking@> @@ -18003,8 +17988,8 @@ Node |r| is the passive node being moved from stack to stack. @<Reverse the links of the relevant passive nodes...@>= q=break_node(best_bet);cur_p=null; -do {r=q;q=prev_break(q);next_break(r)=cur_p;cur_p=r; -} while (!(q==null)); +@/do@+{r=q;q=prev_break(q);next_break(r)=cur_p;cur_p=r; +}@+ while (!(q==null)) @ Glue and penalty and kern and math nodes are deleted at the beginning of a line, except in the anomalous case that the node to be deleted is actually @@ -18257,8 +18242,8 @@ int @!c; /*character being considered for hyphenation*/ second pass, and |cur_p| points to a glue node. @p -static void hyphenate_word(void) -{ @+pointer @!q, @!s, @!prev_s; /*miscellaneous nodes of temporary interest*/ +static void hyphenate_word(void)@t\2\2@>@/ +{ pointer @!q, @!s, @!prev_s;@t\1@> /*miscellaneous nodes of temporary interest*/ small_number @!j; /*an index into |hc| or |hu|*/ uint8_t @!c; /*character being considered for hyphenation*/ @@ -18692,7 +18677,7 @@ pointer @!hyf_node; /*the hyphen, if it exists*/ @ When the following code is performed, |hyf[0]| and |hyf[hn]| will be zero. @<Reconstitute nodes for the hyphenated word...@>= -do {l=j;j=reconstitute(j, hn, bchar, qi(hyf_char))+1; +@/do@+{l=j;j=reconstitute(j, hn, bchar, qi(hyf_char))+1; if (hyphen_passed==0) {@+link(s)=link(hold_head); while (link(s) > null) s=link(s); @@ -18702,8 +18687,8 @@ if (hyphen_passed==0) } if (hyphen_passed > 0) @<Create and append a discretionary node as an alternative to the unhyphenated -word, and continue to develop both branches until they become equivalent@>@; -} while (!(j > hn)); +word, and continue to develop both branches until they become equivalent@>; +}@+ while (!(j > hn)); link(s)=q @ In this repeat loop we will insert another discretionary if |hyf[j-1]| is @@ -18717,7 +18702,7 @@ point. (Consider the word `difficult', where the letter `c' is in position |j|.) } @<Create and append a discretionary node as an alternative...@>= -do {r=get_node(small_node_size); +@/do@+{r=get_node(small_node_size); link(r)=link(hold_head);type(r)=disc_node; major_tail=r;r_count=0; while (link(major_tail) > null) advance_major_tail; @@ -18728,7 +18713,7 @@ list and to |major_tail| until synchronization has been achieved@>; @<Move pointer |s| to the end of the current list, and set |replace_count(r)| appropriately@>; hyphen_passed=j-1;link(hold_head)=null; -} while (!(!odd(hyf[j-1]))); +}@+ while (!(!odd(hyf[j-1]))) @ The new hyphen might combine with the previous character via ligature or kern. At this point we have |l-1 <= i < j| and |i < hn|. @@ -18760,7 +18745,7 @@ if (bchar_label[hf]!=non_address) /*put left boundary at beginning of new line* {@+decr(l);c=hu[l];c_loc=l;hu[l]=256; } while (l < j) - {@+do {l=reconstitute(l, hn, bchar, non_char)+1; + {@+@/do@+{l=reconstitute(l, hn, bchar, non_char)+1; if (c_loc > 0) {@+hu[c_loc]=c;c_loc=0; } @@ -18770,7 +18755,7 @@ while (l < j) minor_tail=link(hold_head); while (link(minor_tail) > null) minor_tail=link(minor_tail); } - } while (!(l >= j)); + }@+ while (!(l >= j)); while (l > j) @<Append characters of |hu[j..]| to |major_tail|, advancing~|j|@>; } @@ -18888,10 +18873,10 @@ for (j=0; j<=r_hyf-1; j++) hyf[hn-j]=0 @ @<Store \(m)maximum values in the |hyf| table@>= {@+v=trie_op(z); -do {v=v+op_start[cur_lang];i=l-hyf_distance[v]; +@/do@+{v=v+op_start[cur_lang];i=l-hyf_distance[v]; if (hyf_num[v] > hyf[i]) hyf[i]=hyf_num[v]; v=hyf_next[v]; -} while (!(v==min_quarterword)); +}@+ while (!(v==min_quarterword)); } @ The exception table that is built by \TeX's \.{\\hyphenation} primitive is @@ -18956,10 +18941,10 @@ k=hyph_word[h];if (k==0) goto not_found; if (length(k) < hn) goto not_found; if (length(k)==hn) {@+j=1;u=str_start[k]; - do {if (so(str_pool[u]) < hc[j]) goto not_found; + @/do@+{if (so(str_pool[u]) < hc[j]) goto not_found; if (so(str_pool[u]) > hc[j]) goto done; incr(j);incr(u); - } while (!(j > hn)); + }@+ while (!(j > hn)); @<Insert hyphens as specified in |hyph_list[h]|@>; decr(hn);goto found; } @@ -19085,10 +19070,10 @@ k=hyph_word[h]; if (length(k) < length(s)) goto found; if (length(k) > length(s)) goto not_found; u=str_start[k];v=str_start[s]; -do {if (str_pool[u] < str_pool[v]) goto found; +@/do@+{if (str_pool[u] < str_pool[v]) goto found; if (str_pool[u] > str_pool[v]) goto not_found; incr(u);incr(v); -} while (!(u==str_start[k+1])); +}@+ while (!(u==str_start[k+1])); found: q=hyph_list[h];hyph_list[h]=p;p=q;@/ t=hyph_word[h];hyph_word[h]=s;s=t; not_found: @@ -19376,7 +19361,7 @@ loop@+{@+h=z-c;@/ otherwise |goto not_found|@>; not_found: z=trie_link(z); /*move to the next hole*/ } -found: @<Pack the family into |trie| relative to |h|@>@; +found: @<Pack the family into |trie| relative to |h|@>; } @ By making sure that |trie_max| is at least |h+256|, we can be sure that @@ -19387,9 +19372,9 @@ never be occupied in |trie|, and we will have |trie_max >= trie_link(z)|. if (trie_max < h+256) {@+if (trie_size <= h+256) overflow("pattern memory", trie_size); @:TeX capacity exceeded pattern memory}{\quad pattern memory@> - do {incr(trie_max);trie_taken[trie_max]=false; + @/do@+{incr(trie_max);trie_taken[trie_max]=false; trie_link(trie_max)=trie_max+1;trie_back(trie_max)=trie_max-1; - } while (!(trie_max==h+256)); + }@+ while (!(trie_max==h+256)); } @ @<If all characters of the family fit relative to |h|...@>= @@ -19402,15 +19387,15 @@ goto found @ @<Pack the family into |trie| relative to |h|@>= trie_taken[h]=true;trie_ref[p]=h;q=p; -do {z=h+so(trie_c[q]);l=trie_back(z);r=trie_link(z); +@/do@+{z=h+so(trie_c[q]);l=trie_back(z);r=trie_link(z); trie_back(r)=l;trie_link(l)=r;trie_link(z)=0; if (l < 256) {@+if (z < 256) ll=z;@+else ll=256; - do {trie_min[l]=r;incr(l); - } while (!(l==ll)); + @/do@+{trie_min[l]=r;incr(l); + }@+ while (!(l==ll)); } q=trie_r[q]; -} while (!(q==0)); +}@+ while (!(q==0)) @ To pack the entire linked trie, we use the following recursive procedure. @^recursion@> @@ -19418,12 +19403,12 @@ q=trie_r[q]; @<Declare procedures for preprocessing hyph...@>= static void trie_pack(trie_pointer @!p) /*pack subtries of a family*/ {@+trie_pointer q; /*a local variable that need not be saved on recursive calls*/ -do {q=trie_l[p]; +@/do@+{q=trie_l[p]; if ((q > 0)&&(trie_ref[q]==0)) {@+first_fit(q);trie_pack(q); } p=trie_r[p]; -} while (!(p==0)); +}@+ while (!(p==0)); } @ When the whole trie has been allocated into the sequential table, we @@ -19441,8 +19426,8 @@ if (trie_max==0) /*no patterns were given*/ else{@+if (hyph_root > 0) trie_fix(hyph_root); if (trie_root > 0) trie_fix(trie_root); /*this fixes the non-holes in |trie|*/ r=0; /*now we will zero out all the holes*/ - do {s=trie_link(r);trie[r]=h;r=s; - } while (!(r > trie_max)); + @/do@+{s=trie_link(r);trie[r]=h;r=s; + }@+ while (!(r > trie_max)); } trie_char(0)=qi('?'); /*make |trie_char(c)!=c| for all |c|*/ @@ -19458,11 +19443,11 @@ static void trie_fix(trie_pointer @!p) /*moves |p| and its siblings into |trie|* ASCII_code @!c; /*another one that need not be saved*/ trie_pointer @!z; /*|trie| reference; this local variable must be saved*/ z=trie_ref[p]; -do {q=trie_l[p];c=so(trie_c[p]); +@/do@+{q=trie_l[p];c=so(trie_c[p]); trie_link(z+c)=trie_ref[q];trie_char(z+c)=qi(c);trie_op(z+c)=trie_o[p]; if (q > 0) trie_fix(q); p=trie_r[p]; -} while (!(p==0)); +}@+ while (!(p==0)); } @ Now let's go back to the easier problem, of building the linked @@ -20061,9 +20046,9 @@ if (page_head!=page_tail) print_scaled(t); if (type(r)==split_up) {@+q=page_head;t=0; - do {q=link(q); + @/do@+{q=link(q); if ((type(q)==ins_node)&&(subtype(q)==subtype(r))) incr(t); - } while (!(q==broken_ins(r))); + }@+ while (!(q==broken_ins(r))); print(", #");print_int(t);print(" might split"); } r=link(r); @@ -20723,7 +20708,8 @@ pop_nest();build_page(); @.Unbalanced output routine@> help2("Your sneaky output routine has problematic {'s and/or }'s.",@/ "I can't handle that very well; good luck.");error(); -do get_token(); while (!(loc==null)); +@/do@+{get_token(); +}@+ while (!(loc==null)); } /*loops forever if reading from a file, since |null==min_halfword <= 0|*/ @ @<Ensure that box 255 is empty after output@>= @@ -20807,7 +20793,7 @@ case hmode+no_boundary: {@+get_x_token(); case hmode+spacer: if (space_factor==1000) goto append_normal_space; else app_space();@+break; case hmode+ex_space: case mmode+ex_space: goto append_normal_space; -@/@t\4@>@<Cases of |main_control| that are not part of the inner loop@>@; +@t\4@>@<Cases of |main_control| that are not part of the inner loop@>@; } /*of the big |case| statement*/ goto big_switch; main_loop: @<Append character |cur_chr| and the following characters (if~any) @@ -21120,7 +21106,7 @@ if ((space_factor >= 2000)&&(xspace_skip!=zero_glue)) else{@+if (space_skip!=zero_glue) main_p=space_skip; else@<Find the glue specification...@>; main_p=new_spec(main_p); - @<Modify the glue specification in |main_p| according to the space factor@>@; + @<Modify the glue specification in |main_p| according to the space factor@>; q=new_glue(main_p);glue_ref_count(main_p)=null; } link(tail)=q;tail=q; @@ -21129,7 +21115,7 @@ link(tail)=q;tail=q; @ @<Modify the glue specification in |main_p| according to the space factor@>= if (space_factor >= 2000) width(main_p)=width(main_p)+extra_space(cur_font); stretch(main_p)=xn_over_d(stretch(main_p), space_factor, 1000); -shrink(main_p)=xn_over_d(shrink(main_p), 1000, space_factor); +shrink(main_p)=xn_over_d(shrink(main_p), 1000, space_factor) @ Whew---that covers the main loop. We can now proceed at a leisurely pace through the other combinations of possibilities. @@ -21144,7 +21130,7 @@ any_mode(ignore_spaces): {@+@<Get the next non-blank non-call...@>; goto reswitch; } case vmode+stop: if (its_all_over()) return;@+break; /*this is the only way out*/ -@<Forbidden cases detected in |main_control|@>@+@, any_mode(mac_param): +@t\4@>@<Forbidden cases detected in |main_control|@>@+@, any_mode(mac_param): report_illegal_case();@+break; @<Math-only cases in non-math modes, or vice versa@>: insert_dollar_sign();@+break; @t\4@>@<Cases of |main_control| that build boxes and lists@>@; @@ -21497,7 +21483,7 @@ case bottom_level: {@+print_err("Too many }'s"); } @+break; case semi_simple_group: case math_shift_group: case math_left_group: extra_right_brace();@+break; -@/@t\4@>@<Cases of |handle_right_brace| where a |right_brace| triggers a delayed +@t\4@>@<Cases of |handle_right_brace| where a |right_brace| triggers a delayed action@>@; default:confusion("rightbrace"); @:this can't happen rightbrace}{\quad rightbrace@> @@ -21693,7 +21679,7 @@ current vertical list. } else{@+cur_val=box_context-global_box_flag;a=4; } -if (cur_val < 256) @[g_define(box_base+cur_val, box_ref, cur_box)@]; +if (cur_val < 256) define(box_base+cur_val, box_ref, cur_box); else sa_def_box; } @@ -21761,13 +21747,13 @@ else{@+if (!is_char_node(tail)) @ @<Remove the last box...@>= {@+q=head; -do {p=q; +@/do@+{p=q; if (!is_char_node(q)) if (type(q)==disc_node) {@+for (m=1; m<=replace_count(q); m++) p=link(p); if (p==tail) goto done; } q=link(p); -} while (!(q==tail)); +}@+ while (!(q==tail)); cur_box=tail;shift_amount(cur_box)=0; tail=p;link(p)=null; done: ;} @@ -22078,13 +22064,13 @@ if ((mode==vmode)&&(tail==head)) non-glue@>@; else{@+if (!is_char_node(tail)) if (type(tail)==cur_chr) {@+q=head; - do {p=q; + @/do@+{p=q; if (!is_char_node(q)) if (type(q)==disc_node) {@+for (m=1; m<=replace_count(q); m++) p=link(p); if (p==tail) return; } q=link(p); - } while (!(q==tail)); + }@+ while (!(q==tail)); link(p)=null;flush_node_list(tail);tail=p; } } @@ -22125,8 +22111,8 @@ case remove_item: if (chr_code==glue_node) print_esc("unskip"); else print_esc("unpenalty");@+break; case un_hbox: if (chr_code==copy_code) print_esc("unhcopy"); else print_esc("unhbox");@+break; -case un_vbox: if (chr_code==copy_code) print_esc("unvcopy"); - else @<Cases of |un_vbox| for |print_cmd_chr|@>@; +case un_vbox: if (chr_code==copy_code) print_esc("unvcopy") + @<Cases of |un_vbox| for |print_cmd_chr|@>;@/ else print_esc("unvbox");@+break; @ The |un_hbox| and |un_vbox| commands unwrap one of the 256 current boxes. @@ -23167,8 +23153,8 @@ primitive("right", left_right, right_noad); text(frozen_right)=text(cur_val);eqtb[frozen_right]=eqtb[cur_val]; @ @<Cases of |print_cmd_chr|...@>= -case left_right: if (chr_code==left_noad) print_esc("left"); -else @<Cases of |left_right| for |print_cmd_chr|@>@; +case left_right: if (chr_code==left_noad) print_esc("left") +@/@<Cases of |left_right| for |print_cmd_chr|@>;@/ else print_esc("right");@+break; @ @<Cases of |main_control| that build...@>= @@ -23505,8 +23491,8 @@ primitive("xdef", def, 3); @ @<Cases of |print_cmd_chr|...@>= case prefix: if (chr_code==1) print_esc("long"); - else if (chr_code==2) print_esc("outer"); - else @<Cases of |prefix| for |print_cmd_chr|@>@; + else if (chr_code==2) print_esc("outer") + @/@<Cases of |prefix| for |print_cmd_chr|@>;@/ else print_esc("global");@+break; case def: if (chr_code==0) print_esc("def"); else if (chr_code==1) print_esc("gdef"); @@ -23616,7 +23602,7 @@ if ((cur_cmd!=def)&&((a%4!=0)||(j!=0))) since the following routines test for the \.{\\global} prefix as follows. @d global (a >= 4) -@d g_define(A, B, C) if (global) geq_define(A, B, C);@+else eq_define(A, B, C) +@d define(A, B, C) if (global) geq_define(A, B, C);@+else eq_define(A, B, C) @d word_define(A, B) if (global) geq_word_define(A, B);@+else eq_word_define(A, B) @<Adjust \(f)for the setting of \.{\\globaldefs}@>= @@ -23634,7 +23620,8 @@ control sequence for a token that is not redefinable. @<Declare subprocedures for |prefixed_command|@>= static void get_r_token(void) {@+ -restart: do get_token(); while (!(cur_tok!=space_token)); +restart: @/do@+{get_token(); +}@+ while (!(cur_tok!=space_token)); if ((cur_cs==0)||(cur_cs > frozen_control_sequence)) {@+print_err("Missing control sequence inserted"); @.Missing control...@> @@ -23657,7 +23644,7 @@ text(frozen_protection)=s_no("inaccessible"); (Unfortunately, they aren't all as simple as this.) @<Assignments@>= -case set_font: g_define(cur_font_loc, data, cur_chr);@+break; +case set_font: define(cur_font_loc, data, cur_chr);@+break; @ When a |def| command has been scanned, |cur_chr| is odd if the definition is supposed to be global, and @@ -23671,7 +23658,7 @@ case def: {@+if (odd(cur_chr)&&!global&&(global_defs >= 0)) a=a+4; {@+q=get_avail();info(q)=j;link(q)=link(def_ref); link(def_ref)=q; } - g_define(p, call+(a%4), def_ref); + define(p, call+(a%4), def_ref); } @+break; @ Both \.{\\let} and \.{\\futurelet} share the command code |let|. @@ -23689,7 +23676,8 @@ case let: if (chr_code!=normal) print_esc("futurelet");@+else print_esc("let");@ case let: {@+n=cur_chr; get_r_token();p=cur_cs; if (n==normal) - {@+do get_token(); while (!(cur_cmd!=spacer)); + {@+@/do@+{get_token(); + }@+ while (!(cur_cmd!=spacer)); if (cur_tok==other_token+'=') {@+get_token(); if (cur_cmd==spacer) get_token(); @@ -23702,7 +23690,7 @@ case let: {@+n=cur_chr; else if ((cur_cmd==internal_register)||(cur_cmd==toks_register)) if ((cur_chr < mem_bot)||(cur_chr > lo_mem_stat_max)) add_sa_ref(cur_chr); - g_define(p, cur_cmd, cur_chr); + define(p, cur_cmd, cur_chr); } @+break; @ A \.{\\chardef} creates a control sequence whose |cmd| is |char_given|; @@ -23757,12 +23745,12 @@ producing an ``undefined control sequence'' error or expanding the previous meaning. This allows, for instance, `\.{\\chardef\\foo=123\\foo}'. @<Assignments@>= -case shorthand_def: {@+n=cur_chr;get_r_token();p=cur_cs;g_define(p, relax, 256); +case shorthand_def: {@+n=cur_chr;get_r_token();p=cur_cs;define(p, relax, 256); scan_optional_equals(); switch (n) { - case char_def_code: {@+scan_char_num();g_define(p, char_given, cur_val); + case char_def_code: {@+scan_char_num();define(p, char_given, cur_val); } @+break; - case math_char_def_code: {@+scan_fifteen_bit_int();g_define(p, math_given, cur_val); + case math_char_def_code: {@+scan_fifteen_bit_int();define(p, math_given, cur_val); } @+break; default:{@+scan_register_num(); if (cur_val > 255) @@ -23770,15 +23758,15 @@ case shorthand_def: {@+n=cur_chr;get_r_token();p=cur_cs;g_define(p, relax, 256); if (j > mu_val) j=tok_val; /*|int_val dotdot mu_val| or |tok_val|*/ find_sa_element(j, cur_val, true);add_sa_ref(cur_ptr); if (j==tok_val) j=toks_register;@+else j=internal_register; - g_define(p, j, cur_ptr); + define(p, j, cur_ptr); } else switch (n) { - case count_def_code: g_define(p, assign_int, count_base+cur_val);@+break; - case dimen_def_code: g_define(p, assign_dimen, scaled_base+cur_val);@+break; - case skip_def_code: g_define(p, assign_glue, skip_base+cur_val);@+break; - case mu_skip_def_code: g_define(p, assign_mu_glue, mu_skip_base+cur_val);@+break; - case toks_def_code: g_define(p, assign_toks, toks_base+cur_val); + case count_def_code: define(p, assign_int, count_base+cur_val);@+break; + case dimen_def_code: define(p, assign_dimen, scaled_base+cur_val);@+break; + case skip_def_code: define(p, assign_glue, skip_base+cur_val);@+break; + case mu_skip_def_code: define(p, assign_mu_glue, mu_skip_base+cur_val);@+break; + case toks_def_code: define(p, assign_toks, toks_base+cur_val); } /*there are no other cases*/ } } @@ -23794,7 +23782,7 @@ case read_to_cs: {@+j=cur_chr;scan_int();n=cur_val; "I'm going to look for the \\cs now.");error(); } get_r_token(); - p=cur_cs;read_toks(n, p, j);g_define(p, call, cur_val); + p=cur_cs;read_toks(n, p, j);define(p, call, cur_val); } @+break; @ The token-list parameters, \.{\\output} and \.{\\everypar}, etc., receive @@ -23864,7 +23852,7 @@ case assign_dimen: {@+p=cur_chr;scan_optional_equals(); case assign_glue: case assign_mu_glue: {@+p=cur_chr;n=cur_cmd;scan_optional_equals(); if (n==assign_mu_glue) scan_glue(mu_val);@+else scan_glue(glue_val); trap_zero_glue(); - g_define(p, glue_ref, cur_val); + define(p, glue_ref, cur_val); } @+break; @ When a glue register or parameter becomes zero, it will always point to @@ -23927,8 +23915,8 @@ case def_code: {@+@<Let |n| be the largest legal code value, based on |cur_chr|@ help1("I'm going to use 0 instead of that illegal code value.");@/ error();cur_val=0; } - if (p < math_code_base) g_define(p, data, cur_val); - else if (p < del_code_base) g_define(p, data, hi(cur_val)); + if (p < math_code_base) define(p, data, cur_val); + else if (p < del_code_base) define(p, data, hi(cur_val)); else word_define(p, cur_val); } @+break; @@ -23941,7 +23929,7 @@ else n=255 @ @<Assignments@>= case def_family: {@+p=cur_chr;scan_four_bit_int();p=p+cur_val; - scan_optional_equals();scan_font_ident();g_define(p, data, cur_val); + scan_optional_equals();scan_font_ident();define(p, data, cur_val); } @+break; @ Next we consider changes to \TeX's numeric registers. @@ -24149,8 +24137,8 @@ static void alter_integer(void) {@+small_number c; /*0 for \.{\\deadcycles}, 1 for \.{\\insertpenalties}, etc.*/ c=cur_chr;scan_optional_equals();scan_int(); -if (c==0) dead_cycles=cur_val; -else @<Cases for |alter_integer|@>@; +if (c==0) dead_cycles=cur_val +@/@<Cases for |alter_integer|@>@;@/ else insert_penalties=cur_val; } @@ -24188,7 +24176,7 @@ case set_shape: {@+q=cur_chr;scan_optional_equals();scan_int();n=cur_val; } cur_hfactor=fh; cur_vfactor=fv; } - g_define(q, shape_ref, p); + define(q, shape_ref, p); } @+break; @ Here's something that isn't quite so obvious. It guarantees that @@ -24219,7 +24207,7 @@ new_patterns();goto done;@; print_err("Patterns can be loaded only by INITEX"); @.Patterns can be...@> help0;error(); - do get_token(); while (!(cur_cmd==right_brace)); /*flush the patterns*/ + @/do@+{get_token();}@+ while (!(cur_cmd==right_brace)); /*flush the patterns*/ return; } else{@+new_hyph_exceptions();goto done; @@ -24273,12 +24261,12 @@ else{@+old_setting=selector;selector=new_string; @.FONTx@> str_room(1);t=make_string(); } -g_define(u, set_font, null_font);scan_optional_equals();scan_file_name(); +define(u, set_font, null_font);scan_optional_equals();scan_file_name(); @<Scan the font size specification@>; @<If this font has already been loaded, set |f| to the internal font number and |goto common_ending|@>; f=read_font_info(u, cur_name, cur_area, s); -common_ending: g_define(u, set_font, f);eqtb[font_id_base+f]=eqtb[u];font_id_text(f)=t; +common_ending: define(u, set_font, f);eqtb[font_id_base+f]=eqtb[u];font_id_text(f)=t; } @ @<Scan the font size specification@>= @@ -24663,7 +24651,7 @@ so that the inverse relation between them is clear. The global variable |format_ident| is a string that is printed right after the |banner| line when \TeX\ is ready to start. For \.{INITEX} this string says simply `\.{ (INITEX)}'; for other versions of \TeX\ it says, -for example, `\.{(preloaded format=plain 1982.11.19)}', showing the year, +for example, `\.{ (preloaded format=plain 1982.11.19)}', showing the year, month, and day that the format file was created. We have |format_ident==0| before \TeX's tables are loaded. @@ -24853,10 +24841,10 @@ sort_avail();var_used=0; dump_int(lo_mem_max);dump_int(rover); if (eTeX_ex) for (k=int_val; k<=tok_val; k++) dump_int(sa_root[k]); p=mem_bot;q=rover;x=0; -do {for (k=p; k<=q+1; k++) dump_wd(mem[k]); +@/do@+{for (k=p; k<=q+1; k++) dump_wd(mem[k]); x=x+q+2-p;var_used=var_used+q-p; p=q+node_size(q);q=rlink(q); -} while (!(q==rover)); +}@+ while (!(q==rover)); var_used=var_used+lo_mem_max-p;dyn_used=mem_end+1-hi_mem_min;@/ for (k=p; k<=lo_mem_max; k++) dump_wd(mem[k]); x=x+lo_mem_max+1-p; @@ -24878,11 +24866,11 @@ undump(lo_mem_stat_max+1, lo_mem_max, rover); if (eTeX_ex) for (k=int_val; k<=tok_val; k++) undump(null, lo_mem_max, sa_root[k]); p=mem_bot;q=rover; -do {for (k=p; k<=q+1; k++) undump_wd(mem[k]); +@/do@+{for (k=p; k<=q+1; k++) undump_wd(mem[k]); p=q+node_size(q); if ((p > lo_mem_max)||((q >= rlink(q))&&(rlink(q)!=rover))) goto bad_fmt; q=rlink(q); -} while (!(q==rover)); +}@+ while (!(q==rover)); for (k=p; k<=lo_mem_max; k++) undump_wd(mem[k]); if (mem_min < mem_bot-2) /*make more low memory available*/ {@+p=llink(rover);q=mem_min+1; @@ -24897,14 +24885,14 @@ for (k=hi_mem_min; k<=mem_end; k++) undump_wd(mem[k]); undump_int(var_used);undump_int(dyn_used) @ @<Dump the table of equivalents@>= -@<Dump regions 1 to 4 of |eqtb|@>@; -@<Dump regions 5 and 6 of |eqtb|@>@; +@<Dump regions 1 to 4 of |eqtb|@>; +@<Dump regions 5 and 6 of |eqtb|@>; dump_int(par_loc);dump_int(write_loc);@/ dump_int(input_loc);@/ @<Dump the hash table@>@; @ @<Undump the table of equivalents@>= -@<Undump regions 1 to 6 of |eqtb|@>@; +@<Undump regions 1 to 6 of |eqtb|@>; undump(hash_base, frozen_control_sequence, par_loc); par_token=cs_token_flag+par_loc;@/ undump(hash_base, frozen_control_sequence, write_loc);@/ @@ -24919,7 +24907,7 @@ copies of $x_n$, namely $(x_1,\ldots,x_n,x_n,\ldots,x_n)$. @<Dump regions 1 to 4 of |eqtb|@>= k=active_base; -do {j=k; +@/do@+{j=k; while (j < int_base-1) {@+if ((equiv(j)==equiv(j+1))&&(eq_type(j)==eq_type(j+1))&&@| (eq_level(j)==eq_level(j+1))) goto found1; @@ -24937,10 +24925,10 @@ while (k < l) {@+dump_wd(eqtb[k]);incr(k); } k=j+1;dump_int(k-l); -} while (!(k==int_base)); +}@+ while (!(k==int_base)) @ @<Dump regions 5 and 6 of |eqtb|@>= -do {j=k; +@/do@+{j=k; while (j < eqtb_size) {@+if (eqtb[j].i==eqtb[j+1].i) goto found2; incr(j); @@ -24956,11 +24944,11 @@ while (k < l) {@+dump_wd(eqtb[k]);incr(k); } k=j+1;dump_int(k-l); -} while (!(k > eqtb_size)); +}@+ while (!(k > eqtb_size)) @ @<Undump regions 1 to 6 of |eqtb|@>= k=active_base; -do {undump_int(x); +@/do@+{undump_int(x); if ((x < 1)||(k+x > eqtb_size+1)) goto bad_fmt; for (j=k; j<=k+x-1; j++) undump_wd(eqtb[j]); k=k+x; @@ -24968,7 +24956,7 @@ undump_int(x); if ((x < 0)||(k+x > eqtb_size+1)) goto bad_fmt; for (j=k; j<=k+x-1; j++) eqtb[j]=eqtb[k-1]; k=k+x; -} while (!(k > eqtb_size)); +}@+ while (!(k > eqtb_size)) @ A different scheme is used to compress the hash table, since its lower region is usually sparse. When |text(p)!=0| for |p <= hash_used|, we output @@ -24986,8 +24974,8 @@ print_ln();print_int(cs_count);print(" multiletter control sequences") @ @<Undump the hash table@>= undump(hash_base, frozen_control_sequence, hash_used);p=hash_base-1; -do {undump(p+1, hash_used, p);undump_hh(hash[p]); -} while (!(p==hash_used)); +@/do@+{undump(p+1, hash_used, p);undump_hh(hash[p]); +}@+ while (!(p==hash_used)); for (p=hash_used+1; p<=undefined_control_sequence-1; p++) undump_hh(hash[p]); undump_int(cs_count) @@ -25800,7 +25788,7 @@ case extension: switch (chr_code) { case ignore_node: print("[HINT internal: ignore]");@+break; case immediate_code: print_esc("immediate");@+break; case set_language_code: print_esc("setlanguage");@+break; - @/@t\4@>@<Cases of |extension| for |print_cmd_chr|@>@; + @/@<Cases of |extension| for |print_cmd_chr|@>@/ default:print("[unknown extension!]"); } @+break; @@ -25991,7 +25979,7 @@ case xdimen_node: case ignore_node: @+break; case immediate_code: @<Implement \.{\\immediate}@>@;@+break; case set_language_code: @<Implement \.{\\setlanguage}@>@;@+break; -@/@t\4@>@<Cases for |do_extension|@>@; +@/@<Cases for |do_extension|@>@/ default:confusion("ext1"); @:this can't happen ext1}{\quad ext1@> } @@ -26122,7 +26110,7 @@ case language_node: {@+print_esc("setlanguage"); print_int(what_lhm(p));print_char(','); print_int(what_rhm(p));print_char(')'); } @+break; -@/@t\4@>@<Cases for displaying the |whatsit| node@>@; +@/@<Cases for displaying the |whatsit| node@>@/ case param_node: print_esc("parameter "); print_int(param_type(p));print_char(',');print_int(param_no(p)); print_char(':');print_int(param_value(p).i); @@ -26263,7 +26251,7 @@ case write_node: case special_node: case latespecial_node: {@+r=get_node(write_n case close_node: case language_node: {@+r=get_node(small_node_size); words=small_node_size; } @+break; -@/@t\4@>@<Cases for making a partial copy of the whatsit node@>@; +@/@<Cases for making a partial copy of the whatsit node@>@/ case param_node: {@+r=get_node(param_node_size); if (param_type(p)==glue_type) add_glue_ref(param_value(p).i); @@ -26446,7 +26434,7 @@ case stream_node: free_node(p,stream_node_size); @+break; case xdimen_node: free_node(p,xdimen_node_size); -@/@t\4@>@<Cases for wiping out the whatsit node@>@; +@/@<Cases for wiping out the whatsit node@>@/ default:confusion("ext3"); @:this can't happen ext3}{\quad ext3@> } @/ @@ -26459,7 +26447,7 @@ goto done; @ @<Let |d| be the width of the whatsit |p|@>=d=0 -@ @d adv_past(A) if (subtype(A)==language_node) +@ @d adv_past(A) @+if (subtype(A)==language_node) {@+cur_lang=what_lang(A);l_hyf=what_lhm(A);r_hyf=what_rhm(A); set_hyph_index; } @@ -26558,7 +26546,8 @@ end_token_list() /*conserve stack space*/ @.Unbalanced write...@> help2("On this page there's a \\write with fewer real {'s than }'s.",@/ "I can't handle that very well; good luck.");error(); -do get_token(); while (!(cur_tok==end_write_token)); +@/do@+{get_token(); +}@+ while (!(cur_tok==end_write_token)); } @ The |out_what| procedure takes care of outputting whatsit nodes for @@ -27029,9 +27018,9 @@ a=1; print_nl("");print_ln(); loop@+{@+print_nl("### ");print_group(true); if (cur_group==bottom_level) goto done; - do {m=nest[p].mode_field; + @/do@+{m=nest[p].mode_field; if (p > 0) decr(p);else m=vmode; - } while (!(m!=hmode)); + }@+ while (!(m!=hmode)); print(" ("); switch (cur_group) { case simple_group: {@+incr(p);goto found2; @@ -27156,7 +27145,7 @@ scanner_status=s;warning_index=w;def_ref=d; @ The \.{\\showtokens} command displays a token list. -@d show_tokens 5 /* \.{\\showtokens}, must be odd! */ +@d show_tokens 5 /* \.{\\showtokens} , must be odd! */ @<Generate all \eTeX...@>= primitive("showtokens", xray, show_tokens); @@ -27179,9 +27168,9 @@ primitive("unexpanded", the, 1);@/ primitive("detokenize", the, show_tokens);@/ @!@:detokenize\_}{\.{\\detokenize} primitive@> -@ @<Cases of |the| for |print_cmd_chr|@>= -if (chr_code==1) print_esc("unexpanded"); -else print_esc("detokenize"); +@ @<Cases of |the| for |print_cmd_chr|@>=; +else if (chr_code==1) print_esc("unexpanded"); +else print_esc("detokenize") @ @<Handle \.{\\unexpanded} or \.{\\detokenize} and |return|@>= if (odd(cur_chr)) @@ -27216,14 +27205,14 @@ case show_ifs: {@+begin_diagnostic();print_nl("");print_ln(); {@+print_nl("### ");print("no active conditionals"); } else{@+p=cond_ptr;n=0; - do {incr(n);p=link(p);@+} while (!(p==null)); + @/do@+{incr(n);p=link(p);@+}@+ while (!(p==null)); p=cond_ptr;t=cur_if;l=if_line;m=if_limit; - do {print_nl("### level ");print_int(n);print(": "); + @/do@+{print_nl("### level ");print_int(n);print(": "); print_cmd_chr(if_test, t); if (m==fi_code) print_esc("else"); print_if_line(l); decr(n);t=subtype(p);l=if_line_field(p);m=type(p);p=link(p); - } while (!(p==null)); + }@+ while (!(p==null)); } } @+break; @@ -27234,17 +27223,17 @@ interaction mode. primitive("interactionmode", set_page_int, 2); @!@:interaction\_mode\_}{\.{\\interactionmode} primitive@> -@ @<Cases of |set_page_int| for |print_cmd_chr|@>= -if (chr_code==2) print_esc("interactionmode"); +@ @<Cases of |set_page_int| for |print_cmd_chr|@>=; +else if (chr_code==2) print_esc("interactionmode") -@ @<Cases for `Fetch the |dead_cycles| or the |insert_penalties|'@>= -if (m==2) cur_val=interaction; +@ @<Cases for `Fetch the |dead_cycles| or the |insert_penalties|'@>=; +else if (m==2) cur_val=interaction @ @<Declare \eTeX\ procedures for use...@>= static void new_interaction(void); -@ @<Cases for |alter_integer|@>= -if (c==2) +@ @<Cases for |alter_integer|@>=; +else if (c==2) {@+if ((cur_val < batch_mode)||(cur_val > error_stop_mode)) {@+print_err("Bad interaction mode"); @.Bad interaction mode@> @@ -27263,8 +27252,8 @@ delimiters to appear between \.{\\left} and \.{\\right}. primitive("middle", left_right, middle_noad); @!@:middle\_}{\.{\\middle} primitive@> -@ @<Cases of |left_right| for |print_cmd_chr|@>= -if (chr_code==middle_noad) print_esc("middle"); +@ @<Cases of |left_right| for |print_cmd_chr|@>=; +else if (chr_code==middle_noad) print_esc("middle") @ The |scan_tokens| feature of \eTeX\ defines the \.{\\scantokens} primitive. @@ -27273,11 +27262,11 @@ primitive. primitive("scantokens", input, 2); @!@:scan\_tokens\_}{\.{\\scantokens} primitive@> -@ @<Cases of |input| for |print_cmd_chr|@>= -if (chr_code==2) print_esc("scantokens"); +@ @<Cases of |input| for |print_cmd_chr|@>=; +else if (chr_code==2) print_esc("scantokens") -@ @<Cases for |input|@>= -if (cur_chr==2) pseudo_start(); +@ @<Cases for |input|@>=; +else if (cur_chr==2) pseudo_start() @ The global variable |pseudo_files| is used to maintain a stack of pseudo files. The |info| field of each pseudo file points to a linked @@ -27403,8 +27392,8 @@ while (pseudo_files!=null) pseudo_close(); /*flush pseudo files*/ primitive("readline", read_to_cs, 1);@/ @!@:read\_line\_}{\.{\\readline} primitive@> -@ @<Cases of |read| for |print_cmd_chr|@>= -print_esc("readline"); +@ @<Cases of |read| for |print_cmd_chr|@>=; +else print_esc("readline") @ @<Handle \.{\\readline} and |goto done|@>= if (j==1) @@ -27479,9 +27468,9 @@ preceding the mandatory \.{\\endcsname} have been expanded). @<Cases for |conditional|@>= case if_cs_code: {@+n=get_avail();p=n; /*head of the list of characters*/ - do {get_x_token(); + @/do@+{get_x_token(); if (cur_cs==0) store_new_token(cur_tok); - } while (!(cur_cs!=0)); + }@+ while (!(cur_cs!=0)); if (cur_cmd!=end_cs_name) @<Complain about missing \.{\\endcsname}@>; @<Look up the characters of list |n| in the hash table, and set |cur_cs|@>; flush_list(n); @@ -27523,8 +27512,8 @@ or during \.{\\write}. primitive("protected", prefix, 8); @!@:protected\_}{\.{\\protected} primitive@> -@ @<Cases of |prefix| for |print_cmd_chr|@>= -if (chr_code==8) print_esc("protected"); +@ @<Cases of |prefix| for |print_cmd_chr|@>=; +else if (chr_code==8) print_esc("protected") @ The |get_x_or_protected| procedure is like |get_x_token| except that protected macros are not expanded. @@ -27762,7 +27751,7 @@ resume: if (s==expr_none) o=l;@+else o=int_val; found: @<Scan the next operator and set |o|@>; arith_error=b; @<Make sure that |f| is in the proper range@>; -switch (s) {@t\4@>@<Cases for evaluation of the current term@>@; +switch (s) {@<Cases for evaluation of the current term@>@; } /*there are no other cases*/ if (o > expr_sub) s=o;@+else@<Evaluate the current expression@>; b=arith_error; @@ -28423,12 +28412,12 @@ else{@+if (sa_index(q) < mu_val_limit) else if (sa_ptr(q)!=null) return; s=pointer_node_size; } -do {i=hex_dig4(sa_index(q));p=q;q=link(p);free_node(p, s); +@/do@+{i=hex_dig4(sa_index(q));p=q;q=link(p);free_node(p, s); if (q==null) /*the whole tree has been freed*/ {@+sa_root[i]=null;return; } delete_sa_ptr;s=index_node_size; /*node |q| is an index node*/ -} while (!(sa_used(q) > 0)); +}@+ while (!(sa_used(q) > 0)); } @ The |print_sa_num| procedure prints the register number corresponding @@ -28531,7 +28520,7 @@ if (l < 4) /*|q| is an index node*/ } else /*|q| is the node for a mark class*/ {@+switch (a) { - @t\4@>@<Cases for |do_marks|@>@; + @<Cases for |do_marks|@>@; } /*there are no other cases*/ if (sa_bot_mark(q)==null) if (sa_split_bot_mark(q)==null) {@+free_node(q, mark_class_node_size);q=null; @@ -28808,7 +28797,7 @@ at by |sa_chain| @<Declare \eTeX\ procedures for tr...@>= static void sa_restore(void) {@+pointer p; /*sparse array element*/ -do {p=sa_loc(sa_chain); +@/do@+{p=sa_loc(sa_chain); if (sa_lev(p)==level_one) {@+if (sa_index(p) >= dimen_val_limit) sa_destroy(sa_chain); #ifdef @!STAT @@ -28831,7 +28820,7 @@ delete_sa_ref(p); p=sa_chain;sa_chain=link(p); if (sa_index(p) < dimen_val_limit) free_node(p, word_node_size); else free_node(p, pointer_node_size); -} while (!(sa_chain==null)); +}@+ while (!(sa_chain==null)); } @ When reading \.{\\patterns} while \.{\\savinghyphcodes} is positive @@ -28852,8 +28841,8 @@ hyph_root=0;hyph_start=0; @ @<Store hyphenation codes for current language@>= {@+c=cur_lang;first_child=false;p=0; -do {q=p;p=trie_r[q]; -} while (!((p==0)||(c <= so(trie_c[p])))); +@/do@+{q=p;p=trie_r[q]; +}@+ while (!((p==0)||(c <= so(trie_c[p])))); if ((p==0)||(c < so(trie_c[p]))) @<Insert a new trie node between |q| and |p|, and make |p| point to it@>; q=p; /*now node |q| represents |cur_lang|*/ @@ -28931,9 +28920,9 @@ primitive("pagediscards", un_vbox, last_box_code);@/ primitive("splitdiscards", un_vbox, vsplit_code);@/ @!@:split\_discards\_}{\.{\\splitdiscards} primitive@> -@ @<Cases of |un_vbox| for |print_cmd_chr|@>= -if (chr_code==last_box_code) print_esc("pagediscards"); -else if (chr_code==vsplit_code) print_esc("splitdiscards"); +@ @<Cases of |un_vbox| for |print_cmd_chr|@>=; +else if (chr_code==last_box_code) print_esc("pagediscards"); +else if (chr_code==vsplit_code) print_esc("splitdiscards") @ @<Handle saved items and |goto done|@>= {@+link(tail)=disc_ptr[cur_chr];disc_ptr[cur_chr]=null; @@ -28993,7 +28982,7 @@ expand_depth_count=0; @* The extended features of \Prote. \Prote\ extends furthermore \eTeX\ i.e. \eTeX\ is thus required before adding \Prote\ own extensions. But if \eTeX\ mode has not -be enabled, the engine is still compatible with \TeX\ with no added +be enabled, the engine is still compatible with \TeX with no added primitive commands and with a modification of code---from \eTeX\ exclusively for now---that is sufficiently minor so that the engine still deserves the name \TeX. @@ -29288,7 +29277,7 @@ hash since |no_new_control_sequence| is |true|), but since it has the for a control sequence entered but never defined. @ @<Cases for |conditional|@>= -case if_primitive_code: {@+do get_token(); while (!(cur_tok!=space_token)); +case if_primitive_code: {@+@/do@+{get_token();}@+ while (!(cur_tok!=space_token)); if ((cur_cs!=0)&&(cur_cmd!=undefined_cs)&&(cur_cmd < call)) b=true;else b=false; } @+break; @@ -29650,7 +29639,7 @@ dependent. The information shall be set in |xchg_buffer|. @^system dependencies@> In this basic implementation, we set the string to the empty one by -simply setting |xchg_buffer_length| to~$0$. +simply setting |xchg_buffer_length| to $0$. @d get_file_mtime xchg_buffer_length=0 @@ -29727,10 +29716,10 @@ case file_dump_code: { FILE *f=fopen((char*)name_of_file0,"rb"); if (f!=NULL) {@+ fseek(f,k,SEEK_SET); - do {i=fgetc(f); if (i==EOF) break; + do@+{i=fgetc(f); if (i==EOF) break; dig[0]=i%16;dig[1]=i/16; print_the_digs(2);decr(l); - } while (!(feof(f)||(l==0))); + }@+ while (!(feof(f)||(l==0))); fclose(f); } } @+break; @@ -29830,7 +29819,7 @@ communicate with the routines. @ To obtain the MD5 hash signature of a file will need an external implementation, since the algorithm requires bitwise operation that -standard \PASCAL\ does not provide. So we do not bother to try. The +standard \PASCAL does not provide. So we do not bother to try. The present implementation returns nothing. @^system dependencies@> @@ -30015,7 +30004,7 @@ else{@+n=(n-1)*mpfract_one; } } -@ The |do {| loop here preserves the following invariant relations +@ The |@/do@+{| loop here preserves the following invariant relations between |f|, |p|, and~|q|: (i)~|0 <= p < q|; (ii)~$fq+p=2^k(q+p_0)$, where $k$ is an integer and $p_0$ is the original value of~$p$. @@ -30030,11 +30019,11 @@ in a register, not store it in memory. @<Compute $f=\lfloor 2^{28}(1+p/q)+{1\over2}\rfloor$@>= f=1; -do {be_careful=p-q;p=be_careful+p; +@/do@+{be_careful=p-q;p=be_careful+p; if (p >= 0) f=f+f+1; else{@+double(f);p=p+q; } -} while (!(f >= mpfract_one)); +}@+ while (!(f >= mpfract_one)); be_careful=p-q; if (be_careful+p >= 0) incr(f) @@ -30057,7 +30046,7 @@ else{@+n=f/mpfract_one;f=f%mpfract_one; } } f=f+mpfract_one; -@<Compute $p=\lfloor qf/2^{28}+{1\over2}\rfloor-q$@>@; +@<Compute $p=\lfloor qf/2^{28}+{1\over2}\rfloor-q$@>; be_careful=n-el_gordo; if (be_careful+p > 0) {@+arith_error=true;n=el_gordo-p; @@ -30082,12 +30071,12 @@ $f_0$ is the original value of~$f$; (ii)~$2^k\L f<2^{k+1}$. @<Compute $p=\lfloor qf/2^{28}+{1\over2}\rfloor-q$@>= p=mpfract_half; /*that's $2^{27}$; the invariants hold now with $k=28$*/ if (q < mpfract_four) - do {if (odd(f)) p=halfp(p+q);@+else p=halfp(p); + @/do@+{if (odd(f)) p=halfp(p+q);@+else p=halfp(p); f=halfp(f); - } while (!(f==1)); -else do {if (odd(f)) p=p+halfp(q-p);@+else p=halfp(p); + }@+ while (!(f==1)); +else@/do@+{if (odd(f)) p=p+halfp(q-p);@+else p=halfp(p); f=halfp(f); - } while (!(f==1)); + }@+ while (!(f==1)) @ There's an auxiliary array |randoms| that contains 55 pseudo-random fractions. Using the recurrence $x_n=(x_{n-55}-x_{n-31})\bmod 2^{28}$, @@ -30275,15 +30264,15 @@ can readily be obtained with the ratio method (Algorithm 3.4.1R in static scaled norm_rand(void) {@+int @!x, @!u, @!l; /*what the book would call $2^{16}X$, $2^{28}U$, and $-2^{24}\ln U$*/ -do { - do {next_random; +@/do@+{ + @/do@+{next_random; x=take_mpfract(112429, randoms[j_random]-mpfract_half); /*$2^{16}\sqrt{8/e}\approx 112428.82793$*/ next_random;u=randoms[j_random]; - } while (!(abs(x) < u)); + }@+ while (!(abs(x) < u)); x=make_mpfract(x, u); l=139548960-m_log(u); /*$2^{24}\cdot12\ln2\approx139548959.6165$*/ -} while (!(ab_vs_cd(1024, l, x, x) >= 0)); +}@+ while (!(ab_vs_cd(1024, l, x, x) >= 0)); return x; } @@ -31171,8 +31160,8 @@ if (option_no_empty_page && ((eject && penalty(p)>2*(eject_penalty)) || (page_contents==empty && !is_visible(p)))) { pointer r, prev_r = p; - loop@+{ - r =link(prev_r); + while (true) + { r =link(prev_r); if (r==null) return; else if (is_visible(r)) break; else if (type(r)==penalty_node && penalty(r)<=eject_penalty) @@ -32017,14 +32006,15 @@ static pointer new_setpage_node(uint8_t i, str_number n) for (p=link(prev_p); p!=null; prev_p=p,p=link(p)) if (setpage_id(p)==i) break; if (p==null) - @<Allocate a new |setpage_node| |p|@>@; + @<allocate a new |setpage_node| |p|@>@; else link(prev_p)=link(p); link(p)=link(setpage_head); link(setpage_head)=p; return p; } -@ @<Allocate a new |setpage_node| |p|@>= +@ +@<allocate a new |setpage_node| |p|@>= { p=get_node(setpage_node_size);type(p)=whatsit_node;subtype(p)=setpage_node; setpage_number(p)=max_ref[page_kind]=++max_page; setpage_id(p)=i; @@ -32111,7 +32101,7 @@ static void hint_open(void) output_file_name=make_name_string(); DBG(DBGBASIC,"Output file %s opened\n",(char *)name_of_file+1); } -@# + #define HITEX_VERSION "1.1" static void hput_definitions(); extern int option_global; @@ -32326,7 +32316,7 @@ but we will need it repeatedly in the function |hdef_param_node| and the overhea not warrant having the mapping in both directions. @<Hi\TeX\ variables@>= -static const int hmap_int[] ={@t\1\1@>@/ +static const int hmap_int[] ={@/ pretolerance_no, /* |pretolerance_code| 0 */ tolerance_no, /* |tolerance_code| 1 */ line_penalty_no, /* |line_penalty_code| 2 */ @@ -32369,7 +32359,7 @@ year_no, /* |year_code| 23 */ -1, /* |output_penalty_code| 39 */ -1, /* |max_dead_cycles_code| 40 */ hang_after_no, /* |hang_after_code| 41*/ -@t\2\2@> floating_penalty_no /* |floating_penalty_code| 42*/ +floating_penalty_no /* |floating_penalty_code| 42*/ }; @@ -32381,7 +32371,7 @@ hang_after_no, /* |hang_after_code| 41*/ if ( hmap_int[i]>=0) int_defined[hmap_int[i]]=int_par(i); max_ref[int_kind]=MAX_INT_DEFAULT; @ The function |hget_int_no| tries to allocate a predefined integer number; -if not successful, it returns~$-1$. +if not successful, it returns $-1$. @<Hi\TeX\ auxiliary routines@>= static int hget_int_no(int32_t n) @@ -32424,7 +32414,7 @@ We proceed as we did for integers, starting with the array that holds the define @<Hi\TeX\ variables@>= static scaled dimen_defined[0x100]={0}; @ @<Hi\TeX\ variables@>= -static const int hmap_dimen[] ={@t\1\1@>@/ +static const int hmap_dimen[] ={@/ -1, /* |par_indent_code| 0 */ -1, /* |math_surround_code| 1 */ line_skip_limit_no, /* |line_skip_limit_code| 2 */ @@ -32445,7 +32435,7 @@ static const int hmap_dimen[] ={@t\1\1@>@/ hang_indent_no, /* |hang_indent_code| 17 */ -1, /* |h_offset_code| 18 */ -1, /* |v_offset_code| 19 */ - @t\2\2@> emergency_stretch_no /* |emergency_stretch_code| 20 */ + emergency_stretch_no /* |emergency_stretch_code| 20 */ }; @ @<Fix definitions for dimension parameters@>= dimen_defined[zero_dimen_no]=0; @@ -32551,7 +32541,8 @@ glue specifications and often a simple comparison of pointers might suffice. @<Hi\TeX\ variables@>= static pointer glue_defined[0x100]; @ @<Hi\TeX\ variables@>= -static int hmap_glue[] ={@t\1\1@>@/ +static int hmap_glue[] ={ + line_skip_no, /* |line_skip_code| 0 */ baseline_skip_no, /* |baseline_skip_code| 1 */ -1, /* |par_skip_code| 2 */ @@ -32566,7 +32557,7 @@ split_top_skip_no, /* |split_top_skip_code| 10 */ tab_skip_no, /* |tab_skip_code| 11 */ -1, /* |space_skip_code| 12 */ -1, /* |xspace_skip_code| 13 */ -@t\2\2@> par_fill_skip_no /* |par_fill_skip_code| 14 */ +par_fill_skip_no /* |par_fill_skip_code| 14 */ }; @ @<Fix definitions for glue parameters@>= glue_defined[zero_skip_no]=zero_glue; incr(glue_ref_count(zero_glue)); @@ -32818,8 +32809,8 @@ static bool node_equal(pointer p, pointer q) } static bool list_equal(pointer p, pointer q) -{@+loop@+{ - if (p==q) return true; +{@+while (true) + { if (p==q) return true; if (p==null || q==null) return false; if (!node_equal(p,q)) return false; p=link(p);q=link(q); @@ -34397,7 +34388,7 @@ static const char *option_mfmode="ljfour", *option_dpi_str="600"; extern int option_compress; extern unsigned int debugflags; -static struct option long_options[] = {@t\1\1@>@/ +static struct option long_options[] = {@/ { "help", 0, 0, 0 },@/ { "version", 0, 0, 0 },@/ { "interaction", 1, 0, 0 },@/ @@ -34428,8 +34419,8 @@ static struct option long_options[] = {@t\1\1@>@/ { "hint-debug", 1, 0, 0 },@/ { "hint-debug-help", 0, 0, 0 },@/ #endif -@t\2\2@> { 0, 0, 0, 0 } @/ -}; + { 0, 0, 0, 0 }@+}@+; + @ Parsing the command line options is accomplished with the |parse_options| function which in turn uses the |getopt_long_only| @@ -34438,7 +34429,7 @@ function from the \CEE/ library. This function returns 0 and sets the the end of all options is reached. @<\TeX\ Live functions@>= static void parse_options (int argc, char *argv[]) -{@+ loop @+ { +{@+ while (true) { int option_index; int g = getopt_long_only (argc, argv, "+", long_options, &option_index); if (g==0) @@ -34488,7 +34479,7 @@ the option structure. #include <kpathsea/kpathsea.h> static int argument_is(struct option *opt, char * s) {@+ return STREQ(opt->name, s); @+} -#define ARGUMENT_IS(S) @[argument_is(long_options+option_index,S)@] +#define ARGUMENT_IS(S) argument_is(long_options+option_index,S) @ Now we can handle the first two options: @@ -35111,7 +35102,7 @@ last=first; while (optind < argc) input_add_str(argv[optind++]); loc=first; return (loc < last); -} +@+ } @ @<Forward declarations@>= static int input_command_line(void); @@ -35169,9 +35160,8 @@ static bool b_open_out(byte_file *f) /*open a binary file for output*/ {@+f->f=open_out((char *)name_of_file+1,"wb"); return f->f!=NULL && ferror(f->f)==0;@+ } -@# + #ifdef @!INIT -@+@t}\6\4\4{@> static bool w_open_out(word_file *f) /*open a word file for output*/ {@+f->f=open_out((char *)name_of_file+1,"wb"); return f->f!=NULL && ferror(f->f)==0;@+ @@ -35359,8 +35349,6 @@ static int get_md5_sum(int s, int file); @ The code that follows was taken from the \.{texmfmp.c} file of the \TeX\ Live distribution and slightly modified. -@s md5_byte_t int -@s md5_state_t int @<\TeX\ Live auxiliary functions@>= @@ -35419,17 +35407,17 @@ make_time_str(time_t t, bool utc) static void get_creation_date(void) { make_time_str(start_time,source_date_epoch!=NULL); } -@# -#ifdef WIN32 + /* static structure for file status set by |find_input_file| */ -@+@t}\6{@> +#ifdef WIN32 static struct _stat file_stat; -#define GET_FILE_STAT @[_stat(fname,&file_stat)@] +#define GET_FILE_STAT _stat(fname,&file_stat) #else static struct stat file_stat; -#define GET_FILE_STAT @[stat(fname,&file_stat)@] +#define GET_FILE_STAT stat(fname,&file_stat) #endif + static char* find_input_file(void) { char *fname; int r; diff --git a/Build/source/texk/web2c/man/ChangeLog b/Build/source/texk/web2c/man/ChangeLog index f82821f1847..b047bb6abf4 100644 --- a/Build/source/texk/web2c/man/ChangeLog +++ b/Build/source/texk/web2c/man/ChangeLog @@ -1,3 +1,7 @@ +2024-08-12 Andreas Scherer <https://ascherer.github.io> + + * ctwill.man: CWEB 4.12 release. + 2024-04-14 TANAKA Takuji <ttk@t-lab.opal.ne.jp> * Makefile.am: Remove eptex. diff --git a/Build/source/texk/web2c/man/ctwill.man b/Build/source/texk/web2c/man/ctwill.man index 50437193073..a30dcd6a0be 100644 --- a/Build/source/texk/web2c/man/ctwill.man +++ b/Build/source/texk/web2c/man/ctwill.man @@ -1,6 +1,6 @@ .\" Automatically generated by Pandoc .\" -.TH "CTWILL" "1" "March 10, 2024" "Web2c @VERSION@" "General Commands Manual" +.TH "CTWILL" "1" "August 12, 2024" "Web2c @VERSION@" "General Commands Manual" .SH NAME ctwill, ctwill-proofsort, ctwill-refsort, ctwill-twinx \- translate CWEB to TeX with mini-indexes @@ -122,7 +122,7 @@ The present incarnation of \f[B]ctwill\f[R] and its utilities tries hard to be a drop-in replacement for the original package. There are, however, a few differences worth noting: .IP \[bu] 2 -This version is based on the most recent version of CWEB (4.11). +This version is based on the most recent version of CWEB (4.12). .IP \[bu] 2 In TeX\ Live the utility programs are prefixed with \f[B]ctwill\-\f[R] and the macro files with \f[B]ct\f[R] for technical reasons. diff --git a/Build/source/texk/web2c/pdftexdir/ChangeLog b/Build/source/texk/web2c/pdftexdir/ChangeLog index 75b70a5ff71..ee5e17bb9f3 100644 --- a/Build/source/texk/web2c/pdftexdir/ChangeLog +++ b/Build/source/texk/web2c/pdftexdir/ChangeLog @@ -1,3 +1,7 @@ +2024-08-04 Thanh Han The <hanthethanh@gmail.com> + + * pdftoepdf.cc (write_epdf): reversed sep and pdfkeyprefix. + 2024-07-26 Andreas Scherer <https://ascherer.github.io> * pdftex.ch: Prepare for compilation with gcc-14. diff --git a/Build/source/texk/web2c/pdftexdir/pdftoepdf.cc b/Build/source/texk/web2c/pdftexdir/pdftoepdf.cc index 238ed4dba5d..237bd6530c4 100644 --- a/Build/source/texk/web2c/pdftexdir/pdftoepdf.cc +++ b/Build/source/texk/web2c/pdftexdir/pdftoepdf.cc @@ -846,18 +846,18 @@ void write_epdf(void) // write additional information if ((suppress_ptex_info & MASK_SUPPRESS_PTEX_FILENAME) == 0) { - pdf_printf("/%s%sFileName (%s)\n", sep, pdfkeyprefix, + pdf_printf("/%s%sFileName (%s)\n", pdfkeyprefix, sep, convertStringToPDFString(pdf_doc->file_name, strlen(pdf_doc->file_name))); } if ((suppress_ptex_info & MASK_SUPPRESS_PTEX_PAGENUMBER) == 0) { - pdf_printf("/%s%sPageNumber %i\n", sep, pdfkeyprefix, (int) epdf_selected_page); + pdf_printf("/%s%sPageNumber %i\n", pdfkeyprefix, sep, (int) epdf_selected_page); } if ((suppress_ptex_info & MASK_SUPPRESS_PTEX_INFODICT) == 0) { pdf_doc->doc->getDocInfoNF(&info); if (info.isRef()) { // the info dict must be indirect (PDF Ref p. 61) - pdf_printf("/%s%sInfoDict ", sep, pdfkeyprefix); + pdf_printf("/%s%sInfoDict ", pdfkeyprefix, sep); pdf_printf("%d 0 R\n", addOther(info.getRef())); } } diff --git a/Build/source/texk/web2c/pktogf.ch b/Build/source/texk/web2c/pktogf.ch index bd468f2a9de..1dc768e46e0 100644 --- a/Build/source/texk/web2c/pktogf.ch +++ b/Build/source/texk/web2c/pktogf.ch @@ -79,7 +79,7 @@ begin @<Labels...@>=final_end; @y @ This module is deleted, because it is only useful for -a non-local goto, which we don't use in C. +a non-local |goto|\unskip, which we don't use in C. @z % [6] Remove terminal_line_length, since there is no dialog, and diff --git a/Build/source/texk/web2c/pktype.ch b/Build/source/texk/web2c/pktype.ch index b5e64566529..df785ce8b26 100644 --- a/Build/source/texk/web2c/pktype.ch +++ b/Build/source/texk/web2c/pktype.ch @@ -65,7 +65,7 @@ begin @<Labels...@>=final_end; @y @ This module is deleted, because it is only useful for -a non-local |goto|, which we don't use in C. +a non-local |goto|\unskip, which we don't use in C. @z % [6] No need for |name_length| or |terminal_line_length|. Since these @@ -89,7 +89,7 @@ to the very end of the program with an error message. begin goto final_end; end; @y -@ We use a call to the external C exit to avoid a non-local |goto|. +@ We use a call to the external C exit to avoid a non-local |goto|\unskip. @d abort(#)==begin print_ln(#); uexit(1) end diff --git a/Build/source/texk/web2c/showstream.ch b/Build/source/texk/web2c/showstream.ch index d0347a795c4..17a6a70e401 100644 --- a/Build/source/texk/web2c/showstream.ch +++ b/Build/source/texk/web2c/showstream.ch @@ -72,7 +72,7 @@ show_lists_code: begin begin_diagnostic; show_activities; end; @y show_lists_code: - begin @<Adjust |selector| based on |show_stream|@> + begin @<Adjust |selector| based on |show_stream|@>@; begin_diagnostic; show_activities; end; @z @@ -132,13 +132,9 @@ While the other cases have separate blocks @ @<Show the current meaning of a token...@>= begin get_token; @y -@ @<Adjust |selector| based on |show_stream|@>= -if (show_stream>=0) and (show_stream<no_print) and write_open[show_stream] then - selector:=show_stream; - @ @<Show the current meaning of a token...@>= begin get_token; - @<Adjust |selector| based on |show_stream|@> + @<Adjust |selector| based on |show_stream|@>@; @z @x @@ -147,7 +143,7 @@ begin scan_register_num; fetch_box(p); begin_diagnostic; @y @ @<Show the current contents of a box@>= begin scan_register_num; fetch_box(p); -@<Adjust |selector| based on |show_stream|@> +@<Adjust |selector| based on |show_stream|@>@; begin_diagnostic; @z @@ -157,19 +153,29 @@ begin p:=the_toks; @y @ @<Show the current value of some parameter...@>= begin p:=the_toks; -@<Adjust |selector| based on |show_stream|@> +@<Adjust |selector| based on |show_stream|@>@; @z @x show_groups: begin begin_diagnostic; show_save_groups; @y -show_groups: begin @<Adjust |selector| based on |show_stream|@> +show_groups: begin @<Adjust |selector| based on |show_stream|@>@; begin_diagnostic; show_save_groups; @z @x show_ifs: begin begin_diagnostic; print_nl(""); print_ln; @y -show_ifs: begin @<Adjust |selector| based on |show_stream|@> +show_ifs: begin @<Adjust |selector| based on |show_stream|@>@; begin_diagnostic; print_nl(""); print_ln; @z + +@x +@* \[55] Index. +@y +@ @<Adjust |selector| based on |show_stream|@>= +if (show_stream>=0) and (show_stream<no_print) and write_open[show_stream] then + selector:=show_stream; + +@* \[55] Index. +@z diff --git a/Build/source/texk/web2c/vftovp.ch b/Build/source/texk/web2c/vftovp.ch index 6b423e33408..e9c8f3ff2b5 100644 --- a/Build/source/texk/web2c/vftovp.ch +++ b/Build/source/texk/web2c/vftovp.ch @@ -49,7 +49,7 @@ procedure initialize; {this procedure gets things started properly} var @!k:integer; {all-purpose index for initialization} begin print_ln(banner);@/ @y -@<Define |parse_arguments|@> +@<Define \(p)|parse_arguments|@> procedure initialize; {this procedure gets things started properly} var @!k:integer; {all-purpose index for initialization} begin @@ -546,7 +546,7 @@ Parse a Unix-style command line. @d argument_is (#) == (strcmp (long_options[option_index].name, #) = 0) -@<Define |parse_arguments|@> = +@<Define \(p)|parse_arguments|@> = procedure parse_arguments; const n_options = 4; {Pascal won't count array lengths for us.} var @!long_options: array[0..n_options] of getopt_struct; @@ -555,7 +555,7 @@ var @!long_options: array[0..n_options] of getopt_struct; @!current_option: 0..n_options; begin @<Initialize the option variables@>; - @<Define the option table@>; + @<Define \(t)the option table@>; repeat getopt_return_val := getopt_long_only (argc, argv, '', long_options, address_of (option_index)); @@ -602,7 +602,7 @@ end; @ Here are the options we allow. The first is one of the standard GNU options. @.-help@> -@<Define the option...@> = +@<Define \(t)the option...@> = current_option := 0; long_options[current_option].name := 'help'; long_options[current_option].has_arg := 0; @@ -613,7 +613,7 @@ incr (current_option); @ Another of the standard options. @.-version@> -@<Define the option...@> = +@<Define \(t)the option...@> = long_options[current_option].name := 'version'; long_options[current_option].has_arg := 0; long_options[current_option].flag := 0; @@ -623,7 +623,7 @@ incr (current_option); @ Print progress information? @.-verbose@> -@<Define the option...@> = +@<Define \(t)the option...@> = long_options[current_option].name := 'verbose'; long_options[current_option].has_arg := 0; long_options[current_option].flag := address_of (verbose); @@ -644,7 +644,7 @@ verbose := false; @ Here is an option to change how we output character codes. @.-charcode-format@> -@<Define the option...@> = +@<Define \(t)the option...@> = long_options[current_option].name := 'charcode-format'; long_options[current_option].has_arg := 1; long_options[current_option].flag := 0; @@ -672,7 +672,7 @@ charcode_format := charcode_default; @ An element with all zeros always ends the list. -@<Define the option...@> = +@<Define \(t)the option...@> = long_options[current_option].name := 0; long_options[current_option].has_arg := 0; long_options[current_option].flag := 0; diff --git a/Build/source/texk/web2c/weav-twill.ch b/Build/source/texk/web2c/weav-twill.ch index 17c02718758..0c556a098ba 100644 --- a/Build/source/texk/web2c/weav-twill.ch +++ b/Build/source/texk/web2c/weav-twill.ch @@ -51,9 +51,11 @@ Limbo. \def\title{TWILL for \TeX~Live} @z -@x 48c24 +@x 47c23 + \def\rheader{\mainfont Appendix D\hfil \contentspagenumber} \centerline{\titlefont The {\ttitlefont WEAVE} processor} @y + \def\rheader{\mainfont Appendix D${}'$\hfil \contentspagenumber} \centerline{\titlefont The {\ttitlefont TWILL} processor} @z |