# It is necessary if you want to build targets usually of interest
# only to the maintainer.
-# Copyright (C) 2001, 2003, 2006-2024 Free Software Foundation, Inc.
+# Copyright (C) 2001, 2003, 2006-2026 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# Ensure that $(VERSION) is up to date for dist-related targets, but not
# for others: rerunning autoreconf and recompiling everything isn't cheap.
+# This is not part of the essential workflow with .tarball-version. Rather,
+# it is meant to help the maintainer who has changed the current version
+# but not done a "make distclean".
_have-git-version-gen := \
$(shell test -f $(srcdir)/$(_build-aux)/git-version-gen && echo yes)
ifeq ($(_have-git-version-gen)0,yes$(MAKELEVEL))
# Generate a release announcement message.
-# Copyright (C) 2002-2024 Free Software Foundation, Inc.
+# Copyright (C) 2002-2026 Free Software Foundation, Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
#
# Written by Jim Meyering
-# This is a prologue that allows to run a perl script as an executable
+# This prologue allows running a perl script as an executable
# on systems that are compliant to a POSIX version before POSIX:2017.
# On such systems, the usual invocation of an executable through execlp()
# or execvp() fails with ENOEXEC if it is a script that does not start
eval 'exec perl -wSx "$0" "$@"'
if 0;
-my $VERSION = '2023-12-29 18:26'; # UTC
+my $VERSION = '2025-11-26 21:27'; # UTC
# The definition above must lie within the first 8 lines in order
# for the Emacs time-stamp write hook (at end) to update it.
# If you change this file with Emacs, please let the write hook
# do its job. Otherwise, update this string manually.
-my $copyright_year = '2022';
+(my $copyright_year = $VERSION) =~ s/^(\d*)-.*$/$1/;
use strict;
use Getopt::Long;
(my $ME = $0) =~ s|.*/||;
my %valid_release_types = map {$_ => 1} qw (alpha beta stable);
-my @archive_suffixes = qw (tar.gz tar.bz2 tar.lz tar.lzma tar.xz);
+my @archive_suffixes = qw (tar.gz tar.bz2 tar.bz3 tar.lz tar.lzma tar.xz
+ tar.zst zip);
my $srcdir = '.';
sub usage ($)
sign the tarballs
--gpg-keyring-url=URL URL pointing to keyring containing the key used
to sign the tarballs
- --no-print-checksums do not emit SHA1 or SHA256 checksums
+ --no-print-checksums do not emit SHA256 or SHA3-256 checksums
+ --cksum-checksums emit SHA256 and SHA3-256 checksums in a form
+ that requires cksum from coreutils or OpenBSD
--archive-suffix=SUF add SUF to the list of archive suffixes
--mail-headers=HEADERS a space-separated list of mail headers, e.g.,
To: x\@example.com Cc: y-announce\@example.com,...
--help display this help and exit
--version output version information and exit
+Send patches and bug reports to <bug-gnulib\@gnu.org>.
EOF
}
exit $exit_code;
}
+=over
-=item C<%size> = C<sizes (@file)>
+=item C<%size = sizes (@file)>
Compute the sizes of the C<@file> and return them as a hash. Return
C<undef> if one of the computation failed.
my %res;
foreach my $f (@file)
{
- my $cmd = "du -h $f";
+ my $cmd = "du -h -L $f";
my $t = `$cmd`;
# FIXME-someday: give a better diagnostic, a la $PROCESS_STATUS
$@
return $fail ? undef : %res;
}
-=item C<print_locations ($title, \@url, \%size, @file)
+=item C<print_locations ($title, \@url, \%size, @file)>
-Print a section C<$title> dedicated to the list of <@file>, which
+Print a section C<$title> dedicated to the list of C<@file>, which
sizes are stored in C<%size>, and which are available from the C<@url>.
=cut
print "\n";
}
-=item C<print_checksums (@file)
+=item C<print_checksums (@file)>
-Print the SHA1 and SHA256 signature section for each C<@file>.
+Print the SHA256 and SHA3-256 signature section for each C<@file>.
=cut
# This digest function omits the "=" padding that is required by cksum,
# so add the 0..2 bytes of padding required for each of Digest's algorithms.
+# To verify such a digest, users need
+# - a particular command ('cksum -a sha256 --check')
+# - and particular tools (coreutils >= 9.2 or OpenBSD's cksum since 2007).
sub digest_file_base64_wrap ($$)
{
my ($file, $alg) = @_;
my $h = digest_file_base64($file, $alg);
$alg =~ tr{-}{}d;
- my %pad = (MD5 => 2, SHA1 => 1, SHA256 => 1, SHA384 => 0, SHA512 => 2);
- return $h . '=' x $pad{$alg};
+ my %pad = (MD5 => 2, SHA1 => 1, SHA256 => 1, SHA384 => 0, SHA512 => 2,
+ SHA3256 => 1, SHA3384 => 0, SHA3512 => 2);
+ (my $alg_tag = $alg) =~ s/^SHA3(\d{3})/SHA3-$1/;
+ return $alg_tag . " (" . $file . ") = " . $h . '=' x $pad{$alg};
}
-sub print_checksums (@)
+sub print_checksums ($@)
{
- my (@file) = @_;
+ my ($prefer_cksum, @file) = @_;
- print "Here are the SHA1 and SHA256 checksums:\n";
+ print "Here are the SHA256 and SHA3-256 checksums:\n";
print "\n";
use Digest::file qw(digest_file_hex digest_file_base64);
- foreach my $f (@file)
+ if ($prefer_cksum)
{
- print ' ', digest_file_hex ($f, "SHA-1"), " $f\n";
- print ' ', digest_file_base64_wrap ($f, "SHA-256"), " $f\n";
+ foreach my $f (@file)
+ {
+ print ' ', digest_file_base64_wrap ($f, "SHA-256"), "\n";
+ print ' ', digest_file_base64_wrap ($f, "SHA3-256"), "\n";
+ }
+ print "\nVerify the base64 SHA256 checksum with 'cksum -a sha256 --check'\n";
+ print "from coreutils-9.2 or OpenBSD's cksum since 2007.\n";
+ print "\nVerify the base64 SHA3-256 checksum with 'cksum -a sha3 --check'\n";
+ print "from coreutils-9.8.\n\n";
+ }
+ else
+ {
+ foreach my $f (@file)
+ {
+ print " File: $f\n";
+ print ' SHA256 sum: ', digest_file_hex ($f, "SHA-256"), "\n";
+ print ' SHA3-256 sum: ', digest_file_hex ($f, "SHA3-256"), "\n";
+ print "\n";
+ }
+ print "Verify the SHA256 checksum with either sha256sum, sha256, or\n";
+ print "'shasum -a 256'.\n";
+ print "\nVerify the SHA3-256 checksum with 'cksum -a sha3 -l 256 --base64'\n";
+ print "from coreutils-9.8.\n\n";
}
- print "\nVerify the base64 SHA256 checksum with cksum -a sha256 --check\n";
- print "from coreutils-9.2 or OpenBSD's cksum since 2007.\n\n";
}
-=item C<print_news_deltas ($news_file, $prev_version, $curr_version)
+=item C<print_news_deltas ($news_file, $prev_version, $curr_version)>
Print the section of the NEWS file C<$news_file> addressing changes
between versions C<$prev_version> and C<$curr_version>.
# the first occurrence of $prev_version.
my $in_items;
- my $re_prefix = qr/(?:\* )?(?:Noteworthy c|Major c|C)(?i:hanges)/;
+ my $re_prefix = qr/(?:[#*]+ )?(?:Noteworthy c|Major c|C)(?i:hanges)/;
my $found_news;
open NEWS, '<', $news_file
# Assume that the last "word" on the first line of
# 'tool --version' output is the version string.
my ($first_line, undef) = split ("\n", `$t --version`);
- if ($first_line =~ /.* (\d[\w.-]+)$/)
+ if ($first_line =~ /.* ([a-f\d][\w.-]+)$/)
{
$t = ucfirst $t;
push @tool_version_pair, "$t $1";
}
else
{
+ warn "$t: unexpected --version output:\n$first_line";
defined $first_line
and $first_line = '';
- warn "$t: unexpected --version output\n:$first_line";
$fail = 1;
}
}
my $bootstrap_tools;
my $gnulib_version;
my $print_checksums_p = 1;
+ my $cksum_checksums_p;
my $gpg_key_email;
my $gpg_keyring_url;
'bootstrap-tools=s' => \$bootstrap_tools,
'gnulib-version=s' => \$gnulib_version,
'print-checksums!' => \$print_checksums_p,
+ 'cksum-checksums' => \$cksum_checksums_p,
'archive-suffix=s' => \@archive_suffixes,
help => sub { usage 0 },
my $v0 = $prev_version;
my $v1 = $curr_version;
- (my $first_name = `git config user.name|cut -d' ' -f1`)
+ (my $first_name = `git -C "$srcdir" config user.name|cut -d' ' -f1`)
=~ m{\S} or die "no name? set user.name in ~/.gitconfig\n";
- chomp (my $n_ci = `git rev-list "v$v0..v$v1" | wc -l`);
- chomp (my $n_p = `git shortlog "v$v0..v$v1" | grep -c '^[^ ]'`);
+ chomp (my $n_ci = `git -C "$srcdir" rev-list "v$v0..v$v1" | wc -l`);
+ chomp (my $n_p = `git -C "$srcdir" shortlog "v$v0..v$v1" | grep -c '^[^ ]'`);
- my $prev_release_date = `git log --pretty=%ct -1 "v$v0"`;
- my $this_release_date = `git log --pretty=%ct -1 "v$v1"`;
+ my $this_commit_hash = `git -C "$srcdir" log --pretty=%H -1 "v$v1"`;
+ chop $this_commit_hash;
+ my $prev_release_date = `git -C "$srcdir" log --pretty=%ct -1 "v$v0"`;
+ my $this_release_date = `git -C "$srcdir" log --pretty=%ct -1 "v$v1"`;
my $n_seconds = $this_release_date - $prev_release_date;
my $time_since_prev = readable_interval $n_seconds;
- my $names = `git shortlog "v$v0..v$v1"|perl -lne '/^(\\w.*):/ and print " ".\$1'`;
+ my $names = `git -C "$srcdir" shortlog "v$v0..v$v1"|perl -lne '/^(\\w.*):/ and print " ".\$1'`;
print <<EOF;
There have been $n_ci commits by $n_p people in the $time_since_prev since $v0.
Here is the GNU $package_name home page:
https://gnu.org/s/$package_name/
-For a summary of changes and contributors, see:
- https://git.sv.gnu.org/gitweb/?p=$package_name.git;a=shortlog;h=v$v1
-or run this command from a git-cloned $package_name directory:
- git shortlog v$v0..v$v1
-
EOF
if (@url_dir_list == 1 && @tarballs == 1)
}
$print_checksums_p
- and print_checksums (@sizable);
+ and print_checksums ($cksum_checksums_p, @sizable);
print <<EOF;
Use a .sig file to verify that the corresponding file (without the
gpg --keyring gnu-keyring.gpg --verify $tarballs[0].sig
EOF
+ print <<EOF;
+
+This release is based on the $package_name git repository, available as
+
+ git clone https://https.git.savannah.gnu.org/git/$package_name.git
+
+with commit $this_commit_hash tagged as v$v1.
+
+For a summary of changes and contributors, see:
+
+ https://gitweb.git.savannah.gnu.org/gitweb/?p=$package_name.git;a=shortlog;h=v$v1
+
+or run this command from a git-cloned $package_name directory:
+
+ git shortlog v$v0..v$v1
+EOF
+
my @tool_versions = get_tool_versions (\@tool_list, $gnulib_version);
@tool_versions
and print "\nThis release was bootstrapped with the following tools:",
exit 0;
}
+=back
+
+=cut
+
### Setup "GNU" style for perl-mode and cperl-mode.
## Local Variables:
## mode: perl
## perl-label-offset: -2
## perl-extra-newline-before-brace: t
## perl-merge-trailing-else: nil
-## eval: (add-hook 'before-save-hook 'time-stamp)
+## eval: (add-hook 'before-save-hook 'time-stamp nil t)
## time-stamp-line-limit: 50
## time-stamp-start: "my $VERSION = '"
-## time-stamp-format: "%:y-%02m-%02d %02H:%02M"
+## time-stamp-format: "%Y-%02m-%02d %02H:%02M"
## time-stamp-time-zone: "UTC0"
## time-stamp-end: "'; # UTC"
## End:
#! /bin/sh
# Attempt to guess a canonical system name.
-# Copyright 1992-2024 Free Software Foundation, Inc.
+# Copyright 1992-2025 Free Software Foundation, Inc.
# shellcheck disable=SC2006,SC2268 # see below for rationale
-timestamp='2024-01-01'
+timestamp='2025-07-10'
# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
GNU config.guess ($timestamp)
Originally written by Per Bothner.
-Copyright 1992-2024 Free Software Foundation, Inc.
+Copyright 1992-2025 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
dummy=$tmp/dummy
case ${CC_FOR_BUILD-},${HOST_CC-},${CC-} in
,,) echo "int x;" > "$dummy.c"
- for driver in cc gcc c89 c99 ; do
+ for driver in cc gcc c17 c99 c89 ; do
if ($driver -c -o "$dummy.o" "$dummy.c") >/dev/null 2>&1 ; then
CC_FOR_BUILD=$driver
break
sed 's/^ //' << EOF > "$dummy.c"
#include <sys/systemcfg.h>
- main()
+ int
+ main ()
{
if (!__power_pc())
exit(1);
#include <stdlib.h>
#include <unistd.h>
- int main ()
+ int
+ main ()
{
#if defined(_SC_KERNEL_BITS)
long bits = sysconf(_SC_KERNEL_BITS);
*:Unleashed:*:*)
GUESS=$UNAME_MACHINE-unknown-unleashed$UNAME_RELEASE
;;
- *:Ironclad:*:*)
- GUESS=$UNAME_MACHINE-unknown-ironclad
+ x86_64:[Ii]ronclad:*:*|i?86:[Ii]ronclad:*:*)
+ GUESS=$UNAME_MACHINE-pc-ironclad-mlibc
+ ;;
+ *:[Ii]ronclad:*:*)
+ GUESS=$UNAME_MACHINE-unknown-ironclad-mlibc
;;
esac
#endif
#endif
#endif
+int
main ()
{
#if defined (sony)
exit 1
# Local variables:
-# eval: (add-hook 'before-save-hook 'time-stamp)
+# eval: (add-hook 'before-save-hook 'time-stamp nil t)
# time-stamp-start: "timestamp='"
-# time-stamp-format: "%:y-%02m-%02d"
+# time-stamp-format: "%Y-%02m-%02d"
# time-stamp-end: "'"
# End:
#! /bin/sh
# Configuration validation subroutine script.
-# Copyright 1992-2024 Free Software Foundation, Inc.
+# Copyright 1992-2025 Free Software Foundation, Inc.
-# shellcheck disable=SC2006,SC2268 # see below for rationale
+# shellcheck disable=SC2006,SC2268,SC2162 # see below for rationale
-timestamp='2024-01-01'
+timestamp='2025-07-10'
# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
version="\
GNU config.sub ($timestamp)
-Copyright 1992-2024 Free Software Foundation, Inc.
+Copyright 1992-2025 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
esac
# Split fields of configuration type
-# shellcheck disable=SC2162
saved_IFS=$IFS
IFS="-" read field1 field2 field3 field4 <<EOF
$1
# parts
maybe_os=$field2-$field3
case $maybe_os in
- nto-qnx* | linux-* | uclinux-uclibc* \
- | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* \
- | netbsd*-eabi* | kopensolaris*-gnu* | cloudabi*-eabi* \
- | storm-chaos* | os2-emx* | rtmk-nova* | managarm-* \
+ cloudabi*-eabi* \
+ | kfreebsd*-gnu* \
+ | knetbsd*-gnu* \
+ | kopensolaris*-gnu* \
+ | ironclad-* \
+ | linux-* \
+ | managarm-* \
+ | netbsd*-eabi* \
+ | netbsd*-gnu* \
+ | nto-qnx* \
+ | os2-emx* \
+ | rtmk-nova* \
+ | storm-chaos* \
+ | uclinux-gnu* \
+ | uclinux-uclibc* \
| windows-* )
basic_machine=$field1
basic_os=$maybe_os
esac
;;
*-*)
- # A lone config we happen to match not fitting any pattern
case $field1-$field2 in
+ # Shorthands that happen to contain a single dash
+ convex-c[12] | convex-c3[248])
+ basic_machine=$field2-convex
+ basic_os=
+ ;;
decstation-3100)
basic_machine=mips-dec
basic_os=
*-*)
# Second component is usually, but not always the OS
case $field2 in
- # Prevent following clause from handling this valid os
+ # Do not treat sunos as a manufacturer
sun*os*)
basic_machine=$field1
basic_os=$field2
;;
- zephyr*)
- basic_machine=$field1-unknown
- basic_os=$field2
- ;;
# Manufacturers
- dec* | mips* | sequent* | encore* | pc533* | sgi* | sony* \
- | att* | 7300* | 3300* | delta* | motorola* | sun[234]* \
- | unicom* | ibm* | next | hp | isi* | apollo | altos* \
- | convergent* | ncr* | news | 32* | 3600* | 3100* \
- | hitachi* | c[123]* | convex* | sun | crds | omron* | dg \
- | ultra | tti* | harris | dolphin | highlevel | gould \
- | cbm | ns | masscomp | apple | axis | knuth | cray \
- | microblaze* | sim | cisco \
- | oki | wec | wrs | winbond)
+ 3100* \
+ | 32* \
+ | 3300* \
+ | 3600* \
+ | 7300* \
+ | acorn \
+ | altos* \
+ | apollo \
+ | apple \
+ | atari \
+ | att* \
+ | axis \
+ | be \
+ | bull \
+ | cbm \
+ | ccur \
+ | cisco \
+ | commodore \
+ | convergent* \
+ | convex* \
+ | cray \
+ | crds \
+ | dec* \
+ | delta* \
+ | dg \
+ | digital \
+ | dolphin \
+ | encore* \
+ | gould \
+ | harris \
+ | highlevel \
+ | hitachi* \
+ | hp \
+ | ibm* \
+ | intergraph \
+ | isi* \
+ | knuth \
+ | masscomp \
+ | microblaze* \
+ | mips* \
+ | motorola* \
+ | ncr* \
+ | news \
+ | next \
+ | ns \
+ | oki \
+ | omron* \
+ | pc533* \
+ | rebel \
+ | rom68k \
+ | rombug \
+ | semi \
+ | sequent* \
+ | sgi* \
+ | siemens \
+ | sim \
+ | sni \
+ | sony* \
+ | stratus \
+ | sun \
+ | sun[234]* \
+ | tektronix \
+ | tti* \
+ | ultra \
+ | unicom* \
+ | wec \
+ | winbond \
+ | wrs)
basic_machine=$field1-$field2
basic_os=
;;
+ tock* | zephyr*)
+ basic_machine=$field1-unknown
+ basic_os=$field2
+ ;;
*)
basic_machine=$field1
basic_os=$field2
basic_machine=arm-unknown
basic_os=cegcc
;;
- convex-c1)
- basic_machine=c1-convex
- basic_os=bsd
- ;;
- convex-c2)
- basic_machine=c2-convex
- basic_os=bsd
- ;;
- convex-c32)
- basic_machine=c32-convex
- basic_os=bsd
- ;;
- convex-c34)
- basic_machine=c34-convex
- basic_os=bsd
- ;;
- convex-c38)
- basic_machine=c38-convex
- basic_os=bsd
- ;;
cray)
basic_machine=j90-cray
basic_os=unicos
vendor=dec
basic_os=tops20
;;
- delta | 3300 | motorola-3300 | motorola-delta \
- | 3300-motorola | delta-motorola)
+ delta | 3300 | delta-motorola | 3300-motorola | motorola-delta | motorola-3300)
cpu=m68k
vendor=motorola
;;
- dpx2*)
+ # This used to be dpx2*, but that gets the RS6000-based
+ # DPX/20 and the x86-based DPX/2-100 wrong. See
+ # https://oldskool.silicium.org/stations/bull_dpx20.htm
+ # https://www.feb-patrimoine.com/english/bull_dpx2.htm
+ # https://www.feb-patrimoine.com/english/unix_and_bull.htm
+ dpx2 | dpx2[23]00 | dpx2[23]xx)
cpu=m68k
vendor=bull
- basic_os=sysv3
+ ;;
+ dpx2100 | dpx21xx)
+ cpu=i386
+ vendor=bull
+ ;;
+ dpx20)
+ cpu=rs6000
+ vendor=bull
;;
encore | umax | mmax)
cpu=ns32k
next | m*-next)
cpu=m68k
vendor=next
- case $basic_os in
- openstep*)
- ;;
- nextstep*)
- ;;
- ns2*)
- basic_os=nextstep2
- ;;
- *)
- basic_os=nextstep3
- ;;
- esac
;;
np1)
cpu=np1
;;
*-*)
- # shellcheck disable=SC2162
saved_IFS=$IFS
IFS="-" read cpu vendor <<EOF
$basic_machine
# Decode basic machines in the full and proper CPU-Company form.
case $cpu-$vendor in
- # Here we handle the default manufacturer of certain CPU types in canonical form. It is in
- # some cases the only manufacturer, in others, it is the most popular.
+ # Here we handle the default manufacturer of certain CPU types in canonical form.
+ # It is in some cases the only manufacturer, in others, it is the most popular.
+ c[12]-convex | c[12]-unknown | c3[248]-convex | c3[248]-unknown)
+ vendor=convex
+ basic_os=${basic_os:-bsd}
+ ;;
craynv-unknown)
vendor=cray
basic_os=${basic_os:-unicosmp}
;;
c90-unknown | c90-cray)
vendor=cray
- basic_os=${Basic_os:-unicos}
+ basic_os=${basic_os:-unicos}
;;
fx80-unknown)
vendor=alliant
vendor=alt
basic_os=${basic_os:-linux-gnueabihf}
;;
- dpx20-unknown | dpx20-bull)
- cpu=rs6000
- vendor=bull
+
+ # Normalized CPU+vendor pairs that imply an OS, if not otherwise specified
+ m68k-isi)
+ basic_os=${basic_os:-sysv}
+ ;;
+ m68k-sony)
+ basic_os=${basic_os:-newsos}
+ ;;
+ m68k-tektronix)
+ basic_os=${basic_os:-bsd}
+ ;;
+ m88k-harris)
+ basic_os=${basic_os:-sysv3}
+ ;;
+ i386-bull | m68k-bull)
+ basic_os=${basic_os:-sysv3}
+ ;;
+ rs6000-bull)
basic_os=${basic_os:-bosx}
;;
+ mips-sni)
+ basic_os=${basic_os:-sysv4}
+ ;;
# Here we normalize CPU types irrespective of the vendor
amd64-*)
;;
blackfin-*)
cpu=bfin
- basic_os=linux
+ basic_os=${basic_os:-linux}
;;
c54x-*)
cpu=tic54x
;;
m68knommu-*)
cpu=m68k
- basic_os=linux
+ basic_os=${basic_os:-linux}
;;
m9s12z-* | m68hcs12z-* | hcs12z-* | s12z-*)
cpu=s12z
;;
parisc-*)
cpu=hppa
- basic_os=linux
+ basic_os=${basic_os:-linux}
;;
pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
cpu=i586
pentium4-*)
cpu=i786
;;
- pc98-*)
- cpu=i386
- ;;
ppc-* | ppcbe-*)
cpu=powerpc
;;
tx39el-*)
cpu=mipstx39el
;;
- x64-*)
- cpu=x86_64
- ;;
xscale-* | xscalee[bl]-*)
cpu=`echo "$cpu" | sed 's/^xscale/arm/'`
;;
- arm64-* | aarch64le-*)
+ arm64-* | aarch64le-* | arm64_32-*)
cpu=aarch64
;;
# Recognize the canonical CPU types that are allowed with any
# company name.
case $cpu in
- 1750a | 580 \
+ 1750a \
+ | 580 \
+ | [cjt]90 \
| a29k \
- | aarch64 | aarch64_be | aarch64c | arm64ec \
+ | aarch64 \
+ | aarch64_be \
+ | aarch64c \
| abacus \
- | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] \
- | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] \
- | alphapca5[67] | alpha64pca5[67] \
+ | alpha \
+ | alpha64 \
+ | alpha64ev56 \
+ | alpha64ev6[78] \
+ | alpha64ev[4-8] \
+ | alpha64pca5[67] \
+ | alphaev56 \
+ | alphaev6[78] \
+ | alphaev[4-8] \
+ | alphapca5[67] \
| am33_2.0 \
| amdgcn \
- | arc | arceb | arc32 | arc64 \
- | arm | arm[lb]e | arme[lb] | armv* \
- | avr | avr32 \
+ | arc \
+ | arc32 \
+ | arc64 \
+ | arceb \
+ | arm \
+ | arm64e \
+ | arm64ec \
+ | arm[lb]e \
+ | arme[lb] \
+ | armv* \
| asmjs \
+ | avr \
+ | avr32 \
| ba \
- | be32 | be64 \
- | bfin | bpf | bs2000 \
- | c[123]* | c30 | [cjt]90 | c4x \
- | c8051 | clipper | craynv | csky | cydra \
- | d10v | d30v | dlx | dsp16xx \
- | e2k | elxsi | epiphany \
- | f30[01] | f700 | fido | fr30 | frv | ft32 | fx80 \
- | javascript \
- | h8300 | h8500 \
- | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
+ | be32 \
+ | be64 \
+ | bfin \
+ | bpf \
+ | bs2000 \
+ | c30 \
+ | c4x \
+ | c8051 \
+ | c[123]* \
+ | clipper \
+ | craynv \
+ | csky \
+ | cydra \
+ | d10v \
+ | d30v \
+ | dlx \
+ | dsp16xx \
+ | e2k \
+ | elxsi \
+ | epiphany \
+ | f30[01] \
+ | f700 \
+ | fido \
+ | fr30 \
+ | frv \
+ | ft32 \
+ | fx80 \
+ | h8300 \
+ | h8500 \
| hexagon \
- | i370 | i*86 | i860 | i960 | ia16 | ia64 \
- | ip2k | iq2000 \
+ | hppa \
+ | hppa1.[01] \
+ | hppa2.0 \
+ | hppa2.0[nw] \
+ | hppa64 \
+ | i*86 \
+ | i370 \
+ | i860 \
+ | i960 \
+ | ia16 \
+ | ia64 \
+ | intelgt \
+ | ip2k \
+ | iq2000 \
+ | javascript \
| k1om \
| kvx \
- | le32 | le64 \
+ | le32 \
+ | le64 \
| lm32 \
- | loongarch32 | loongarch64 \
- | m32c | m32r | m32rle \
- | m5200 | m68000 | m680[012346]0 | m68360 | m683?2 | m68k \
- | m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x \
- | m88110 | m88k | maxq | mb | mcore | mep | metag \
- | microblaze | microblazeel \
+ | loongarch32 \
+ | loongarch64 \
+ | m32c \
+ | m32r \
+ | m32rle \
+ | m5200 \
+ | m68000 \
+ | m680[012346]0 \
+ | m6811 \
+ | m6812 \
+ | m68360 \
+ | m683?2 \
+ | m68hc11 \
+ | m68hc12 \
+ | m68hcs12x \
+ | m68k \
+ | m88110 \
+ | m88k \
+ | maxq \
+ | mb \
+ | mcore \
+ | mep \
+ | metag \
+ | microblaze \
+ | microblazeel \
| mips* \
| mmix \
- | mn10200 | mn10300 \
+ | mn10200 \
+ | mn10300 \
| moxie \
- | mt \
| msp430 \
+ | mt \
| nanomips* \
- | nds32 | nds32le | nds32be \
+ | nds32 \
+ | nds32be \
+ | nds32le \
| nfp \
- | nios | nios2 | nios2eb | nios2el \
- | none | np1 | ns16k | ns32k | nvptx \
+ | nios \
+ | nios2 \
+ | nios2eb \
+ | nios2el \
+ | none \
+ | np1 \
+ | ns16k \
+ | ns32k \
+ | nvptx \
| open8 \
| or1k* \
| or32 \
| orion \
+ | pdp10 \
+ | pdp11 \
| picochip \
- | pdp10 | pdp11 | pj | pjl | pn | power \
- | powerpc | powerpc64 | powerpc64le | powerpcle | powerpcspe \
+ | pj \
+ | pjl \
+ | pn \
+ | power \
+ | powerpc \
+ | powerpc64 \
+ | powerpc64le \
+ | powerpcle \
+ | powerpcspe \
| pru \
| pyramid \
- | riscv | riscv32 | riscv32be | riscv64 | riscv64be \
- | rl78 | romp | rs6000 | rx \
- | s390 | s390x \
+ | riscv \
+ | riscv32 \
+ | riscv32be \
+ | riscv64 \
+ | riscv64be \
+ | rl78 \
+ | romp \
+ | rs6000 \
+ | rx \
+ | s390 \
+ | s390x \
| score \
- | sh | shl \
- | sh[1234] | sh[24]a | sh[24]ae[lb] | sh[23]e | she[lb] | sh[lb]e \
- | sh[1234]e[lb] | sh[12345][lb]e | sh[23]ele | sh64 | sh64le \
- | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet \
+ | sh \
+ | sh64 \
+ | sh64le \
+ | sh[12345][lb]e \
+ | sh[1234] \
+ | sh[1234]e[lb] \
+ | sh[23]e \
+ | sh[23]ele \
+ | sh[24]a \
+ | sh[24]ae[lb] \
+ | sh[lb]e \
+ | she[lb] \
+ | shl \
+ | sparc \
+ | sparc64 \
+ | sparc64b \
+ | sparc64v \
+ | sparc86x \
+ | sparclet \
| sparclite \
- | sparcv8 | sparcv9 | sparcv9b | sparcv9v | sv1 | sx* \
+ | sparcv8 \
+ | sparcv9 \
+ | sparcv9b \
+ | sparcv9v \
| spu \
+ | sv1 \
+ | sx* \
| tahoe \
| thumbv7* \
- | tic30 | tic4x | tic54x | tic55x | tic6x | tic80 \
+ | tic30 \
+ | tic4x \
+ | tic54x \
+ | tic55x \
+ | tic6x \
+ | tic80 \
| tron \
| ubicom32 \
- | v70 | v850 | v850e | v850e1 | v850es | v850e2 | v850e2v3 \
+ | v70 \
+ | v810 \
+ | v850 \
+ | v850e \
+ | v850e1 \
+ | v850e2 \
+ | v850e2v3 \
+ | v850es \
| vax \
| vc4 \
| visium \
| w65 \
- | wasm32 | wasm64 \
+ | wasm32 \
+ | wasm64 \
| we32k \
- | x86 | x86_64 | xc16x | xgate | xps100 \
- | xstormy16 | xtensa* \
+ | x86 \
+ | x86_64 \
+ | xc16x \
+ | xgate \
+ | xps100 \
+ | xstormy16 \
+ | xtensa* \
| ymp \
- | z8k | z80)
+ | z80 \
+ | z8k)
;;
*)
os=`echo "$basic_os" | sed -e 's|nto-qnx|qnx|'`
;;
*-*)
- # shellcheck disable=SC2162
saved_IFS=$IFS
IFS="-" read kernel os <<EOF
$basic_os
kernel=nto
os=`echo "$basic_os" | sed -e 's|nto|qnx|'`
;;
+ ironclad*)
+ kernel=ironclad
+ os=`echo "$basic_os" | sed -e 's|ironclad|mlibc|'`
+ ;;
linux*)
kernel=linux
os=`echo "$basic_os" | sed -e 's|linux|gnu|'`
unixware*)
os=sysv4.2uw
;;
+ # The marketing names for NeXT's operating systems were
+ # NeXTSTEP, NeXTSTEP 2, OpenSTEP 3, OpenSTEP 4. 'openstep' is
+ # mapped to 'openstep3', but 'openstep1' and 'openstep2' are
+ # mapped to 'nextstep' and 'nextstep2', consistent with the
+ # treatment of SunOS/Solaris.
+ ns | ns1 | nextstep | nextstep1 | openstep1)
+ os=nextstep
+ ;;
+ ns2 | nextstep2 | openstep2)
+ os=nextstep2
+ ;;
+ ns3 | nextstep3 | openstep | openstep3)
+ os=openstep3
+ ;;
+ ns4 | nextstep4 | openstep4)
+ os=openstep4
+ ;;
# es1800 is here to avoid being matched by es* (a different OS)
es1800*)
os=ose
;;
utek*)
os=bsd
+ vendor=`echo "$vendor" | sed -e 's|^unknown$|tektronix|'`
;;
dynix*)
os=bsd
386bsd)
os=bsd
;;
- ctix* | uts*)
+ ctix*)
os=sysv
+ vendor=`echo "$vendor" | sed -e 's|^unknown$|convergent|'`
;;
- nova*)
- os=rtmk-nova
+ uts*)
+ os=sysv
;;
- ns2)
- os=nextstep2
+ nova*)
+ kernel=rtmk
+ os=nova
;;
# Preserve the version number of sinix5.
sinix5.*)
os=`echo "$os" | sed -e 's|sinix|sysv|'`
+ vendor=`echo "$vendor" | sed -e 's|^unknown$|sni|'`
;;
sinix*)
os=sysv4
+ vendor=`echo "$vendor" | sed -e 's|^unknown$|sni|'`
;;
tpf*)
os=tpf
os=
obj=elf
;;
+ # The -sgi and -siemens entries must be before the mips- entry
+ # or we get the wrong os.
+ *-sgi)
+ os=irix
+ ;;
+ *-siemens)
+ os=sysv4
+ ;;
mips*-cisco)
os=
obj=elf
os=
obj=coff
;;
- *-tti) # must be before sparc entry or we get the wrong os.
+ # This must be before the sparc-* entry or we get the wrong os.
+ *-tti)
os=sysv3
;;
sparc-* | *-sun)
os=hpux
;;
*-hitachi)
- os=hiux
+ os=hiuxwe2
;;
i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
os=sysv
*-encore)
os=bsd
;;
- *-sgi)
- os=irix
- ;;
- *-siemens)
- os=sysv4
- ;;
*-masscomp)
os=rtu
;;
ghcjs)
;;
# Now accept the basic system types.
- # The portable systems comes first.
# Each alternative MUST end in a * to match a version number.
- gnu* | android* | bsd* | mach* | minix* | genix* | ultrix* | irix* \
- | *vms* | esix* | aix* | cnk* | sunos | sunos[34]* \
- | hpux* | unos* | osf* | luna* | dgux* | auroraux* | solaris* \
- | sym* | plan9* | psp* | sim* | xray* | os68k* | v88r* \
- | hiux* | abug | nacl* | netware* | windows* \
- | os9* | macos* | osx* | ios* | tvos* | watchos* \
- | mpw* | magic* | mmixware* | mon960* | lnews* \
- | amigaos* | amigados* | msdos* | newsos* | unicos* | aof* \
- | aos* | aros* | cloudabi* | sortix* | twizzler* \
- | nindy* | vxsim* | vxworks* | ebmon* | hms* | mvs* \
- | clix* | riscos* | uniplus* | iris* | isc* | rtu* | xenix* \
- | mirbsd* | netbsd* | dicos* | openedition* | ose* \
- | bitrig* | openbsd* | secbsd* | solidbsd* | libertybsd* | os108* \
- | ekkobsd* | freebsd* | riscix* | lynxos* | os400* \
- | bosx* | nextstep* | cxux* | oabi* \
- | ptx* | ecoff* | winnt* | domain* | vsta* \
- | udi* | lites* | ieee* | go32* | aux* | hcos* \
- | chorusrdb* | cegcc* | glidix* | serenity* \
- | cygwin* | msys* | moss* | proelf* | rtems* \
- | midipix* | mingw32* | mingw64* | mint* \
- | uxpv* | beos* | mpeix* | udk* | moxiebox* \
- | interix* | uwin* | mks* | rhapsody* | darwin* \
- | openstep* | oskit* | conix* | pw32* | nonstopux* \
- | storm-chaos* | tops10* | tenex* | tops20* | its* \
- | os2* | vos* | palmos* | uclinux* | nucleus* | morphos* \
- | scout* | superux* | sysv* | rtmk* | tpf* | windiss* \
- | powermax* | dnix* | nx6 | nx7 | sei* | dragonfly* \
- | skyos* | haiku* | rdos* | toppers* | drops* | es* \
- | onefs* | tirtos* | phoenix* | fuchsia* | redox* | bme* \
- | midnightbsd* | amdhsa* | unleashed* | emscripten* | wasi* \
- | nsk* | powerunix* | genode* | zvmoe* | qnx* | emx* | zephyr* \
- | fiwix* | mlibc* | cos* | mbr* | ironclad* )
+ abug \
+ | aix* \
+ | amdhsa* \
+ | amigados* \
+ | amigaos* \
+ | android* \
+ | aof* \
+ | aos* \
+ | aros* \
+ | atheos* \
+ | auroraux* \
+ | aux* \
+ | banan_os* \
+ | beos* \
+ | bitrig* \
+ | bme* \
+ | bosx* \
+ | bsd* \
+ | cegcc* \
+ | chorusos* \
+ | chorusrdb* \
+ | clix* \
+ | cloudabi* \
+ | cnk* \
+ | conix* \
+ | cos* \
+ | cxux* \
+ | cygwin* \
+ | darwin* \
+ | dgux* \
+ | dicos* \
+ | dnix* \
+ | domain* \
+ | dragonfly* \
+ | drops* \
+ | ebmon* \
+ | ecoff* \
+ | ekkobsd* \
+ | emscripten* \
+ | emx* \
+ | es* \
+ | fiwix* \
+ | freebsd* \
+ | fuchsia* \
+ | genix* \
+ | genode* \
+ | glidix* \
+ | gnu* \
+ | go32* \
+ | haiku* \
+ | hcos* \
+ | hiux* \
+ | hms* \
+ | hpux* \
+ | ieee* \
+ | interix* \
+ | ios* \
+ | iris* \
+ | irix* \
+ | isc* \
+ | its* \
+ | l4re* \
+ | libertybsd* \
+ | lites* \
+ | lnews* \
+ | luna* \
+ | lynxos* \
+ | mach* \
+ | macos* \
+ | magic* \
+ | mbr* \
+ | midipix* \
+ | midnightbsd* \
+ | mingw32* \
+ | mingw64* \
+ | minix* \
+ | mint* \
+ | mirbsd* \
+ | mks* \
+ | mlibc* \
+ | mmixware* \
+ | mon960* \
+ | morphos* \
+ | moss* \
+ | moxiebox* \
+ | mpeix* \
+ | mpw* \
+ | msdos* \
+ | msys* \
+ | mvs* \
+ | nacl* \
+ | netbsd* \
+ | netware* \
+ | newsos* \
+ | nextstep* \
+ | nindy* \
+ | nonstopux* \
+ | nova* \
+ | nsk* \
+ | nucleus* \
+ | nx6 \
+ | nx7 \
+ | oabi* \
+ | ohos* \
+ | onefs* \
+ | openbsd* \
+ | openedition* \
+ | openstep* \
+ | os108* \
+ | os2* \
+ | os400* \
+ | os68k* \
+ | os9* \
+ | ose* \
+ | osf* \
+ | oskit* \
+ | osx* \
+ | palmos* \
+ | phoenix* \
+ | plan9* \
+ | powermax* \
+ | powerunix* \
+ | proelf* \
+ | psos* \
+ | psp* \
+ | ptx* \
+ | pw32* \
+ | qnx* \
+ | rdos* \
+ | redox* \
+ | rhapsody* \
+ | riscix* \
+ | riscos* \
+ | rtems* \
+ | rtmk* \
+ | rtu* \
+ | scout* \
+ | secbsd* \
+ | sei* \
+ | serenity* \
+ | sim* \
+ | skyos* \
+ | solaris* \
+ | solidbsd* \
+ | sortix* \
+ | storm-chaos* \
+ | sunos \
+ | sunos[34]* \
+ | superux* \
+ | syllable* \
+ | sym* \
+ | sysv* \
+ | tenex* \
+ | tirtos* \
+ | tock* \
+ | toppers* \
+ | tops10* \
+ | tops20* \
+ | tpf* \
+ | tvos* \
+ | twizzler* \
+ | uclinux* \
+ | udi* \
+ | udk* \
+ | ultrix* \
+ | unicos* \
+ | uniplus* \
+ | unleashed* \
+ | unos* \
+ | uwin* \
+ | uxpv* \
+ | v88r* \
+ |*vms* \
+ | vos* \
+ | vsta* \
+ | vxsim* \
+ | vxworks* \
+ | wasi* \
+ | watchos* \
+ | wince* \
+ | windiss* \
+ | windows* \
+ | winnt* \
+ | xenix* \
+ | xray* \
+ | zephyr* \
+ | zvmoe* )
;;
# This one is extra strict with allowed versions
sco3.2v2 | sco3.2v[4-9]* | sco5v6*)
case $kernel-$os-$obj in
linux-gnu*- | linux-android*- | linux-dietlibc*- | linux-llvm*- \
| linux-mlibc*- | linux-musl*- | linux-newlib*- \
- | linux-relibc*- | linux-uclibc*- )
+ | linux-relibc*- | linux-uclibc*- | linux-ohos*- )
+ ;;
+ uclinux-uclibc*- | uclinux-gnu*- )
;;
- uclinux-uclibc*- )
+ ironclad-mlibc*-)
;;
managarm-mlibc*- | managarm-kernel*- )
;;
echo "Invalid configuration '$1': '$os' needs 'windows'." 1>&2
exit 1
;;
- kfreebsd*-gnu*- | kopensolaris*-gnu*-)
+ kfreebsd*-gnu*- | knetbsd*-gnu*- | netbsd*-gnu*- | kopensolaris*-gnu*-)
;;
vxworks-simlinux- | vxworks-simwindows- | vxworks-spe-)
;;
;;
os2-emx-)
;;
+ rtmk-nova-)
+ ;;
*-eabi*- | *-gnueabi*-)
;;
+ ios*-simulator- | tvos*-simulator- | watchos*-simulator- )
+ ;;
none--*)
# None (no kernel, i.e. freestanding / bare metal),
# can be paired with an machine code file format
*-riscix*)
vendor=acorn
;;
- *-sunos*)
+ *-sunos* | *-solaris*)
vendor=sun
;;
*-cnk* | *-aix*)
exit
# Local variables:
-# eval: (add-hook 'before-save-hook 'time-stamp)
+# eval: (add-hook 'before-save-hook 'time-stamp nil t)
# time-stamp-start: "timestamp='"
-# time-stamp-format: "%:y-%02m-%02d"
+# time-stamp-format: "%Y-%02m-%02d"
# time-stamp-end: "'"
# End:
# gendocs.sh -- generate a GNU manual in many formats. This script is
# mentioned in maintain.texi. See the help message below for usage details.
-scriptversion=2024-01-27.16
+scriptversion=2026-01-01.00
-# Copyright 2003-2024 Free Software Foundation, Inc.
+# Copyright 2003-2026 Free Software Foundation, Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
version="gendocs.sh $scriptversion
-Copyright 2024 Free Software Foundation, Inc.
+Copyright 2026 Free Software Foundation, Inc.
There is NO warranty. You may redistribute this software
under the terms of the GNU General Public License.
For more information about these matters, see the files named COPYING."
# Function to return size of $1 in something resembling kilobytes.
calcsize()
{
- size=`ls -ksl $1 | awk '{print $1}'`
- echo $size
+ set `ls -ks "$1"`
+ echo $1
}
# copy_images OUTDIR HTML-FILE...
/<img src="(.*?)"/g && ++$need{$1};
END {
- #print "$me: @{[keys %need]}\n"; # for debugging, show images found.
- FILE: for my $f (keys %need) {
+ #print "$me: @{[sort keys %need]}\n"; # for debugging, show images found.
+ FILE: for my $f (sort keys %need) {
for my $d (@dirs) {
if (-f "$d/$f") {
use File::Basename;
split_html_dir=$PACKAGE.html
(
cd ${split_html_dir} || exit 1
- ln -sf ${PACKAGE}.html index.html
+ test -f index.html || test ! -f ${PACKAGE}.html ||
+ ln -s ${PACKAGE}.html index.html
tar -czf "$abs_outdir/${PACKAGE}.html_$1.tar.gz" -- *.html
)
eval html_$1_tgz_size=`calcsize "$outdir/${PACKAGE}.html_$1.tar.gz"`
done
# if $MAKEINFO is recent enough, use --trace-includes on the
- # $srcfile to get the included files of the targetted manual only
+ # $srcfile to get the included files of the targeted manual only
base=`basename "$srcfile"`
cmd="$SETLANG $MAKEINFO $commonarg --trace-includes \"$base\""
echo "Done, see $outdir/ subdirectory for new files."
# Local variables:
-# eval: (add-hook 'before-save-hook 'time-stamp)
+# eval: (add-hook 'before-save-hook 'time-stamp nil t)
# time-stamp-start: "scriptversion="
-# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-format: "%Y-%02m-%02d.%02H"
# time-stamp-end: "$"
# End:
#!/bin/sh
# Print a version string.
-scriptversion=2022-07-09.08; # UTC
+scriptversion=2025-06-10.02; # UTC
-# Copyright (C) 2007-2024 Free Software Foundation, Inc.
+# Copyright (C) 2007-2026 Free Software Foundation, Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# along with this program. If not, see <https://www.gnu.org/licenses/>.
# This script is derived from GIT-VERSION-GEN from GIT: https://git-scm.com/.
-# It may be run two ways:
+
+# It may be run in the following ways, presuming the script is invoked
+# like "./git-version-gen .tarball-version":
+#
# - from a git repository in which the "git describe" command below
# produces useful output (thus requiring at least one signed tag)
-# - from a non-git-repo directory containing a .tarball-version file, which
-# presumes this script is invoked like "./git-version-gen .tarball-version".
+#
+# - from a "make dist" non-git-repo directory containing a
+# .tarball-version file
+#
+# - from a "git archive" non-git-repo directory containing a
+# .tarball-version-git file
-# In order to use intra-version strings in your project, you will need two
+# In order to use intra-version strings in your project, you will need some
# separate generated version string files:
#
-# .tarball-version - present only in a distribution tarball, and not in
-# a checked-out repository. Created with contents that were learned at
-# the last time autoconf was run, and used by git-version-gen. Must not
-# be present in either $(srcdir) or $(builddir) for git-version-gen to
-# give accurate answers during normal development with a checked out tree,
-# but must be present in a tarball when there is no version control system.
-# Therefore, it cannot be used in any dependencies. GNUmakefile has
-# hooks to force a reconfigure at distribution time to get the value
-# correct, without penalizing normal development with extra reconfigures.
+# .tarball-version - contains the version number assigned by the maintainer.
+# Present or missing in a checked-out repository, at the discretion of the
+# maintainer/contributor. Present in a distribution tarball, because the
+# tarball does not include the version control history.
+# Used by git-version-gen as an override.
+# Cannot be used in any dependencies (since it may be absent).
+# GNUmakefile has hooks to force a reconfigure at "make dist" time to get
+# the value correct, without penalizing normal development with extra
+# reconfigures.
#
-# .version - present in a checked-out repository and in a distribution
-# tarball. Usable in dependencies, particularly for files that don't
-# want to depend on config.h but do want to track version changes.
-# Delete this file prior to any autoconf run where you want to rebuild
-# files to pick up a version string change; and leave it stale to
-# minimize rebuild time after unrelated changes to configure sources.
+# .tarball-version-git - a file committed to git containing a single
+# line with the string $Format:%(describe)$ and that the file is
+# marked in .gitattributes with ".tarball-version-git export-subst".
+# If the file doesn't exist or the export-subst keyword wasn't
+# effective, the file is ignored.
#
-# As with any generated file in a VC'd directory, you should add
-# /.version to .gitignore, so that you don't accidentally commit it.
-# .tarball-version is never generated in a VC'd directory, so needn't
-# be listed there.
-#
-# Use the following line in your configure.ac, so that $(VERSION) will
+# Use the following snippet in your configure.ac, so that $(VERSION) will
# automatically be up-to-date each time configure is run (and note that
# since configure.ac no longer includes a version string, Makefile rules
# should not depend on configure.ac for version updates).
#
-# AC_INIT([GNU project],
-# m4_esyscmd([build-aux/git-version-gen .tarball-version]),
-# [bug-project@example])
+# AC_INIT([@var{package}], [package])
+# AC_CONFIG_SRCDIR([@var{unique-file-in-source-dir}])
+# AC_CONFIG_AUX_DIR([build-aux])
+# VERSION_NUMBER=`cd $srcdir \
+# && build-aux/git-version-gen .tarball-version`
+# gl_INIT_PACKAGE_VERSION([$VERSION_NUMBER])
+# AM_INIT_AUTOMAKE([@var{options}])
#
-# Then use the following lines in your Makefile.am, so that .version
-# will be present for dependencies, and so that .version and
+# Then use the following lines in your Makefile.am, so that
# .tarball-version will exist in distribution tarballs.
#
-# EXTRA_DIST = $(top_srcdir)/.version
-# BUILT_SOURCES = $(top_srcdir)/.version
-# $(top_srcdir)/.version:
-# echo '$(VERSION)' > $@-t
-# mv $@-t $@
-# dist-hook:
+# dist-hook: dist-tarball-version
+# .PHONY: dist-tarball-version
+# dist-tarball-version:
# echo '$(VERSION)' > $(distdir)/.tarball-version
-
+#
+# To setup support for "git archive" tarballs, use the following:
+#
+# echo '$Format:%(describe)$' > .tarball-version-git
+# echo '.tarball-version-git export-subst' >> .gitattributes
+# git add .tarball-version-git .gitattributes
+# git commit -m "Add .tarball-version-git for git-version-gen."
me=$0
# First see if there is a tarball-only version file.
# then try "git describe", then default.
-if test -f $tarball_version_file
+if test -f "$tarball_version_file"
then
- v=`cat $tarball_version_file` || v=
+ v=`cat "$tarball_version_file"` || v=
case $v in
*$nl*) v= ;; # reject multi-line output
esac
test "$commit_list" = failed && v=UNKNOWN
;;
esac
-
- # Change the penultimate "-" to ".", for version-comparing tools.
- # Remove the "g" to save a byte.
- v=`echo "$v" | sed 's/-\([^-]*\)-g\([^-]*\)$/.\1-\2/'`;
v_from_git=1
elif test "x$fallback" = x || git --version >/dev/null 2>&1; then
v=UNKNOWN
v=$fallback
fi
+if test "x$v" = xUNKNOWN \
+ && test -f "$tarball_version_file"-git \
+ && v=$(head -1 "$tarball_version_file"-git); then
+ case $v in
+ *Format*) v=UNKNOWN ;;
+ esac
+fi
+
+# Change the penultimate "-" to ".", for version-comparing tools.
+# Remove the "g" to save a byte.
+v=`echo "$v" | sed 's/-\([^-]*\)-g\([^-]*\)$/.\1-\2/'`;
+
v=`echo "$v" |sed "s/^$prefix//"`
-# Test whether to append the "-dirty" suffix only if the version
+# The "-modified" suffix was previously called "-dirty". While this term
+# was invented by the git people to designate a checkout that is not "clean",
+# it has a negative connotation that is not in line with the fact that
+# a Free Software developer routinely works with modified source code.
+# In fact, modifying source code is the *essence* of Free Software.
+# What we need here is a term that is suitable for naming tarballs, without
+# shaming the developer. Giving a name to a tarball is something else than
+# describing the state of a git checkout.
+#
+# Test whether to append the "-modified" suffix only if the version
# string we're using came from git. I.e., skip the test if it's "UNKNOWN"
# or if it came from .tarball-version.
if test "x$v_from_git" != x; then
- # Don't declare a version "dirty" merely because a timestamp has changed.
+ # Don't declare a version "modified" merely because a timestamp has changed.
git update-index --refresh > /dev/null 2>&1
- dirty=`exec 2>/dev/null;git diff-index --name-only HEAD` || dirty=
- case "$dirty" in
+ modified=`exec 2>/dev/null;git diff-index --name-only HEAD` || modified=
+ case "$modified" in
'') ;;
*) # Append the suffix only if there isn't one already.
case $v in
- *-dirty) ;;
- *) v="$v-dirty" ;;
+ *-dirty | *-modified) ;;
+ *) v="$v-modified" ;;
esac ;;
esac
fi
printf %s "$v"
# Local variables:
-# eval: (add-hook 'before-save-hook 'time-stamp)
+# eval: (add-hook 'before-save-hook 'time-stamp nil t)
# time-stamp-start: "scriptversion="
-# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-format: "%Y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC0"
# time-stamp-end: "; # UTC"
# End:
# Convert git log output to ChangeLog format.
-# Copyright (C) 2008-2024 Free Software Foundation, Inc.
+# Copyright (C) 2008-2026 Free Software Foundation, Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
eval 'exec perl -wSx "$0" "$@"'
if 0;
-my $VERSION = '2023-06-24 21:59'; # UTC
+my $VERSION = '2025-06-10 02:43'; # UTC
# The definition above must lie within the first 8 lines in order
# for the Emacs time-stamp write hook (at end) to update it.
# If you change this file with Emacs, please let the write hook
# do its job. Otherwise, update this string manually.
+(my $copyright_year = $VERSION) =~ s/^(\d*)-.*$/$1/;
+
use strict;
use warnings;
use Getopt::Long;
--strip-cherry-pick remove data inserted by "git cherry-pick";
this includes the "cherry picked from commit ..." line,
and the possible final "Conflicts:" paragraph.
+ --commit-timezone use dates respecting the timezone commits were made in.
--help display this help and exit
--version output version information and exit
# Change the author to be Paul. Note the escaped "@":
s,Jim .*>,Paul Eggert <eggert\\\@cs.ucla.edu>,
+Send patches and bug reports to <bug-gnulib\@gnu.org>.
EOF
}
exit $exit_code;
}
+sub print_version ()
+{
+ print "$ME version $VERSION\n";
+ print "Copyright (C) $copyright_year Free Software Foundation, Inc.\n";
+ print "License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>\n"
+ . "This is free software: you are free to change and redistribute it.\n"
+ . "There is NO WARRANTY, to the extent permitted by law.\n";
+ print "\n";
+ my $author = "Jim Meyering";
+ print "Written by $author.\n";
+}
+
# If the string $S is a well-behaved file name, simply return it.
# If it contains white space, quotes, etc., quote it, and return the new string.
sub shell_quote($)
my $ignore_line;
my $strip_tab = 0;
my $strip_cherry_pick = 0;
+ my $commit_timezone = 0;
my $srcdir;
GetOptions
(
help => sub { usage 0 },
- version => sub { print "$ME version $VERSION\n"; exit },
+ version => sub { print_version; exit },
'since=s' => \$since_date,
'until=s' => \$until_date,
'format=s' => \$format_string,
'ignore-line=s' => \$ignore_line,
'strip-tab' => \$strip_tab,
'strip-cherry-pick' => \$strip_cherry_pick,
+ 'commit-timezone' => \$commit_timezone,
'srcdir=s' => \$srcdir,
) or usage 1;
# that makes a correction in the log or attribution of that commit.
my $amend_code = defined $amend_file ? parse_amend_file $amend_file : {};
+ my $commit_time_format = $commit_timezone ? '%cI' : '%ct';
my @cmd = ('git',
git_dir_option $srcdir,
qw(log --log-size),
- '--pretty=format:%H:%ct %an <%ae>%n%n'.$format_string, @ARGV);
+ ("--pretty=format:%H:$commit_time_format"
+ . ' %an <%ae>%n%n'.$format_string, @ARGV));
open PIPE, '-|', @cmd
or die ("$ME: failed to run '". quoted_cmd (@cmd) ."': $!\n"
. "(Is your Git too old? Version 1.5.1 or later is required.)\n");
my $author_line = shift @line;
defined $author_line
or die "$ME:$.: unexpected EOF\n";
- $author_line =~ /^(\d+) (.*>)$/
+ $author_line =~ /^(\S+) (.*>)$/
or die "$ME:$.: Invalid line "
. "(expected date/author/email):\n$author_line\n";
+ # Author <email>
+ my $author = $2;
+
+ my $commit_date = $1;
+ if (! $commit_timezone)
+ {
+ # Seconds since the Epoch.
+ $commit_date = strftime "%Y-%m-%d", localtime ($commit_date);
+ }
+ else
+ {
+ # ISO 8601 date.
+ $commit_date =~ s/T.*$//;
+ }
+
# Format 'Copyright-paperwork-exempt: Yes' as a standard ChangeLog
# '(tiny change)' annotation.
my $tiny = (grep (/^(?:Copyright-paperwork-exempt|Tiny-change):\s+[Yy]es$/, @line)
? ' (tiny change)' : '');
- my $date_line = sprintf "%s %s$tiny\n",
- strftime ("%Y-%m-%d", localtime ($1)), $2;
+ my $date_line = "$commit_date $author$tiny\n";
my @coauthors = grep /^Co-authored-by:.*$/, @line;
# Omit meta-data lines we've already interpreted.
# Complain about any unused entry in the --amend=F specified file.
my $fail = 0;
- foreach my $sha (keys %$amend_code)
+ foreach my $sha (sort keys %$amend_code)
{
warn "$ME:$amend_file: unused entry: $sha\n";
$fail = 1;
# Local Variables:
# mode: perl
# indent-tabs-mode: nil
-# eval: (add-hook 'before-save-hook 'time-stamp)
+# eval: (add-hook 'before-save-hook 'time-stamp nil t)
# time-stamp-line-limit: 50
# time-stamp-start: "my $VERSION = '"
-# time-stamp-format: "%:y-%02m-%02d %02H:%02M"
+# time-stamp-format: "%Y-%02m-%02d %02H:%02M"
# time-stamp-time-zone: "UTC0"
# time-stamp-end: "'; # UTC"
# End:
#!/bin/sh
# Sign files and upload them.
-scriptversion=2022-01-27.18; # UTC
+scriptversion=2025-06-28.18; # UTC
-# Copyright (C) 2004-2024 Free Software Foundation, Inc.
+# Copyright (C) 2004-2026 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# Choose the proper version of gpg, so as to avoid a
# "gpg-agent is not available in this session" error
# when gpg-agent is version 2 but gpg is still version 1.
-# FIXME-2020: remove, once all major distros ship gpg version 2 as /usr/bin/gpg
+# FIXME: remove, once all major distros ship gpg version 2 as /usr/bin/gpg
gpg_agent_version=`(gpg-agent --version) 2>/dev/null | sed -e '2,$d' -e 's/^[^0-9]*//'`
case "$gpg_agent_version" in
2.*)
# gpg2 is present.
GPG=gpg2
else
- # gpg2 is missing. Ubuntu users should install the package 'gnupg2'.
+ # gpg2 is missing. Slackware users should install the package 'gnupg2'.
echo "WARNING: Using 'gpg', which is too old. You should install 'gpg2'." 1>&2
fi
;;
actual command line options. Use this to keep your defaults. Comments
(#) and empty lines in $conffile are allowed.
+You may need to set GPG_TTY=\$(tty) in your environment. See the
+gpg-agent man page.
+
<https://www.gnu.org/prep/maintain/html_node/Automated-FTP-Uploads.html>
gives some further background.
exit 0
# Local variables:
-# eval: (add-hook 'before-save-hook 'time-stamp)
+# eval: (add-hook 'before-save-hook 'time-stamp nil t)
# time-stamp-start: "scriptversion="
-# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-format: "%Y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC0"
# time-stamp-end: "; # UTC"
# End:
#!/bin/sh
# install - install a program, script, or datafile
-scriptversion=2023-11-23.18; # UTC
+scriptversion=2025-06-18.21; # UTC
# This originates from X11R5 (mit/util/scripts/install.sh), which was
# later released in X11R6 (xc/config/util/install.sh) with the
-T) is_target_a_directory=never;;
- --version) echo "$0 $scriptversion"; exit $?;;
+ --version) echo "$0 (GNU Automake) $scriptversion"; exit $?;;
--) shift
break;;
' 0
# Because "mkdir -p" follows existing symlinks and we likely work
- # directly in world-writeable /tmp, make sure that the '$tmpdir'
+ # directly in world-writable /tmp, make sure that the '$tmpdir'
# directory is successfully created first before we actually test
# 'mkdir -p'.
if (umask $mkdir_umask &&
exec $mkdirprog $mkdir_mode -p -- "$tmpdir/a/b") >/dev/null 2>&1
then
if test -z "$dir_arg" || {
- # Check for POSIX incompatibilities with -m.
+ # Check for POSIX incompatibility with -m.
# HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
# other-writable bit of parent directory when it shouldn't.
# FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
done
# Local variables:
-# eval: (add-hook 'before-save-hook 'time-stamp)
+# eval: (add-hook 'before-save-hook 'time-stamp nil t)
# time-stamp-start: "scriptversion="
-# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-format: "%Y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC0"
# time-stamp-end: "; # UTC"
# End:
# Like mv $1 $2, but if the files are the same, just delete $1.
# Status is zero if successful, nonzero otherwise.
-VERSION='2018-03-07 03:47'; # UTC
+VERSION='2025-06-10 02:42'; # UTC
# The definition above must lie within the first 8 lines in order
# for the Emacs time-stamp write hook (at end) to update it.
# If you change this file with Emacs, please let the write hook
# do its job. Otherwise, update this string manually.
-# Copyright (C) 2002-2024 Free Software Foundation, Inc.
+# Copyright (C) 2002-2026 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
fi
## Local Variables:
-## eval: (add-hook 'before-save-hook 'time-stamp)
+## eval: (add-hook 'before-save-hook 'time-stamp nil t)
## time-stamp-start: "VERSION='"
-## time-stamp-format: "%:y-%02m-%02d %02H:%02M"
+## time-stamp-format: "%Y-%02m-%02d %02H:%02M"
## time-stamp-time-zone: "UTC0"
## time-stamp-end: "'; # UTC"
## End:
% Load plain if necessary, i.e., if running under initex.
\expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi
%
-\def\texinfoversion{2024-02-10.22}
+\def\texinfoversion{2025-12-23.13}
%
-% Copyright 1985, 1986, 1988, 1990-2024 Free Software Foundation, Inc.
+% Copyright 1985, 1986, 1988, 1990-2025 Free Software Foundation, Inc.
%
% This texinfo.tex file is free software: you can redistribute it and/or
% modify it under the terms of the GNU General Public License as
% Give the space character the catcode for a space.
\def\spaceisspace{\catcode`\ =10\relax}
-% Likewise for ^^M, the end of line character.
-\def\endlineisspace{\catcode13=10\relax}
+% Used to ignore an active newline that may appear immediately after
+% a macro name.
+{\catcode13=\active \gdef\ignoreactivenewline{\let^^M\empty}}
\chardef\dashChar = `\-
\chardef\slashChar = `\/
% Avoid "undefined control sequence" errors.
\def\currentchapterdefs{}
\def\currentsectiondefs{}
-\def\currentsection{}
\def\prevchapterdefs{}
\def\prevsectiondefs{}
\def\currentcolordefs{}
%
% Make the heading and footing. \makeheadline and \makefootline
% use the contents of \headline and \footline.
- \def\commonheadfootline{\let\hsize=\txipagewidth \texinfochars}
+ \def\commonheadfootline{\let\hsize=\txipagewidth \texinfochars}%
\ifodd\pageno \getoddheadingmarks \else \getevenheadingmarks \fi
\global\setbox\headlinebox = \vbox{\commonheadfootline \makeheadline}%
\ifodd\pageno \getoddfootingmarks \else \getevenfootingmarks \fi
% \envdef\foo{...}
% \def\Efoo{...}
%
-% It's the responsibility of \envdef to insert \begingroup before the
-% actual body; @end closes the group after calling \Efoo. \envdef also
+% \envdef inserts \begingroup before the actual body; @end calls
+% \Efoo then closes the group with \endgroup. \envdef also
% defines \thisenv, so the current environment is known; @end checks
% whether the environment name matches. The \checkenv macro can also be
% used to check whether the current environment is the one expected.
\def\:{\spacefactor=1000 }
% @* forces a line break.
-\def\*{\unskip\hfil\break\hbox{}\ignorespaces}
+% In internal horizontal or vertical mode, convert explicit line breaks
+% from @* into spaces. For instance, if the user gives these in long
+% section titles, this may occur in the table of contents, or the page
+% heading line.
+\def\*{%
+ \ifinner\unskip\space\ignorespaces
+ \else\unskip\hfil\break\hbox{}\ignorespaces\fi}
% @/ allows a line break.
\let\/=\allowbreak
\let\setfilename=\comment
% @bye.
-\outer\def\bye{\chappager\pagelabels\tracingstats=1\ptexend}
+\outer\def\bye{%
+ \chappager\pagelabels
+ % possibly set in \printindex
+ \ifx\byeerror\relax\else\errmessage{\byeerror}\fi
+ \tracingstats=1\ptexend}
+% set in \donoderef below, but we need to define this here so that
+% conditionals balance inside the large \ifpdf ... \fi blocks below.
+\newif\ifnodeseen
+\nodeseenfalse
\message{pdf,}
% adobe `portable' document format
\newif\ifpdf
\newif\ifpdfmakepagedest
+% when pdftex is run in dvi mode, \pdfoutput is defined (so \pdfoutput=1
+% can be set). So we test for \relax and 0 as well as being undefined.
+\ifx\pdfoutput\thisisundefined
+\else
+ \ifx\pdfoutput\relax
+ \else
+ \ifcase\pdfoutput
+ \else
+ \pdftrue
+ \fi
+ \fi
+\fi
+
+\newif\ifxetex
+\ifx\XeTeXrevision\thisisundefined\else
+ \xetextrue
+\fi
+
+\newif\ifluatex
+\ifx\luatexversion\thisisundefined\else
+ \luatextrue
+ \ifnum\luatexversion>84
+ \pdftrue
+ \fi
+\fi
+
+\newif\ifpdforxetex
+\ifpdf
+ \pdforxetextrue
+\fi
+\ifxetex
+ \pdforxetextrue
+\fi
+
+
+
+% Whether to use non-ASCII bytes in internal link targets. Presently this
+% is almost always on.
+\newif\iftxiuseunicodedestname
+\txiuseunicodedestnametrue
+
%
% For LuaTeX
%
-\newif\iftxiuseunicodedestname
-\txiuseunicodedestnamefalse % For pdfTeX etc.
-
-\ifx\luatexversion\thisisundefined
-\else
+\ifluatex
% Use Unicode destination names
\txiuseunicodedestnametrue
% Escape PDF strings with converting UTF-16 from UTF-8
%
\endgroup
\def\pdfescapestring#1{\directlua{PDFescstr('\luaescapestring{#1}')}}
- \ifnum\luatexversion>84
+ \ifpdf
% For LuaTeX >= 0.85
\def\pdfdest{\pdfextension dest}
\let\pdfoutput\outputmode
\fi
\fi
-% when pdftex is run in dvi mode, \pdfoutput is defined (so \pdfoutput=1
-% can be set). So we test for \relax and 0 as well as being undefined.
-\ifx\pdfoutput\thisisundefined
-\else
- \ifx\pdfoutput\relax
- \else
- \ifcase\pdfoutput
- \else
- \pdftrue
- \fi
- \fi
-\fi
-
-\newif\ifpdforxetex
-\pdforxetexfalse
-\ifpdf
- \pdforxetextrue
-\fi
-\ifx\XeTeXrevision\thisisundefined\else
- \pdforxetextrue
-\fi
-
% Output page labels information.
% See PDF reference v.1.7 p.594, section 8.3.1.
be supported due to the design of the PDF format; use regular TeX (DVI
output) for that.)}
+% definitions for pdftex or luatex with pdf output
\ifpdf
+ % Strings in PDF outlines can either be ASCII, or encoded in UTF-16BE
+ % with BOM. Unfortunately there is no simple way with pdftex to output
+ % UTF-16, so we have to do some quite convoluted expansion games if we
+ % find the string contains a non-ASCII codepoint if we want these to
+ % display correctly. We generated the UTF-16 sequences in
+ % \DeclareUnicodeCharacter and we access them here.
+ %
+ \def\defpdfoutlinetextunicode#1{%
+ \def\pdfoutlinetext{#1}%
+ %
+ % Make UTF-8 sequences expand to UTF-16 definitions.
+ \passthroughcharsfalse \utfbytespdftrue
+ \utfviiidefinedwarningfalse
+ %
+ % Completely expand, eliminating any control sequences such as \code,
+ % leaving only possibly \utfbytes.
+ \let\utfbytes\relax
+ \pdfaccentliterals
+ \xdef\pdfoutlinetextchecked{#1}%
+ \checkutfbytes
+ }%
+ % Check if \utfbytes occurs in expansion.
+ \def\checkutfbytes{%
+ \expandafter\checkutfbytesz\pdfoutlinetextchecked\utfbytes\finish
+ }%
+ \def\checkutfbytesz#1\utfbytes#2\finish{%
+ \def\after{#2}%
+ \ifx\after\empty
+ % No further action needed. Output ASCII string as-is, as converting
+ % to UTF-16 is somewhat slow (and uses more space).
+ \global\let\pdfoutlinetext\pdfoutlinetextchecked
+ \else
+ \passthroughcharstrue % pass UTF-8 sequences unaltered
+ \xdef\pdfoutlinetext{\pdfoutlinetext}%
+ \expandafter\expandutfsixteen\expandafter{\pdfoutlinetext}\pdfoutlinetext
+ \fi
+ }%
%
- % Color manipulation macros using ideas from pdfcolor.tex,
- % except using rgb instead of cmyk; the latter is said to render as a
- % very dark gray on-screen and a very dark halftone in print, instead
- % of actual black. The dark red here is dark enough to print on paper as
- % nearly black, but still distinguishable for online viewing. We use
- % black by default, though.
- \def\rgbDarkRed{0.50 0.09 0.12}
- \def\rgbBlack{0 0 0}
- %
- % rg sets the color for filling (usual text, etc.);
- % RG sets the color for stroking (thin rules, e.g., normal _'s).
- \def\pdfsetcolor#1{\pdfliteral{#1 rg #1 RG}}
+ \catcode2=1 % begin-group character
+ \catcode3=2 % end-group character
%
- % Set color, and create a mark which defines \thiscolor accordingly,
- % so that \makeheadline knows which color to restore.
- \def\curcolor{0 0 0}%
- \def\setcolor#1{%
- \ifx#1\curcolor\else
- \xdef\currentcolordefs{\gdef\noexpand\thiscolor{#1}}%
- \domark
- \pdfsetcolor{#1}%
- \xdef\curcolor{#1}%
- \fi
- }
+ % argument should be pure UTF-8 with no control sequences. convert to
+ % UTF-16BE by inserting null bytes before bytes < 128 and expanding
+ % UTF-8 multibyte sequences to saved UTF-16BE sequences.
+ \def\expandutfsixteen#1#2{%
+ \bgroup \asciitounicode
+ \passthroughcharsfalse
+ \let\utfbytes\asis
+ %
+ % for Byte Order Mark (BOM)
+ \catcode"FE=12
+ \catcode"FF=12
+ %
+ % we want to treat { and } in #1 as any other ASCII bytes. however,
+ % we need grouping characters for \scantokens and definitions/assignments,
+ % so define alternative grouping characters using control characters
+ % that are unlikely to occur.
+ % this does not affect 0x02 or 0x03 bytes arising from expansion as
+ % these are tokens with different catcodes.
+ \catcode"02=1 % begin-group character
+ \catcode"03=2 % end-group character
+ %
+ \expandafter\xdef\expandafter#2\scantokens{%
+ ^^02^^fe^^ff#1^^03}%
+ % NB we need \scantokens to provide both the open and close group tokens
+ % for \xdef otherwise there is an e-TeX error "File ended while
+ % scanning definition of..."
+ % NB \scantokens is a e-TeX command which is assumed to be provided by
+ % pdfTeX.
+ %
+ \egroup
+ }%
%
- \let\maincolor\rgbBlack
- \pdfsetcolor{\maincolor}
- \edef\thiscolor{\maincolor}
- \def\currentcolordefs{}
+ \catcode2=12 \catcode3=12 % defaults
%
- \def\makefootline{%
- \baselineskip24pt
- \line{\pdfsetcolor{\maincolor}\the\footline}%
- }
+ % Color support
%
- \def\makeheadline{%
- \vbox to 0pt{%
- \vskip-22.5pt
- \line{%
- \vbox to8.5pt{}%
- % Extract \thiscolor definition from the marks.
- \getcolormarks
- % Typeset the headline with \maincolor, then restore the color.
- \pdfsetcolor{\maincolor}\the\headline\pdfsetcolor{\thiscolor}%
- }%
- \vss
- }%
- \nointerlineskip
- }
+ % rg sets the color for filling (usual text, etc.);
+ % RG sets the color for stroking (thin rules, e.g., normal _'s).
+ \def\pdfsetcolor#1{\pdfliteral{#1 rg #1 RG}}
%
+ % PDF outline support
%
\pdfcatalog{/PageMode /UseOutlines}
%
\def\pdfoutlinetext{#1}%
\else
\ifx \declaredencoding \utfeight
- \ifx\luatexversion\thisisundefined
- % For pdfTeX with UTF-8.
- % TODO: the PDF format can use UTF-16 in bookmark strings,
- % but the code for this isn't done yet.
- % Use ASCII approximations.
- \passthroughcharsfalse
- \def\pdfoutlinetext{#1}%
- \else
+ \ifluatex
% For LuaTeX with UTF-8.
% Pass through Unicode characters for title texts.
\passthroughcharstrue
- \def\pdfoutlinetext{#1}%
+ \pdfaccentliterals
+ \xdef\pdfoutlinetext{#1}%
+ \else
+ % For pdfTeX with UTF-8.
+ \defpdfoutlinetextunicode{#1}%
\fi
\else
% For non-Latin-1 or non-UTF-8 encodings.
\safewhatsit{\pdfdest name{\pdfdestname} xyz}%
}
%
- % used to mark target names; must be expandable.
- \def\pdfmkpgn#1{#1}
- %
- % by default, use black for everything.
- \def\urlcolor{\rgbBlack}
- \let\linkcolor\rgbBlack
- \def\endlink{\setcolor{\maincolor}\pdfendlink}
- %
% Adding outlines to PDF; macros for calculating structure of outlines
% come from Petr Olsak
\def\expnumber#1{\expandafter\ifx\csname#1\endcsname\relax 0%
\def\pdfdestname{#4}%
\fi
%
- \pdfoutline goto name{\pdfmkpgn{\pdfdestname}}#2{\pdfoutlinetext}%
+ \pdfoutline goto name{\pdfdestname}#2{\pdfoutlinetext}%
}
%
\def\pdfmakeoutlines{%
\def\thischapnum{##2}%
\def\thissecnum{0}%
\def\thissubsecnum{0}%
+ \def\indexlastsec{chap\thischapnum}%
}%
\def\numsecentry##1##2##3##4{%
\advancenumber{chap\thischapnum}%
\def\thissecnum{##2}%
\def\thissubsecnum{0}%
+ \def\indexlastsec{sec\thissecnum}%
}%
\def\numsubsecentry##1##2##3##4{%
\advancenumber{sec\thissecnum}%
\def\thissubsecnum{##2}%
+ \def\indexlastsec{subsec\thissecnum}%
}%
\def\numsubsubsecentry##1##2##3##4{%
\advancenumber{subsec\thissubsecnum}%
\def\thischapnum{0}%
\def\thissecnum{0}%
\def\thissubsecnum{0}%
+ \let\indexlastsec\empty
%
+ % Index initials are subsidiary to whatever sectioning command just
+ % occurred, usually @appendix or @chapter but occasionally a lower level.
+ \def\idxinitialentry##1##2##3##4{%
+ \expandafter\advancenumber\expandafter{\indexlastsec}%
+ }%
% use \def rather than \let here because we redefine \chapentry et
% al. a second time, below.
\def\appentry{\numchapentry}%
\def\unnsecentry{\numsecentry}%
\def\unnsubsecentry{\numsubsecentry}%
\def\unnsubsubsecentry{\numsubsubsecentry}%
+ %
\readdatafile{toc}%
%
% Read toc second time, this time actually producing the outlines.
\dopdfoutline{##1}{count-\expnumber{subsec##2}}{##3}{##4}}%
\def\numsubsubsecentry##1##2##3##4{% count is always zero
\dopdfoutline{##1}{}{##3}{##4}}%
+ \def\idxinitialentry##1##2##3##4{%
+ \dopdfoutline{##1}{}{idx.##1.##2}{##4}}%
%
- % PDF outlines are displayed using system fonts, instead of
- % document fonts. Therefore we cannot use special characters,
- % since the encoding is unknown. For example, the eogonek from
- % Latin 2 (0xea) gets translated to a | character. Info from
- % Staszek Wawrykiewicz, 19 Jan 2004 04:09:24 +0100.
- %
- % TODO this right, we have to translate 8-bit characters to
- % their "best" equivalent, based on the @documentencoding. Too
- % much work for too little return. Just use the ASCII equivalents
- % we use for the index sort strings.
- %
- \indexnofonts
+ \ifnodeseen\else \dopdfoutlinecontents \fi % for @contents at beginning
\setupdatafile
% We can have normal brace characters in the PDF outlines, unlike
% Texinfo index files. So set that up.
\def\{{\lbracecharliteral}%
\def\}{\rbracecharliteral}%
\catcode`\\=\active \otherbackslash
- \input \tocreadfilename
+ \input \tocreadfilename\relax
+ \ifnodeseen \dopdfoutlinecontents \fi % for @contents at end
\endgroup
}
+ \def\dopdfoutlinecontents{%
+ \expandafter\dopdfoutline\expandafter{\putwordTOC}{}{txi.CONTENTS}{}%
+ }
{\catcode`[=1 \catcode`]=2
\catcode`{=\other \catcode`}=\other
\gdef\lbracecharliteral[{]%
\else
\let \startlink \pdfstartlink
\fi
- % make a live url in pdf output.
- \def\pdfurl#1{%
- \begingroup
- % it seems we really need yet another set of dummies; have not
- % tried to figure out what each command should do in the context
- % of @url. for now, just make @/ a no-op, that's the only one
- % people have actually reported a problem with.
- %
- \normalturnoffactive
- \def\@{@}%
- \let\/=\empty
- \makevalueexpandable
- % do we want to go so far as to use \indexnofonts instead of just
- % special-casing \var here?
- \def\var##1{##1}%
- %
- \leavevmode\setcolor{\urlcolor}%
- \startlink attr{/Border [0 0 0]}%
- user{/Subtype /Link /A << /S /URI /URI (#1) >>}%
- \endgroup}
- % \pdfgettoks - Surround page numbers in #1 with @pdflink. #1 may
- % be a simple number, or a list of numbers in the case of an index
- % entry.
- \def\pdfgettoks#1.{\setbox\boxA=\hbox{\toksA={#1.}\toksB={}\maketoks}}
- \def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks}
- \def\adn#1{\addtokens{\toksC}{#1}\global\countA=1\let\next=\maketoks}
- \def\poptoks#1#2|ENDTOKS|{\let\first=#1\toksD={#1}\toksA={#2}}
- \def\maketoks{%
- \expandafter\poptoks\the\toksA|ENDTOKS|\relax
- \ifx\first0\adn0
- \else\ifx\first1\adn1 \else\ifx\first2\adn2 \else\ifx\first3\adn3
- \else\ifx\first4\adn4 \else\ifx\first5\adn5 \else\ifx\first6\adn6
- \else\ifx\first7\adn7 \else\ifx\first8\adn8 \else\ifx\first9\adn9
- \else
- \ifnum0=\countA\else\makelink\fi
- \ifx\first.\let\next=\done\else
- \let\next=\maketoks
- \addtokens{\toksB}{\the\toksD}
- \ifx\first,\addtokens{\toksB}{\space}\fi
- \fi
- \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
- \next}
- \def\makelink{\addtokens{\toksB}%
- {\noexpand\pdflink{\the\toksC}}\toksC={}\global\countA=0}
+ \def\pdfmakeurl#1{%
+ \startlink attr{/Border [0 0 0]}%
+ user{/Subtype /Link /A << /S /URI /URI (#1) >>}%
+ }%
+ \def\endlink{\setcolor{\maincolor}\pdfendlink}
+ %
\def\pdflink#1{\pdflinkpage{#1}{#1}}%
\def\pdflinkpage#1#2{%
- \startlink attr{/Border [0 0 0]} goto name{\pdfmkpgn{#1}}
+ \startlink attr{/Border [0 0 0]} goto name{#1}
\setcolor{\linkcolor}#2\endlink}
- \def\done{\edef\st{\global\noexpand\toksA={\the\toksB}}\st}
\else
% non-pdf mode
\let\pdfmkdest = \gobble
\let\setcolor = \gobble
\let\pdfsetcolor = \gobble
\let\pdfmakeoutlines = \relax
-\fi % \ifx\pdfoutput
+\fi
%
% For XeTeX
%
-\ifx\XeTeXrevision\thisisundefined
-\else
+\ifxetex
%
% XeTeX version check
%
\fi
%
% Color support
- %
- \def\rgbDarkRed{0.50 0.09 0.12}
- \def\rgbBlack{0 0 0}
- %
\def\pdfsetcolor#1{\special{pdf:scolor [#1]}}
%
- % Set color, and create a mark which defines \thiscolor accordingly,
- % so that \makeheadline knows which color to restore.
- \def\setcolor#1{%
- \xdef\currentcolordefs{\gdef\noexpand\thiscolor{#1}}%
- \domark
- \pdfsetcolor{#1}%
- }
- %
- \def\maincolor{\rgbBlack}
- \pdfsetcolor{\maincolor}
- \edef\thiscolor{\maincolor}
- \def\currentcolordefs{}
- %
- \def\makefootline{%
- \baselineskip24pt
- \line{\pdfsetcolor{\maincolor}\the\footline}%
- }
- %
- \def\makeheadline{%
- \vbox to 0pt{%
- \vskip-22.5pt
- \line{%
- \vbox to8.5pt{}%
- % Extract \thiscolor definition from the marks.
- \getcolormarks
- % Typeset the headline with \maincolor, then restore the color.
- \pdfsetcolor{\maincolor}\the\headline\pdfsetcolor{\thiscolor}%
- }%
- \vss
- }%
- \nointerlineskip
- }
- %
% PDF outline support
%
% Emulate pdfTeX primitive
\safewhatsit{\pdfdest name{\pdfdestname} xyz}%
}
%
- % by default, use black for everything.
- \def\urlcolor{\rgbBlack}
- \def\linkcolor{\rgbBlack}
- \def\endlink{\setcolor{\maincolor}\pdfendlink}
- %
\def\dopdfoutline#1#2#3#4{%
\setpdfoutlinetext{#1}
\setpdfdestname{#3}
%
\def\pdfmakeoutlines{%
\begingroup
- %
% For XeTeX, counts of subentries are not necessary.
% Therefore, we read toc only once.
%
% horizontal space being required in the PDF viewer.
\def\partentry##1##2##3##4{}% ignore parts in the outlines
\def\numchapentry##1##2##3##4{%
- \dopdfoutline{##2 ##1}{1}{##3}{##4}}%
+ \dopdfoutline{##2 ##1}{1}{##3}{##4}%
+ \def\indexseclevel{2}}%
\def\numsecentry##1##2##3##4{%
- \dopdfoutline{##1}{2}{##3}{##4}}%
+ \dopdfoutline{##1}{2}{##3}{##4}%
+ \def\indexseclevel{3}}%
\def\numsubsecentry##1##2##3##4{%
- \dopdfoutline{##1}{3}{##3}{##4}}%
+ \dopdfoutline{##1}{3}{##3}{##4}%
+ \def\indexseclevel{4}}%
\def\numsubsubsecentry##1##2##3##4{%
- \dopdfoutline{##1}{4}{##3}{##4}}%
+ \dopdfoutline{##1}{4}{##3}{##4}%
+ \def\indexseclevel{5}}%
+ %
+ \def\idxinitialentry##1##2##3##4{%
+ \dopdfoutline{##1}{\indexseclevel}{idx.##1.##2}{##4}}%
%
\let\appentry\numchapentry%
\let\appsecentry\numsecentry%
% Therefore, the encoding and the language may not be considered.
%
\indexnofonts
+ \pdfaccentliterals
+ \ifnodeseen\else \dopdfoutlinecontents \fi % for @contents at beginning
+ %
\setupdatafile
% We can have normal brace characters in the PDF outlines, unlike
% Texinfo index files. So set that up.
\def\{{\lbracecharliteral}%
\def\}{\rbracecharliteral}%
\catcode`\\=\active \otherbackslash
- \input \tocreadfilename
+ \xetexpreauxfile
+ \input \tocreadfilename\relax
+ \xetexpostauxfile
+ \ifnodeseen \dopdfoutlinecontents \fi % for @contents at end
\endgroup
}
+ \def\dopdfoutlinecontents{%
+ \expandafter\dopdfoutline\expandafter
+ {\putwordTOC}{1}{txi.CONTENTS}{txi.CONTENTS}%
+ }
{\catcode`[=1 \catcode`]=2
\catcode`{=\other \catcode`}=\other
\gdef\lbracecharliteral[{]%
% However, due to a UTF-16 conversion issue of xdvipdfmx 20150315,
% ``\special{pdf:dest ...}'' cannot handle non-ASCII strings.
% It is fixed by xdvipdfmx 20160106 (TeX Live SVN r39753).
-%
+ %
\def\skipspaces#1{\def\PP{#1}\def\D{|}%
\ifx\PP\D\let\nextsp\relax
\else\let\nextsp\skipspaces
\edef\temp{#1}%
\expandafter\skipspaces\temp|\relax
}
- % make a live url in pdf output.
- \def\pdfurl#1{%
- \begingroup
- % it seems we really need yet another set of dummies; have not
- % tried to figure out what each command should do in the context
- % of @url. for now, just make @/ a no-op, that's the only one
- % people have actually reported a problem with.
- %
- \normalturnoffactive
- \def\@{@}%
- \let\/=\empty
- \makevalueexpandable
- % do we want to go so far as to use \indexnofonts instead of just
- % special-casing \var here?
- \def\var##1{##1}%
- %
- \leavevmode\setcolor{\urlcolor}%
- \special{pdf:bann << /Border [0 0 0]
- /Subtype /Link /A << /S /URI /URI (#1) >> >>}%
- \endgroup}
+ \def\pdfmakeurl#1{%
+ \special{pdf:bann << /Border [0 0 0]
+ /Subtype /Link /A << /S /URI /URI (#1) >> >>}%
+ }
\def\endlink{\setcolor{\maincolor}\special{pdf:eann}}
- \def\pdfgettoks#1.{\setbox\boxA=\hbox{\toksA={#1.}\toksB={}\maketoks}}
- \def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks}
- \def\adn#1{\addtokens{\toksC}{#1}\global\countA=1\let\next=\maketoks}
- \def\poptoks#1#2|ENDTOKS|{\let\first=#1\toksD={#1}\toksA={#2}}
- \def\maketoks{%
- \expandafter\poptoks\the\toksA|ENDTOKS|\relax
- \ifx\first0\adn0
- \else\ifx\first1\adn1 \else\ifx\first2\adn2 \else\ifx\first3\adn3
- \else\ifx\first4\adn4 \else\ifx\first5\adn5 \else\ifx\first6\adn6
- \else\ifx\first7\adn7 \else\ifx\first8\adn8 \else\ifx\first9\adn9
- \else
- \ifnum0=\countA\else\makelink\fi
- \ifx\first.\let\next=\done\else
- \let\next=\maketoks
- \addtokens{\toksB}{\the\toksD}
- \ifx\first,\addtokens{\toksB}{\space}\fi
- \fi
- \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
- \next}
- \def\makelink{\addtokens{\toksB}%
- {\noexpand\pdflink{\the\toksC}}\toksC={}\global\countA=0}
\def\pdflink#1{\pdflinkpage{#1}{#1}}%
\def\pdflinkpage#1#2{%
\special{pdf:bann << /Border [0 0 0]
/Type /Annot /Subtype /Link /A << /S /GoTo /D (#1) >> >>}%
\setcolor{\linkcolor}#2\endlink}
- \def\done{\edef\st{\global\noexpand\toksA={\the\toksB}}\st}
-%
+ %
%
% @image support
%
\XeTeXpicfile "#1".\xeteximgext ""
\fi
\fi
- \ifdim \wd0 >0pt width \xeteximagewidth \fi
- \ifdim \wd2 >0pt height \xeteximageheight \fi \relax
- \egroup
- }
+ \ifdim \wd0 >0pt width \xeteximagewidth \fi
+ \ifdim \wd2 >0pt height \xeteximageheight \fi \relax
+ \egroup
+ }
+\fi
+
+% common definitions and code for pdftex, luatex and xetex
+\ifpdforxetex
+ % The dark red here is dark enough to print on paper as
+ % nearly black, but still distinguishable for online viewing. We use
+ % black by default, though.
+ \def\rgbDarkRed{0.50 0.09 0.12}
+ \def\rgbBlack{0 0 0}
+ %
+ % Set color, and create a mark which defines \thiscolor accordingly,
+ % so that \makeheadline knows which color to restore.
+ \def\curcolor{0 0 0}%
+ \def\setcolor#1{%
+ \ifx#1\curcolor\else
+ \xdef\currentcolordefs{\gdef\noexpand\thiscolor{#1}}%
+ \domark
+ \pdfsetcolor{#1}%
+ \xdef\curcolor{#1}%
+ \fi
+ }
+ %
+ \let\maincolor\rgbBlack
+ \pdfsetcolor{\maincolor}
+ \edef\thiscolor{\maincolor}
+ \def\currentcolordefs{}
+ %
+ \def\makefootline{%
+ \baselineskip24pt
+ \line{\pdfsetcolor{\maincolor}\the\footline}%
+ }
+ %
+ \def\makeheadline{%
+ \vbox to 0pt{%
+ \vskip-22.5pt
+ \line{%
+ \vbox to8.5pt{}%
+ % Extract \thiscolor definition from the marks.
+ \getcolormarks
+ % Typeset the headline with \maincolor, then restore the color.
+ \pdfsetcolor{\maincolor}\the\headline\pdfsetcolor{\thiscolor}%
+ }%
+ \vss
+ }%
+ \nointerlineskip
+ }
+ %
+ % by default, use black for everything.
+ \def\urlcolor{\rgbBlack}
+ \let\linkcolor\rgbBlack
+ %
+ % make a live url in pdf output.
+ \def\pdfurl#1{%
+ \begingroup
+ % it seems we really need yet another set of dummies; have not
+ % tried to figure out what each command should do in the context
+ % of @url. for now, just make @/ a no-op, that's the only one
+ % people have actually reported a problem with.
+ %
+ \normalturnoffactive
+ \def\@{@}%
+ \let\/=\empty
+ \makevalueexpandable
+ % do we want to go so far as to use \indexnofonts instead of just
+ % special-casing \var here?
+ \def\var##1{##1}%
+ %
+ \leavevmode\setcolor{\urlcolor}%
+ \pdfmakeurl{#1}%
+ \endgroup}
+ %
+ % \pdfgettoks - Surround page numbers in #1 with @pdflink. #1 may
+ % be a simple number, or a list of numbers in the case of an index
+ % entry.
+ \def\pdfgettoks#1.{\setbox\boxA=\hbox{\toksA={#1.}\toksB={}\maketoks}}
+ \def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks}
+ \def\adn#1{\addtokens{\toksC}{#1}\global\countA=1\let\next=\maketoks}
+ \def\poptoks#1#2|ENDTOKS|{\let\first=#1\toksD={#1}\toksA={#2}}
+ \def\maketoks{%
+ \expandafter\poptoks\the\toksA|ENDTOKS|\relax
+ \ifx\first0\adn0
+ \else\ifx\first1\adn1 \else\ifx\first2\adn2 \else\ifx\first3\adn3
+ \else\ifx\first4\adn4 \else\ifx\first5\adn5 \else\ifx\first6\adn6
+ \else\ifx\first7\adn7 \else\ifx\first8\adn8 \else\ifx\first9\adn9
+ \else
+ \ifnum0=\countA\else\makelink\fi
+ \ifx\first.\let\next=\done\else
+ \let\next=\maketoks
+ \addtokens{\toksB}{\the\toksD}
+ \ifx\first,\addtokens{\toksB}{\space}\fi
+ \fi
+ \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
+ \next}
+ \def\makelink{\addtokens{\toksB}%
+ {\noexpand\pdflink{\the\toksC}}\toksC={}\global\countA=0}
+ \def\done{\edef\st{\global\noexpand\toksA={\the\toksB}}\st}
\fi
+\ifpdforxetex
+ % for pdftex.
+ {\catcode`^^cc=13
+ \gdef\pdfaccentliteralsutfviii{%
+ % For PDF outline only. Unicode combining accents follow the
+ % character they modify. Note we need at least the first byte
+ % of the UTF-8 sequences to have an active catcode to allow the
+ % definitions to do their magic.
+ \def\"##1{##1^^cc^^88}% U+0308
+ \def\'##1{##1^^cc^^81}% U+0301
+ \def\,##1{##1^^cc^^a7}% U+0327
+ \def\=##1{##1^^cc^^85}% U+0305
+ \def\^##1{##1^^cc^^82}% U+0302
+ \def\`##1{##1^^cc^^80}% U+0300
+ \def\~##1{##1^^cc^^83}% U+0303
+ \def\dotaccent##1{##1^^cc^^87}% U+0307
+ \def\H##1{##1^^cc^^8b}% U+030B
+ \def\ogonek##1{##1^^cc^^a8}% U+0328
+ \def\ringaccent##1{##1^^cc^^8a}% U+030A
+ \def\u##1{##1^^cc^^8c}% U+0306
+ \def\ubaraccent##1{##1^^cc^^b1}% U+0331
+ \def\udotaccent##1{##1^^cc^^a3}% U+0323
+ \def\v##1{##1^^cc^^8c}% U+030C
+ % this definition of @tieaccent will only work with exactly two characters
+ % in argument as we need to insert the combining character between them.
+ \def\tieaccent##1{\tieaccentz##1}%
+ \def\tieaccentz##1##2{##1^^cd^^a1##2} % U+0361
+ }}%
+ %
+ % for xetex and luatex, which both support extended ^^^^ escapes and
+ % process the Unicode codepoint as a single token.
+ \gdef\pdfaccentliteralsnative{%
+ \def\"##1{##1^^^^0308}%
+ \def\'##1{##1^^^^0301}%
+ \def\,##1{##1^^^^0327}%
+ \def\=##1{##1^^^^0305}%
+ \def\^##1{##1^^^^0302}%
+ \def\`##1{##1^^^^0300}%
+ \def\~##1{##1^^^^0303}%
+ \def\dotaccent##1{##1^^^^0307}%
+ \def\H##1{##1^^^^030b}%
+ \def\ogonek##1{##1^^^^0328}%
+ \def\ringaccent##1{##1^^^^030a}%
+ \def\u##1{##1^^^^0306}%
+ \def\ubaraccent##1{##1^^^^0331}%
+ \def\udotaccent##1{##1^^^^0323}%
+ \def\v##1{##1^^^^030c}%
+ \def\tieaccent##1{\tieaccentz##1}%
+ \def\tieaccentz##1##2{##1^^^^0361##2} % U+0361
+ }%
+ %
+ % use the appropriate definition
+ \ifluatex
+ \let\pdfaccentliterals\pdfaccentliteralsnative
+ \else
+ \ifxetex
+ \let\pdfaccentliterals\pdfaccentliteralsnative
+ \else
+ \let\pdfaccentliterals\pdfaccentliteralsutfviii
+ \fi
+ \fi
+\fi
%
\message{fonts,}
% @cite unconditionally uses \sl with \smartitaliccorrection.
\def\cite#1{{\sl #1}\smartitaliccorrection}
-% @var unconditionally uses \sl. This gives consistency for
-% parameter names whether they are in @def, @table @code or a
-% regular paragraph.
-% To get ttsl font for @var when used in code context, @set txicodevaristt.
-% The \null is to reset \spacefactor.
+% By default, use ttsl font for @var when used in code context.
+% To unconditionally use \sl for @var, @clear txicodevaristt. This
+% gives consistency for parameter names whether they are in @def,
+% @table @code or a regular paragraph.
\def\aftersmartic{}
\def\var#1{%
\let\saveaftersmartic = \aftersmartic
\def\aftersmartic{\null\let\aftersmartic=\saveaftersmartic}%
+ % The \null is to reset \spacefactor.
%
\ifflagclear{txicodevaristt}%
{\def\varnext{{{\sl #1}}\smartitaliccorrection}}%
\varnext
}
-% To be removed after next release
\def\SETtxicodevaristt{}% @set txicodevaristt
\let\i=\smartitalic
\def\ii#1{{\it #1}} % italic font
% @b, explicit bold. Also @strong.
-\def\b#1{{\bf #1}}
+\def\b#1{{\bf \defcharsdefault #1}}
\let\strong=\b
% @sansserif, explicit sans.
\unhbox0\ (\urefcode{#1})%
\fi
\else
- \ifx\XeTeXrevision\thisisundefined
- \unhbox0\ (\urefcode{#1})% DVI, always show arg and url
- \else
+ \ifxetex
% For XeTeX
\ifurefurlonlylink
% PDF plus option to not display url, show just arg
% visibility, if the pdf is eventually used to print, etc.
\unhbox0\ (\urefcode{#1})%
\fi
+ \else
+ \unhbox0\ (\urefcode{#1})% DVI, always show arg and url
\fi
\fi
\else
% at the end of the line, or no break at all here.
% Changing the value of the penalty and/or the amount of stretch affects how
% preferable one choice is over the other.
+% Check test cases in doc/texinfo-tex-test.texi before making any changes.
\def\urefallowbreak{%
\penalty0\relax
- \hskip 0pt plus 2 em\relax
+ \hskip 0pt plus 3 em\relax
\penalty1000\relax
- \hskip 0pt plus -2 em\relax
+ \hskip 0pt plus -3 em\relax
}
\urefbreakstyle after
{\font\thisecfont = #1ctt\ecsize \space at \nominalsize}%
% else
{\ifx\curfontstyle\bfstylename
- % bold:
- \font\thisecfont = #1cb\ifusingit{i}{x}\ecsize \space at \nominalsize
+ \etcfontbold{#1}%
\else
- % regular:
- \font\thisecfont = #1c\ifusingit{ti}{rm}\ecsize \space at \nominalsize
+ \ifrmisbold
+ \etcfontbold{#1}%
+ \else
+ % regular:
+ \font\thisecfont = #1c\ifusingit{ti}{rm}\ecsize \space
+ at \nominalsize
+ \fi
\fi}%
\thisecfont
}
+\def\etcfontbold#1{%
+ % bold:
+ \font\thisecfont = #1cb\ifusingit{i}{x}\ecsize \space at \nominalsize
+}
+
% @registeredsymbol - R in a circle. The font for the R should really
% be smaller yet, but lllsize is the best we can do for now.
% Adapted from the plain.tex definition of \copyright.
}
\def\finishtitlepage{%
- \vskip4pt \hrule height 2pt width \hsize
+ \ifseenauthor \vskip4pt \else \vskip 0pt plus 1filll \fi
+ \hrule height 2pt width \hsize
\vskip\titlepagebottomglue
\finishedtitlepagetrue
}
\let\subtitlerm=\rmfont
\def\subtitlefont{\subtitlerm \normalbaselineskip = 13pt \normalbaselines}
+\let\savedtitle\empty
+\let\savedsubtitlegroup\empty
+\let\savedauthorgroup\empty
+
\parseargdef\title{%
- \checkenv\titlepage
- \vbox{\titlefonts \raggedtitlesettings #1\par}%
- % print a rule at the page bottom also.
- \finishedtitlepagefalse
- \vskip4pt \hrule height 4pt width \hsize \vskip4pt
+ \expandafter\ifx\thisenv\documentinfo
+ \gdef\savedtitle{#1}%
+ \else
+ \checkenv\titlepage
+ \vbox{\titlefonts \raggedtitlesettings #1\par}%
+ % print a rule at the page bottom also.
+ \finishedtitlepagefalse
+ \vskip4pt \hrule height 4pt width \hsize \vskip4pt
+ \fi
}
\parseargdef\subtitle{%
- \checkenv\titlepage
- {\subtitlefont \rightline{#1}}%
+ \expandafter\ifx\thisenv\documentinfo
+ \ifx\savedsubtitlegroup\empty
+ \gdef\savedsubtitlegroup{\savedsubtitle{#1}}%
+ \else
+ \expandafter\gdef\expandafter\savedsubtitlegroup\expandafter{%
+ \savedsubtitlegroup\savedsubtitle{#1}}%
+ \fi
+ \else
+ \checkenv\titlepage
+ {\subtitlefont \rightline{#1}}%
+ \fi
}
% @author should come last, but may come many times.
% It can also be used inside @quotation.
%
\parseargdef\author{%
- \def\temp{\quotation}%
- \ifx\thisenv\temp
- \def\quotationauthor{#1}% printed in \Equotation.
+ \expandafter\ifx\thisenv\documentinfo
+ \ifx\savedauthorgroup\empty
+ \gdef\savedauthorgroup{\savedauthor{#1}}%
+ \else
+ \expandafter\gdef\expandafter\savedauthorgroup\expandafter{%
+ \savedauthorgroup\savedauthor{#1}}%
+ \fi
\else
- \checkenv\titlepage
- \ifseenauthor\else \vskip 0pt plus 1filll \seenauthortrue \fi
- {\secfonts\rm \leftline{#1}}%
+ \def\temp{\quotation}%
+ \ifx\thisenv\temp
+ \def\quotationauthor{#1}% printed in \Equotation.
+ \else
+ \checkenv\titlepage
+ \ifseenauthor\else \vskip 0pt plus 1filll \seenauthortrue \fi
+ {\secfonts\rm \leftline{#1}}%
+ \fi
\fi
}
+% @maketitle
+{\obeylines
+\gdef\maketitle{%
+\titlepage
+\ifx\savedtitle\empty\else
+ \title \savedtitle
+ \ifx\savedsubtitlegroup\empty\else
+ \savedsubtitlegroup
+\fi\fi
+\ifx\savedauthorgroup\empty\else
+ \savedauthorgroup
+\fi
+% start verso page if either copying or publication text is given
+\ifx\copyingtext\relax
+ \ifx\publicationtext\relax\else
+ \page \vskip 0pt plus 1filll
+ \fi
+\else
+ \page \vskip 0pt plus 1filll
+\fi
+\ifx\publicationtext\relax\else
+ \insertpublication
+ \sp 1
+\fi
+\ifx\copyingtext\relax\else
+ \insertcopying
+\fi
+\end titlepage
+}
+
+% \savedauthor{#1}, called with braces. output an @author line.
+\gdef\savedauthor#1{%
+\author#1
+}
+
+% \savedsubtitle{#1}, called with braces. output a @subtitle line.
+\gdef\savedsubtitle#1{%
+\subtitle#1
+}
+} % \obeylines
+
+% @documentinfo block
+\envdef\documentinfo{%
+}
+\def\Edocumentinfo{}%
+
% Set up page headings and footings.
%
\uccode`\1=`\{ \uppercase{\def\{{1}}%
\uccode`\1=`\} \uppercase{\def\}{1}}%
- \let\lbracechar\{%
- \let\rbracechar\}%
+ \def\lbracechar##1{\{}%
+ \def\rbracechar##1{\}}%
%
%
% We need to get rid of all macros, leaving only the arguments (if present).
\tolerance = 9500
\plainfrenchspacing
\everypar = {}% don't want the \kern\-parindent from indentation suppression.
+ \let\entry\indexentry
+ \ifxetex\xetexpreauxfile\fi
%
% See comment in \requireopenindexfile.
\def\indexname{#1}\ifx\indexname\indexisfl\def\indexname{f1}\fi
\fi
\fi
\closein 1
+ \ifxetex\xetexpostauxfile\fi
\endgroup}
+% Checked in @bye
+\let\byeerror\relax
+
% If the index file starts with a backslash, forgo reading the index
% file altogether. If somebody upgrades texinfo.tex they may still have
% old index files using \ as the escape character. Reading this would
\ifflagclear{txiindexescapeisbackslash}{%
\uccode`\~=`\\ \uppercase{\if\noexpand~}\noexpand#1
\ifflagclear{txiskipindexfileswithbackslash}{%
-\errmessage{%
+ % Delay the error message until the very end to give a chance
+ % for the whole index to be output as input for texindex.
+ \global\def\byeerror{%
ERROR: A sorted index file in an obsolete format was skipped.
To fix this problem, please upgrade your version of 'texi2dvi'
or 'texi2pdf' to that at <https://ftp.gnu.org/gnu/texinfo>.
}%
\else
\begindoublecolumns
+ \ifxetex\xetexpreauxfile\fi
\input \jobname.\indexname s
+ \ifxetex\xetexpostauxfile\fi
\enddoublecolumns
\fi
}{%
% should work because we (hopefully) don't otherwise use @ in index files.
%\catcode`\@=12\relax
\catcode`\@=0\relax
+ \ifxetex\xetexpreauxfile\fi
\input \jobname.\indexname s
+ \ifxetex\xetexpostauxfile\fi
\enddoublecolumns
}%
}
+\def\indexentry#1#2{%
+ \let\entrypagetarget\empty
+ \ifflagclear{txilinkindextext}{}{%
+ \ifpdforxetex
+ % link the index text to the page if no comma appears in the
+ % list of pages, i.e. there is only one page
+ \checkpagelistcomma{#2}\pagelistcomma
+ \expandafter\ifcase\pagelistcomma
+ \def\entrypagetarget{#2}%
+ \fi
+ \fi%
+ }%
+ \entryinternal{#1}{#2}%
+}
+
+\def\checkpagelistcomma#1#2{%
+ \checkpagelistcommaxx#2#1,\finish
+}
+\def\checkpagelistcommaxx#1#2,#3\finish{%
+ \def\tmp{#3}%
+ \ifx\tmp\empty
+ \def#1{0\relax}
+ \else
+ \def#1{1\relax}
+ \fi
+}
+
+
% These macros are used by the sorted index file itself.
% Change them to control the appearance of the index.
\def\initial{%
\bgroup
- \initialglyphs
\initialx
}
%
% No shrink because it confuses \balancecolumns.
\vskip 1.67\baselineskip plus 1\baselineskip
- \leftline{\secfonts \kern-0.05em \secbf #1}%
+ \doindexinitialentry{#1}%
+ \initialglyphs
+ \leftline{%
+ \secfonts \kern-0.05em \secbf #1}%
% \secfonts is inside the argument of \leftline so that the change of
% \baselineskip will not affect any glue inserted before the vbox that
% \leftline creates.
\egroup % \initialglyphs
}
+\def\doindexinitialentry#1{%
+ \ifpdforxetex
+ \global\advance\idxinitialno by 1
+ \def\indexlbrace{\{}%
+ \def\indexrbrace{\}}%
+ \def\indexbackslash{\realbackslash}%
+ \def\indexatchar{\@}%
+ \writetocentry{idxinitial}{\asis #1\empty}{IDX\the\idxinitialno}%
+ % The @asis removes a pair of braces around e.g. {@indexatchar} that
+ % are output by texindex. \empty is an argument to \asis in case #1
+ % is empty.
+ %
+ \pdfmkdest{idx.\asis #1.IDX\the\idxinitialno}%
+ \fi
+}
+
+% No listing in TOC
+\def\idxinitialentry#1#2#3#4{}
+
+% For index initials.
+\newcount\idxinitialno \idxinitialno=1
+
+
\newdimen\entryrightmargin
\entryrightmargin=0pt
\newdimen\entrycontskip
\entrycontskip=1em
-% for PDF output, whether to make the text of the entry a link to the page
-% number. set for @contents and @shortcontents where there is only one
-% page number.
+% for PDF output, whether to make the text of the entry a link to the section.
+% set for @contents and @shortcontents.
\newif\iflinkentrytext
-% \entry typesets a paragraph consisting of the text (#1), dot leaders, and
-% then page number (#2) flushed to the right margin. It is used for index
-% and table of contents entries. The paragraph is indented by \leftskip.
-%
-\def\entry{%
+% \entryinternal typesets a paragraph consisting of the text (#1), dot
+% leaders, and then page number (#2) flushed to the right margin. It is
+% used for index and table of contents entries. The paragraph is indented
+% by \leftskip.
+% For PDF output, if \linkentrytexttrue and \tocnodetarget is set, link text
+% to the referenced node. Else if \entrypagetarget is set, link text to the
+% page.
+\def\entryinternal{%
\begingroup
%
% Start a new paragraph if necessary, so our assignments below can't
% No extra space above this paragraph.
\parskip = 0in
%
- % When reading the text of entry, convert explicit line breaks
- % from @* into spaces. The user might give these in long section
- % titles, for instance.
- \def\*{\unskip\space\ignorespaces}%
\def\entrybreak{\hfil\break}% An undocumented command
%
% Swallow the left brace of the text (first parameter):
\global\setbox\boxA=\hbox\bgroup
\ifpdforxetex
\iflinkentrytext
- \pdflinkpage{#1}{\unhbox\boxA}%
+ \ifx\tocnodetarget\empty
+ \unhbox\boxA
+ \else
+ \startxreflink{\tocnodetarget}{}%
+ \unhbox\boxA
+ \endlink
+ \fi
\else
- \unhbox\boxA
+ \ifx\entrypagetarget\empty
+ \unhbox\boxA
+ \else
+ \pdflinkpage{\entrypagetarget}{\unhbox\boxA}%
+ \fi
\fi
\else
\unhbox\boxA
%
\null\nobreak\indexdotfill % Have leaders before the page number.
%
+ \hskip\skip\thinshrinkable
\ifpdforxetex
- \pdfgettoks#1.%
- \hskip\skip\thinshrinkable\the\toksA
+ \ifx\tocnodetarget\empty
+ \pdfgettoks#1.%
+ \the\toksA
+ \else
+ % Should just be a single page number in toc
+ \startxreflink{\tocnodetarget}{}%
+ #1\endlink
+ \fi
\else
- \hskip\skip\thinshrinkable #1%
+ #1%
\fi
\fi
\egroup % end \boxA
% and \thissection, as is done in \startcontents.
\let\pchapsepmacro\relax
\chapmacro{}{Yomitfromtoc}{}%
+ \gdef\thispart{#1}%
\chapoddpage
\endgroup
}
+% Name of current part, if any.
+% Note: unlike @thischapter etc. defined below, the name of the part
+% is always set before a page with a heading or footing is shipped out,
+% so there is no need to keep the value of these in "marks".
+\def\thispart{}%
+
% \unnumberedno is an oxymoron. But we count the unnumbered
% sections so that we can refer to them unambiguously in the pdf
% outlines by their "section number". We avoid collisions with chapter
\parseargdef\subsubheading{\sectionheading{#1}{subsubsec}{Yomitfromtoc}{}
\suppressfirstparagraphindent}
+% @xrefname - give text with printed name for linking to node and allow
+% referencing node, but do not print any heading.
+\parseargdef\xrefname{\donoderef{Yomitfromtoc}{#1}}%
+
% These macros generate a chapter, section, etc. heading only
% (including whitespace, linebreaking, etc. around it),
% given all the information in convenient, parsed form.
\chapfonts \rm
\let\footnote=\errfootnoteheading % give better error message
%
- % Have to define \currentsection before calling \donoderef, because the
- % xref code eventually uses it. On the other hand, it has to be called
- % after \pchapsepmacro, or the headline will change too soon.
- \gdef\currentsection{#1}%
- %
% Only insert the separating space if we have a chapter/appendix
% number, and don't print the unnumbered ``number''.
\ifx\temptype\Ynothingkeyword
% been typeset. If the destination for the pdf outline is after the
% text, then jumping from the outline may wind up with the text not
% being visible, for instance under high magnification.
- \donoderef{#2}%
+ \donoderef{#2}{#1}%
%
% Typeset the actual heading.
\nobreak % Avoid page breaks at the interline glue.
\ifx\temptype\Ynothingkeyword
\setbox0 = \hbox{}%
\def\toctype{unn}%
- \gdef\currentsection{#1}%
\else\ifx\temptype\Yomitfromtockeyword
- % for @headings -- no section number, don't include in toc,
- % and don't redefine \currentsection.
+ % for @headings -- no section number, don't include in toc.
\setbox0 = \hbox{}%
\def\toctype{omit}%
\let\sectionlevel=\empty
\else\ifx\temptype\Yappendixkeyword
\setbox0 = \hbox{#4\enspace}%
\def\toctype{app}%
- \gdef\currentsection{#1}%
\else
\setbox0 = \hbox{#4\enspace}%
\def\toctype{num}%
- \gdef\currentsection{#1}%
\fi\fi\fi
%
% Write the toc entry (before \donoderef). See comments in \chapmacro.
%
% Write the node reference (= pdf destination for pdftex).
% Again, see comments in \chapmacro.
- \donoderef{#3}%
+ \donoderef{#3}{#1}%
%
% Interline glue will be inserted when the vbox is completed.
% That glue will be a valid breakpoint for the page, since it'll be
% Prepare to read what we've written to \tocfile.
%
-\def\startcontents#1{%
+\def\startcontents#1#2{%
% If @setchapternewpage on, and @headings double, the contents should
% start on an odd page, unlike chapters.
\contentsalignmacro
\immediate\closeout\tocfile
%
+ #2%
% Don't need to put `Contents' or `Short Contents' in the headline.
% It is abundantly clear what they are.
\chapmacro{#1}{Yomitfromtoc}{}%
% \raggedbottom in plain.tex hardcodes \topskip so override it
\catcode`\@=11
-\def\raggedbottom{\advance\topskip by 0pt plus60pt \r@ggedbottomtrue}
+\def\raggedbottom{\advance\topskip by 0pt plus30pt \r@ggedbottomtrue}
\catcode`\@=\other
% redefined for the two-volume lispref. We always output on
% Normal (long) toc.
%
\def\contents{%
- \startcontents{\putwordTOC}%
+ \startcontents{\putwordTOC}{\contentsmkdest}%
+ \ifxetex\xetexpreauxfile\fi
+ \penalty2 % mark beginning of contents
\openin 1 \tocreadfilename\space
\ifeof 1 \else
\findsecnowidths
\pdfmakeoutlines
\fi
\closein 1
+ \ifxetex\xetexpostauxfile\fi
\endgroup
\contentsendroman
}
+\def\contentsmkdest{%
+ \pdfmkdest{txi.CONTENTS}%
+}
+
% And just the chapters.
\def\summarycontents{%
- \startcontents{\putwordShortTOC}%
+ \startcontents{\putwordShortTOC}{}%
%
\let\partentry = \shortpartentry
\let\numchapentry = \shortchapentry
\let\numsubsubsecentry = \numsecentry
\let\appsubsubsecentry = \numsecentry
\let\unnsubsubsecentry = \numsecentry
+ \ifxetex\xetexpreauxfile\fi
\openin 1 \tocreadfilename\space
\ifeof 1 \else
\readtocfile
\fi
\closein 1
+ \ifxetex\xetexpostauxfile\fi
\vfill \eject
\contentsalignmacro % in case @setchapternewpage odd is in effect
\endgroup
% #3 - level of section (e.g "chap", "sec")
% #4 - page number
-% Parts, in the main contents. Replace the part number, which doesn't
-% exist, with an empty box. Let's hope all the numbers have the same width.
-% Also ignore the page number, which is conventionally not printed.
-\def\numeralbox{\setbox0=\hbox{8}\hbox to \wd0{\hfil}}
+% Parts, in the main contents. Ignore the page number, which is
+% conventionally not printed.
\def\partentry#1#2#3#4{%
+ \ifnum\lastpenalty = 2
+ % use less space if at very first entry of contents
+ \vskip 1\baselineskip plus .33\baselineskip minus .25\baselineskip
+ \else
+ \vskip 2\baselineskip plus .66\baselineskip minus .5\baselineskip
+ \fi
% Add stretch and a bonus for breaking the page before the part heading.
% This reduces the chance of the page being broken immediately after the
% part heading, before a following chapter heading.
- \vskip 0pt plus 5\baselineskip
+ \vskip 0pt plus 3\baselineskip
\penalty-300
- \vskip 0pt plus -5\baselineskip
- \dochapentry{#1}{\numeralbox}{}%
+ \vskip 0pt plus -3\baselineskip
+ \begingroup
+ \secfonts \rm
+ \entryinternal{#1}{}%
+ \endgroup
+ \afterpartentrytrue
}
+\newif\ifafterpartentry
%
% Parts, in the short toc.
\def\shortpartentry#1#2#3#4{%
\penalty-300
\vskip.5\baselineskip plus.15\baselineskip minus.1\baselineskip
- \shortchapentry{{\bf #1}}{\numeralbox}{}{}%
+ \tocentry{{\bf #1}}{}{}{}%
}
% Chapters, in the main contents.
\def\numchapentry#1#2#3#4{%
\retrievesecnowidth\secnowidthchap{#2}%
- \dochapentry{#1}{#2}{#4}%
+ \dochapentry{#1}{#2}{#3}{#4}%
}
% Chapters, in the short toc.
\def\shortchapentry#1#2#3#4{%
- \tocentry{#1}{\shortchaplabel{#2}}{#4}%
+ \tocentry{#1}{\shortchaplabel{#2}}{#3}{#4}%
}
% Appendices, in the main contents.
%
\def\appentry#1#2#3#4{%
\retrievesecnowidth\secnowidthchap{#2}%
- \dochapentry{\appendixbox{#2}\hskip.7em#1}{}{#4}%
+ \dochapentry{\appendixbox{#2}\hskip.7em#1}{}{#3}{#4}%
}
% Unnumbered chapters.
-\def\unnchapentry#1#2#3#4{\dochapentry{#1}{}{#4}}
-\def\shortunnchapentry#1#2#3#4{\tocentry{#1}{}{#4}}
+\def\unnchapentry#1#2#3#4{\dochapentry{#1}{}{#3}{#4}}
+\def\shortunnchapentry#1#2#3#4{\tocentry{#1}{}{#3}{#4}}
% Sections.
-\def\numsecentry#1#2#3#4{\dosecentry{#1}{#2}{#4}}
-
\def\numsecentry#1#2#3#4{%
\retrievesecnowidth\secnowidthsec{#2}%
- \dosecentry{#1}{#2}{#4}%
+ \dosecentry{#1}{#2}{#3}{#4}%
}
\let\appsecentry=\numsecentry
\def\unnsecentry#1#2#3#4{%
\retrievesecnowidth\secnowidthsec{#2}%
- \dosecentry{#1}{}{#4}%
+ \dosecentry{#1}{}{#3}{#4}%
}
% Subsections.
\def\numsubsecentry#1#2#3#4{%
\retrievesecnowidth\secnowidthssec{#2}%
- \dosubsecentry{#1}{#2}{#4}%
+ \dosubsecentry{#1}{#2}{#3}{#4}%
}
\let\appsubsecentry=\numsubsecentry
\def\unnsubsecentry#1#2#3#4{%
\retrievesecnowidth\secnowidthssec{#2}%
- \dosubsecentry{#1}{}{#4}%
+ \dosubsecentry{#1}{}{#3}{#4}%
}
% And subsubsections.
-\def\numsubsubsecentry#1#2#3#4{\dosubsubsecentry{#1}{#2}{#4}}
+\def\numsubsubsecentry#1#2#3#4{\dosubsubsecentry{#1}{#2}{#3}{#4}}
\let\appsubsubsecentry=\numsubsubsecentry
-\def\unnsubsubsecentry#1#2#3#4{\dosubsubsecentry{#1}{}{#4}}
+\def\unnsubsubsecentry#1#2#3#4{\dosubsubsecentry{#1}{}{#3}{#4}}
% This parameter controls the indentation of the various levels.
% Same as \defaultparindent.
\newdimen\tocindent \tocindent = 15pt
% Now for the actual typesetting. In all these, #1 is the text, #2 is
-% a section number if present, and #3 is the page number.
+% a section number if present, #3 is the node, and #4 is the page number.
%
% If the toc has to be broken over pages, we want it to be at chapters
% if at all possible; hence the \penalty.
-\def\dochapentry#1#2#3{%
- \penalty-300 \vskip1\baselineskip plus.33\baselineskip minus.25\baselineskip
+\def\dochapentry#1#2#3#4{%
+ \ifafterpartentry
+ \afterpartentryfalse
+ \penalty5000
+ \else
+ \penalty-300
+ \fi
+ \vskip1\baselineskip plus.33\baselineskip minus.25\baselineskip
\begingroup
% Move the page numbers slightly to the right
\advance\entryrightmargin by -0.05em
\chapentryfonts
\extrasecnoskip=0.4em % separate chapter number more
- \tocentry{#1}{#2}{#3}%
+ \tocentry{#1}{#2}{#3}{#4}%
\endgroup
\nobreak\vskip .25\baselineskip plus.1\baselineskip
}
-\def\dosecentry#1#2#3{\begingroup
+\def\dosecentry#1#2#3#4{\begingroup
\secnowidth=\secnowidthchap
\secentryfonts \leftskip=\tocindent
- \tocentry{#1}{#2}{#3}%
+ \tocentry{#1}{#2}{#3}{#4}%
\endgroup}
-\def\dosubsecentry#1#2#3{\begingroup
+\def\dosubsecentry#1#2#3#4{\begingroup
\secnowidth=\secnowidthsec
\subsecentryfonts \leftskip=2\tocindent
- \tocentry{#1}{#2}{#3}%
+ \tocentry{#1}{#2}{#3}{#4}%
\endgroup}
-\def\dosubsubsecentry#1#2#3{\begingroup
+\def\dosubsubsecentry#1#2#3#4{\begingroup
\secnowidth=\secnowidthssec
\subsubsecentryfonts \leftskip=3\tocindent
- \tocentry{#1}{#2}{#3}%
+ \tocentry{#1}{#2}{#3}{#4}%
\endgroup}
% Used for the maximum width of a section number so we can align
\newdimen\extrasecnoskip
\extrasecnoskip=0pt
-% \tocentry{TITLE}{SEC NO}{PAGE}
+\let\tocnodetarget\empty
+\let\entrypagetarget\empty
+
+% \tocentry{TITLE}{SEC NO}{NODE}{PAGE}
%
-\def\tocentry#1#2#3{%
+\def\tocentry#1#2#3#4{%
+ \def\tocnodetarget{#3}%
\def\secno{#2}%
\ifx\empty\secno
- \entry{#1}{#3}%
+ \entryinternal{#1}{#4}%
\else
\ifdim 0pt=\secnowidth
\setbox0=\hbox{#2\hskip\labelspace\hskip\extrasecnoskip}%
#2\hskip\labelspace\hskip\extrasecnoskip\hfill}%
\fi
\entrycontskip=\wd0
- \entry{\box0 #1}{#3}%
+ \entryinternal{\box0 #1}{#4}%
\fi
}
\newdimen\labelspace
{\catcode`\ =\other
\gdef\docopying#1@end copying{\endgroup\def\copyingtext{#1}}
}
+\let\copyingtext\relax
\def\insertcopying{%
\begingroup
\endgroup
}
+\def\publication{\checkenv{}\begingroup\macrobodyctxt\dopublication}
+{\catcode`\ =\other
+\gdef\dopublication#1@end publication{\endgroup\def\publicationtext{#1}}
+}
+\let\publicationtext\relax
+
+\def\insertpublication{%
+ \begingroup
+ \parindent = 0pt % paragraph indentation looks wrong on title page
+ \scanexp\publicationtext
+ \endgroup
+}
\message{defuns,}
% @defun etc.
{\rm\enskip}% hskip 0.5 em of \rmfont
}{}%
%
- \boldbrax
+ \parenbrackglyphs
% arguments will be output next, if any.
}
\def\^^M{}% for line continuation
\df \ifdoingtypefn \tt \else \sl \fi
\ifflagclear{txicodevaristt}{}%
- {\def\var##1{{\setregularquotes \ttsl ##1}}}%
+ % use \ttsl for @var in both @def* and @deftype*.
+ % the kern prevents an italic correction at end, which appears
+ % too much for ttsl.
+ {\def\var##1{{\setregularquotes \ttsl ##1\kern 0pt }}}%
#1%
\egroup
}
\let\lparen = ( \let\rparen = )
% Be sure that we always have a definition for `(', etc. For example,
-% if the fn name has parens in it, \boldbrax will not be in effect yet,
-% so TeX would otherwise complain about undefined control sequence.
+% if the fn name has parens in it, \parenbrackglyphs will not be in
+% effect yet, so TeX would otherwise complain about undefined control
+% sequence.
{
\activeparens
\gdef\defcharsdefault{%
}
\globaldefs=1 \defcharsdefault
- \gdef\boldbrax{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb}
+ \gdef\parenbrackglyphs{\let(=\opnr\let)=\cpnr\let[=\lbrb\let]=\rbrb}
\gdef\magicamp{\let&=\amprm}
}
\let\ampchar\&
-\newcount\parencount
-
-% If we encounter &foo, then turn on ()-hacking afterwards
-\newif\ifampseen
-\def\amprm#1 {\ampseentrue{\rm\ }}
-
-\def\parenfont{%
- \ifampseen
- % At the first level, print parens in roman,
- % otherwise use the default font.
- \ifnum \parencount=1 \rm \fi
- \else
- % The \sf parens (in \boldbrax) actually are a little bolder than
- % the contained text. This is especially needed for [ and ] .
- \sf
- \fi
-}
-\def\infirstlevel#1{%
- \ifampseen
- \ifnum\parencount=1
- #1%
- \fi
- \fi
-}
-\def\bfafterword#1 {#1 \bf}
+\def\amprm#1 {{\rm\ }}
+\newcount\parencount
+% opening and closing parentheses in roman font
\def\opnr{%
+ \ptexslash % italic correction
\global\advance\parencount by 1
- {\parenfont(}%
- \infirstlevel \bfafterword
+ {\sf(}%
}
-\def\clnr{%
- {\parenfont)}%
- \infirstlevel \sl
+\def\cpnr{%
+ \ptexslash % italic correction
+ {\sf)}%
\global\advance\parencount by -1
}
\newcount\brackcount
+% left and right square brackets in bold font
\def\lbrb{%
\global\advance\brackcount by 1
{\bf[}%
}
\fi
-\let\E=\expandafter
-
% Used at the time of macro expansion.
% Argument is macro body with arguments substituted
\def\scanmacro#1{%
\newlinechar`\^^M
- % expand the expansion of \eatleadingcr twice to maybe remove a leading
- % newline (and \else and \fi tokens), then call \eatspaces on the result.
- \def\xeatspaces##1{%
- \E\E\E\E\E\E\E\eatspaces\E\E\E\E\E\E\E{\eatleadingcr##1%
- }}%
- \def\xempty##1{}%
+ \def\xeatspaces##1{\eatleadingcrthen\eatspaces{##1}}%
%
% Process the macro body under the current catcode regime.
\scantokens{#1@comment}%
\unbrace{\gdef\trim@@@ #1 } #2@{#1}
}
-{\catcode`\^^M=\other%
-\gdef\eatleadingcr#1{\if\noexpand#1\noexpand^^M\else\E#1\fi}}%
-% Warning: this won't work for a delimited argument
-% or for an empty argument
+% Trim a single leading ^^M off a string, then call #1
+{\catcode`\^^M=\active \catcode`\Q=3%
+\gdef\eatleadingcrthen #1#2{\eatlcra #1Q#2Q^^MQ}%
+\gdef\eatlcra #1#2Q^^M{\eatlcrb #1#2Q}%
+\gdef\eatlcrb #1Q#2Q#3Q{#1{#2}}%
+}
% Trim a single trailing ^^M off a string.
{\catcode`\^^M=\other \catcode`\Q=3%
% <parameter list> is #, then the preceding argument is delimited by
% an opening brace, and that opening brace is not consumed.
+% Make @ a letter, so that we can make private-to-Texinfo macro names.
+\edef\texiatcatcode{\the\catcode`\@}
+\catcode `@=11\relax
+
% Parse the optional {params} list to @macro or @rmacro.
% Set \paramno to the number of arguments,
% and \paramlist to a parameter text for the macro (e.g. #1,#2,#3 for a
% That gets used by \mbodybackslash (above).
%
% If there are 10 or more arguments, a different technique is used: see
-% \parsemmanyargdef.
+% \parsemmanyargdef@@.
%
\def\parsemargdef#1;{%
\paramno=0\def\paramlist{}%
\let\hash\relax
% \hash is redefined to `#' later to get it into definitions
\let\xeatspaces\relax
- \let\xempty\relax
\parsemargdefxxx#1,;,%
\ifnum\paramno<10\relax\else
\paramno0\relax
\else \let\next=\parsemargdefxxx
\advance\paramno by 1
\expandafter\edef\csname macarg.\eatspaces{#1}\endcsname
- {\xeatspaces{\hash\the\paramno\noexpand\xempty{}}}%
+ {\xeatspaces{\hash\the\paramno}}%
\edef\paramlist{\paramlist\hash\the\paramno,}%
\fi\next}
-% the \xempty{} is to give \eatleadingcr an argument in the case of an
-% empty macro argument.
% \parsemacbody, \parsermacbody
%
% body to be transformed.
% Set \macrobody to the body of the macro, and call \macrodef.
%
+\catcode `\@\texiatcatcode
{\catcode`\ =\other\long\gdef\parsemacbody#1@end macro{%
\xdef\macrobody{\eatcr{#1}}\endgroup\macrodef}}%
{\catcode`\ =\other\long\gdef\parsermacbody#1@end rmacro{%
\xdef\macrobody{\eatcr{#1}}\endgroup\macrodef}}%
-
-% Make @ a letter, so that we can make private-to-Texinfo macro names.
-\edef\texiatcatcode{\the\catcode`\@}
-\catcode `@=11\relax
+\catcode `\@=11\relax
%%%%%%%%%%%%%% Code for > 10 arguments only %%%%%%%%%%%%%%%%%%
\expandafter\xdef\csname\the\macname\endcsname{%
\begingroup
\noexpand\spaceisspace
- \noexpand\endlineisspace
+ \noexpand\ignoreactivenewline
\noexpand\expandafter % skip any whitespace after the macro name.
\expandafter\noexpand\csname\the\macname @@@\endcsname}%
\expandafter\xdef\csname\the\macname @@@\endcsname{%
\noexpand\expandafter
\expandafter\noexpand\csname\the\macname @@\endcsname}%
\expandafter\xdef\csname\the\macname @@\endcsname##1{%
- \noexpand\passargtomacro
- \expandafter\noexpand\csname\the\macname @@@\endcsname{##1,}}%
+ \noexpand\passargtomacro
+ \expandafter\noexpand\csname\the\macname @@@\endcsname{##1,}}%
\expandafter\xdef\csname\the\macname @@@\endcsname##1{%
- \expandafter\noexpand\csname\the\macname @@@@\endcsname ##1}%
- \expandafter\expandafter
- \expandafter\xdef
- \expandafter\expandafter
- \csname\the\macname @@@@\endcsname\paramlist{%
- \endgroup\noexpand\scanmacro{\macrobody}}%
+ \expandafter\noexpand\csname\the\macname @@@@\endcsname ##1}%
+ \expandaftergroup{\expandafter\xdef\csname\the\macname @@@@\endcsname}%
+ \paramlist{%
+ \endgroup\noexpand\scanmacro{\macrobody}}%
\else % 10 or more:
\expandafter\xdef\csname\the\macname\endcsname{%
\noexpand\getargvals@{\the\macname}{\argl}%
\catcode `\@\texiatcatcode\relax % end private-to-Texinfo catcodes
+% utility definition to avoid excessive use of \expandafter. call
+% as \expandaftergroup{CONTENT}\WORD to expand \WORD exactly once and remove
+% braces around CONTENT.
+\def\expandaftergroup#1#2{%
+ \expandafter\expandaftergroupx\expandafter{#2}{#1}%
+}
+\def\expandaftergroupx#1#2{%
+ #2#1%
+}
+
\def\norecurse#1{\bgroup\cslet{#1}{macsave.#1}}
\expandafter\noexpand
\csname\the\macname @@@\endcsname##1\noexpand\endlinemacro
}
- \expandafter\expandafter
- \expandafter\xdef
- \expandafter\expandafter\csname\the\macname @@@\endcsname\paramlist{%
+ \expandaftergroup{\expandafter\xdef\csname\the\macname @@@\endcsname}%
+ \paramlist{%
\newlinechar=13 % split \macrobody into lines
\noexpand\scantokens{\macrobody}%
}
\let\lastnode=\empty
% Write a cross-reference definition for the current node. #1 is the
-% type (Ynumbered, Yappendix, Ynothing).
+% type (Ynumbered, Yappendix, Ynothing). #2 is the section title.
%
-\def\donoderef#1{%
+\def\donoderef#1#2{%
\ifx\lastnode\empty\else
- \setref{\lastnode}{#1}%
+ \setref{\lastnode}{#1}{#2}%
\global\let\lastnode=\empty
+ \setnodeseenonce
\fi
}
+\def\setnodeseenonce{
+ \global\nodeseentrue
+ \let\setnodeseenonce\relax
+}
% @nodedescription, @nodedescriptionblock - do nothing for TeX
\parseargdef\nodedescription{}
%
\def\savesf{\relax \ifhmode \savesfregister=\spacefactor \fi}
\def\restoresf{\relax \ifhmode \spacefactor=\savesfregister \fi}
-\def\anchor#1{\savesf \setref{#1}{Ynothing}\restoresf \ignorespaces}
-
-% \setref{NAME}{SNT} defines a cross-reference point NAME (a node or an
-% anchor), which consists of three parts:
-% 1) NAME-title - the current sectioning name taken from \currentsection,
-% or the anchor name.
-% 2) NAME-snt - section number and type, passed as the SNT arg, or
-% empty for anchors.
+\def\anchor#1{%
+ \savesf \setref{#1}{Yanchor}{#1}\restoresf \ignorespaces
+}
+
+% @namedanchor{NAME, XREFNAME} -- define xref target at arbitrary point
+% with label text for cross-references to it.
+\def\namedanchor#1{\donamedanchor#1\finish}%
+\def\donamedanchor#1,#2\finish{%
+ \savesf \setref{#1}{Yanchor}{\ignorespaces #2\unskip}\restoresf \ignorespaces
+}
+
+% \setref{NAME}{SNT}{TITLE} defines a cross-reference point NAME (a node
+% or an anchor), which consists of three parts:
+% 1) NAME-title - the current sectioning name
+% 2) NAME-snt - section number and type, passed as the SNT arg.
% 3) NAME-pg - the page number.
%
% This is called from \donoderef, \anchor, and \dofloat. In the case of
% floats, there is an additional part, which is not written here:
% 4) NAME-lof - the text as it should appear in a @listoffloats.
%
-\def\setref#1#2{%
+\def\setref#1#2#3{%
\pdfmkdest{#1}%
\iflinks
{%
\write\auxfile{@xrdef{#1-% #1 of \setref, expanded by the \edef
##1}{##2}}% these are parameters of \writexrdef
}%
- \toks0 = \expandafter{\currentsection}%
+ \toks0 = {#3}%
\immediate \writexrdef{title}{\the\toks0 }%
\immediate \writexrdef{snt}{\csname #2\endcsname}% \Ynumbered etc.
\safewhatsit{\writexrdef{pg}{\folio}}% will be written later, at \shipout
\setbox\infofilenamebox = \hbox{\infofilename\unskip}%
%
\startxreflink{#1}{#4}%
- {%
- % Have to otherify everything special to allow the \csname to
- % include an _ in the xref name, etc.
- \indexnofonts
- \turnoffactive
- \def\value##1{##1}%
- \expandafter\global\expandafter\let\expandafter\Xthisreftitle
- \csname XR#1-title\endcsname
- }%
+ \getrefx{#1-title}\Xthisreftitle
%
% Float references are printed completely differently: "Figure 1.2"
% instead of "[somenode], p.3". \iffloat distinguishes them by
% Cross-manual reference with a printed manual name.
%
\crossmanualxref{\cite{\printedmanual\unskip}}%
- %
\else\ifdim \wd\infofilenamebox > 0pt
% Cross-manual reference with only an info filename (arg 4), no
% printed manual name (arg 5). This is essentially the same as
% the case above; we output the filename, since we have nothing else.
%
\crossmanualxref{\code{\infofilename\unskip}}%
- %
\else
% Reference within this manual.
%
- % Only output a following space if the -snt ref is nonempty, as the ref
- % will be empty for @unnumbered and @anchor.
- \setbox2 = \hbox{\ignorespaces \refx{#1-snt}}%
- \ifdim \wd2 > 0pt \refx{#1-snt}\space\fi
+ % Only output a following space if the -snt ref is nonempty, as is
+ % the case for @unnumbered and @anchor.
+ \getrefx{#1-snt}\tmp
+ \ifx\tmp\empty\else
+ \ifx\tmp\Yanchor\else
+ \tmp\space
+ \fi
+ \fi
%
% output the `[mynode]' via the macro below so it can be overridden.
\xrefprintnodename\printedrefname
\else
% Otherwise just copy the Info node name.
\def\printedrefname{\ignorespaces #1}%
- \fi%
+ \fi
\fi
\fi
\fi
\ifnum\filenamelength>0
goto file{\the\filename.pdf} name{\pdfdestname}%
\else
- goto name{\pdfmkpgn{\pdfdestname}}%
+ goto name{\pdfdestname}%
\fi
\else % XeTeX
\ifnum\filenamelength>0
%
\def\Ynothing{}
\def\Yomitfromtoc{}
+\def\Yanchor{\isanchor} \let\isanchor\relax
\def\Ynumbered{%
\ifnum\secno=0
\putwordChapter@tie \the\chapno
% \refx{NAME} - reference a cross-reference string named NAME.
\def\refx#1{%
- \requireauxfile
- {%
- \indexnofonts
- \turnoffactive
- \def\value##1{##1}%
- \expandafter\global\expandafter\let\expandafter\thisrefX
- \csname XR#1\endcsname
- }%
+ \getrefx{#1}\thisrefX
\ifx\thisrefX\relax
% If not defined, say something at least.
\angleleft un\-de\-fined\angleright
\fi
}
+% Set #2 to xref string #1
+\def\getrefx#1#2{%
+ \requireauxfile
+ {%
+ \indexnofonts
+ \turnoffactive
+ \def\value##1{##1}%
+ \expandafter\global\expandafter\let\expandafter#2\csname XR#1\endcsname
+ }%
+}
+
% This is the macro invoked by entries in the aux file. Define a control
% sequence for a cross-reference target (we prepend XR to the control sequence
% name to avoid collisions). The value is the page number. If this is a float
\expandafter\xdef\csname floatlist\iffloattype\endcsname{\the\toks0
{\safexrefname}}%
\fi
+ \ignorespaces % ignore ends of line in aux file
}
% If working on a large document in chapters, it is convenient to
% Read the last existing aux file, if any. No error if none exists.
%
\def\tryauxfile{%
+ \ifxetex\xetexpreauxfile\fi
\openin 1 \jobname.aux
\ifeof 1 \else
\readdatafile{aux}%
\global\havexrefstrue
\fi
\closein 1
+ \ifxetex\xetexpostauxfile\fi
}
\def\setupdatafile{%
% Auto-number footnotes. Otherwise like plain.
\gdef\footnote{%
\global\advance\footnoteno by \@ne
- \edef\thisfootno{$^{\the\footnoteno}$}%
+ %
+ % Output for the footnote marker. If we are immediately after another
+ % footnote, output a comma and small space first.
+ \edef\thisfootno{$^{\ifnum\lastpenalty=3 ,\mskip 1mu \fi\the\footnoteno}$}%
%
% In case the footnote comes at the end of a sentence, preserve the
% extra spacing after we do the footnote number.
%
% Remove inadvertent blank space before typesetting the footnote number.
\unskip
- \thisfootno\@sf
+ %
+ % \scriptspace is 0.5pt by default and gives excessive space before the
+ % comma if we have multiple footnote markers in a row.
+ \bgroup\scriptspace=0pt
+ \thisfootno\@sf
+ \egroup
\dofootnote
}%
-% Don't bother with the trickery in plain.tex to not require the
-% footnote text as a parameter. Our footnotes don't need to be so general.
-%
-% Oh yes, they do; otherwise, @ifset (and anything else that uses
-% \parseargline) fails inside footnotes because the tokens are fixed when
-% the footnote is read. --karl, 16nov96.
+% marker for immediately after a footnote marker
+\gdef\footnoteendmarker{\penalty3 }
+
+% Do not require the footnote text as a parameter; otherwise, @ifset
+% (and anything else that uses \parseargline) fails inside footnotes
+% because the tokens are fixed when the footnote is read.
%
\gdef\dofootnote{%
\insert\footins\bgroup
+ \aftergroup\footnoteendmarker
%
% Nested footnotes are not supported in TeX, that would take a lot
% more work. (\startsavinginserts does not suffice.)
% Hang the footnote text off the number. Use \everypar in case the
% footnote extends for more than one paragraph.
\everypar = {\hang}%
- \textindent{\thisfootno}%
+ \textindent{$^{\the\footnoteno}$}%
%
% Don't crash into the line above the footnote text. Since this
% expands into a box, it must come within the paragraph, lest it
% provide a place where TeX can split the footnote.
\footstrut
%
- % Invoke rest of plain TeX footnote routine.
+ % Eat opening brace and invoke rest of plain TeX footnote routine.
\futurelet\next\fo@t
}
}%end \catcode `\@=11
% For pdfTeX and LuaTeX <= 0.80
\dopdfimage{#1}{#2}{#3}%
\else
- \ifx\XeTeXrevision\thisisundefined
+ \ifxetex
+ \doxeteximage{#1}{#2}{#3}%
+ \else
% For epsf.tex
% \epsfbox itself resets \epsf?size at each figure.
\setbox0 = \hbox{\ignorespaces #2}%
\setbox0 = \hbox{\ignorespaces #3}%
\ifdim\wd0 > 0pt \epsfysize=#3\relax \fi
\epsfbox{#1.eps}%
- \else
- % For XeTeX
- \doxeteximage{#1}{#2}{#3}%
\fi
\fi
%
\global\advance\floatno by 1
%
{%
- % This magic value for \currentsection is output by \setref as the
- % XREFLABEL-title value. \xrefX uses it to distinguish float
+ % This magic value for the third argument of \setref is output as
+ % the XREFLABEL-title value. \xrefX uses it to distinguish float
% labels (which have a completely different output format) from
% node and anchor labels. And \xrdef uses it to construct the
% lists of floats.
%
- \edef\currentsection{\floatmagic=\safefloattype}%
- \setref{\floatlabel}{Yfloat}%
+ \edef\tmp{\noexpand\setref{\noexpand\floatlabel}{Yfloat}%
+ {\floatmagic=\safefloattype}}%
+ \tmp
}%
\fi
%
% #1 is the control sequence we are passed; we expand into a conditional
% which is true if #1 represents a float ref. That is, the magic
-% \currentsection value which we \setref above.
+% value which we passed to \setref above.
%
\def\iffloat#1{\expandafter\doiffloat#1==\finish}
%
\toksA = \expandafter{\csname XR#1-lof\endcsname}%
%
% use the same \entry macro we use to generate the TOC and index.
+ \let\entry\entryinternal
\edef\writeentry{\noexpand\entry{\the\toksA}{\csname XR#1-pg\endcsname}}%
\writeentry
}}
\gdef\documentlanguagetrywithoutunderscore#1_#2\finish{%
\openin 1 txi-#1.tex
\ifeof 1
- \errhelp = \nolanghelp
- \errmessage{Cannot read language file txi-#1.tex}%
+ \def\lang{#1}%
+ \def\enword{en}%
+ \ifx\lang\enword
+ % for English only, keep on going rather than issuing a fatal error
+ % message, as txi-en.tex likely doesn't contain any changes from the
+ % defaults. note that this is a problem if we already loaded another
+ % language file and want to switch back to English.
+ \message{Cannot read language file txi-#1.tex}%
+ \else
+ \errhelp = \nolanghelp
+ \errmessage{Cannot read language file txi-#1.tex}%
+ \fi
\else
\globaldefs = 1 % everything in the txi-LL files needs to persist
\input txi-#1.tex
\newif\iftxinativeunicodecapable
\newif\iftxiusebytewiseio
-\ifx\XeTeXrevision\thisisundefined
- \ifx\luatexversion\thisisundefined
- \txinativeunicodecapablefalse
- \txiusebytewiseiotrue
- \else
+\ifxetex
+ \txinativeunicodecapabletrue
+ \txiusebytewiseiofalse
+\else
+ \ifluatex
\txinativeunicodecapabletrue
\txiusebytewiseiofalse
+ \else
+ \txinativeunicodecapablefalse
+ \txiusebytewiseiotrue
\fi
-\else
- \txinativeunicodecapabletrue
- \txiusebytewiseiofalse
\fi
+\let\xetexpreauxfile\relax
+\let\xetexpostauxfile\relax
+
% Set I/O by bytes instead of UTF-8 sequence for XeTeX and LuaTex
% for non-UTF-8 (byte-wise) encodings.
%
\def\setbytewiseio{%
- \ifx\XeTeXrevision\thisisundefined
- \else
- \XeTeXdefaultencoding "bytes" % For subsequent files to be read
- \XeTeXinputencoding "bytes" % For document root file
- % Unfortunately, there seems to be no corresponding XeTeX command for
- % output encoding. This is a problem for auxiliary index and TOC files.
- % The only solution would be perhaps to write out @U{...} sequences in
- % place of non-ASCII characters.
+ \ifxetex
+ % For document root file
+ \XeTeXinputencoding "bytes"
+ %
+ % Setting for subsequent files to be read with @include.
+ \XeTeXdefaultencoding "bytes"
+ %
+ % Use UTF-8 for reading auxiliary index and TOC files, which are
+ % always output in UTF-8 with XeTeX.
+ \def\xetexpreauxfile{\XeTeXdefaultencoding "UTF-8"}%
+ \def\xetexpostauxfile{\XeTeXdefaultencoding "bytes"}%
\fi
- \ifx\luatexversion\thisisundefined
- \else
+ \ifluatex
\directlua{
local utf8_char, byte, gsub = unicode.utf8.char, string.byte, string.gsub
local function convert_char (char)
\fi % lattwo
\fi % ascii
%
- \ifx\XeTeXrevision\thisisundefined
- \else
+ \ifxetex
\ifx \declaredencoding \utfeight
\else
\ifx \declaredencoding \ascii
\gdefchar^^af{\={}}
%
\gdefchar^^b0{\textdegree}
- \gdefchar^^b1{$\pm$}
+ \gdefchar^^b1{\ensuremath\pm}
\gdefchar^^b2{$^2$}
\gdefchar^^b3{$^3$}
\gdefchar^^b4{\'{}}
\gdefchar^^c2{\^A}
\gdefchar^^c3{\~A}
\gdefchar^^c4{\"A}
- \gdefchar^^c5{\ringaccent A}
+ \gdefchar^^c5{\AA}
\gdefchar^^c6{\AE}
\gdefchar^^c7{\cedilla C}
\gdefchar^^c8{\`E}
\gdefchar^^d4{\^O}
\gdefchar^^d5{\~O}
\gdefchar^^d6{\"O}
- \gdefchar^^d7{$\times$}
+ \gdefchar^^d7{\ensuremath\times}
\gdefchar^^d8{\O}
\gdefchar^^d9{\`U}
\gdefchar^^da{\'U}
\gdefchar^^e2{\^a}
\gdefchar^^e3{\~a}
\gdefchar^^e4{\"a}
- \gdefchar^^e5{\ringaccent a}
+ \gdefchar^^e5{\aa}
\gdefchar^^e6{\ae}
\gdefchar^^e7{\cedilla c}
\gdefchar^^e8{\`e}
\gdefchar^^f4{\^o}
\gdefchar^^f5{\~o}
\gdefchar^^f6{\"o}
- \gdefchar^^f7{$\div$}
+ \gdefchar^^f7{\ensuremath\div}
\gdefchar^^f8{\o}
\gdefchar^^f9{\`u}
\gdefchar^^fa{\'u}
\gdefchar^^d4{\^O}
\gdefchar^^d5{\H O}
\gdefchar^^d6{\"O}
- \gdefchar^^d7{$\times$}
+ \gdefchar^^d7{\ensuremath\times}
\gdefchar^^d8{\v R}
\gdefchar^^d9{\ringaccent U}
\gdefchar^^da{\'U}
\gdefchar^^f4{\^o}
\gdefchar^^f5{\H o}
\gdefchar^^f6{\"o}
- \gdefchar^^f7{$\div$}
+ \gdefchar^^f7{\ensuremath\div}
\gdefchar^^f8{\v r}
\gdefchar^^f9{\ringaccent u}
\gdefchar^^fa{\'u}
\gdef\UTFviiiDefined#1{%
\ifx #1\relax
- \message{\linenumber Unicode char \string #1 not defined for Texinfo}%
+ \ifutfviiidefinedwarning
+ \message{\linenumber Unicode char \string #1 not defined for Texinfo}%
+ \fi
\else
\expandafter #1%
\fi
}
+\newif\ifutfviiidefinedwarning
+\utfviiidefinedwarningtrue
% Give non-ASCII bytes the active definitions for processing UTF-8 sequences
\begingroup
% Loop from \countUTFx to \countUTFy, performing \UTFviiiTmp
% substituting ~ and $ with a character token of that value.
- \def\UTFviiiLoop{%
- \global\catcode\countUTFx\active
+ \gdef\UTFviiiLoop{%
+ \catcode\countUTFx\active
\uccode`\~\countUTFx
\uccode`\$\countUTFx
\uppercase\expandafter{\UTFviiiTmp}%
\ifnum\countUTFx < \countUTFy
\expandafter\UTFviiiLoop
\fi}
-
+ %
% For bytes other than the first in a UTF-8 sequence. Not expected to
% be expanded except when writing to auxiliary files.
\countUTFx = "80
\else\expandafter\UTFviiiFourOctets\expandafter$\fi
}}%
\UTFviiiLoop
+ %
+ % for pdftex only, used to expand ASCII to UTF-16BE.
+ \gdef\asciitounicode{%
+ \countUTFx = "20
+ \countUTFy = "80
+ \def\UTFviiiTmp{%
+ \def~{\nullbyte $}}%
+ \UTFviiiLoop
+ }
+ {\catcode0=11 \gdef\nullbyte{^^00}}%
\endgroup
\def\globallet{\global\let} % save some \expandafter's below
\fi
}
-% These macros are used here to construct the name of a control
-% sequence to be defined.
+% These macros are used here to construct the names of macros
+% that expand to the definitions for UTF-8 sequences.
\def\UTFviiiTwoOctetsName#1#2{%
\csname u8:#1\string #2\endcsname}%
\def\UTFviiiThreeOctetsName#1#2#3{%
\def\UTFviiiFourOctetsName#1#2#3#4{%
\csname u8:#1\string #2\string #3\string #4\endcsname}%
+% generate UTF-16 from codepoint
+\def\utfsixteentotoks#1#2{%
+ \countUTFz = "#2\relax
+ \ifnum \countUTFz > 65535
+ % doesn't work for codepoints > U+FFFF
+ % we don't define glyphs for any of these anyway, so it doesn't matter
+ #1={U+#2}%
+ \else
+ \countUTFx = \countUTFz
+ \divide\countUTFx by 256
+ \countUTFy = \countUTFx
+ \multiply\countUTFx by 256
+ \advance\countUTFz by -\countUTFx
+ \uccode`,=\countUTFy
+ \uccode`;=\countUTFz
+ \ifnum\countUTFy = 0
+ \uppercase{#1={\nullbyte\string;}}%
+ \else\ifnum\countUTFz = 0
+ \uppercase{#1={\string,\nullbyte}}%
+ \else
+ \uppercase{#1={\string,\string;}}%
+ \fi\fi
+ % NB \uppercase cannot insert a null byte
+ \fi
+}
+
+\newif\ifutfbytespdf
+\utfbytespdffalse
+
% For UTF-8 byte sequences (TeX, e-TeX and pdfTeX),
% provide a definition macro to replace a Unicode character;
% this gets used by the @U command
\countUTFz = "#1\relax
\begingroup
\parseXMLCharref
-
- % Give \u8:... its definition. The sequence of seven \expandafter's
- % expands after the \gdef three times, e.g.
%
+ % Completely expand \UTFviiiTmp, which looks like:
% 1. \UTFviiTwoOctetsName B1 B2
% 2. \csname u8:B1 \string B2 \endcsname
% 3. \u8: B1 B2 (a single control sequence token)
+ \xdef\UTFviiiTmp{\UTFviiiTmp}%
%
- \expandafter\expandafter
- \expandafter\expandafter
- \expandafter\expandafter
- \expandafter\gdef \UTFviiiTmp{#2}%
+ \ifpdf
+ \toksA={#2}%
+ \utfsixteentotoks\toksB{#1}%
+ \expandafter\xdef\UTFviiiTmp{%
+ \noexpand\ifutfbytespdf\noexpand\utfbytes{\the\toksB}%
+ \noexpand\else\the\toksA\noexpand\fi}%
+ \else
+ \expandafter\gdef\UTFviiiTmp{#2}%
+ \fi
%
\expandafter\ifx\csname uni:#1\endcsname \relax \else
\message{Internal error, already defined: #1}%
\expandafter\globallet\csname uni:#1\endcsname \UTFviiiTmp
\endgroup}
%
- % Given the value in \countUTFz as a Unicode code point, set \UTFviiiTmp
- % to the corresponding UTF-8 sequence.
+ % Given the value in \countUTFz as a Unicode code point, set
+ % \UTFviiiTmp to one of the \UTVviii*OctetsName macros followed by
+ % the corresponding UTF-8 sequence.
\gdef\parseXMLCharref{%
\ifnum\countUTFz < "20\relax
\errhelp = \EMsimple
\catcode"#1=\other
}
+% Suppress ligature creation from adjacent characters.
+\ifluatex
+ % Braces do not suppress ligature creation in LuaTeX, e.g. in of{}fice
+ % to suppress the "ff" ligature. Using a kern appears to be the only
+ % workaround.
+ \def\nolig{\kern0pt{}}
+\else
+ \def\nolig{{}}
+\fi
+
% https://en.wikipedia.org/wiki/Plane_(Unicode)#Basic_M
% U+0000..U+007F = https://en.wikipedia.org/wiki/Basic_Latin_(Unicode_block)
% U+0080..U+00FF = https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)
% Punctuation
\DeclareUnicodeCharacter{2013}{--}%
\DeclareUnicodeCharacter{2014}{---}%
- \DeclareUnicodeCharacter{2018}{\quoteleft{}}%
- \DeclareUnicodeCharacter{2019}{\quoteright{}}%
+ \DeclareUnicodeCharacter{2018}{\quoteleft\nolig}%
+ \DeclareUnicodeCharacter{2019}{\quoteright\nolig}%
\DeclareUnicodeCharacter{201A}{\quotesinglbase{}}%
\DeclareUnicodeCharacter{201C}{\quotedblleft{}}%
\DeclareUnicodeCharacter{201D}{\quotedblright{}}%
\DeclareUnicodeCharacter{2287}{\ensuremath\supseteq}%
%
\DeclareUnicodeCharacter{2016}{\ensuremath\Vert}%
- \DeclareUnicodeCharacter{2032}{\ensuremath\prime}%
+ \DeclareUnicodeCharacter{2032}{\ensuremath{^\prime}}%
\DeclareUnicodeCharacter{210F}{\ensuremath\hbar}%
\DeclareUnicodeCharacter{2111}{\ensuremath\Im}%
\DeclareUnicodeCharacter{2113}{\ensuremath\ell}%
%
\global\mathchardef\checkmark="1370% actually the square root sign
\DeclareUnicodeCharacter{2713}{\ensuremath\checkmark}%
+ %
+ % These are all the combining accents. We need these empty definitions
+ % at present for the sake of PDF outlines.
+ \DeclareUnicodeCharacter{0300}{}%
+ \DeclareUnicodeCharacter{0301}{}%
+ \DeclareUnicodeCharacter{0302}{}%
+ \DeclareUnicodeCharacter{0303}{}%
+ \DeclareUnicodeCharacter{0305}{}%
+ \DeclareUnicodeCharacter{0306}{}%
+ \DeclareUnicodeCharacter{0307}{}%
+ \DeclareUnicodeCharacter{0308}{}%
+ \DeclareUnicodeCharacter{030A}{}%
+ \DeclareUnicodeCharacter{030B}{}%
+ \DeclareUnicodeCharacter{030C}{}%
+ \DeclareUnicodeCharacter{0323}{}%
+ \DeclareUnicodeCharacter{0327}{}%
+ \DeclareUnicodeCharacter{0328}{}%
+ \DeclareUnicodeCharacter{0331}{}%
+ \DeclareUnicodeCharacter{0361}{}%
}% end of \unicodechardefs
% UTF-8 byte sequence (pdfTeX) definitions (replacing and @U command)
\pdfhorigin = 1 true in
\pdfvorigin = 1 true in
\else
- \ifx\XeTeXrevision\thisisundefined
- \special{papersize=#8,#7}%
- \else
+ \ifxetex
\pdfpageheight #7\relax
\pdfpagewidth #8\relax
% XeTeX does not have \pdfhorigin and \pdfvorigin.
+ \else
+ \special{papersize=#8,#7}%
\fi
\fi
%
#1#2#3=\countB\relax
}
-\ifx\XeTeXrevision\thisisundefined
- \ifx\luatexversion\thisisundefined
+\ifxetex % XeTeX
+ \mtsetprotcode\textrm
+ \def\mtfontexpand#1{}
+\else
+ \ifluatex % LuaTeX
+ \mtsetprotcode\textrm
+ \def\mtfontexpand#1{\expandglyphsinfont#1 20 20 1\relax}
+ \else
\ifpdf % pdfTeX
\mtsetprotcode\textrm
\def\mtfontexpand#1{\pdffontexpand#1 20 20 1 autoexpand\relax}
\else % TeX
\def\mtfontexpand#1{}
\fi
- \else % LuaTeX
- \mtsetprotcode\textrm
- \def\mtfontexpand#1{\expandglyphsinfont#1 20 20 1\relax}
\fi
-\else % XeTeX
- \mtsetprotcode\textrm
- \def\mtfontexpand#1{}
\fi
\def\microtypeON{%
\microtypetrue
%
- \ifx\XeTeXrevision\thisisundefined
- \ifx\luatexversion\thisisundefined
+ \ifxetex % XeTeX
+ \XeTeXprotrudechars=2
+ \else
+ \ifluatex % LuaTeX
+ \adjustspacing=2
+ \protrudechars=2
+ \else
\ifpdf % pdfTeX
\pdfadjustspacing=2
\pdfprotrudechars=2
\fi
- \else % LuaTeX
- \adjustspacing=2
- \protrudechars=2
\fi
- \else % XeTeX
- \XeTeXprotrudechars=2
\fi
%
\mtfontexpand\textrm
\def\microtypeOFF{%
\microtypefalse
%
- \ifx\XeTeXrevision\thisisundefined
- \ifx\luatexversion\thisisundefined
+ \ifxetex % XeTeX
+ \XeTeXprotrudechars=0
+ \else
+ \ifluatex % LuaTeX
+ \adjustspacing=0
+ \protrudechars=0
+ \else
\ifpdf % pdfTeX
\pdfadjustspacing=0
\pdfprotrudechars=0
\fi
- \else % LuaTeX
- \adjustspacing=0
- \protrudechars=0
\fi
- \else % XeTeX
- \XeTeXprotrudechars=0
\fi
}
# Update an FSF copyright year list to include the current year.
-# Copyright (C) 2009-2024 Free Software Foundation, Inc.
+# Copyright (C) 2009-2026 Free Software Foundation, Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# Each file's copyright statement must be formatted correctly in
# order to be recognized. For example, each of these is fine:
#
-# Copyright @copyright{} 1990-2005, 2007-2009 Free Software
+# Copyright @copyright{} 1990-2005, 2007-2009, 2025-2026 Free Software
# Foundation, Inc.
#
# # Copyright (C) 1990-2005, 2007-2009 Free Software
eval 'exec perl -wSx -0777 -pi "$0" "$@"'
if 0;
-my $VERSION = '2024-01-15.18:30'; # UTC
+my $VERSION = '2025-06-10.02:42'; # UTC
# The definition above must lie within the first 8 lines in order
# for the Emacs time-stamp write hook (at end) to update it.
# If you change this file with Emacs, please let the write hook
else
{
my $ndash = ($ARGV =~ /\.tex(i(nfo)?)?$/ ? "--"
- : $ARGV =~ /\.(\d[a-z]*|man)$/ ? "\\(en"
+ : $ARGV =~ /\.(\d[a-z]*|man)(\.in)?$/ && $ARGV !~ /ChangeLog\./ ? "\\(en"
: "-");
$stmt =~
# coding: utf-8
# mode: perl
# indent-tabs-mode: nil
-# eval: (add-hook 'before-save-hook 'time-stamp)
+# eval: (add-hook 'before-save-hook 'time-stamp nil t)
# time-stamp-line-limit: 200
# time-stamp-start: "my $VERSION = '"
-# time-stamp-format: "%:y-%02m-%02d.%02H:%02M"
+# time-stamp-format: "%Y-%02m-%02d.%02H:%02M"
# time-stamp-time-zone: "UTC0"
# time-stamp-end: "'; # UTC"
# End:
# Detect instances of "if (p) free (p);".
# Likewise "if (p != 0)", "if (0 != p)", or with NULL; and with braces.
-# Copyright (C) 2008-2024 Free Software Foundation, Inc.
+# Copyright (C) 2008-2026 Free Software Foundation, Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
#
# Written by Jim Meyering
-# This is a prologue that allows to run a perl script as an executable
+# This prologue allows running a perl script as an executable
# on systems that are compliant to a POSIX version before POSIX:2017.
# On such systems, the usual invocation of an executable through execlp()
# or execvp() fails with ENOEXEC if it is a script that does not start
eval 'exec perl -wSx "$0" "$@"'
if 0;
-my $VERSION = '2022-01-27 18:51'; # UTC
+my $VERSION = '2025-06-10 02:42'; # UTC
# The definition above must lie within the first 8 lines in order
# for the Emacs time-stamp write hook (at end) to update it.
# If you change this file with Emacs, please let the write hook
# do its job. Otherwise, update this string manually.
-my $copyright_year = '2022';
+(my $copyright_year = $VERSION) =~ s/^(\d*)-.*$/$1/;
use strict;
use warnings;
git ls-files -z |xargs -0 $ME --name=kfree
+Send patches and bug reports to <bug-gnulib\@gnu.org>.
EOF
}
exit $exit_code;
sub is_NULL ($)
{
my ($expr) = @_;
- return ($expr eq 'NULL' || $expr eq '0');
+ return ($expr eq 'NULL' || $expr eq 'nullptr' || $expr eq '0');
}
{
git grep -l -z "$free *(" \
| xargs -0 useless-if-before-free -l --name="$free" \
| xargs -0 perl -0x3b -pi -e \
- 's/\bif\s*\(\s*(\S+?)(?:\s*!=\s*(?:0|NULL))?\s*\)\s+('"$free"'\s*\((?:\s*\([^)]+\))?\s*\1\s*\)\s*;)/$2/s'
+ 's/\bif\s*\(\s*(\S+?)(?:\s*!=\s*(?:0|NULL|nullptr))?\s*\)\s+('"$free"'\s*\((?:\s*\([^)]+\))?\s*\1\s*\)\s*;)/$2/s'
# Use the following to remove redundant uses of kfree inside braces.
# Note that -0777 puts perl in slurp-whole-file mode;
git grep -l -z "$free *(" \
| xargs -0 useless-if-before-free -l --name="$free" \
| xargs -0 perl -0777 -pi -e \
- 's/\bif\s*\(\s*(\S+?)(?:\s*!=\s*(?:0|NULL))?\s*\)\s*\{\s*('"$free"'\s*\((?:\s*\([^)]+\))?\s*\1\s*\);)\s*\}[^\n]*$/$2/gms'
+ 's/\bif\s*\(\s*(\S+?)(?:\s*!=\s*(?:0|NULL|nullptr))?\s*\)\s*\{\s*('"$free"'\s*\((?:\s*\([^)]+\))?\s*\1\s*\);)\s*\}[^\n]*$/$2/gms'
Be careful that the result of the above transformation is valid.
If the matched string is followed by "else", then obviously, it won't be.
## Local Variables:
## mode: perl
## indent-tabs-mode: nil
-## eval: (add-hook 'before-save-hook 'time-stamp)
+## eval: (add-hook 'before-save-hook 'time-stamp nil t)
## time-stamp-line-limit: 50
## time-stamp-start: "my $VERSION = '"
-## time-stamp-format: "%:y-%02m-%02d %02H:%02M"
+## time-stamp-format: "%Y-%02m-%02d %02H:%02M"
## time-stamp-time-zone: "UTC0"
## time-stamp-end: "'; # UTC"
## End:
# List version-controlled file names.
# Print a version string.
-scriptversion=2018-03-07.03; # UTC
+scriptversion=2025-06-10.02; # UTC
-# Copyright (C) 2006-2024 Free Software Foundation, Inc.
+# Copyright (C) 2006-2026 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
done
# Local variables:
-# eval: (add-hook 'before-save-hook 'time-stamp)
+# eval: (add-hook 'before-save-hook 'time-stamp nil t)
# time-stamp-start: "scriptversion="
-# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-format: "%Y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC0"
# time-stamp-end: "; # UTC"
# End:
<!-- Parent-Version: 1.78 -->
<!--
-Copyright (C) 2006-2024 Free Software Foundation, Inc.
+Copyright (C) 2006-2026 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
to <a href="mailto:%%EMAIL%%"><%%EMAIL%%></a>.</p>
</div>
-<p>Copyright © 2023 Free Software Foundation, Inc.</p>
+<p>Copyright © 2023, 2026 Free Software Foundation, Inc.</p>
<p>This page is licensed under a <a rel="license"
href="https://creativecommons.org/licenses/by-nd/3.0/us/">Creative
@example
ar bison cc flex install ld ldconfig lex
-make makeinfo ranlib texi2dvi yacc
+make makeinfo ranlib texi2pdf yacc
@end example
Use the following @code{make} variables to run those programs:
@example
$(AR) $(BISON) $(CC) $(FLEX) $(INSTALL) $(LD) $(LDCONFIG) $(LEX)
-$(MAKE) $(MAKEINFO) $(RANLIB) $(TEXI2DVI) $(YACC)
+$(MAKE) $(MAKEINFO) $(RANLIB) $(TEXI2PDF) $(YACC)
@end example
When you use @code{ranlib} or @code{ldconfig}, you should make sure
@code{docdir} for compatibility with existing practice.
@item htmldir
-@itemx dvidir
@itemx pdfdir
@itemx psdir
Directories for installing documentation files in the particular
format. They should all be set to @code{$(docdir)} by default. (If
you are using Autoconf, write them as @samp{@@htmldir@@},
-@samp{@@dvidir@@}, etc.) Packages which supply several translations
+etc.) Packages which supply several translations
of their documentation should install them in
@samp{$(htmldir)/}@var{ll}, @samp{$(pdfdir)/}@var{ll}, etc. where
@var{ll} is a locale abbreviation such as @samp{en} or @samp{pt_BR}.
@item all
Compile the entire program. This should be the default target. This
target need not rebuild any documentation files; Info files should
-normally be included in the distribution, and DVI (and other
+normally be included in the distribution, and PDF (and other
documentation format) files should be made only when explicitly asked
for.
Categories}.
@item install-html
-@itemx install-dvi
@itemx install-pdf
@itemx install-ps
These targets install documentation in formats other than Info;
them. There is no need to delete parent directories that were created
with @samp{mkdir -p}, since they could have existed anyway.
-Delete @file{.dvi} files here if they are not part of the distribution.
+Delete @file{.pdf} files here if they are not part of the distribution.
@item distclean
Delete all files in the current directory (or created by this
users build the package, ordinarily Make will not update the Info files
because they will already be up to date.
-@item dvi
-@itemx html
+@item html
@itemx pdf
@itemx ps
Generate documentation files in the given format. These targets
format cannot be generated. These targets should not be dependencies
of the @code{all} target; the user must manually invoke them.
-Here's an example rule for generating DVI files from Texinfo:
+Here's an example rule for generating PDF files from Texinfo:
@smallexample
-dvi: foo.dvi
+pdf: foo.pdf
-foo.dvi: foo.texi chap1.texi chap2.texi
- $(TEXI2DVI) $(srcdir)/foo.texi
+foo.pdf: foo.texi chap1.texi chap2.texi
+ $(TEXI2PDF) $(srcdir)/foo.texi
@end smallexample
@noindent
-You must define the variable @code{TEXI2DVI} in the Makefile. It
-should run the program @code{texi2dvi}, which is part of the Texinfo
-distribution. (@code{texi2dvi} uses @TeX{} to do the real work of
+You must define the variable @code{TEXI2PDF} in the Makefile. It
+should run the program @code{texi2pdf}, which is part of the Texinfo
+distribution. (@code{texi2pdf} uses @TeX{} to do the real work of
formatting. @TeX{} is not distributed with Texinfo.) Alternatively,
write only the dependencies, and allow GNU @code{make} to provide the
command.
@setfilename standards.info
@settitle GNU Coding Standards
@c This date is automagically updated when you save this file:
-@set lastupdate August 17, 2021
+@set lastupdate July 5, 2025
@c %**end of header
@dircategory GNU organization
* Writing C:: Making the best use of C.
* Documentation:: Documenting programs.
* Managing Releases:: The release process.
-* References:: Mentioning non-free software or documentation.
+* References:: Mentioning nonfree software or documentation.
* GNU Free Documentation License:: Copying and sharing this manual.
* Index::
If you did not obtain this file directly from the GNU project and
recently, please check for a newer version. You can get the GNU
Coding Standards from the GNU web server in many
-different formats, including the Texinfo source, PDF, HTML, DVI, plain
+different formats, including the Texinfo source, PDF, HTML, plain
text, and more, at: @uref{https://www.gnu.org/prep/standards/}.
If you are maintaining an official GNU package, in addition to this
avoids legal difficulties, and other related issues.
@menu
-* Reading Non-Free Code:: Referring to proprietary programs.
+* Reading Nonfree Code:: Referring to proprietary programs.
* Contributions:: Accepting contributions.
* Trademarks:: How we deal with trademark issues.
+* Terms to Avoid:: Be careful of certain words!
@end menu
-@node Reading Non-Free Code
+@node Reading Nonfree Code
@section Referring to Proprietary Programs
@cindex proprietary programs
@cindex avoiding proprietary code
GNU packages. Please write ``Windows'' in full, or abbreviate it to
``w.'' @xref{System Portability}.
+@node Terms to Avoid
+@section Terms to Avoid
+
+Be careful---never use the word ``steward'' to refer to any person
+involved with developing any free software! An EU directive, the CRA,
+gives that word a specific legal meaning which imposes requirements
+that are painful or even impossible.
+
@node Design Advice
@chapter General Program Design
@cindex program design
already. That would be extremely troublesome in certain cases.
@node Standard C
-@section Standard C and Pre-Standard C
+@section Standard C
@cindex ANSI C standard
-1989 Standard C is widespread enough now that it is ok to use its
+ISO C99 is widespread enough now that it is ok to use its
features in programs. There is one exception: do not ever use the
-``trigraph'' feature of Standard C.
+``trigraph'' misfeature introduced by C89 and not removed until C23.
-The 1999 and 2011 editions of Standard C are not fully supported
-on all platforms. If you aim to support compilation by
-compilers other than GCC, you should not require these C
-features in your programs. It is ok to use these features
-conditionally when the compiler supports them.
+Not all features of recent Standard C are fully supported on all
+platforms. If you aim to support compilation by compilers other than
+GCC, you should generally not require newer Standard C features in
+your programs, or else use them conditionally on whether the compiler
+supports them. The same goes for GNU C extensions such as variable
+length arrays.
-If your program is only meant to compile with GCC, then you can
-use these features if GCC supports them, when they give substantial
-benefit.
-
-However, it is easy to support pre-standard compilers in most programs,
-so if you know how to do that, feel free.
+If your program is only meant to compile with GCC, then you can use
+these features if GCC supports them. Don't use features that GCC does
+not support, except conditionally as a way to use equivalent features
+to those that are used when compiling with GCC.
@cindex function prototypes
-To support pre-standard C, instead of writing function definitions in
-standard prototype form,
-
-@example
-int
-foo (int x, int y)
-@dots{}
-@end example
-
-@noindent
-write the definition in pre-standard style like this,
+Before C89, functions needed to be written in the K&R style, like
+this:
@example
int
@end example
@noindent
-and use a separate declaration to specify the argument prototype:
+with a separate declaration to specify the argument prototype:
@example
int foo (int, int);
@end example
-You need such a declaration anyway, in a header file, to get the benefit
-of prototypes in all the files where the function is called. And once
-you have the declaration, you normally lose nothing by writing the
-function definition in the pre-standard style.
-
-This technique does not work for integer types narrower than @code{int}.
-If you think of an argument as being of a type narrower than @code{int},
-declare it as @code{int} instead.
+Until the 2020s, that was the way to get the most portability to
+different compilers. But not any more.
-There are a few special cases where this technique is hard to use. For
-example, if a function argument needs to hold the system type
-@code{dev_t}, you run into trouble, because @code{dev_t} is shorter than
-@code{int} on some machines; but you cannot use @code{int} instead,
-because @code{dev_t} is wider than @code{int} on some machines. There
-is no type you can safely use on all machines in a non-standard
-definition. The only way to support non-standard C and pass such an
-argument is to check the width of @code{dev_t} using Autoconf and choose
-the argument type accordingly. This may not be worth the trouble.
+Nowadays, it is rare to find a C compiler which fails to support the
+prototype style of function definition. It is more common to run into
+a compiler that has dropped support for the old K&R style. Thus, to
+maximize portability, write function definitions in the Standard C
+style.
-In order to support pre-standard compilers that do not recognize
-prototypes, you may want to use a preprocessor macro like this:
-
-@example
-/* Declare the prototype for a general external function. */
-#if defined (__STDC__) || defined (WINDOWSNT)
-#define P_(proto) proto
-#else
-#define P_(proto) ()
-#endif
-@end example
+You generally need a declaration for the function in addition to its
+definition, usually in a header file, to get the benefit of prototypes
+in all the files where the function is called.
@node Conditional Compilation
@section Conditional Compilation
portably. For instance, GCC implements nearly all the features of
Standard C as specified by that standard. C program developers would
be unhappy if it did not. And GNU utilities mostly follow
-specifications of POSIX.2; shell script writers and users would be
+specifications of POSIX; shell script writers and users would be
unhappy if our programs were incompatible.
But we do not follow either of these specifications rigidly, and there
we can say ``GCC is a 100% implementation of the standard'', not
because there is any reason to actually use it.
-POSIX.2 specifies that @samp{df} and @samp{du} must output sizes by
+POSIX specifies that @samp{df} and @samp{du} must output sizes by
default in units of 512 bytes. What users want is units of 1k, so
that is what we do by default. If you want the ridiculous behavior
``required'' by POSIX, you must set the environment variable
@samp{POSIXLY_CORRECT} (which was originally going to be named
@samp{POSIX_ME_HARDER}).
-GNU utilities also depart from the letter of the POSIX.2 specification
+GNU utilities also depart from the letter of the POSIX specification
when they support long-named command-line options, and intermixing
-options with ordinary arguments. This minor incompatibility with
+of options with ordinary arguments. This minor incompatibility with
POSIX is never a problem in practice, and it is very useful.
In particular, don't reject a new feature, or remove an old one,
command line.
@menu
-* --version:: The standard output for --version.
-* --help:: The standard output for --help.
+* --version:: The standard output for @option{--version}.
+* --help:: The standard output for @option{--help}.
@end menu
@node --version
each on a separate line.
Next should follow a line stating the license, preferably using one of
-abbreviations below, and a brief statement that the program is free
+the abbreviations below, and a brief statement that the program is free
software, and that users are free to copy and change it. Also mention
that there is no warranty, to the extent permitted by law. See
recommended wording below.
@item nx
Used in GDB.
-@item old-archive
-@samp{-o} in @code{tar}.
-
@item old-file
@samp{-o} in @code{make}.
@item one-file-system
-@samp{-l} in @code{tar}, @code{cp}, and @code{du}.
+@samp{-x} in @code{cp} and @code{du}.
@item only-file
@samp{-o} in @code{ptx}.
@samp{-P} in @code{finger}.
@item portability
-@samp{-c} in @code{cpio} and @code{tar}.
+@samp{-c} in @code{cpio}.
@item posix
Used in @code{gawk}.
@samp{-s} in @code{tac}.
@item sequence
-Used by @code{recode} to chose files or pipes for sequencing passes.
+Used by @code{recode} to choose files or pipes for sequencing passes.
@item shell
@samp{-s} in @code{su}.
@}
@end example
-@noindent
-or, if you want to use traditional C syntax, format the definition like
-this:
-
-@example
-static char *
-concat (s1, s2) /* Name starts in column one here */
- char *s1, *s2;
-@{ /* Open brace in column one here */
- @dots{}
-@}
-@end example
-
-In Standard C, if the arguments don't fit nicely on one line,
+If the arguments don't fit nicely on one line,
split it like this:
@example
Historically, C implementations differed substantially, and many
systems lacked a full implementation of ANSI/ISO C89. Nowadays,
-however, all practical systems have a C89 compiler and GNU C supports
-almost all of C99 and some of C11. Similarly, most systems implement
-POSIX.1-2001 libraries and tools, and many have POSIX.1-2008.
+however, all practical systems have a C89-or-later compiler and GNU C
+supports almost all of C23 (with options to select older versions of
+the standard). Similarly, most systems implement POSIX.1-2008
+libraries and tools, and many have POSIX.1-2017.
Hence, there is little reason to support old C or non-POSIX systems,
and you may want to take advantage of standard C and POSIX to write
this regard. Gnulib provides implementations of standard interfaces
on many of the systems that lack them, including portable
implementations of enhanced GNU interfaces, thereby making their use
-portable, and of POSIX-1.2008 interfaces, some of which are missing
+portable, and of POSIX interfaces, some of which are missing
even on up-to-date GNU systems.
@findex xmalloc, in Gnulib
@findex data structures, in Gnulib
Gnulib also provides many useful non-standard interfaces; for example,
C implementations of standard data structures (hash tables, binary
-trees), error-checking type-safe wrappers for memory allocation
+trees), error-checking wrappers for memory allocation
functions (@code{xmalloc}, @code{xrealloc}), and output of error
messages.
@node Reading other Manuals
@section Reading other Manuals
-There may be non-free books or documentation files that describe the
+There may be nonfree books or documentation files that describe the
program you are documenting.
It is ok to use these documents for reference, just as the author of a
of any non-fiction book consists of facts, in this case facts about how
a certain program works, and these facts are necessarily the same for
everyone who writes about the subject. But be careful not to copy your
-outline structure, wording, tables or examples from preexisting non-free
+outline structure, wording, tables or examples from preexisting nonfree
documentation. Copying from free documentation may be ok; please check
with the FSF about the individual case.
--sharedstatedir --localstatedir --runstatedir
--libdir --includedir --oldincludedir
--datarootdir --datadir --infodir --localedir --mandir --docdir
---htmldir --dvidir --pdfdir --psdir
+--htmldir --pdfdir --psdir
@end example
The @code{configure} script should also take an argument which specifies the
other files to get.
@node References
-@chapter References to Non-Free Software and Documentation
-@cindex references to non-free material
+@chapter References to Nonfree Software and Documentation
+@cindex references to nonfree material
A GNU program should not recommend, promote, or grant legitimacy to
-the use of any non-free program. Proprietary software is a social and
+the use of any nonfree program. Proprietary software is a social and
ethical problem, and our aim is to put an end to that problem. We
can't stop some people from writing proprietary programs, or stop
other people from using them, but we can and should refuse to
@url{https://www.gnu.org/@/philosophy/@/free-sw.html}, and the definition
of free documentation is found at
@url{https://www.gnu.org/@/philosophy/@/free-doc.html}. The terms ``free''
-and ``non-free'', used in this document, refer to those definitions.
+and ``nonfree'', used in this document, refer to those definitions.
A list of important licenses and whether they qualify as free is in
@url{https://www.gnu.org/@/licenses/@/license-list.html}. If it is not
by writing to @email{licensing@@gnu.org}. We will answer, and if the
license is an important one, we will add it to the list.
-When a non-free program or system is well known, you can mention it in
+When a nonfree program or system is well known, you can mention it in
passing---that is harmless, since users who might want to use it
probably already know about it. For instance, it is fine to explain
-how to build your package on top of some widely used non-free
+how to build your package on top of some widely used nonfree
operating system, or how to use it together with some widely used
-non-free program, after first explaining how to use it on the GNU
+nonfree program, after first explaining how to use it on the GNU
system.
However, you should give only the necessary information to help those
-who already use the non-free program to use your program with
+who already use the nonfree program to use your program with
it---don't give, or refer to, any further information about the
proprietary program, and don't imply that the proprietary program
enhances your program, or that its existence is in any way a good
program will not see anything likely to lead them to take an interest
in it.
-You shouldn't recommend any non-free add-ons for the non-free program,
+You shouldn't recommend any nonfree add-ons for the nonfree program,
but it is ok to mention free add-ons that help it to work with your
program, and how to install the free add-ons even if that requires
-running some non-free program.
+running some nonfree program.
-If a non-free program or system is obscure in your program's domain,
+If a nonfree program or system is obscure in your program's domain,
your program should not mention or support it at all, since doing so
-would tend to popularize the non-free program more than it popularizes
+would tend to popularize the nonfree program more than it popularizes
your program. (You cannot hope to find many additional users for your
program among the users of Foobar, if the existence of Foobar is not
generally known among people who might want to use your program.)
Sometimes a program is free software in itself but depends on a
-non-free platform in order to run. For instance, it used to be the
-case that many Java programs depended on some non-free Java libraries.
+nonfree platform in order to run. For instance, it used to be the
+case that many Java programs depended on some nonfree Java libraries.
(See @uref{https://www.gnu.org/philosophy/java-trap.html}.)
To recommend or promote such a program is to promote the other
programs it needs; therefore, judge mentions of the former as if they
were mentions of the latter. For this reason, we were careful about
listing Java programs in the Free Software Directory: we wanted to
-avoid promoting the non-free Java libraries.
+avoid promoting the nonfree Java libraries.
Java no longer has this problem, but the general principle will remain
the same: don't recommend, promote or legitimize programs that depend
-on non-free software to run.
+on nonfree software to run.
-Some free programs strongly encourage the use of non-free software. A
+Some free programs strongly encourage the use of nonfree software. A
typical example is @command{mplayer}. It is free software in itself,
and the free code can handle some kinds of files. However,
-@command{mplayer} recommends use of non-free codecs for other kinds of
+@command{mplayer} recommends use of nonfree codecs for other kinds of
files, and users that install @command{mplayer} are very likely to
install those codecs along with it. To recommend @command{mplayer}
-is, in effect, to promote use of the non-free codecs.
+is, in effect, to promote use of the nonfree codecs.
Thus, you should not recommend programs that strongly encourage the
-use of non-free software. This is why we do not list
+use of nonfree software. This is why we do not list
@command{mplayer} in the Free Software Directory.
-A GNU package should not refer the user to any non-free documentation
+A GNU package should not refer the user to any nonfree documentation
for free software. Free documentation that can be included in free
operating systems is essential for completing the GNU system, or any
free operating system, so encouraging it is a priority; to recommend
use of documentation that we are not allowed to include undermines the
impetus for the community to produce documentation that we can
-include. So GNU packages should never recommend non-free
+include. So GNU packages should never recommend nonfree
documentation.
By contrast, it is ok to refer to journal articles and textbooks in
the comments of a program for explanation of how it functions, even
-though they are non-free. This is because we don't include such
+though they are nonfree. This is because we don't include such
things in the GNU system even if they are free---they are outside the
scope of what a software distribution needs to include.
-Referring to a web site that describes or recommends a non-free
+Referring to a web site that describes or recommends a nonfree
program is promoting that program, so please do not make links to (or
mention by name) web sites that contain such material. This policy is
relevant particularly for the web pages for a GNU package.
What about chains of links? Following links from nearly any web site
-can lead eventually to promotion of non-free software; this is
+can lead eventually to promotion of nonfree software; this is
inherent in the nature of the web. Here's how we treat that.
You should not refer to AT&T's web site if that recommends AT&T's
-non-free software packages; you should not refer to a page @var{p}
+nonfree software packages; you should not refer to a page @var{p}
that links to AT&T's site presenting it as a place to get some
-non-free program, because that part of the page @var{p} itself
-recommends and legitimizes the non-free program.
+nonfree program, because that part of the page @var{p} itself
+recommends and legitimizes the nonfree program.
However, if @var{p} contains a link to AT&T's web site for some other
purpose (such as long-distance telephone service), that is no reason
A web page recommends a program in an implicit but particularly strong
way if it requires users to run that program in order to use the page.
Many pages contain JavaScript code which they recommend in this way.
-This JavaScript code may be free or non-free, but non-free is the usual
+This JavaScript code may be free or nonfree, but nonfree is the usual
case.
If the purpose for which you would refer to the page cannot be carried
-out without running non-free JavaScript code, then you should not refer
+out without running nonfree JavaScript code, then you should not refer
to it. Thus, if the purpose of referring to the page is for people to
view a video, or subscribing to a mailing list, and the viewing or
-subscribing fail to work if the user's browser blocks the non-free
+subscribing fail to work if the user's browser blocks the nonfree
JavaScript code, then don't refer to that page.
-The extreme case is that of web sites which depend on non-free
+The extreme case is that of web sites which depend on nonfree
JavaScript code even to @emph{see} the contents of the pages. Any
site hosted on @indicateurl{wix.com} has this problem, and so do some
other sites. Referring people to such pages to read their contents
-is, in effect, urging them to run those non-free programs---so please
+is, in effect, urging them to run those nonfree programs---so please
don't refer to those pages. (Such pages also break the Web, so they
deserve condemnation for two reasons.)
-# Copyright (C) 2002-2024 Free Software Foundation, Inc.
+# Copyright (C) 2002-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
=cut
-use 5.006;
-use strict;
-use warnings FATAL => 'all';
-
+use 5.006; use strict; use warnings;
use Exporter;
use Autom4te::Channels;
{
# The character class in the second match group is ASCII \S minus
# comma. We are generous with this because category values may come
- # from WARNINGS and we don't want to assume what other programs'
- # syntaxes for warnings categories are.
+ # from WARNINGS and we don't want to assume other programs'
+ # syntax for warnings categories.
/^(no-|)([\w\[\]\/\\!"#$%&'()*+-.:;<=>?@^`{|}~]+)$/
or die "Invalid warnings category: $_";
$warnings{$2} = $1;
-# Copyright (C) 2002-2024 Free Software Foundation, Inc.
+# Copyright (C) 2002-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
=cut
-use 5.006;
-use strict;
-use warnings FATAL => 'all';
-
+use 5.006; use strict; use warnings;
use Carp;
use Exporter;
use File::Basename;
{
my ($ref) = @_;
my $dup = 0;
- foreach my $k (keys %$ref)
+ foreach my $k (keys %$ref) # sort keys not needed
{
$dup += $ref->{$k};
}
my ($hash, %options) = @_;
local $_;
- foreach (keys %options)
+ foreach (sort keys %options)
{
if (exists $hash->{$_})
{
sub setup_channel_type ($%)
{
my ($type, %opts) = @_;
- foreach my $channel (keys %channels)
+ foreach my $channel (sort keys %channels)
{
setup_channel $channel, %opts
if $channels{$channel}{'type'} eq $type;
sub dup_channel_setup ()
{
my %channels_copy;
- foreach my $k1 (keys %channels)
+ foreach my $k1 (keys %channels) # sort keys not needed
{
$channels_copy{$k1} = {%{$channels{$k1}}};
}
sub setup_channel_queue ($$)
{
my ($queue, $key) = @_;
- foreach my $channel (keys %channels)
+ foreach my $channel (sort keys %channels)
{
setup_channel $channel, queue => $queue, queue_key => $key
if $channels{$channel}{'ordered'};
-# Copyright (C) 2003-2024 Free Software Foundation, Inc.
+# Copyright (C) 2003-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
package Autom4te::Configure_ac;
-use 5.006;
-use strict;
-use warnings FATAL => 'all';
+use 5.006; use strict; use warnings;
use Exporter;
-# Copyright (C) 2003-2024 Free Software Foundation, Inc.
+# Copyright (C) 2003-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
=cut
-use 5.006;
-use strict;
-use warnings FATAL => 'all';
+use 5.006; use strict; use warnings;
BEGIN
{
our %_directory_cache;
sub dir_has_case_matching_file ($$)
{
- # Note that print File::Spec->case_tolerant returns 0 even on Mac OS
+ # Note that print File::Spec->case_tolerant returns 0 even on MacOS
# X (with Perl v5.8.1-RC3 at least), so do not try to shortcut this
# function using that.
-# Copyright (C) 2012-2024 Free Software Foundation, Inc.
+# Copyright (C) 2012-2025 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
=cut
-use 5.006;
-use strict;
-use warnings FATAL => 'all';
+use 5.006; use strict; use warnings;
use Carp qw (confess croak);
use Exporter ();
if (@ARGV && $ARGV[0] =~ /^-./)
{
my %argopts;
- for my $k (keys %option)
+ for my $k (keys %option) # sort keys not needed
{
if ($k =~ /(.*)=s$/)
{
-# Copyright (C) 2001-2024 Free Software Foundation, Inc.
+# Copyright (C) 2001-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
=cut
-use 5.006;
-use strict;
-use warnings FATAL => 'all';
-
+use 5.006; use strict; use warnings;
use Errno;
use Exporter;
use IO::File;
# autobuild.m4
# serial 8
-dnl Copyright (C) 2004, 2006-2024 Free Software Foundation, Inc.
+dnl Copyright (C) 2004, 2006-2026 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
+dnl This file is offered as-is, without any warranty.
dnl From Simon Josefsson
# This Makefile fragment tries to be general-purpose enough to be
# used by many projects via the gnulib maintainer-makefile module.
-## Copyright (C) 2001-2024 Free Software Foundation, Inc.
+## Copyright (C) 2001-2026 Free Software Foundation, Inc.
##
## This program is free software: you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
# You can override this variable in cfg.mk if your gnulib submodule lives
# in a different location.
-gnulib_dir ?= $(shell if test -n "$(GNULIB_SRCDIR)" && test -f "$(GNULIB_SRCDIR)/gnulib-tool"; then \
- echo "$(GNULIB_SRCDIR)"; \
- else \
- echo $(srcdir)/gnulib; \
- fi)
+ifeq ($(origin gnulib_dir),undefined)
+ gnulib_dir := $(shell if test -n "$(GNULIB_SRCDIR)" \
+ && test -f "$(GNULIB_SRCDIR)/gnulib-tool"; then \
+ echo "$(GNULIB_SRCDIR)"; \
+ else \
+ echo $(srcdir)/gnulib; \
+ fi)
+endif
# You can override this variable in cfg.mk to set your own regexp
# matching files to ignore.
# If RELEASE_TYPE is undefined, but RELEASE is, use its second word.
# But overwrite VERSION.
ifdef RELEASE
- VERSION := $(word 1, $(RELEASE))
- RELEASE_TYPE ?= $(word 2, $(RELEASE))
+ ifeq ($(origin RELEASE),command line)
+ VERSION := $(word 1,$(RELEASE))
+ RELEASE_TYPE ?= $(word 2,$(RELEASE))
+ endif
endif
# Validate and return $(RELEASE_TYPE), or die.
https://ftpmirror.gnu.org/$(PACKAGE), \
https://$(gnu_rel_host)/gnu/$(PACKAGE))
+# NEWS.md takes precedence over NEWS.
+# Override this in cfg.mk if you use a different file name.
+ifeq ($(origin NEWS_file),undefined)
+ NEWS_file := NEWS$(and $(wildcard $(srcdir)/NEWS.md),.md)
+endif
+
+# An ERE matching the release date (typically today, but not necessarily).
# Override this in cfg.mk if you are using a different format in your
# NEWS file.
-today = $(shell date +%Y-%m-%d)
+today = [0-9]{4,}-[0-9][0-9]-[0-9][0-9]
# Select which lines of NEWS are searched for $(news-check-regexp).
# This is a sed line number spec. The default says that we search
# lines 1..10 of NEWS for $(news-check-regexp).
# If you want to search only line 3 or only lines 20-22, use "3" or "20,22".
news-check-lines-spec ?= 1,10
-news-check-regexp ?= '^\*.* $(VERSION_REGEXP) \($(today)\)'
+
+# An ERE quoted for the shell, for matching a version+date line prefix.
+news-check-regexp ?= '^[\#*].* $(VERSION_REGEXP) \($(today)\)'
+
+# Like news-check-regexp, but as an unquoted BRE for .prev-version.
+news-check-regexp-prev ?= ^[\#*].* $(PREV_VERSION_REGEXP) ([0-9-]*)
# Prevent programs like 'sort' from considering distinct strings to be equal.
# Doing it here saves us from having to set LC_ALL elsewhere in this file.
halt='do not use *scan''f, ato''f, ato''i, ato''l, ato''ll or ato''q' \
$(_sc_search_regexp)
-# Use STREQ rather than comparing strcmp == 0, or != 0.
+# Use streq rather than comparing strcmp == 0, or != 0.
sp_ = strcmp *\(.+\)
sc_prohibit_strcmp:
@prohibit='! *strcmp *\(|\<$(sp_) *[!=]=|[!=]= *$(sp_)' \
exclude='# *define STRN?EQ\(' \
- halt='replace strcmp calls above with STREQ/STRNEQ' \
+ halt='replace strcmp calls above with streq' \
$(_sc_search_regexp)
# Really. You don't want to use this function.
fi
# Generated headers that override system headers.
-# Keep sorted.
+# These are documented in gnulib-tool.texi. Keep sorted.
+# sed -n -e 's/^@item[[:space:]]\{1,\}@code{\([^}]\{1,\}\)}$/\1/p' $GNULIB_SRCDIR/doc/gnulib-tool.texi | sort -u
gl_prefer_angle_bracket_headers_ ?= \
alloca.h \
arpa/inet.h \
assert.h \
+ byteswap.h \
ctype.h \
dirent.h \
+ endian.h \
errno.h \
error.h \
fcntl.h \
locale.h \
malloc.h \
math.h \
+ mntent.h \
monetary.h \
- netdb.h \
net/if.h \
+ netdb.h \
netinet/in.h \
omp.h \
poll.h \
stdlib.h \
string.h \
strings.h \
- sysexits.h \
sys/file.h \
sys/ioctl.h \
sys/msg.h \
sys/times.h \
sys/types.h \
sys/uio.h \
+ sys/un.h \
sys/utsname.h \
sys/wait.h \
+ sysexits.h \
termios.h \
threads.h \
time.h \
sc_prohibit_same_without_use:
@h='same.h' re='\<same_name(at)? *\(' $(_sc_header_without_use)
-sc_prohibit_hash_pjw_without_use:
- @h='hash-pjw.h' \
+sc_prohibit_hashcode_string2_without_use:
+ @h='hashcode-string2.h' \
re='\<hash_pjw\>' \
$(_sc_header_without_use)
halt='do not use HAVE''_FCNTL_H or O'_NDELAY \
$(_sc_search_regexp)
+# Prohibit BSD4.3/SysV u_char, u_short, u_int and u_long usage.
+sc_unsigned_char:
+ @prohibit=u''_char \
+ halt='don'\''t use u''_char; instead use unsigned char' \
+ $(_sc_search_regexp)
+sc_unsigned_short:
+ @prohibit=u''_short \
+ halt='don'\''t use u''_short; instead use unsigned short' \
+ $(_sc_search_regexp)
+sc_unsigned_int:
+ @prohibit=u''_int \
+ halt='don'\''t use u''_int; instead use unsigned int' \
+ $(_sc_search_regexp)
+sc_unsigned_long:
+ @prohibit=u''_long \
+ halt='don'\''t use u''_long; instead use unsigned long' \
+ $(_sc_search_regexp)
+
# FIXME: warn about definitions of EXIT_FAILURE, EXIT_SUCCESS, STREQ
# Each nonempty ChangeLog line must start with a year number, or a TAB.
halt='GFDL vN, N!=3' \
$(_sc_search_regexp)
+# Look out for FSF postal addresses -- use URLs instead:
+# https://www.gnu.org/prep/maintain/html_node/License-Notices-for-Code.html
+sc_fsf_postal:
+ @prohibit='(Mass Ave|Massachusetts Ave|Temple Pl|Franklin St|Milk St)' \
+ halt='use license URLs instead of FSF postal address' \
+ $(_sc_search_regexp)
+
# Don't use Texinfo's @acronym{}.
# https://lists.gnu.org/r/bug-gnulib/2010-03/msg00321.html
texinfo_suffix_re_ ?= \.(txi|texi(nfo)?)$$
$(_sc_search_regexp)
NEWS_hash = \
- $$($(SED) -n '/^\*.* $(PREV_VERSION_REGEXP) ([0-9-]*)/,$$p' \
- $(srcdir)/NEWS \
+ $$($(SED) -n '/$(news-check-regexp-prev)/,$$p' $(srcdir)/$(NEWS_file) \
| perl -0777 -pe \
's/^Copyright.+?Free\sSoftware\sFoundation,\sInc\.\n//ms' \
| md5sum - \
# Ensure that we don't accidentally insert an entry into an old NEWS block.
sc_immutable_NEWS:
- @if test -f $(srcdir)/NEWS; then \
+ @if test -f $(srcdir)/$(NEWS_file); then \
test "$(NEWS_hash)" = '$(old_NEWS_hash)' && : || \
{ echo '$(ME): you have modified old NEWS' 1>&2; exit 1; }; \
fi
# Update the hash stored above. Do this after each release and
# for any corrections to old entries.
-update-NEWS-hash: NEWS
- perl -pi -e 's/^(old_NEWS_hash[ \t]+:?=[ \t]+).*/$${1}'"$(NEWS_hash)/" \
+update-NEWS-hash: $(NEWS_file)
+ $(AM_V_GEN)perl -pi \
+ -e 's/^(old_NEWS_hash[ \t]+:?=[ \t]+).*/$${1}'"$(NEWS_hash)/" \
$(srcdir)/cfg.mk
# Ensure that we use only the standard $(VAR) notation,
$$($(VC_LIST_EXCEPT) | $(GREP) -E '(^|/)(Makefile\.am|[^/]+\.mk)$$') \
&& { echo '$(ME): use $$(...), not @...@' 1>&2; exit 1; } || :
-news-check: NEWS
+news-check: $(NEWS_file)
$(AM_V_GEN)if $(SED) -n $(news-check-lines-spec)p $< \
| $(GREP) -E $(news-check-regexp) >/dev/null; then \
:; \
else \
- echo 'NEWS: $$(news-check-regexp) failed to match' 1>&2; \
+ echo '$<: $$(news-check-regexp) failed to match' 1>&2; \
exit 1; \
fi
# That would be flagged by using -Wundef, however gnulib currently
# tests many undefined macros, and so we can't enable that option.
# So at least preclude common boolean strings as macro values.
+# Although this rule formerly also complained about 'true' and 'false',
+# that complaint is now incorrect given that C23 has blessed this practice
+# and the 'bool' module supports it.
sc_Wundef_boolean:
- @prohibit='^#define.*(yes|no|true|false)$$' \
+ @prohibit='^#define.*(yes|no)$$' \
in_files='$(CONFIG_INCLUDE)' \
- halt='Use 0 or 1 for macro values' \
+ halt='Use 0/1 or false/true for macro values' \
$(_sc_search_regexp)
# Even if you use pathmax.h to guarantee that PATH_MAX is defined, it might
rel-files = $(DIST_ARCHIVES)
-gnulib-version = $$(cd $(gnulib_dir) \
- && { git describe || git rev-parse --short=10 HEAD; } )
+gnulib-version ?= \
+ $$(head -c11 $(gnulib_dir)/ChangeLog; \
+ if test -e $(gnulib_dir)/.git; then \
+ git -C $(gnulib_dir) rev-parse HEAD; \
+ elif test -f $(srcdir)/bootstrap.conf; then \
+ perl -lne '/^\s*GNULIB_REVISION=(\S+)/ and $$d=$$1;' \
+ -e 'END{defined $$d and print $$d}' $(srcdir)/bootstrap.conf; \
+ fi)
bootstrap-tools ?= autoconf,automake,gnulib
-gpgv = $$(gpgv2 --version >/dev/null && echo gpgv2 || echo gpgv)
+gpgv = $$(command -v gpgv2 >/dev/null && echo gpgv2 || echo gpgv)
# If it's not already specified, derive the GPG key ID from
# the signed tag we've just applied to mark this release.
gpg_key_ID ?= \
announcement_mail_Cc_beta = $(announcement_mail_Cc_alpha)
announcement_mail_headers_beta = $(announcement_mail_headers_alpha)
+announce_gen_args ?=
+
announcement_Cc_ ?= $(announcement_Cc_$(release-type))
announcement_mail_headers_ ?= $(announcement_mail_headers_$(release-type))
-announcement: NEWS ChangeLog $(rel-files)
+announcement: $(NEWS_file) ChangeLog $(rel-files)
# Not $(AM_V_GEN) since the output of this command serves as
# announcement message: it would start with " GEN announcement".
$(AM_V_at)$(srcdir)/$(_build-aux)/announce-gen \
$$(test -n "$(gpg_keyring_url)" && \
echo --gpg-keyring-url="$(gpg_keyring_url)") \
--srcdir=$(srcdir) \
- --news=$(srcdir)/NEWS \
+ --news=$(srcdir)/$(NEWS_file) \
--bootstrap-tools=$(bootstrap-tools) \
- $$(case ,$(bootstrap-tools), in (*,gnulib,*) \
- echo --gnulib-version=$(gnulib-version);; esac) \
- $(addprefix --url-dir=, $(url_dir_list))
-
+ "$$(case ,$(bootstrap-tools), in (*,gnulib,*) \
+ echo --gnulib-version=$(gnulib-version);; esac)" \
+ $(addprefix --url-dir=, $(url_dir_list)) \
+ $(announce_gen_args)
+
+release_commit_args ?= \
+ --news=$(NEWS_file) \
+ --stub='$(gl_noteworthy_news_)' \
+ --stub-lines='$(news-check-lines-spec)'
.PHONY: release-commit
release-commit:
$(AM_V_GEN)cd $(srcdir) \
&& $(_build-aux)/do-release-commit-and-tag \
- -C $(abs_builddir) $(RELEASE)
+ -C $(abs_builddir) $(release_commit_args) $(RELEASE)
## ---------------- ##
## Updating files. ##
define emit-commit-log
printf '%s\n' 'maint: post-release administrivia' '' \
- '* NEWS: Add header line for next release.' \
+ '* $(NEWS_file): Add header line for next release.' \
'* .prev-version: Record previous version.' \
'* cfg.mk (old_NEWS_hash): Auto-update.'
endef
.PHONY: no-submodule-changes
no-submodule-changes:
$(AM_V_GEN)if test -d $(srcdir)/.git \
+ && test -e $(srcdir)/.gitmodules \
&& git --version >/dev/null 2>&1; then \
diff=$$(cd $(srcdir) && git submodule -q foreach \
git diff-index --name-only HEAD) \
.PHONY: public-submodule-commit
public-submodule-commit:
$(AM_V_GEN)if test -d $(srcdir)/.git \
+ && test -e $(srcdir)/.gitmodules \
&& git --version >/dev/null 2>&1; then \
cd $(srcdir) && \
git submodule --quiet foreach \
# Override this in cfg.mk if you follow different procedures.
release-prep-hook ?= release-prep
-gl_noteworthy_news_ = * Noteworthy changes in release ?.? (????-??-??) [?]
+# Keep consistent with news-check-regexp and news-check-regexp-prev.
+gl_noteworthy_news_ ?= \
+ $(if $(filter %.md,$(NEWS_file)),#,*) \
+ Noteworthy changes in release ?.? (????-??-??) [?]
.PHONY: release-prep
release-prep:
$(AM_V_GEN)$(MAKE) --no-print-directory -s announcement \
fi
$(AM_V_at)echo $(VERSION) > $(prev_version_file)
$(AM_V_at)$(MAKE) update-NEWS-hash
- $(AM_V_at)perl -pi \
- -e '$$. == 3 and print "$(gl_noteworthy_news_)\n\n\n"' \
- $(srcdir)/NEWS
+ $(AM_V_at)n=$$($(SED) -n -E \
+ '$(news-check-lines-spec){/'$(news-check-regexp)'/=}' \
+ $(srcdir)/$(NEWS_file)); test -n "$$n" \
+ && env gl_n=$$n gl_s='$(gl_noteworthy_news_)' \
+ perl -pi -e '$$. == $$ENV{gl_n} ' \
+ -e ' and print "$$ENV{gl_s}\n\n\n"' \
+ $(srcdir)/$(NEWS_file) \
+ || { printf '$(NEWS_file): %s failed to match\n' \
+ '$$(news-check-regexp)' 1>&2; exit 1; }
$(AM_V_at)msg=$$($(emit-commit-log)) || exit 1; \
cd $(srcdir) && $(VC) commit -m "$$msg" -a
$(MAKE) $(AM_MAKEFLAGS) clean
lcov --directory . --zerocounters
-COVERAGE_CCOPTS ?= "-g --coverage"
+COVERAGE_CCOPTS ?= "-g --coverage -Wno-error"
COVERAGE_OUT ?= doc/coverage
build-coverage:
$(MAKE) $(AM_MAKEFLAGS) CFLAGS=$(COVERAGE_CCOPTS) CXXFLAGS=$(COVERAGE_CCOPTS) check
mkdir -p $(COVERAGE_OUT)
lcov --directory . --output-file $(COVERAGE_OUT)/$(PACKAGE).info \
- --capture
+ --capture --ignore-errors negative,source
gen-coverage:
genhtml --output-directory $(COVERAGE_OUT) \
$(COVERAGE_OUT)/$(PACKAGE).info \
- --highlight --frames --legend \
+ --frames --legend \
+ --ignore-errors source --synthesize-missing \
--title "$(PACKAGE_NAME)"
coverage:
# Indentation
-indent_args ?= -ppi 1
+indent_args ?= --ignore-profile --preprocessor-indentation 1
C_SOURCES ?= $$($(VC_LIST_EXCEPT) | grep '\.[ch]\(.in\)\?$$')
INDENT_SOURCES ?= $(C_SOURCES)
exclude_file_name_regexp--indent ?= $(exclude_file_name_regexp--sc_indent)
exit 1; } || :; \
fi
+# Check code spelling.
+# Example 'cfg.mk' settings for inspiration:
+# codespell_ignore_words_list = foo
+# exclude_file_name_regexp--sc_codespell = ^po/.*.po|doc/.*.pdf$$
+# codespell_extra_args = --summary --count
+# codespell_args = --ignore-words=doc/my-codespell-ignores.txt
+codespell_args ?= --ignore-words-list $(codespell_ignore_words_list) \
+ $(codespell_extra_args)
+sc_codespell:
+ @if ! command -v codespell > /dev/null; then \
+ echo 1>&2 '$(ME): sc_codespell: codespell is missing'; \
+ else \
+ codespell $(codespell_args) $$($(VC_LIST_EXCEPT)); \
+ fi
+
# If you want to set UPDATE_COPYRIGHT_* environment variables,
# put the assignments in this variable.
update-copyright-env ?=
for sig in 1 2 3 13 15; do \
eval "trap 'v=`expr $$sig + 128`; (exit $$v); exit $$v' $$sig"; \
done; \
- src=`for f in $(SOURCES); do \
+ src=`for f in $(sort $(SOURCES)); do \
test -f $$f && d= || d=$(srcdir)/; echo $$d$$f; done`; \
hdr=`for f in $(_gl_TS_headers); do \
test -f $$f && d= || d=$(srcdir)/; echo $$d$$f; done`; \