mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-04-29 19:30:36 +02:00
Merge remote-tracking branch 'origin/stable-2.0'
Conflicts: libguile/feature.c m4/gnulib-cache.m4 module/ice-9/deprecated.scm module/language/tree-il/peval.scm
This commit is contained in:
commit
296004b3ba
63 changed files with 3327 additions and 339 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -144,3 +144,6 @@ INSTALL
|
|||
/test-suite/standalone/test-pthread-create-secondary
|
||||
/lib/fcntl.h
|
||||
/lib/sys/uio.h
|
||||
/lib/stdalign.h
|
||||
/lib/signal.h
|
||||
/lib/sys/types.h
|
||||
|
|
|
@ -45,12 +45,13 @@ include Makefile
|
|||
|
||||
# Some projects override e.g., _autoreconf here.
|
||||
-include $(srcdir)/cfg.mk
|
||||
include $(srcdir)/maint.mk
|
||||
|
||||
# Allow cfg.mk to override these.
|
||||
_build-aux ?= build-aux
|
||||
_autoreconf ?= autoreconf -v
|
||||
|
||||
include $(srcdir)/maint.mk
|
||||
|
||||
# Ensure that $(VERSION) is up to date for dist-related targets, but not
|
||||
# for others: rerunning autoreconf and recompiling everything isn't cheap.
|
||||
_have-git-version-gen := \
|
||||
|
@ -100,6 +101,11 @@ srcdir = .
|
|||
|
||||
# The package can override .DEFAULT_GOAL to run actions like autoreconf.
|
||||
-include ./cfg.mk
|
||||
|
||||
# Allow cfg.mk to override these.
|
||||
_build-aux ?= build-aux
|
||||
_autoreconf ?= autoreconf -v
|
||||
|
||||
include ./maint.mk
|
||||
|
||||
ifeq ($(.DEFAULT_GOAL),abort-due-to-no-makefile)
|
||||
|
|
11
Makefile.am
11
Makefile.am
|
@ -42,12 +42,15 @@ SUBDIRS = \
|
|||
libguileincludedir = $(pkgincludedir)/$(GUILE_EFFECTIVE_VERSION)
|
||||
libguileinclude_HEADERS = libguile.h
|
||||
|
||||
EXTRA_DIST = LICENSE HACKING GUILE-VERSION \
|
||||
m4/ChangeLog-2008 \
|
||||
ChangeLog-2008 \
|
||||
.version
|
||||
EXTRA_DIST = LICENSE HACKING GUILE-VERSION \
|
||||
m4/ChangeLog-2008 \
|
||||
ChangeLog-2008 \
|
||||
.version \
|
||||
gnulib-local/lib/localcharset.h.diff \
|
||||
gnulib-local/lib/localcharset.c.diff
|
||||
|
||||
TESTS = check-guile
|
||||
TESTS_ENVIRONMENT = @LOCALCHARSET_TESTS_ENVIRONMENT@
|
||||
|
||||
ACLOCAL_AMFLAGS = -I m4
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ eval '(exit $?0)' && eval 'exec perl -wS "$0" ${1+"$@"}'
|
|||
if 0;
|
||||
# Generate a release announcement message.
|
||||
|
||||
my $VERSION = '2011-05-17 20:25'; # UTC
|
||||
my $VERSION = '2011-11-09 21:30'; # 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
|
||||
|
@ -453,28 +453,50 @@ FIXME: put comments here
|
|||
|
||||
EOF
|
||||
|
||||
print_locations ("compressed sources", @url_dir_list, %size, @tarballs);
|
||||
-f $xd
|
||||
and print_locations ("xdelta diffs (useful? if so, "
|
||||
. "please tell bug-gnulib\@gnu.org)",
|
||||
@url_dir_list, %size, $xd);
|
||||
my @sig_files = map { "$_.sig" } @tarballs;
|
||||
print_locations ("GPG detached signatures[*]", @url_dir_list, %size,
|
||||
@sig_files);
|
||||
if (@url_dir_list == 1 && @tarballs == 1)
|
||||
{
|
||||
# When there's only one tarball and one URL, use a more concise form.
|
||||
my $m = "$url_dir_list[0]/$tarballs[0]";
|
||||
print "Here are the compressed sources and a GPG detached signature[*]:\n"
|
||||
. " $m\n"
|
||||
. " $m.sig\n\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
print_locations ("compressed sources", @url_dir_list, %size, @tarballs);
|
||||
-f $xd
|
||||
and print_locations ("xdelta diffs (useful? if so, "
|
||||
. "please tell bug-gnulib\@gnu.org)",
|
||||
@url_dir_list, %size, $xd);
|
||||
my @sig_files = map { "$_.sig" } @tarballs;
|
||||
print_locations ("GPG detached signatures[*]", @url_dir_list, %size,
|
||||
@sig_files);
|
||||
}
|
||||
|
||||
if ($url_dir_list[0] =~ "gnu\.org")
|
||||
{
|
||||
print "To reduce load on the main server, use a mirror listed at:\n";
|
||||
print " http://www.gnu.org/order/ftp.html\n\n";
|
||||
print "Use a mirror for higher download bandwidth:\n";
|
||||
if (@tarballs == 1 && $url_dir_list[0] =~ m!http://ftp\.gnu\.org/gnu/!)
|
||||
{
|
||||
(my $m = "$url_dir_list[0]/$tarballs[0]")
|
||||
=~ s!http://ftp\.gnu\.org/gnu/!http://ftpmirror\.gnu\.org/!;
|
||||
print " $m\n"
|
||||
. " $m.sig\n\n";
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
print " http://www.gnu.org/order/ftp.html\n\n";
|
||||
}
|
||||
}
|
||||
|
||||
$print_checksums_p
|
||||
and print_checksums (@sizable);
|
||||
|
||||
print <<EOF;
|
||||
[*] You can use either of the above signature files to verify that
|
||||
the corresponding file (without the .sig suffix) is intact. First,
|
||||
be sure to download both the .sig file and the corresponding tarball.
|
||||
Then, run a command like this:
|
||||
[*] Use a .sig file to verify that the corresponding file (without the
|
||||
.sig suffix) is intact. First, be sure to download both the .sig file
|
||||
and the corresponding tarball. Then, run a command like this:
|
||||
|
||||
gpg --verify $tarballs[0].sig
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#!/bin/sh
|
||||
# Print a version string.
|
||||
scriptversion=2011-08-11.12; # UTC
|
||||
scriptversion=2011-11-13.13; # UTC
|
||||
|
||||
# Copyright (C) 2007-2011 Free Software Foundation, Inc.
|
||||
#
|
||||
|
@ -69,15 +69,59 @@ scriptversion=2011-08-11.12; # UTC
|
|||
# dist-hook:
|
||||
# echo $(VERSION) > $(distdir)/.tarball-version
|
||||
|
||||
case $# in
|
||||
1|2) ;;
|
||||
*) echo 1>&2 "Usage: $0 \$srcdir/.tarball-version" \
|
||||
'[TAG-NORMALIZATION-SED-SCRIPT]'
|
||||
exit 1;;
|
||||
esac
|
||||
|
||||
tarball_version_file=$1
|
||||
tag_sed_script="${2:-s/x/x/}"
|
||||
me=$0
|
||||
|
||||
version="git-version-gen $scriptversion
|
||||
|
||||
Copyright 2011 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."
|
||||
|
||||
usage="\
|
||||
Usage: $me [OPTION]... \$srcdir/.tarball-version [TAG-NORMALIZATION-SED-SCRIPT]
|
||||
Print a version string.
|
||||
|
||||
Options:
|
||||
|
||||
--prefix prefix of git tags (default 'v')
|
||||
|
||||
--help display this help and exit
|
||||
--version output version information and exit
|
||||
|
||||
Running without arguments will suffice in most cases."
|
||||
|
||||
while test $# -gt 0; do
|
||||
case $1 in
|
||||
--help) echo "$usage"; exit 0;;
|
||||
--version) echo "$version"; exit 0;;
|
||||
--prefix) shift; prefix="$1";;
|
||||
-*)
|
||||
echo "$0: Unknown option \`$1'." >&2
|
||||
echo "$0: Try \`--help' for more information." >&2
|
||||
exit 1;;
|
||||
*)
|
||||
if test -z "$tarball_version_file"; then
|
||||
tarball_version_file="$1"
|
||||
elif test -z "$tag_sed_script"; then
|
||||
tag_sed_script="$1"
|
||||
else
|
||||
echo "$0: extra non-option argument \`$1'." >&2
|
||||
exit 1
|
||||
fi;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
if test -z "$tarball_version_file"; then
|
||||
echo "$usage"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
tag_sed_script="${tag_sed_script:-s/x/x/}"
|
||||
prefix="${prefix:-v}"
|
||||
|
||||
nl='
|
||||
'
|
||||
|
||||
|
@ -106,11 +150,11 @@ then
|
|||
# directory, and "git describe" output looks sensible, use that to
|
||||
# derive a version string.
|
||||
elif test "`git log -1 --pretty=format:x . 2>&1`" = x \
|
||||
&& v=`git describe --abbrev=4 --match='v*' HEAD 2>/dev/null \
|
||||
&& v=`git describe --abbrev=4 --match="$prefix*" HEAD 2>/dev/null \
|
||||
|| git describe --abbrev=4 HEAD 2>/dev/null` \
|
||||
&& v=`printf '%s\n' "$v" | sed "$tag_sed_script"` \
|
||||
&& case $v in
|
||||
v[0-9]*) ;;
|
||||
$prefix[0-9]*) ;;
|
||||
*) (exit 1) ;;
|
||||
esac
|
||||
then
|
||||
|
@ -143,7 +187,7 @@ else
|
|||
v=UNKNOWN
|
||||
fi
|
||||
|
||||
v=`echo "$v" |sed 's/^v//'`
|
||||
v=`echo "$v" |sed "s/^$prefix//"`
|
||||
|
||||
# Test whether to append the "-dirty" suffix only if the version
|
||||
# string we're using came from git. I.e., skip the test if it's "UNKNOWN"
|
||||
|
|
|
@ -3,7 +3,7 @@ eval '(exit $?0)' && eval 'exec perl -wS "$0" ${1+"$@"}'
|
|||
if 0;
|
||||
# Convert git log output to ChangeLog format.
|
||||
|
||||
my $VERSION = '2009-10-30 13:46'; # UTC
|
||||
my $VERSION = '2011-11-02 07:53'; # 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
|
||||
|
@ -60,6 +60,10 @@ $ME, they may be preceded by '--'.
|
|||
|
||||
OPTIONS:
|
||||
|
||||
--amend=FILE FILE maps from an SHA1 to perl code (i.e., s/old/new/) that
|
||||
makes a change to SHA1's commit log text or metadata.
|
||||
--append-dot append a dot to the first line of each commit message if
|
||||
there is no other punctuation or blank at the end.
|
||||
--since=DATE convert only the logs since DATE;
|
||||
the default is to convert all log entries.
|
||||
--format=FMT set format string for commit subject and body;
|
||||
|
@ -74,6 +78,23 @@ EXAMPLE:
|
|||
$ME --since=2008-01-01 > ChangeLog
|
||||
$ME -- -n 5 foo > last-5-commits-to-branch-foo
|
||||
|
||||
In a FILE specified via --amend, comment lines (starting with "#") are ignored.
|
||||
FILE must consist of <SHA,CODE+> pairs where SHA is a 40-byte SHA1 (alone on
|
||||
a line) referring to a commit in the current project, and CODE refers to one
|
||||
or more consecutive lines of Perl code. Pairs must be separated by one or
|
||||
more blank line.
|
||||
|
||||
Here is sample input for use with --amend=FILE, from coreutils:
|
||||
|
||||
3a169f4c5d9159283548178668d2fae6fced3030
|
||||
# fix typo in title:
|
||||
s/all tile types/all file types/
|
||||
|
||||
1379ed974f1fa39b12e2ffab18b3f7a607082202
|
||||
# Due to a bug in vc-dwim, I mis-attributed a patch by Paul to myself.
|
||||
# Change the author to be Paul. Note the escaped "@":
|
||||
s,Jim .*>,Paul Eggert <eggert\@cs.ucla.edu>,
|
||||
|
||||
EOF
|
||||
}
|
||||
exit $exit_code;
|
||||
|
@ -99,24 +120,87 @@ sub quoted_cmd(@)
|
|||
return join (' ', map {shell_quote $_} @_);
|
||||
}
|
||||
|
||||
# Parse file F.
|
||||
# Comment lines (starting with "#") are ignored.
|
||||
# F must consist of <SHA,CODE+> pairs where SHA is a 40-byte SHA1
|
||||
# (alone on a line) referring to a commit in the current project, and
|
||||
# CODE refers to one or more consecutive lines of Perl code.
|
||||
# Pairs must be separated by one or more blank line.
|
||||
sub parse_amend_file($)
|
||||
{
|
||||
my $since_date = '1970-01-01 UTC';
|
||||
my ($f) = @_;
|
||||
|
||||
open F, '<', $f
|
||||
or die "$ME: $f: failed to open for reading: $!\n";
|
||||
|
||||
my $fail;
|
||||
my $h = {};
|
||||
my $in_code = 0;
|
||||
my $sha;
|
||||
while (defined (my $line = <F>))
|
||||
{
|
||||
$line =~ /^\#/
|
||||
and next;
|
||||
chomp $line;
|
||||
$line eq ''
|
||||
and $in_code = 0, next;
|
||||
|
||||
if (!$in_code)
|
||||
{
|
||||
$line =~ /^([0-9a-fA-F]{40})$/
|
||||
or (warn "$ME: $f:$.: invalid line; expected an SHA1\n"),
|
||||
$fail = 1, next;
|
||||
$sha = lc $1;
|
||||
$in_code = 1;
|
||||
exists $h->{$sha}
|
||||
and (warn "$ME: $f:$.: duplicate SHA1\n"),
|
||||
$fail = 1, next;
|
||||
}
|
||||
else
|
||||
{
|
||||
$h->{$sha} ||= '';
|
||||
$h->{$sha} .= "$line\n";
|
||||
}
|
||||
}
|
||||
close F;
|
||||
|
||||
$fail
|
||||
and exit 1;
|
||||
|
||||
return $h;
|
||||
}
|
||||
|
||||
{
|
||||
my $since_date;
|
||||
my $format_string = '%s%n%b%n';
|
||||
my $amend_file;
|
||||
my $append_dot = 0;
|
||||
GetOptions
|
||||
(
|
||||
help => sub { usage 0 },
|
||||
version => sub { print "$ME version $VERSION\n"; exit },
|
||||
'since=s' => \$since_date,
|
||||
'format=s' => \$format_string,
|
||||
'amend=s' => \$amend_file,
|
||||
'append-dot' => \$append_dot,
|
||||
) or usage 1;
|
||||
|
||||
my @cmd = (qw (git log --log-size), "--since=$since_date",
|
||||
'--pretty=format:%ct %an <%ae>%n%n'.$format_string, @ARGV);
|
||||
|
||||
defined $since_date
|
||||
and unshift @ARGV, "--since=$since_date";
|
||||
|
||||
# This is a hash that maps an SHA1 to perl code (i.e., s/old/new/)
|
||||
# that makes a correction in the log or attribution of that commit.
|
||||
my $amend_code = defined $amend_file ? parse_amend_file $amend_file : {};
|
||||
|
||||
my @cmd = (qw (git log --log-size),
|
||||
'--pretty=format:%H:%ct %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 $prev_date_line = '';
|
||||
my @prev_coauthors = ();
|
||||
while (1)
|
||||
{
|
||||
defined (my $in = <PIPE>)
|
||||
|
@ -130,7 +214,34 @@ sub quoted_cmd(@)
|
|||
$n_read == $log_nbytes
|
||||
or die "$ME:$.: unexpected EOF\n";
|
||||
|
||||
my @line = split "\n", $log;
|
||||
# Extract leading hash.
|
||||
my ($sha, $rest) = split ':', $log, 2;
|
||||
defined $sha
|
||||
or die "$ME:$.: malformed log entry\n";
|
||||
$sha =~ /^[0-9a-fA-F]{40}$/
|
||||
or die "$ME:$.: invalid SHA1: $sha\n";
|
||||
|
||||
# If this commit's log requires any transformation, do it now.
|
||||
my $code = $amend_code->{$sha};
|
||||
if (defined $code)
|
||||
{
|
||||
eval 'use Safe';
|
||||
my $s = new Safe;
|
||||
# Put the unpreprocessed entry into "$_".
|
||||
$_ = $rest;
|
||||
|
||||
# Let $code operate on it, safely.
|
||||
my $r = $s->reval("$code")
|
||||
or die "$ME:$.:$sha: failed to eval \"$code\":\n$@\n";
|
||||
|
||||
# Note that we've used this entry.
|
||||
delete $amend_code->{$sha};
|
||||
|
||||
# Update $rest upon success.
|
||||
$rest = $_;
|
||||
}
|
||||
|
||||
my @line = split "\n", $rest;
|
||||
my $author_line = shift @line;
|
||||
defined $author_line
|
||||
or die "$ME:$.: unexpected EOF\n";
|
||||
|
@ -139,18 +250,43 @@ sub quoted_cmd(@)
|
|||
. "(expected date/author/email):\n$author_line\n";
|
||||
|
||||
my $date_line = sprintf "%s $2\n", strftime ("%F", localtime ($1));
|
||||
# If this line would be the same as the previous date/name/email
|
||||
# line, then arrange not to print it.
|
||||
if ($date_line ne $prev_date_line)
|
||||
|
||||
# Format 'Co-authored-by: A U Thor <email@example.com>' lines in
|
||||
# standard multi-author ChangeLog format.
|
||||
my @coauthors = grep /^Co-authored-by:.*$/, @line;
|
||||
for (@coauthors)
|
||||
{
|
||||
s/^Co-authored-by:\s*/\t /;
|
||||
s/\s*</ </;
|
||||
|
||||
/<.*?@.*\..*>/
|
||||
or warn "$ME: warning: missing email address for "
|
||||
. substr ($_, 5) . "\n";
|
||||
}
|
||||
|
||||
# If this header would be the same as the previous date/name/email/
|
||||
# coauthors header, then arrange not to print it.
|
||||
if ($date_line ne $prev_date_line or "@coauthors" ne "@prev_coauthors")
|
||||
{
|
||||
$prev_date_line eq ''
|
||||
or print "\n";
|
||||
print $date_line;
|
||||
@coauthors
|
||||
and print join ("\n", @coauthors), "\n";
|
||||
}
|
||||
$prev_date_line = $date_line;
|
||||
@prev_coauthors = @coauthors;
|
||||
|
||||
# Omit "Signed-off-by..." lines.
|
||||
# Omit "Co-authored-by..." and "Signed-off-by..." lines.
|
||||
@line = grep !/^Signed-off-by: .*>$/, @line;
|
||||
@line = grep !/^Co-authored-by: /, @line;
|
||||
|
||||
# Remove leading and trailing blank lines.
|
||||
if (@line)
|
||||
{
|
||||
while ($line[0] =~ /^\s*$/) { shift @line; }
|
||||
while ($line[$#line] =~ /^\s*$/) { pop @line; }
|
||||
}
|
||||
|
||||
# If there were any lines
|
||||
if (@line == 0)
|
||||
|
@ -159,9 +295,17 @@ sub quoted_cmd(@)
|
|||
}
|
||||
else
|
||||
{
|
||||
# Remove leading and trailing blank lines.
|
||||
while ($line[0] =~ /^\s*$/) { shift @line; }
|
||||
while ($line[$#line] =~ /^\s*$/) { pop @line; }
|
||||
if ($append_dot)
|
||||
{
|
||||
# If the first line of the message has enough room, then
|
||||
if (length $line[0] < 72)
|
||||
{
|
||||
# append a dot if there is no other punctuation or blank
|
||||
# at the end.
|
||||
$line[0] =~ /[[:punct:]\s]$/
|
||||
or $line[0] .= '.';
|
||||
}
|
||||
}
|
||||
|
||||
# Prefix each non-empty line with a TAB.
|
||||
@line = map { length $_ ? "\t$_" : '' } @line;
|
||||
|
@ -178,6 +322,16 @@ sub quoted_cmd(@)
|
|||
close PIPE
|
||||
or die "$ME: error closing pipe from " . quoted_cmd (@cmd) . "\n";
|
||||
# FIXME-someday: include $PROCESS_STATUS in the diagnostic
|
||||
|
||||
# Complain about any unused entry in the --amend=F specified file.
|
||||
my $fail = 0;
|
||||
foreach my $sha (keys %$amend_code)
|
||||
{
|
||||
warn "$ME:$amend_file: unused entry: $sha\n";
|
||||
$fail = 1;
|
||||
}
|
||||
|
||||
exit $fail;
|
||||
}
|
||||
|
||||
# Local Variables:
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
@c -*-texinfo-*-
|
||||
@c %**start of header
|
||||
@setfilename guile.info
|
||||
@documentencoding UTF-8
|
||||
@settitle Guile Reference Manual
|
||||
@set guile
|
||||
@set MANUAL-REVISION 1
|
||||
|
|
|
@ -133,21 +133,9 @@ years until the end of 1999, when he too moved on to other projects.
|
|||
Since then, Guile has had a group maintainership. The first group was
|
||||
Maciej Stachowiak, Mikael Djurfeldt, and Marius Vollmer, with Vollmer
|
||||
staying on the longest. By late 2007, Vollmer had mostly moved on to
|
||||
other things, so Neil Jerram and Ludovic
|
||||
@iftex
|
||||
Court@`es
|
||||
@end iftex
|
||||
@ifnottex
|
||||
Courtès
|
||||
@end ifnottex
|
||||
other things, so Neil Jerram and Ludovic Court@`es
|
||||
stepped up to take on the primary maintenance responsibility. Jerram and
|
||||
@iftex
|
||||
Court@`es
|
||||
@end iftex
|
||||
@ifnottex
|
||||
Courtès
|
||||
@end ifnottex
|
||||
were joined by Andy Wingo in late 2009.
|
||||
Court@`es were joined by Andy Wingo in late 2009.
|
||||
|
||||
Of course, a large part of the actual work on Guile has come from
|
||||
other contributors too numerous to mention, but without whom the world
|
||||
|
|
|
@ -1098,17 +1098,171 @@ try to use one of them. The reason for two versions is that the full
|
|||
@section File Tree Walk
|
||||
@cindex file tree walk
|
||||
|
||||
@cindex file system traversal
|
||||
@cindex directory traversal
|
||||
|
||||
The functions in this section traverse a tree of files and
|
||||
directories, in a fashion similar to the C @code{ftw} and @code{nftw}
|
||||
routines (@pxref{Working with Directory Trees,,, libc, GNU C Library
|
||||
Reference Manual}).
|
||||
directories. They come in two flavors: the first one is a high-level
|
||||
functional interface, and the second one is similar to the C @code{ftw}
|
||||
and @code{nftw} routines (@pxref{Working with Directory Trees,,, libc,
|
||||
GNU C Library Reference Manual}).
|
||||
|
||||
@example
|
||||
(use-modules (ice-9 ftw))
|
||||
@end example
|
||||
@sp 1
|
||||
|
||||
@defun ftw startname proc ['hash-size n]
|
||||
@deffn {Scheme Procedure} file-system-tree file-name [enter? [stat]]
|
||||
Return a tree of the form @code{(@var{file-name} @var{stat}
|
||||
@var{children} ...)} where @var{stat} is the result of @code{(@var{stat}
|
||||
@var{file-name})} and @var{children} are similar structures for each
|
||||
file contained in @var{file-name} when it designates a directory.
|
||||
|
||||
The optional @var{enter?} predicate is invoked as @code{(@var{enter?}
|
||||
@var{name} @var{stat})} and should return true to allow recursion into
|
||||
directory @var{name}; the default value is a procedure that always
|
||||
returns @code{#t}. When a directory does not match @var{enter?}, it
|
||||
nonetheless appears in the resulting tree, only with zero children.
|
||||
|
||||
The @var{stat} argument is optional and defaults to @code{lstat}, as for
|
||||
@code{file-system-fold} (see below.)
|
||||
|
||||
The example below shows how to obtain a hierarchical listing of the
|
||||
files under the @file{module/language} directory in the Guile source
|
||||
tree, discarding their @code{stat} info:
|
||||
|
||||
@example
|
||||
(use-modules (ice-9 match))
|
||||
|
||||
(define remove-stat
|
||||
;; Remove the `stat' object the `file-system-tree' provides
|
||||
;; for each file in the tree.
|
||||
(match-lambda
|
||||
((name stat) ; flat file
|
||||
name)
|
||||
((name stat children ...) ; directory
|
||||
(list name (map remove-stat children)))))
|
||||
|
||||
(let ((dir (string-append (assq-ref %guile-build-info 'top_srcdir)
|
||||
"/module/language")))
|
||||
(remove-stat (file-system-tree dir)))
|
||||
|
||||
@result{}
|
||||
("language"
|
||||
(("value" ("spec.go" "spec.scm"))
|
||||
("scheme"
|
||||
("spec.go"
|
||||
"spec.scm"
|
||||
"compile-tree-il.scm"
|
||||
"decompile-tree-il.scm"
|
||||
"decompile-tree-il.go"
|
||||
"compile-tree-il.go"))
|
||||
("tree-il"
|
||||
("spec.go"
|
||||
"fix-letrec.go"
|
||||
"inline.go"
|
||||
"fix-letrec.scm"
|
||||
"compile-glil.go"
|
||||
"spec.scm"
|
||||
"optimize.scm"
|
||||
"primitives.scm"
|
||||
@dots{}))
|
||||
@dots{}))
|
||||
@end example
|
||||
@end deffn
|
||||
|
||||
@cindex file system combinator
|
||||
|
||||
It is often desirable to process directories entries directly, rather
|
||||
than building up a tree of entries in memory, like
|
||||
@code{file-system-tree} does. The following procedure, a
|
||||
@dfn{combinator}, is designed to allow directory entries to be processed
|
||||
directly as a directory tree is traversed; in fact,
|
||||
@code{file-system-tree} is implemented in terms of it.
|
||||
|
||||
@deffn {Scheme Procedure} file-system-fold enter? leaf down up skip init file-name [stat]
|
||||
Traverse the directory at @var{file-name}, recursively, and return the
|
||||
result of the successive applications of the @var{leaf}, @var{down},
|
||||
@var{up}, and @var{skip} procedures as described below.
|
||||
|
||||
Enter sub-directories only when @code{(@var{enter?} @var{path}
|
||||
@var{stat} @var{result})} returns true. When a sub-directory is
|
||||
entered, call @code{(@var{down} @var{path} @var{stat} @var{result})},
|
||||
where @var{path} is the path of the sub-directory and @var{stat} the
|
||||
result of @code{(false-if-exception (@var{stat} @var{path}))}; when it is
|
||||
left, call @code{(@var{up} @var{path} @var{stat} @var{result})}.
|
||||
|
||||
For each file in a directory, call @code{(@var{leaf} @var{path}
|
||||
@var{stat} @var{result})}.
|
||||
|
||||
When @var{enter?} returns @code{#f}, or when an unreadable directory is
|
||||
encountered, call @code{(@var{skip} @var{path} @var{stat}
|
||||
@var{result})}.
|
||||
|
||||
When @var{file-name} names a flat file, @code{(@var{leaf} @var{path}
|
||||
@var{stat} @var{init})} is returned.
|
||||
|
||||
The special @file{.} and @file{..} entries are not passed to these
|
||||
procedures. The @var{path} argument to the procedures is a full file
|
||||
name---e.g., @code{"../foo/bar/gnu"}; if @var{file-name} is an absolute
|
||||
file name, then @var{path} is also an absolute file name. Files and
|
||||
directories, as identified by their device/inode number pair, are
|
||||
traversed only once.
|
||||
|
||||
The optional @var{stat} argument defaults to @code{lstat}, which means
|
||||
that symbolic links are not followed; the @code{stat} procedure can be
|
||||
used instead when symbolic links are to be followed (@pxref{File System,
|
||||
stat}).
|
||||
|
||||
The example below illustrates the use of @code{file-system-fold}:
|
||||
|
||||
@example
|
||||
(define (total-file-size file-name)
|
||||
"Return the size in bytes of the files under FILE-NAME (similar
|
||||
to `du --apparent-size' with GNU Coreutils.)"
|
||||
|
||||
(define (enter? name stat result)
|
||||
;; Skip version control directories.
|
||||
(not (member (basename name) '(".git" ".svn" "CVS"))))
|
||||
(define (leaf name stat result)
|
||||
;; Return RESULT plus the size of the file at NAME.
|
||||
(+ result (stat:size stat)))
|
||||
|
||||
;; Count zero bytes for directories.
|
||||
(define (down name stat result) result)
|
||||
(define (up name stat result) result)
|
||||
|
||||
;; Likewise for skipped directories.
|
||||
(define (skip name stat result) result)
|
||||
|
||||
(file-system-fold enter? leaf down up skip
|
||||
0 ; initial counter is zero bytes
|
||||
file-name))
|
||||
|
||||
(total-file-size ".")
|
||||
@result{} 8217554
|
||||
|
||||
(total-file-size "/dev/null")
|
||||
@result{} 0
|
||||
@end example
|
||||
@end deffn
|
||||
|
||||
The alternative C-like functions are described below.
|
||||
|
||||
@deffn {Scheme Procedure} scandir name [select? [entry<?]]
|
||||
Return the list of the names of files contained in directory @var{name}
|
||||
that match predicate @var{select?} (by default, all files). The
|
||||
returned list of file names is sorted according to @var{entry<?}, which
|
||||
defaults to @code{string-locale<?} such that file names are sorted in
|
||||
the locale's alphabetical order (@pxref{Text Collation}). Return
|
||||
@code{#f} when @var{name} is unreadable or is not a directory.
|
||||
|
||||
This procedure is modeled after the C library function of the same name
|
||||
(@pxref{Scanning Directory Content,,, libc, GNU C Library Reference
|
||||
Manual}).
|
||||
@end deffn
|
||||
|
||||
@deffn {Scheme Procedure} ftw startname proc ['hash-size n]
|
||||
Walk the file system tree descending from @var{startname}, calling
|
||||
@var{proc} for each file and directory.
|
||||
|
||||
|
@ -1161,10 +1315,10 @@ to set the size of the hash table used to track items already visited.
|
|||
In the current implementation, returning non-@code{#t} from @var{proc}
|
||||
is the only valid way to terminate @code{ftw}. @var{proc} must not
|
||||
use @code{throw} or similar to escape.
|
||||
@end defun
|
||||
@end deffn
|
||||
|
||||
|
||||
@defun nftw startname proc ['chdir] ['depth] ['hash-size n] ['mount] ['physical]
|
||||
@deffn {Scheme Procedure} nftw startname proc ['chdir] ['depth] ['hash-size n] ['mount] ['physical]
|
||||
Walk the file system tree starting at @var{startname}, calling
|
||||
@var{proc} for each file and directory. @code{nftw} has extra
|
||||
features over the basic @code{ftw} described above.
|
||||
|
@ -1267,7 +1421,7 @@ caused the stop.
|
|||
In the current implementation, returning non-@code{#t} from @var{proc}
|
||||
is the only valid way to terminate @code{ftw}. @var{proc} must not
|
||||
use @code{throw} or similar to escape.
|
||||
@end defun
|
||||
@end deffn
|
||||
|
||||
|
||||
@node Queues
|
||||
|
@ -1433,7 +1587,7 @@ a list, but they could be printed (infinitely) with for example
|
|||
@end example
|
||||
|
||||
@sp 1
|
||||
@defun make-stream proc initial-state
|
||||
@deffn {Scheme Procedure} make-stream proc initial-state
|
||||
Return a new stream, formed by calling @var{proc} successively.
|
||||
|
||||
Each call is @code{(@var{proc} @var{state})}, it should return a pair,
|
||||
|
@ -1441,32 +1595,32 @@ the @code{car} being the value for the stream, and the @code{cdr}
|
|||
being the new @var{state} for the next call. For the first call
|
||||
@var{state} is the given @var{initial-state}. At the end of the
|
||||
stream, @var{proc} should return some non-pair object.
|
||||
@end defun
|
||||
@end deffn
|
||||
|
||||
@defun stream-car stream
|
||||
@deffn {Scheme Procedure} stream-car stream
|
||||
Return the first element from @var{stream}. @var{stream} must not be
|
||||
empty.
|
||||
@end defun
|
||||
@end deffn
|
||||
|
||||
@defun stream-cdr stream
|
||||
@deffn {Scheme Procedure} stream-cdr stream
|
||||
Return a stream which is the second and subsequent elements of
|
||||
@var{stream}. @var{stream} must not be empty.
|
||||
@end defun
|
||||
@end deffn
|
||||
|
||||
@defun stream-null? stream
|
||||
@deffn {Scheme Procedure} stream-null? stream
|
||||
Return true if @var{stream} is empty.
|
||||
@end defun
|
||||
@end deffn
|
||||
|
||||
@defun list->stream list
|
||||
@defunx vector->stream vector
|
||||
@deffn {Scheme Procedure} list->stream list
|
||||
@deffnx {Scheme Procedure} vector->stream vector
|
||||
Return a stream with the contents of @var{list} or @var{vector}.
|
||||
|
||||
@var{list} or @var{vector} should not be modified subsequently, since
|
||||
it's unspecified whether changes there will be reflected in the stream
|
||||
returned.
|
||||
@end defun
|
||||
@end deffn
|
||||
|
||||
@defun port->stream port readproc
|
||||
@deffn {Scheme Procedure} port->stream port readproc
|
||||
Return a stream which is the values obtained by reading from
|
||||
@var{port} using @var{readproc}. Each read call is
|
||||
@code{(@var{readproc} @var{port})}, and it should return an EOF object
|
||||
|
@ -1477,34 +1631,34 @@ For example a stream of characters from a file,
|
|||
@example
|
||||
(port->stream (open-input-file "/foo/bar.txt") read-char)
|
||||
@end example
|
||||
@end defun
|
||||
@end deffn
|
||||
|
||||
@defun stream->list stream
|
||||
@deffn {Scheme Procedure} stream->list stream
|
||||
Return a list which is the entire contents of @var{stream}.
|
||||
@end defun
|
||||
@end deffn
|
||||
|
||||
@defun stream->reversed-list stream
|
||||
@deffn {Scheme Procedure} stream->reversed-list stream
|
||||
Return a list which is the entire contents of @var{stream}, but in
|
||||
reverse order.
|
||||
@end defun
|
||||
@end deffn
|
||||
|
||||
@defun stream->list&length stream
|
||||
@deffn {Scheme Procedure} stream->list&length stream
|
||||
Return two values (@pxref{Multiple Values}), being firstly a list
|
||||
which is the entire contents of @var{stream}, and secondly the number
|
||||
of elements in that list.
|
||||
@end defun
|
||||
@end deffn
|
||||
|
||||
@defun stream->reversed-list&length stream
|
||||
@deffn {Scheme Procedure} stream->reversed-list&length stream
|
||||
Return two values (@pxref{Multiple Values}) being firstly a list which
|
||||
is the entire contents of @var{stream}, but in reverse order, and
|
||||
secondly the number of elements in that list.
|
||||
@end defun
|
||||
@end deffn
|
||||
|
||||
@defun stream->vector stream
|
||||
@deffn {Scheme Procedure} stream->vector stream
|
||||
Return a vector which is the entire contents of @var{stream}.
|
||||
@end defun
|
||||
@end deffn
|
||||
|
||||
@defun stream-fold proc init stream0 @dots{} streamN
|
||||
@deffn {Scheme Procedure} stream-fold proc init stream0 @dots{} streamN
|
||||
Apply @var{proc} successively over the elements of the given streams,
|
||||
from first to last until the end of the shortest stream is reached.
|
||||
Return the result from the last @var{proc} call.
|
||||
|
@ -1513,9 +1667,9 @@ Each call is @code{(@var{proc} elem0 @dots{} elemN prev)}, where each
|
|||
@var{elem} is from the corresponding @var{stream}. @var{prev} is the
|
||||
return from the previous @var{proc} call, or the given @var{init} for
|
||||
the first call.
|
||||
@end defun
|
||||
@end deffn
|
||||
|
||||
@defun stream-for-each proc stream0 @dots{} streamN
|
||||
@deffn {Scheme Procedure} stream-for-each proc stream0 @dots{} streamN
|
||||
Call @var{proc} on the elements from the given @var{stream}s. The
|
||||
return value is unspecified.
|
||||
|
||||
|
@ -1523,16 +1677,16 @@ Each call is @code{(@var{proc} elem0 @dots{} elemN)}, where each
|
|||
@var{elem} is from the corresponding @var{stream}.
|
||||
@code{stream-for-each} stops when it reaches the end of the shortest
|
||||
@var{stream}.
|
||||
@end defun
|
||||
@end deffn
|
||||
|
||||
@defun stream-map proc stream0 @dots{} streamN
|
||||
@deffn {Scheme Procedure} stream-map proc stream0 @dots{} streamN
|
||||
Return a new stream which is the results of applying @var{proc} to the
|
||||
elements of the given @var{stream}s.
|
||||
|
||||
Each call is @code{(@var{proc} elem0 @dots{} elemN)}, where each
|
||||
@var{elem} is from the corresponding @var{stream}. The new stream
|
||||
ends when the end of the shortest given @var{stream} is reached.
|
||||
@end defun
|
||||
@end deffn
|
||||
|
||||
|
||||
@node Buffered Input
|
||||
|
@ -1551,7 +1705,7 @@ characters which are to be handed out on reading the port. A notion
|
|||
of further input for an application level logical expression is
|
||||
maintained too, and passed through to the reader.
|
||||
|
||||
@defun make-buffered-input-port reader
|
||||
@deffn {Scheme Procedure} make-buffered-input-port reader
|
||||
Create an input port which returns characters obtained from the given
|
||||
@var{reader} function. @var{reader} is called (@var{reader} cont),
|
||||
and should return a string or an EOF object.
|
||||
|
@ -1566,9 +1720,9 @@ application level notion, set with
|
|||
@code{set-buffered-input-continuation?!} below. If the user has
|
||||
entered a partial expression then it allows @var{reader} for instance
|
||||
to give a different prompt to show more is required.
|
||||
@end defun
|
||||
@end deffn
|
||||
|
||||
@defun make-line-buffered-input-port reader
|
||||
@deffn {Scheme Procedure} make-line-buffered-input-port reader
|
||||
@cindex Line buffered input
|
||||
Create an input port which returns characters obtained from the
|
||||
specified @var{reader} function, similar to
|
||||
|
@ -1578,9 +1732,9 @@ expected to be a line-oriented.
|
|||
@var{reader} is called (@var{reader} cont), and should return a string
|
||||
or an EOF object as above. Each string is a line of input without a
|
||||
newline character, the port code inserts a newline after each string.
|
||||
@end defun
|
||||
@end deffn
|
||||
|
||||
@defun set-buffered-input-continuation?! port cont
|
||||
@deffn {Scheme Procedure} set-buffered-input-continuation?! port cont
|
||||
Set the input continuation flag for a given buffered input
|
||||
@var{port}.
|
||||
|
||||
|
@ -1595,7 +1749,7 @@ example with the Scheme @code{read} function (@pxref{Scheme Read}),
|
|||
(let ((obj (read my-port)))
|
||||
...
|
||||
@end example
|
||||
@end defun
|
||||
@end deffn
|
||||
|
||||
|
||||
@c Local Variables:
|
||||
|
|
|
@ -843,6 +843,10 @@ be empty for this to succeed. The return value is unspecified.
|
|||
@cindex directory contents
|
||||
Open the directory specified by @var{dirname} and return a directory
|
||||
stream.
|
||||
|
||||
Before using this and the procedures below, make sure to see the
|
||||
higher-level procedures for directory traversal that are available
|
||||
(@pxref{File Tree Walk}).
|
||||
@end deffn
|
||||
|
||||
@deffn {Scheme Procedure} directory-stream? object
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
@c -*-texinfo-*-
|
||||
@c This is part of the GNU Guile Reference Manual.
|
||||
@c Copyright (C) 1996, 1997, 2000, 2001, 2002, 2003, 2004, 2010
|
||||
@c Copyright (C) 1996, 1997, 2000, 2001, 2002, 2003, 2004, 2010, 2011
|
||||
@c Free Software Foundation, Inc.
|
||||
@c See the file guile.texi for copying conditions.
|
||||
|
||||
|
@ -41,7 +41,7 @@ the documentation of Scheme data types, control mechanisms and
|
|||
procedures. In addition, he wrote the documentation for Guile's SRFI
|
||||
modules and modules associated with the Guile REPL.
|
||||
|
||||
Ludovic Courtès and Andy Wingo, the Guile maintainers at the time of
|
||||
Ludovic Court@`es and Andy Wingo, the Guile maintainers at the time of
|
||||
this writing (late 2010), have also made their dent in the manual,
|
||||
writing documentation for new modules and subsystems in Guile 2.0. They
|
||||
are also responsible for ensuring that the existing text retains its
|
||||
|
|
84
gnulib-local/lib/localcharset.c.diff
Normal file
84
gnulib-local/lib/localcharset.c.diff
Normal file
|
@ -0,0 +1,84 @@
|
|||
Add a variant of `locale_charset' that returns its result based solely on
|
||||
information from the environment. See
|
||||
http://lists.gnu.org/archive/html/guile-devel/2011-11/msg00040.html for the
|
||||
rationale.
|
||||
|
||||
--- a/lib/localcharset.c 2011-12-14 23:10:58.000000000 +0100
|
||||
+++ b/lib/localcharset.c 2011-12-15 00:45:12.000000000 +0100
|
||||
@@ -527,6 +527,76 @@ locale_charset (void)
|
||||
codeset = "";
|
||||
|
||||
/* Resolve alias. */
|
||||
+ for (aliases = get_charset_aliases ();
|
||||
+ *aliases != '\0';
|
||||
+ aliases += strlen (aliases) + 1, aliases += strlen (aliases) + 1)
|
||||
+ if (strcmp (codeset, aliases) == 0
|
||||
+ || (aliases[0] == '*' && aliases[1] == '\0'))
|
||||
+ {
|
||||
+ codeset = aliases + strlen (aliases) + 1;
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ /* Don't return an empty string. GNU libc and GNU libiconv interpret
|
||||
+ the empty string as denoting "the locale's character encoding",
|
||||
+ thus GNU libiconv would call this function a second time. */
|
||||
+ if (codeset[0] == '\0')
|
||||
+ codeset = "ASCII";
|
||||
+
|
||||
+ return codeset;
|
||||
+}
|
||||
+
|
||||
+/* A variant of the above, without calls to `setlocale', `nl_langinfo',
|
||||
+ etc. */
|
||||
+const char *
|
||||
+environ_locale_charset (void)
|
||||
+{
|
||||
+ static char buf[2 + 10 + 1];
|
||||
+ const char *codeset, *aliases;
|
||||
+ const char *locale = NULL;
|
||||
+
|
||||
+ locale = getenv ("LC_ALL");
|
||||
+ if (locale == NULL || locale[0] == '\0')
|
||||
+ {
|
||||
+ locale = getenv ("LC_CTYPE");
|
||||
+ if (locale == NULL || locale[0] == '\0')
|
||||
+ locale = getenv ("LANG");
|
||||
+ }
|
||||
+
|
||||
+ if (locale != NULL && locale[0] != '\0')
|
||||
+ {
|
||||
+ /* If the locale name contains an encoding after the dot, return it. */
|
||||
+ const char *dot = strchr (locale, '.');
|
||||
+
|
||||
+ if (dot != NULL)
|
||||
+ {
|
||||
+ const char *modifier;
|
||||
+
|
||||
+ dot++;
|
||||
+ /* Look for the possible @... trailer and remove it, if any. */
|
||||
+ modifier = strchr (dot, '@');
|
||||
+ if (modifier == NULL)
|
||||
+ return dot;
|
||||
+ if (modifier - dot < sizeof (buf))
|
||||
+ {
|
||||
+ memcpy (buf, dot, modifier - dot);
|
||||
+ buf [modifier - dot] = '\0';
|
||||
+ return buf;
|
||||
+ }
|
||||
+ }
|
||||
+ else if (strcmp (locale, "C") == 0)
|
||||
+ {
|
||||
+ strcpy (buf, "ASCII");
|
||||
+ return buf;
|
||||
+ }
|
||||
+
|
||||
+ /* Resolve through the charset.alias file. */
|
||||
+ codeset = locale;
|
||||
+ }
|
||||
+ else
|
||||
+ codeset = "";
|
||||
+
|
||||
+ /* Resolve alias. */
|
||||
for (aliases = get_charset_aliases ();
|
||||
*aliases != '\0';
|
||||
aliases += strlen (aliases) + 1, aliases += strlen (aliases) + 1)
|
22
gnulib-local/lib/localcharset.h.diff
Normal file
22
gnulib-local/lib/localcharset.h.diff
Normal file
|
@ -0,0 +1,22 @@
|
|||
Add a variant of `locale_charset' that returns its result based solely on
|
||||
information from the environment. See
|
||||
http://lists.gnu.org/archive/html/guile-devel/2011-11/msg00040.html for the
|
||||
rationale.
|
||||
|
||||
diff --git a/lib/localcharset.h b/lib/localcharset.h
|
||||
index 8907ccd..43e976f 100644
|
||||
--- a/lib/localcharset.h
|
||||
+++ b/lib/localcharset.h
|
||||
@@ -32,6 +32,12 @@ extern "C" {
|
||||
name. */
|
||||
extern const char * locale_charset (void);
|
||||
|
||||
+/* Same as above, but only look at environment variables, avoiding calls to
|
||||
+ `setlocale', `nl_langinfo', etc. See
|
||||
+ <http://lists.gnu.org/archive/html/guile-devel/2011-11/msg00040.html> for
|
||||
+ the rationale. */
|
||||
+extern const char * environ_locale_charset (void);
|
||||
+
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
160
lib/Makefile.am
160
lib/Makefile.am
|
@ -21,7 +21,7 @@
|
|||
# the same distribution terms as the rest of that program.
|
||||
#
|
||||
# Generated by gnulib-tool.
|
||||
# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --lgpl=3 --no-conditional-dependencies --libtool --macro-prefix=gl --no-vc-files accept alignof alloca-opt announce-gen autobuild bind byteswap canonicalize-lgpl ceil close connect duplocale environ extensions flock floor fpieee frexp full-read full-write func gendocs getaddrinfo getpeername getsockname getsockopt git-version-gen gitlog-to-changelog gnu-web-doc-update gnupload havelib iconv_open-utf inet_ntop inet_pton isinf isnan ldexp lib-symbol-versions lib-symbol-visibility libunistring listen locale log1p maintainer-makefile malloc-gnu malloca nproc open pipe2 putenv recv recvfrom rename send sendto setsockopt shutdown socket stat-time stdlib strftime striconveh string sys_stat trunc verify vsnprintf warnings wchar
|
||||
# Reproduce by: gnulib-tool --import --dir=. --local-dir=gnulib-local --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --lgpl=3 --no-conditional-dependencies --libtool --macro-prefix=gl --no-vc-files accept alignof alloca-opt announce-gen autobuild bind byteswap canonicalize-lgpl ceil close connect duplocale environ extensions flock floor fpieee frexp full-read full-write func gendocs getaddrinfo getpeername getsockname getsockopt git-version-gen gitlog-to-changelog gnu-web-doc-update gnupload havelib iconv_open-utf inet_ntop inet_pton isinf isnan ldexp lib-symbol-versions lib-symbol-visibility libunistring listen localcharset locale log1p maintainer-makefile malloc-gnu malloca nproc open pipe2 putenv recv recvfrom rename send sendto setsockopt shutdown socket stat-time stdlib strftime striconveh string sys_stat trunc verify vsnprintf warnings wchar
|
||||
|
||||
AUTOMAKE_OPTIONS = 1.5 gnits subdir-objects
|
||||
|
||||
|
@ -234,6 +234,50 @@ EXTRA_libgnu_la_SOURCES += close.c
|
|||
|
||||
## end gnulib module close
|
||||
|
||||
## begin gnulib module configmake
|
||||
|
||||
# Listed in the same order as the GNU makefile conventions, and
|
||||
# provided by autoconf 2.59c+.
|
||||
# The Automake-defined pkg* macros are appended, in the order
|
||||
# listed in the Automake 1.10a+ documentation.
|
||||
configmake.h: Makefile
|
||||
$(AM_V_GEN)rm -f $@-t && \
|
||||
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
|
||||
echo '#define PREFIX "$(prefix)"'; \
|
||||
echo '#define EXEC_PREFIX "$(exec_prefix)"'; \
|
||||
echo '#define BINDIR "$(bindir)"'; \
|
||||
echo '#define SBINDIR "$(sbindir)"'; \
|
||||
echo '#define LIBEXECDIR "$(libexecdir)"'; \
|
||||
echo '#define DATAROOTDIR "$(datarootdir)"'; \
|
||||
echo '#define DATADIR "$(datadir)"'; \
|
||||
echo '#define SYSCONFDIR "$(sysconfdir)"'; \
|
||||
echo '#define SHAREDSTATEDIR "$(sharedstatedir)"'; \
|
||||
echo '#define LOCALSTATEDIR "$(localstatedir)"'; \
|
||||
echo '#define INCLUDEDIR "$(includedir)"'; \
|
||||
echo '#define OLDINCLUDEDIR "$(oldincludedir)"'; \
|
||||
echo '#define DOCDIR "$(docdir)"'; \
|
||||
echo '#define INFODIR "$(infodir)"'; \
|
||||
echo '#define HTMLDIR "$(htmldir)"'; \
|
||||
echo '#define DVIDIR "$(dvidir)"'; \
|
||||
echo '#define PDFDIR "$(pdfdir)"'; \
|
||||
echo '#define PSDIR "$(psdir)"'; \
|
||||
echo '#define LIBDIR "$(libdir)"'; \
|
||||
echo '#define LISPDIR "$(lispdir)"'; \
|
||||
echo '#define LOCALEDIR "$(localedir)"'; \
|
||||
echo '#define MANDIR "$(mandir)"'; \
|
||||
echo '#define MANEXT "$(manext)"'; \
|
||||
echo '#define PKGDATADIR "$(pkgdatadir)"'; \
|
||||
echo '#define PKGINCLUDEDIR "$(pkgincludedir)"'; \
|
||||
echo '#define PKGLIBDIR "$(pkglibdir)"'; \
|
||||
echo '#define PKGLIBEXECDIR "$(pkglibexecdir)"'; \
|
||||
} | sed '/""/d' > $@-t
|
||||
mv -f $@-t $@
|
||||
|
||||
BUILT_SOURCES += configmake.h
|
||||
CLEANFILES += configmake.h configmake.h-t
|
||||
|
||||
## end gnulib module configmake
|
||||
|
||||
## begin gnulib module connect
|
||||
|
||||
|
||||
|
@ -680,6 +724,80 @@ EXTRA_libgnu_la_SOURCES += listen.c
|
|||
|
||||
## end gnulib module listen
|
||||
|
||||
## begin gnulib module localcharset
|
||||
|
||||
libgnu_la_SOURCES += localcharset.h localcharset.c
|
||||
|
||||
# We need the following in order to install a simple file in $(libdir)
|
||||
# which is shared with other installed packages. We use a list of referencing
|
||||
# packages so that "make uninstall" will remove the file if and only if it
|
||||
# is not used by another installed package.
|
||||
# On systems with glibc-2.1 or newer, the file is redundant, therefore we
|
||||
# avoid installing it.
|
||||
|
||||
all-local: charset.alias ref-add.sed ref-del.sed
|
||||
|
||||
charset_alias = $(DESTDIR)$(libdir)/charset.alias
|
||||
charset_tmp = $(DESTDIR)$(libdir)/charset.tmp
|
||||
install-exec-local: install-exec-localcharset
|
||||
install-exec-localcharset: all-local
|
||||
if test $(GLIBC21) = no; then \
|
||||
case '$(host_os)' in \
|
||||
darwin[56]*) \
|
||||
need_charset_alias=true ;; \
|
||||
darwin* | cygwin* | mingw* | pw32* | cegcc*) \
|
||||
need_charset_alias=false ;; \
|
||||
*) \
|
||||
need_charset_alias=true ;; \
|
||||
esac ; \
|
||||
else \
|
||||
need_charset_alias=false ; \
|
||||
fi ; \
|
||||
if $$need_charset_alias; then \
|
||||
$(mkinstalldirs) $(DESTDIR)$(libdir) ; \
|
||||
fi ; \
|
||||
if test -f $(charset_alias); then \
|
||||
sed -f ref-add.sed $(charset_alias) > $(charset_tmp) ; \
|
||||
$(INSTALL_DATA) $(charset_tmp) $(charset_alias) ; \
|
||||
rm -f $(charset_tmp) ; \
|
||||
else \
|
||||
if $$need_charset_alias; then \
|
||||
sed -f ref-add.sed charset.alias > $(charset_tmp) ; \
|
||||
$(INSTALL_DATA) $(charset_tmp) $(charset_alias) ; \
|
||||
rm -f $(charset_tmp) ; \
|
||||
fi ; \
|
||||
fi
|
||||
|
||||
uninstall-local: uninstall-localcharset
|
||||
uninstall-localcharset: all-local
|
||||
if test -f $(charset_alias); then \
|
||||
sed -f ref-del.sed $(charset_alias) > $(charset_tmp); \
|
||||
if grep '^# Packages using this file: $$' $(charset_tmp) \
|
||||
> /dev/null; then \
|
||||
rm -f $(charset_alias); \
|
||||
else \
|
||||
$(INSTALL_DATA) $(charset_tmp) $(charset_alias); \
|
||||
fi; \
|
||||
rm -f $(charset_tmp); \
|
||||
fi
|
||||
|
||||
charset.alias: config.charset
|
||||
$(AM_V_GEN)rm -f t-$@ $@ && \
|
||||
$(SHELL) $(srcdir)/config.charset '$(host)' > t-$@ && \
|
||||
mv t-$@ $@
|
||||
|
||||
SUFFIXES += .sed .sin
|
||||
.sin.sed:
|
||||
$(AM_V_GEN)rm -f t-$@ $@ && \
|
||||
sed -e '/^#/d' -e 's/@''PACKAGE''@/$(PACKAGE)/g' $< > t-$@ && \
|
||||
mv t-$@ $@
|
||||
|
||||
CLEANFILES += charset.alias ref-add.sed ref-del.sed
|
||||
|
||||
EXTRA_DIST += config.charset ref-add.sin ref-del.sin
|
||||
|
||||
## end gnulib module localcharset
|
||||
|
||||
## begin gnulib module locale
|
||||
|
||||
BUILT_SOURCES += locale.h
|
||||
|
@ -789,6 +907,9 @@ math.h: math.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(
|
|||
-e 's/@''GNULIB_FLOOR''@/$(GNULIB_FLOOR)/g' \
|
||||
-e 's/@''GNULIB_FLOORF''@/$(GNULIB_FLOORF)/g' \
|
||||
-e 's/@''GNULIB_FLOORL''@/$(GNULIB_FLOORL)/g' \
|
||||
-e 's/@''GNULIB_FMA''@/$(GNULIB_FMA)/g' \
|
||||
-e 's/@''GNULIB_FMAF''@/$(GNULIB_FMAF)/g' \
|
||||
-e 's/@''GNULIB_FMAL''@/$(GNULIB_FMAL)/g' \
|
||||
-e 's/@''GNULIB_FMODF''@/$(GNULIB_FMODF)/g' \
|
||||
-e 's/@''GNULIB_FREXPF''@/$(GNULIB_FREXPF)/g' \
|
||||
-e 's/@''GNULIB_FREXP''@/$(GNULIB_FREXP)/g' \
|
||||
|
@ -842,6 +963,9 @@ math.h: math.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(
|
|||
-e 's|@''HAVE_EXPF''@|$(HAVE_EXPF)|g' \
|
||||
-e 's|@''HAVE_EXPL''@|$(HAVE_EXPL)|g' \
|
||||
-e 's|@''HAVE_FABSF''@|$(HAVE_FABSF)|g' \
|
||||
-e 's|@''HAVE_FMA''@|$(HAVE_FMA)|g' \
|
||||
-e 's|@''HAVE_FMAF''@|$(HAVE_FMAF)|g' \
|
||||
-e 's|@''HAVE_FMAL''@|$(HAVE_FMAL)|g' \
|
||||
-e 's|@''HAVE_FMODF''@|$(HAVE_FMODF)|g' \
|
||||
-e 's|@''HAVE_FREXPF''@|$(HAVE_FREXPF)|g' \
|
||||
-e 's|@''HAVE_ISNANF''@|$(HAVE_ISNANF)|g' \
|
||||
|
@ -893,6 +1017,9 @@ math.h: math.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(
|
|||
-e 's|@''REPLACE_FLOOR''@|$(REPLACE_FLOOR)|g' \
|
||||
-e 's|@''REPLACE_FLOORF''@|$(REPLACE_FLOORF)|g' \
|
||||
-e 's|@''REPLACE_FLOORL''@|$(REPLACE_FLOORL)|g' \
|
||||
-e 's|@''REPLACE_FMA''@|$(REPLACE_FMA)|g' \
|
||||
-e 's|@''REPLACE_FMAF''@|$(REPLACE_FMAF)|g' \
|
||||
-e 's|@''REPLACE_FMAL''@|$(REPLACE_FMAL)|g' \
|
||||
-e 's|@''REPLACE_FREXPF''@|$(REPLACE_FREXPF)|g' \
|
||||
-e 's|@''REPLACE_FREXP''@|$(REPLACE_FREXP)|g' \
|
||||
-e 's|@''REPLACE_FREXPL''@|$(REPLACE_FREXPL)|g' \
|
||||
|
@ -1373,6 +1500,29 @@ EXTRA_DIST += stat-time.h
|
|||
|
||||
## end gnulib module stat-time
|
||||
|
||||
## begin gnulib module stdalign
|
||||
|
||||
BUILT_SOURCES += $(STDALIGN_H)
|
||||
|
||||
# We need the following in order to create <stdalign.h> when the system
|
||||
# doesn't have one that works.
|
||||
if GL_GENERATE_STDALIGN_H
|
||||
stdalign.h: stdalign.in.h $(top_builddir)/config.status
|
||||
$(AM_V_GEN)rm -f $@-t $@ && \
|
||||
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
|
||||
cat $(srcdir)/stdalign.in.h; \
|
||||
} > $@-t && \
|
||||
mv $@-t $@
|
||||
else
|
||||
stdalign.h: $(top_builddir)/config.status
|
||||
rm -f $@
|
||||
endif
|
||||
MOSTLYCLEANFILES += stdalign.h stdalign.h-t
|
||||
|
||||
EXTRA_DIST += stdalign.in.h
|
||||
|
||||
## end gnulib module stdalign
|
||||
|
||||
## begin gnulib module stdbool
|
||||
|
||||
BUILT_SOURCES += $(STDBOOL_H)
|
||||
|
@ -1636,6 +1786,7 @@ stdlib.h: stdlib.in.h $(top_builddir)/config.status $(CXXDEFS_H) \
|
|||
-e 's/@''GNULIB_MKSTEMPS''@/$(GNULIB_MKSTEMPS)/g' \
|
||||
-e 's/@''GNULIB_POSIX_OPENPT''@/$(GNULIB_POSIX_OPENPT)/g' \
|
||||
-e 's/@''GNULIB_PTSNAME''@/$(GNULIB_PTSNAME)/g' \
|
||||
-e 's/@''GNULIB_PTSNAME_R''@/$(GNULIB_PTSNAME_R)/g' \
|
||||
-e 's/@''GNULIB_PUTENV''@/$(GNULIB_PUTENV)/g' \
|
||||
-e 's/@''GNULIB_RANDOM_R''@/$(GNULIB_RANDOM_R)/g' \
|
||||
-e 's/@''GNULIB_REALLOC_POSIX''@/$(GNULIB_REALLOC_POSIX)/g' \
|
||||
|
@ -1663,6 +1814,7 @@ stdlib.h: stdlib.in.h $(top_builddir)/config.status $(CXXDEFS_H) \
|
|||
-e 's|@''HAVE_MKSTEMPS''@|$(HAVE_MKSTEMPS)|g' \
|
||||
-e 's|@''HAVE_POSIX_OPENPT''@|$(HAVE_POSIX_OPENPT)|g' \
|
||||
-e 's|@''HAVE_PTSNAME''@|$(HAVE_PTSNAME)|g' \
|
||||
-e 's|@''HAVE_PTSNAME_R''@|$(HAVE_PTSNAME_R)|g' \
|
||||
-e 's|@''HAVE_RANDOM_H''@|$(HAVE_RANDOM_H)|g' \
|
||||
-e 's|@''HAVE_RANDOM_R''@|$(HAVE_RANDOM_R)|g' \
|
||||
-e 's|@''HAVE_REALPATH''@|$(HAVE_REALPATH)|g' \
|
||||
|
@ -1680,6 +1832,7 @@ stdlib.h: stdlib.in.h $(top_builddir)/config.status $(CXXDEFS_H) \
|
|||
-e 's|@''REPLACE_MALLOC''@|$(REPLACE_MALLOC)|g' \
|
||||
-e 's|@''REPLACE_MBTOWC''@|$(REPLACE_MBTOWC)|g' \
|
||||
-e 's|@''REPLACE_MKSTEMP''@|$(REPLACE_MKSTEMP)|g' \
|
||||
-e 's|@''REPLACE_PTSNAME_R''@|$(REPLACE_PTSNAME_R)|g' \
|
||||
-e 's|@''REPLACE_PUTENV''@|$(REPLACE_PUTENV)|g' \
|
||||
-e 's|@''REPLACE_REALLOC''@|$(REPLACE_REALLOC)|g' \
|
||||
-e 's|@''REPLACE_REALPATH''@|$(REPLACE_REALPATH)|g' \
|
||||
|
@ -2153,11 +2306,12 @@ unistd.h: unistd.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H
|
|||
-e 's/@''GNULIB_READLINK''@/$(GNULIB_READLINK)/g' \
|
||||
-e 's/@''GNULIB_READLINKAT''@/$(GNULIB_READLINKAT)/g' \
|
||||
-e 's/@''GNULIB_RMDIR''@/$(GNULIB_RMDIR)/g' \
|
||||
-e 's/@''GNULIB_SETHOSTNAME''@/$(GNULIB_SETHOSTNAME)/g' \
|
||||
-e 's/@''GNULIB_SLEEP''@/$(GNULIB_SLEEP)/g' \
|
||||
-e 's/@''GNULIB_SYMLINK''@/$(GNULIB_SYMLINK)/g' \
|
||||
-e 's/@''GNULIB_SYMLINKAT''@/$(GNULIB_SYMLINKAT)/g' \
|
||||
-e 's/@''GNULIB_TTYNAME_R''@/$(GNULIB_TTYNAME_R)/g' \
|
||||
-e 's/@''GNULIB_UNISTD_H_GETOPT''@/$(GNULIB_UNISTD_H_GETOPT)/g' \
|
||||
-e 's/@''GNULIB_UNISTD_H_GETOPT''@/0$(GNULIB_GL_UNISTD_H_GETOPT)/g' \
|
||||
-e 's/@''GNULIB_UNISTD_H_NONBLOCKING''@/$(GNULIB_UNISTD_H_NONBLOCKING)/g' \
|
||||
-e 's/@''GNULIB_UNISTD_H_SIGPIPE''@/$(GNULIB_UNISTD_H_SIGPIPE)/g' \
|
||||
-e 's/@''GNULIB_UNLINK''@/$(GNULIB_UNLINK)/g' \
|
||||
|
@ -2190,6 +2344,7 @@ unistd.h: unistd.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H
|
|||
-e 's|@''HAVE_PWRITE''@|$(HAVE_PWRITE)|g' \
|
||||
-e 's|@''HAVE_READLINK''@|$(HAVE_READLINK)|g' \
|
||||
-e 's|@''HAVE_READLINKAT''@|$(HAVE_READLINKAT)|g' \
|
||||
-e 's|@''HAVE_SETHOSTNAME''@|$(HAVE_SETHOSTNAME)|g' \
|
||||
-e 's|@''HAVE_SLEEP''@|$(HAVE_SLEEP)|g' \
|
||||
-e 's|@''HAVE_SYMLINK''@|$(HAVE_SYMLINK)|g' \
|
||||
-e 's|@''HAVE_SYMLINKAT''@|$(HAVE_SYMLINKAT)|g' \
|
||||
|
@ -2202,6 +2357,7 @@ unistd.h: unistd.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H
|
|||
-e 's|@''HAVE_DECL_GETLOGIN_R''@|$(HAVE_DECL_GETLOGIN_R)|g' \
|
||||
-e 's|@''HAVE_DECL_GETPAGESIZE''@|$(HAVE_DECL_GETPAGESIZE)|g' \
|
||||
-e 's|@''HAVE_DECL_GETUSERSHELL''@|$(HAVE_DECL_GETUSERSHELL)|g' \
|
||||
-e 's|@''HAVE_DECL_SETHOSTNAME''@|$(HAVE_DECL_SETHOSTNAME)|g' \
|
||||
-e 's|@''HAVE_DECL_TTYNAME_R''@|$(HAVE_DECL_TTYNAME_R)|g' \
|
||||
-e 's|@''HAVE_OS_H''@|$(HAVE_OS_H)|g' \
|
||||
-e 's|@''HAVE_SYS_PARAM_H''@|$(HAVE_SYS_PARAM_H)|g' \
|
||||
|
|
|
@ -20,8 +20,11 @@
|
|||
|
||||
#include <stddef.h>
|
||||
|
||||
/* Determine the alignment of a structure slot (field) of a given type,
|
||||
/* alignof_slot (TYPE)
|
||||
Determine the alignment of a structure slot (field) of a given type,
|
||||
at compile time. Note that the result depends on the ABI.
|
||||
This is the same as alignof (TYPE) and _Alignof (TYPE), defined in
|
||||
<stdalign.h> if __alignof_is_defined is 1.
|
||||
Note: The result cannot be used as a value for an 'enum' constant,
|
||||
due to bugs in HP-UX 10.20 cc and AIX 3.2.5 xlc. */
|
||||
#if defined __cplusplus
|
||||
|
@ -31,7 +34,8 @@
|
|||
# define alignof_slot(type) offsetof (struct { char __slot1; type __slot2; }, __slot2)
|
||||
#endif
|
||||
|
||||
/* Determine the good alignment of an object of the given type at compile time.
|
||||
/* alignof_type (TYPE)
|
||||
Determine the good alignment of an object of the given type at compile time.
|
||||
Note that this is not necessarily the same as alignof_slot(type).
|
||||
For example, with GNU C on x86 platforms: alignof_type(double) = 8, but
|
||||
- when -malign-double is not specified: alignof_slot(double) = 4,
|
||||
|
@ -44,10 +48,4 @@
|
|||
# define alignof_type alignof_slot
|
||||
#endif
|
||||
|
||||
/* alignof is an alias for alignof_slot semantics, since that's what most
|
||||
callers need.
|
||||
Note: The result cannot be used as a value for an 'enum' constant,
|
||||
due to bugs in HP-UX 10.20 cc and AIX 3.2.5 xlc. */
|
||||
#define alignof alignof_slot
|
||||
|
||||
#endif /* _ALIGNOF_H */
|
||||
|
|
|
@ -118,23 +118,23 @@ extern "C" {
|
|||
if (c_isalpha (*s)) ...
|
||||
*/
|
||||
|
||||
extern bool c_isascii (int c); /* not locale dependent */
|
||||
extern bool c_isascii (int c) _GL_ATTRIBUTE_CONST; /* not locale dependent */
|
||||
|
||||
extern bool c_isalnum (int c);
|
||||
extern bool c_isalpha (int c);
|
||||
extern bool c_isblank (int c);
|
||||
extern bool c_iscntrl (int c);
|
||||
extern bool c_isdigit (int c);
|
||||
extern bool c_islower (int c);
|
||||
extern bool c_isgraph (int c);
|
||||
extern bool c_isprint (int c);
|
||||
extern bool c_ispunct (int c);
|
||||
extern bool c_isspace (int c);
|
||||
extern bool c_isupper (int c);
|
||||
extern bool c_isxdigit (int c);
|
||||
extern bool c_isalnum (int c) _GL_ATTRIBUTE_CONST;
|
||||
extern bool c_isalpha (int c) _GL_ATTRIBUTE_CONST;
|
||||
extern bool c_isblank (int c) _GL_ATTRIBUTE_CONST;
|
||||
extern bool c_iscntrl (int c) _GL_ATTRIBUTE_CONST;
|
||||
extern bool c_isdigit (int c) _GL_ATTRIBUTE_CONST;
|
||||
extern bool c_islower (int c) _GL_ATTRIBUTE_CONST;
|
||||
extern bool c_isgraph (int c) _GL_ATTRIBUTE_CONST;
|
||||
extern bool c_isprint (int c) _GL_ATTRIBUTE_CONST;
|
||||
extern bool c_ispunct (int c) _GL_ATTRIBUTE_CONST;
|
||||
extern bool c_isspace (int c) _GL_ATTRIBUTE_CONST;
|
||||
extern bool c_isupper (int c) _GL_ATTRIBUTE_CONST;
|
||||
extern bool c_isxdigit (int c) _GL_ATTRIBUTE_CONST;
|
||||
|
||||
extern int c_tolower (int c);
|
||||
extern int c_toupper (int c);
|
||||
extern int c_tolower (int c) _GL_ATTRIBUTE_CONST;
|
||||
extern int c_toupper (int c) _GL_ATTRIBUTE_CONST;
|
||||
|
||||
|
||||
#if defined __GNUC__ && defined __OPTIMIZE__ && !defined __OPTIMIZE_SIZE__ && !defined NO_C_CTYPE_MACROS
|
||||
|
|
|
@ -40,12 +40,13 @@ extern "C" {
|
|||
/* Compare strings S1 and S2, ignoring case, returning less than, equal to or
|
||||
greater than zero if S1 is lexicographically less than, equal to or greater
|
||||
than S2. */
|
||||
extern int c_strcasecmp (const char *s1, const char *s2);
|
||||
extern int c_strcasecmp (const char *s1, const char *s2) _GL_ATTRIBUTE_PURE;
|
||||
|
||||
/* Compare no more than N characters of strings S1 and S2, ignoring case,
|
||||
returning less than, equal to or greater than zero if S1 is
|
||||
lexicographically less than, equal to or greater than S2. */
|
||||
extern int c_strncasecmp (const char *s1, const char *s2, size_t n);
|
||||
extern int c_strncasecmp (const char *s1, const char *s2, size_t n)
|
||||
_GL_ATTRIBUTE_PURE;
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
683
lib/config.charset
Normal file
683
lib/config.charset
Normal file
|
@ -0,0 +1,683 @@
|
|||
#! /bin/sh
|
||||
# Output a system dependent table of character encoding aliases.
|
||||
#
|
||||
# Copyright (C) 2000-2004, 2006-2011 Free Software Foundation, Inc.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Lesser General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Lesser General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public License along
|
||||
# with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# The table consists of lines of the form
|
||||
# ALIAS CANONICAL
|
||||
#
|
||||
# ALIAS is the (system dependent) result of "nl_langinfo (CODESET)".
|
||||
# ALIAS is compared in a case sensitive way.
|
||||
#
|
||||
# CANONICAL is the GNU canonical name for this character encoding.
|
||||
# It must be an encoding supported by libiconv. Support by GNU libc is
|
||||
# also desirable. CANONICAL is case insensitive. Usually an upper case
|
||||
# MIME charset name is preferred.
|
||||
# The current list of GNU canonical charset names is as follows.
|
||||
#
|
||||
# name MIME? used by which systems
|
||||
# ASCII, ANSI_X3.4-1968 glibc solaris freebsd netbsd darwin cygwin
|
||||
# ISO-8859-1 Y glibc aix hpux irix osf solaris freebsd netbsd openbsd darwin cygwin
|
||||
# ISO-8859-2 Y glibc aix hpux irix osf solaris freebsd netbsd openbsd darwin cygwin
|
||||
# ISO-8859-3 Y glibc solaris cygwin
|
||||
# ISO-8859-4 Y osf solaris freebsd netbsd openbsd darwin
|
||||
# ISO-8859-5 Y glibc aix hpux irix osf solaris freebsd netbsd openbsd darwin cygwin
|
||||
# ISO-8859-6 Y glibc aix hpux solaris cygwin
|
||||
# ISO-8859-7 Y glibc aix hpux irix osf solaris netbsd openbsd darwin cygwin
|
||||
# ISO-8859-8 Y glibc aix hpux osf solaris cygwin
|
||||
# ISO-8859-9 Y glibc aix hpux irix osf solaris darwin cygwin
|
||||
# ISO-8859-13 glibc netbsd openbsd darwin cygwin
|
||||
# ISO-8859-14 glibc cygwin
|
||||
# ISO-8859-15 glibc aix osf solaris freebsd netbsd openbsd darwin cygwin
|
||||
# KOI8-R Y glibc solaris freebsd netbsd openbsd darwin
|
||||
# KOI8-U Y glibc freebsd netbsd openbsd darwin cygwin
|
||||
# KOI8-T glibc
|
||||
# CP437 dos
|
||||
# CP775 dos
|
||||
# CP850 aix osf dos
|
||||
# CP852 dos
|
||||
# CP855 dos
|
||||
# CP856 aix
|
||||
# CP857 dos
|
||||
# CP861 dos
|
||||
# CP862 dos
|
||||
# CP864 dos
|
||||
# CP865 dos
|
||||
# CP866 freebsd netbsd openbsd darwin dos
|
||||
# CP869 dos
|
||||
# CP874 woe32 dos
|
||||
# CP922 aix
|
||||
# CP932 aix cygwin woe32 dos
|
||||
# CP943 aix
|
||||
# CP949 osf darwin woe32 dos
|
||||
# CP950 woe32 dos
|
||||
# CP1046 aix
|
||||
# CP1124 aix
|
||||
# CP1125 dos
|
||||
# CP1129 aix
|
||||
# CP1131 darwin
|
||||
# CP1250 woe32
|
||||
# CP1251 glibc solaris netbsd openbsd darwin cygwin woe32
|
||||
# CP1252 aix woe32
|
||||
# CP1253 woe32
|
||||
# CP1254 woe32
|
||||
# CP1255 glibc woe32
|
||||
# CP1256 woe32
|
||||
# CP1257 woe32
|
||||
# GB2312 Y glibc aix hpux irix solaris freebsd netbsd darwin
|
||||
# EUC-JP Y glibc aix hpux irix osf solaris freebsd netbsd darwin
|
||||
# EUC-KR Y glibc aix hpux irix osf solaris freebsd netbsd darwin cygwin
|
||||
# EUC-TW glibc aix hpux irix osf solaris netbsd
|
||||
# BIG5 Y glibc aix hpux osf solaris freebsd netbsd darwin cygwin
|
||||
# BIG5-HKSCS glibc solaris darwin
|
||||
# GBK glibc aix osf solaris darwin cygwin woe32 dos
|
||||
# GB18030 glibc solaris netbsd darwin
|
||||
# SHIFT_JIS Y hpux osf solaris freebsd netbsd darwin
|
||||
# JOHAB glibc solaris woe32
|
||||
# TIS-620 glibc aix hpux osf solaris cygwin
|
||||
# VISCII Y glibc
|
||||
# TCVN5712-1 glibc
|
||||
# ARMSCII-8 glibc darwin
|
||||
# GEORGIAN-PS glibc cygwin
|
||||
# PT154 glibc
|
||||
# HP-ROMAN8 hpux
|
||||
# HP-ARABIC8 hpux
|
||||
# HP-GREEK8 hpux
|
||||
# HP-HEBREW8 hpux
|
||||
# HP-TURKISH8 hpux
|
||||
# HP-KANA8 hpux
|
||||
# DEC-KANJI osf
|
||||
# DEC-HANYU osf
|
||||
# UTF-8 Y glibc aix hpux osf solaris netbsd darwin cygwin
|
||||
#
|
||||
# Note: Names which are not marked as being a MIME name should not be used in
|
||||
# Internet protocols for information interchange (mail, news, etc.).
|
||||
#
|
||||
# Note: ASCII and ANSI_X3.4-1968 are synonymous canonical names. Applications
|
||||
# must understand both names and treat them as equivalent.
|
||||
#
|
||||
# The first argument passed to this file is the canonical host specification,
|
||||
# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
|
||||
# or
|
||||
# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
|
||||
|
||||
host="$1"
|
||||
os=`echo "$host" | sed -e 's/^[^-]*-[^-]*-\(.*\)$/\1/'`
|
||||
echo "# This file contains a table of character encoding aliases,"
|
||||
echo "# suitable for operating system '${os}'."
|
||||
echo "# It was automatically generated from config.charset."
|
||||
# List of references, updated during installation:
|
||||
echo "# Packages using this file: "
|
||||
case "$os" in
|
||||
linux-gnulibc1*)
|
||||
# Linux libc5 doesn't have nl_langinfo(CODESET); therefore
|
||||
# localcharset.c falls back to using the full locale name
|
||||
# from the environment variables.
|
||||
echo "C ASCII"
|
||||
echo "POSIX ASCII"
|
||||
for l in af af_ZA ca ca_ES da da_DK de de_AT de_BE de_CH de_DE de_LU \
|
||||
en en_AU en_BW en_CA en_DK en_GB en_IE en_NZ en_US en_ZA \
|
||||
en_ZW es es_AR es_BO es_CL es_CO es_DO es_EC es_ES es_GT \
|
||||
es_HN es_MX es_PA es_PE es_PY es_SV es_US es_UY es_VE et \
|
||||
et_EE eu eu_ES fi fi_FI fo fo_FO fr fr_BE fr_CA fr_CH fr_FR \
|
||||
fr_LU ga ga_IE gl gl_ES id id_ID in in_ID is is_IS it it_CH \
|
||||
it_IT kl kl_GL nl nl_BE nl_NL no no_NO pt pt_BR pt_PT sv \
|
||||
sv_FI sv_SE; do
|
||||
echo "$l ISO-8859-1"
|
||||
echo "$l.iso-8859-1 ISO-8859-1"
|
||||
echo "$l.iso-8859-15 ISO-8859-15"
|
||||
echo "$l.iso-8859-15@euro ISO-8859-15"
|
||||
echo "$l@euro ISO-8859-15"
|
||||
echo "$l.cp-437 CP437"
|
||||
echo "$l.cp-850 CP850"
|
||||
echo "$l.cp-1252 CP1252"
|
||||
echo "$l.cp-1252@euro CP1252"
|
||||
#echo "$l.atari-st ATARI-ST" # not a commonly used encoding
|
||||
echo "$l.utf-8 UTF-8"
|
||||
echo "$l.utf-8@euro UTF-8"
|
||||
done
|
||||
for l in cs cs_CZ hr hr_HR hu hu_HU pl pl_PL ro ro_RO sk sk_SK sl \
|
||||
sl_SI sr sr_CS sr_YU; do
|
||||
echo "$l ISO-8859-2"
|
||||
echo "$l.iso-8859-2 ISO-8859-2"
|
||||
echo "$l.cp-852 CP852"
|
||||
echo "$l.cp-1250 CP1250"
|
||||
echo "$l.utf-8 UTF-8"
|
||||
done
|
||||
for l in mk mk_MK ru ru_RU; do
|
||||
echo "$l ISO-8859-5"
|
||||
echo "$l.iso-8859-5 ISO-8859-5"
|
||||
echo "$l.koi8-r KOI8-R"
|
||||
echo "$l.cp-866 CP866"
|
||||
echo "$l.cp-1251 CP1251"
|
||||
echo "$l.utf-8 UTF-8"
|
||||
done
|
||||
for l in ar ar_SA; do
|
||||
echo "$l ISO-8859-6"
|
||||
echo "$l.iso-8859-6 ISO-8859-6"
|
||||
echo "$l.cp-864 CP864"
|
||||
#echo "$l.cp-868 CP868" # not a commonly used encoding
|
||||
echo "$l.cp-1256 CP1256"
|
||||
echo "$l.utf-8 UTF-8"
|
||||
done
|
||||
for l in el el_GR gr gr_GR; do
|
||||
echo "$l ISO-8859-7"
|
||||
echo "$l.iso-8859-7 ISO-8859-7"
|
||||
echo "$l.cp-869 CP869"
|
||||
echo "$l.cp-1253 CP1253"
|
||||
echo "$l.cp-1253@euro CP1253"
|
||||
echo "$l.utf-8 UTF-8"
|
||||
echo "$l.utf-8@euro UTF-8"
|
||||
done
|
||||
for l in he he_IL iw iw_IL; do
|
||||
echo "$l ISO-8859-8"
|
||||
echo "$l.iso-8859-8 ISO-8859-8"
|
||||
echo "$l.cp-862 CP862"
|
||||
echo "$l.cp-1255 CP1255"
|
||||
echo "$l.utf-8 UTF-8"
|
||||
done
|
||||
for l in tr tr_TR; do
|
||||
echo "$l ISO-8859-9"
|
||||
echo "$l.iso-8859-9 ISO-8859-9"
|
||||
echo "$l.cp-857 CP857"
|
||||
echo "$l.cp-1254 CP1254"
|
||||
echo "$l.utf-8 UTF-8"
|
||||
done
|
||||
for l in lt lt_LT lv lv_LV; do
|
||||
#echo "$l BALTIC" # not a commonly used encoding, wrong encoding name
|
||||
echo "$l ISO-8859-13"
|
||||
done
|
||||
for l in ru_UA uk uk_UA; do
|
||||
echo "$l KOI8-U"
|
||||
done
|
||||
for l in zh zh_CN; do
|
||||
#echo "$l GB_2312-80" # not a commonly used encoding, wrong encoding name
|
||||
echo "$l GB2312"
|
||||
done
|
||||
for l in ja ja_JP ja_JP.EUC; do
|
||||
echo "$l EUC-JP"
|
||||
done
|
||||
for l in ko ko_KR; do
|
||||
echo "$l EUC-KR"
|
||||
done
|
||||
for l in th th_TH; do
|
||||
echo "$l TIS-620"
|
||||
done
|
||||
for l in fa fa_IR; do
|
||||
#echo "$l ISIRI-3342" # a broken encoding
|
||||
echo "$l.utf-8 UTF-8"
|
||||
done
|
||||
;;
|
||||
linux* | *-gnu*)
|
||||
# With glibc-2.1 or newer, we don't need any canonicalization,
|
||||
# because glibc has iconv and both glibc and libiconv support all
|
||||
# GNU canonical names directly. Therefore, the Makefile does not
|
||||
# need to install the alias file at all.
|
||||
# The following applies only to glibc-2.0.x and older libcs.
|
||||
echo "ISO_646.IRV:1983 ASCII"
|
||||
;;
|
||||
aix*)
|
||||
echo "ISO8859-1 ISO-8859-1"
|
||||
echo "ISO8859-2 ISO-8859-2"
|
||||
echo "ISO8859-5 ISO-8859-5"
|
||||
echo "ISO8859-6 ISO-8859-6"
|
||||
echo "ISO8859-7 ISO-8859-7"
|
||||
echo "ISO8859-8 ISO-8859-8"
|
||||
echo "ISO8859-9 ISO-8859-9"
|
||||
echo "ISO8859-15 ISO-8859-15"
|
||||
echo "IBM-850 CP850"
|
||||
echo "IBM-856 CP856"
|
||||
echo "IBM-921 ISO-8859-13"
|
||||
echo "IBM-922 CP922"
|
||||
echo "IBM-932 CP932"
|
||||
echo "IBM-943 CP943"
|
||||
echo "IBM-1046 CP1046"
|
||||
echo "IBM-1124 CP1124"
|
||||
echo "IBM-1129 CP1129"
|
||||
echo "IBM-1252 CP1252"
|
||||
echo "IBM-eucCN GB2312"
|
||||
echo "IBM-eucJP EUC-JP"
|
||||
echo "IBM-eucKR EUC-KR"
|
||||
echo "IBM-eucTW EUC-TW"
|
||||
echo "big5 BIG5"
|
||||
echo "GBK GBK"
|
||||
echo "TIS-620 TIS-620"
|
||||
echo "UTF-8 UTF-8"
|
||||
;;
|
||||
hpux*)
|
||||
echo "iso88591 ISO-8859-1"
|
||||
echo "iso88592 ISO-8859-2"
|
||||
echo "iso88595 ISO-8859-5"
|
||||
echo "iso88596 ISO-8859-6"
|
||||
echo "iso88597 ISO-8859-7"
|
||||
echo "iso88598 ISO-8859-8"
|
||||
echo "iso88599 ISO-8859-9"
|
||||
echo "iso885915 ISO-8859-15"
|
||||
echo "roman8 HP-ROMAN8"
|
||||
echo "arabic8 HP-ARABIC8"
|
||||
echo "greek8 HP-GREEK8"
|
||||
echo "hebrew8 HP-HEBREW8"
|
||||
echo "turkish8 HP-TURKISH8"
|
||||
echo "kana8 HP-KANA8"
|
||||
echo "tis620 TIS-620"
|
||||
echo "big5 BIG5"
|
||||
echo "eucJP EUC-JP"
|
||||
echo "eucKR EUC-KR"
|
||||
echo "eucTW EUC-TW"
|
||||
echo "hp15CN GB2312"
|
||||
#echo "ccdc ?" # what is this?
|
||||
echo "SJIS SHIFT_JIS"
|
||||
echo "utf8 UTF-8"
|
||||
;;
|
||||
irix*)
|
||||
echo "ISO8859-1 ISO-8859-1"
|
||||
echo "ISO8859-2 ISO-8859-2"
|
||||
echo "ISO8859-5 ISO-8859-5"
|
||||
echo "ISO8859-7 ISO-8859-7"
|
||||
echo "ISO8859-9 ISO-8859-9"
|
||||
echo "eucCN GB2312"
|
||||
echo "eucJP EUC-JP"
|
||||
echo "eucKR EUC-KR"
|
||||
echo "eucTW EUC-TW"
|
||||
;;
|
||||
osf*)
|
||||
echo "ISO8859-1 ISO-8859-1"
|
||||
echo "ISO8859-2 ISO-8859-2"
|
||||
echo "ISO8859-4 ISO-8859-4"
|
||||
echo "ISO8859-5 ISO-8859-5"
|
||||
echo "ISO8859-7 ISO-8859-7"
|
||||
echo "ISO8859-8 ISO-8859-8"
|
||||
echo "ISO8859-9 ISO-8859-9"
|
||||
echo "ISO8859-15 ISO-8859-15"
|
||||
echo "cp850 CP850"
|
||||
echo "big5 BIG5"
|
||||
echo "dechanyu DEC-HANYU"
|
||||
echo "dechanzi GB2312"
|
||||
echo "deckanji DEC-KANJI"
|
||||
echo "deckorean EUC-KR"
|
||||
echo "eucJP EUC-JP"
|
||||
echo "eucKR EUC-KR"
|
||||
echo "eucTW EUC-TW"
|
||||
echo "GBK GBK"
|
||||
echo "KSC5601 CP949"
|
||||
echo "sdeckanji EUC-JP"
|
||||
echo "SJIS SHIFT_JIS"
|
||||
echo "TACTIS TIS-620"
|
||||
echo "UTF-8 UTF-8"
|
||||
;;
|
||||
solaris*)
|
||||
echo "646 ASCII"
|
||||
echo "ISO8859-1 ISO-8859-1"
|
||||
echo "ISO8859-2 ISO-8859-2"
|
||||
echo "ISO8859-3 ISO-8859-3"
|
||||
echo "ISO8859-4 ISO-8859-4"
|
||||
echo "ISO8859-5 ISO-8859-5"
|
||||
echo "ISO8859-6 ISO-8859-6"
|
||||
echo "ISO8859-7 ISO-8859-7"
|
||||
echo "ISO8859-8 ISO-8859-8"
|
||||
echo "ISO8859-9 ISO-8859-9"
|
||||
echo "ISO8859-15 ISO-8859-15"
|
||||
echo "koi8-r KOI8-R"
|
||||
echo "ansi-1251 CP1251"
|
||||
echo "BIG5 BIG5"
|
||||
echo "Big5-HKSCS BIG5-HKSCS"
|
||||
echo "gb2312 GB2312"
|
||||
echo "GBK GBK"
|
||||
echo "GB18030 GB18030"
|
||||
echo "cns11643 EUC-TW"
|
||||
echo "5601 EUC-KR"
|
||||
echo "ko_KR.johap92 JOHAB"
|
||||
echo "eucJP EUC-JP"
|
||||
echo "PCK SHIFT_JIS"
|
||||
echo "TIS620.2533 TIS-620"
|
||||
#echo "sun_eu_greek ?" # what is this?
|
||||
echo "UTF-8 UTF-8"
|
||||
;;
|
||||
freebsd* | os2*)
|
||||
# FreeBSD 4.2 doesn't have nl_langinfo(CODESET); therefore
|
||||
# localcharset.c falls back to using the full locale name
|
||||
# from the environment variables.
|
||||
# Likewise for OS/2. OS/2 has XFree86 just like FreeBSD. Just
|
||||
# reuse FreeBSD's locale data for OS/2.
|
||||
echo "C ASCII"
|
||||
echo "US-ASCII ASCII"
|
||||
for l in la_LN lt_LN; do
|
||||
echo "$l.ASCII ASCII"
|
||||
done
|
||||
for l in da_DK de_AT de_CH de_DE en_AU en_CA en_GB en_US es_ES \
|
||||
fi_FI fr_BE fr_CA fr_CH fr_FR is_IS it_CH it_IT la_LN \
|
||||
lt_LN nl_BE nl_NL no_NO pt_PT sv_SE; do
|
||||
echo "$l.ISO_8859-1 ISO-8859-1"
|
||||
echo "$l.DIS_8859-15 ISO-8859-15"
|
||||
done
|
||||
for l in cs_CZ hr_HR hu_HU la_LN lt_LN pl_PL sl_SI; do
|
||||
echo "$l.ISO_8859-2 ISO-8859-2"
|
||||
done
|
||||
for l in la_LN lt_LT; do
|
||||
echo "$l.ISO_8859-4 ISO-8859-4"
|
||||
done
|
||||
for l in ru_RU ru_SU; do
|
||||
echo "$l.KOI8-R KOI8-R"
|
||||
echo "$l.ISO_8859-5 ISO-8859-5"
|
||||
echo "$l.CP866 CP866"
|
||||
done
|
||||
echo "uk_UA.KOI8-U KOI8-U"
|
||||
echo "zh_TW.BIG5 BIG5"
|
||||
echo "zh_TW.Big5 BIG5"
|
||||
echo "zh_CN.EUC GB2312"
|
||||
echo "ja_JP.EUC EUC-JP"
|
||||
echo "ja_JP.SJIS SHIFT_JIS"
|
||||
echo "ja_JP.Shift_JIS SHIFT_JIS"
|
||||
echo "ko_KR.EUC EUC-KR"
|
||||
;;
|
||||
netbsd*)
|
||||
echo "646 ASCII"
|
||||
echo "ISO8859-1 ISO-8859-1"
|
||||
echo "ISO8859-2 ISO-8859-2"
|
||||
echo "ISO8859-4 ISO-8859-4"
|
||||
echo "ISO8859-5 ISO-8859-5"
|
||||
echo "ISO8859-7 ISO-8859-7"
|
||||
echo "ISO8859-13 ISO-8859-13"
|
||||
echo "ISO8859-15 ISO-8859-15"
|
||||
echo "eucCN GB2312"
|
||||
echo "eucJP EUC-JP"
|
||||
echo "eucKR EUC-KR"
|
||||
echo "eucTW EUC-TW"
|
||||
echo "BIG5 BIG5"
|
||||
echo "SJIS SHIFT_JIS"
|
||||
;;
|
||||
openbsd*)
|
||||
echo "646 ASCII"
|
||||
echo "ISO8859-1 ISO-8859-1"
|
||||
echo "ISO8859-2 ISO-8859-2"
|
||||
echo "ISO8859-4 ISO-8859-4"
|
||||
echo "ISO8859-5 ISO-8859-5"
|
||||
echo "ISO8859-7 ISO-8859-7"
|
||||
echo "ISO8859-13 ISO-8859-13"
|
||||
echo "ISO8859-15 ISO-8859-15"
|
||||
;;
|
||||
darwin[56]*)
|
||||
# Darwin 6.8 doesn't have nl_langinfo(CODESET); therefore
|
||||
# localcharset.c falls back to using the full locale name
|
||||
# from the environment variables.
|
||||
echo "C ASCII"
|
||||
for l in en_AU en_CA en_GB en_US la_LN; do
|
||||
echo "$l.US-ASCII ASCII"
|
||||
done
|
||||
for l in da_DK de_AT de_CH de_DE en_AU en_CA en_GB en_US es_ES \
|
||||
fi_FI fr_BE fr_CA fr_CH fr_FR is_IS it_CH it_IT nl_BE \
|
||||
nl_NL no_NO pt_PT sv_SE; do
|
||||
echo "$l ISO-8859-1"
|
||||
echo "$l.ISO8859-1 ISO-8859-1"
|
||||
echo "$l.ISO8859-15 ISO-8859-15"
|
||||
done
|
||||
for l in la_LN; do
|
||||
echo "$l.ISO8859-1 ISO-8859-1"
|
||||
echo "$l.ISO8859-15 ISO-8859-15"
|
||||
done
|
||||
for l in cs_CZ hr_HR hu_HU la_LN pl_PL sl_SI; do
|
||||
echo "$l.ISO8859-2 ISO-8859-2"
|
||||
done
|
||||
for l in la_LN lt_LT; do
|
||||
echo "$l.ISO8859-4 ISO-8859-4"
|
||||
done
|
||||
for l in ru_RU; do
|
||||
echo "$l.KOI8-R KOI8-R"
|
||||
echo "$l.ISO8859-5 ISO-8859-5"
|
||||
echo "$l.CP866 CP866"
|
||||
done
|
||||
for l in bg_BG; do
|
||||
echo "$l.CP1251 CP1251"
|
||||
done
|
||||
echo "uk_UA.KOI8-U KOI8-U"
|
||||
echo "zh_TW.BIG5 BIG5"
|
||||
echo "zh_TW.Big5 BIG5"
|
||||
echo "zh_CN.EUC GB2312"
|
||||
echo "ja_JP.EUC EUC-JP"
|
||||
echo "ja_JP.SJIS SHIFT_JIS"
|
||||
echo "ko_KR.EUC EUC-KR"
|
||||
;;
|
||||
darwin*)
|
||||
# Darwin 7.5 has nl_langinfo(CODESET), but sometimes its value is
|
||||
# useless:
|
||||
# - It returns the empty string when LANG is set to a locale of the
|
||||
# form ll_CC, although ll_CC/LC_CTYPE is a symlink to an UTF-8
|
||||
# LC_CTYPE file.
|
||||
# - The environment variables LANG, LC_CTYPE, LC_ALL are not set by
|
||||
# the system; nl_langinfo(CODESET) returns "US-ASCII" in this case.
|
||||
# - The documentation says:
|
||||
# "... all code that calls BSD system routines should ensure
|
||||
# that the const *char parameters of these routines are in UTF-8
|
||||
# encoding. All BSD system functions expect their string
|
||||
# parameters to be in UTF-8 encoding and nothing else."
|
||||
# It also says
|
||||
# "An additional caveat is that string parameters for files,
|
||||
# paths, and other file-system entities must be in canonical
|
||||
# UTF-8. In a canonical UTF-8 Unicode string, all decomposable
|
||||
# characters are decomposed ..."
|
||||
# but this is not true: You can pass non-decomposed UTF-8 strings
|
||||
# to file system functions, and it is the OS which will convert
|
||||
# them to decomposed UTF-8 before accessing the file system.
|
||||
# - The Apple Terminal application displays UTF-8 by default.
|
||||
# - However, other applications are free to use different encodings:
|
||||
# - xterm uses ISO-8859-1 by default.
|
||||
# - TextEdit uses MacRoman by default.
|
||||
# We prefer UTF-8 over decomposed UTF-8-MAC because one should
|
||||
# minimize the use of decomposed Unicode. Unfortunately, through the
|
||||
# Darwin file system, decomposed UTF-8 strings are leaked into user
|
||||
# space nevertheless.
|
||||
# Then there are also the locales with encodings other than US-ASCII
|
||||
# and UTF-8. These locales can be occasionally useful to users (e.g.
|
||||
# when grepping through ISO-8859-1 encoded text files), when all their
|
||||
# file names are in US-ASCII.
|
||||
echo "ISO8859-1 ISO-8859-1"
|
||||
echo "ISO8859-2 ISO-8859-2"
|
||||
echo "ISO8859-4 ISO-8859-4"
|
||||
echo "ISO8859-5 ISO-8859-5"
|
||||
echo "ISO8859-7 ISO-8859-7"
|
||||
echo "ISO8859-9 ISO-8859-9"
|
||||
echo "ISO8859-13 ISO-8859-13"
|
||||
echo "ISO8859-15 ISO-8859-15"
|
||||
echo "KOI8-R KOI8-R"
|
||||
echo "KOI8-U KOI8-U"
|
||||
echo "CP866 CP866"
|
||||
echo "CP949 CP949"
|
||||
echo "CP1131 CP1131"
|
||||
echo "CP1251 CP1251"
|
||||
echo "eucCN GB2312"
|
||||
echo "GB2312 GB2312"
|
||||
echo "eucJP EUC-JP"
|
||||
echo "eucKR EUC-KR"
|
||||
echo "Big5 BIG5"
|
||||
echo "Big5HKSCS BIG5-HKSCS"
|
||||
echo "GBK GBK"
|
||||
echo "GB18030 GB18030"
|
||||
echo "SJIS SHIFT_JIS"
|
||||
echo "ARMSCII-8 ARMSCII-8"
|
||||
echo "PT154 PT154"
|
||||
#echo "ISCII-DEV ?"
|
||||
echo "* UTF-8"
|
||||
;;
|
||||
beos* | haiku*)
|
||||
# BeOS and Haiku have a single locale, and it has UTF-8 encoding.
|
||||
echo "* UTF-8"
|
||||
;;
|
||||
msdosdjgpp*)
|
||||
# DJGPP 2.03 doesn't have nl_langinfo(CODESET); therefore
|
||||
# localcharset.c falls back to using the full locale name
|
||||
# from the environment variables.
|
||||
echo "#"
|
||||
echo "# The encodings given here may not all be correct."
|
||||
echo "# If you find that the encoding given for your language and"
|
||||
echo "# country is not the one your DOS machine actually uses, just"
|
||||
echo "# correct it in this file, and send a mail to"
|
||||
echo "# Juan Manuel Guerrero <juan.guerrero@gmx.de>"
|
||||
echo "# and Bruno Haible <bruno@clisp.org>."
|
||||
echo "#"
|
||||
echo "C ASCII"
|
||||
# ISO-8859-1 languages
|
||||
echo "ca CP850"
|
||||
echo "ca_ES CP850"
|
||||
echo "da CP865" # not CP850 ??
|
||||
echo "da_DK CP865" # not CP850 ??
|
||||
echo "de CP850"
|
||||
echo "de_AT CP850"
|
||||
echo "de_CH CP850"
|
||||
echo "de_DE CP850"
|
||||
echo "en CP850"
|
||||
echo "en_AU CP850" # not CP437 ??
|
||||
echo "en_CA CP850"
|
||||
echo "en_GB CP850"
|
||||
echo "en_NZ CP437"
|
||||
echo "en_US CP437"
|
||||
echo "en_ZA CP850" # not CP437 ??
|
||||
echo "es CP850"
|
||||
echo "es_AR CP850"
|
||||
echo "es_BO CP850"
|
||||
echo "es_CL CP850"
|
||||
echo "es_CO CP850"
|
||||
echo "es_CR CP850"
|
||||
echo "es_CU CP850"
|
||||
echo "es_DO CP850"
|
||||
echo "es_EC CP850"
|
||||
echo "es_ES CP850"
|
||||
echo "es_GT CP850"
|
||||
echo "es_HN CP850"
|
||||
echo "es_MX CP850"
|
||||
echo "es_NI CP850"
|
||||
echo "es_PA CP850"
|
||||
echo "es_PY CP850"
|
||||
echo "es_PE CP850"
|
||||
echo "es_SV CP850"
|
||||
echo "es_UY CP850"
|
||||
echo "es_VE CP850"
|
||||
echo "et CP850"
|
||||
echo "et_EE CP850"
|
||||
echo "eu CP850"
|
||||
echo "eu_ES CP850"
|
||||
echo "fi CP850"
|
||||
echo "fi_FI CP850"
|
||||
echo "fr CP850"
|
||||
echo "fr_BE CP850"
|
||||
echo "fr_CA CP850"
|
||||
echo "fr_CH CP850"
|
||||
echo "fr_FR CP850"
|
||||
echo "ga CP850"
|
||||
echo "ga_IE CP850"
|
||||
echo "gd CP850"
|
||||
echo "gd_GB CP850"
|
||||
echo "gl CP850"
|
||||
echo "gl_ES CP850"
|
||||
echo "id CP850" # not CP437 ??
|
||||
echo "id_ID CP850" # not CP437 ??
|
||||
echo "is CP861" # not CP850 ??
|
||||
echo "is_IS CP861" # not CP850 ??
|
||||
echo "it CP850"
|
||||
echo "it_CH CP850"
|
||||
echo "it_IT CP850"
|
||||
echo "lt CP775"
|
||||
echo "lt_LT CP775"
|
||||
echo "lv CP775"
|
||||
echo "lv_LV CP775"
|
||||
echo "nb CP865" # not CP850 ??
|
||||
echo "nb_NO CP865" # not CP850 ??
|
||||
echo "nl CP850"
|
||||
echo "nl_BE CP850"
|
||||
echo "nl_NL CP850"
|
||||
echo "nn CP865" # not CP850 ??
|
||||
echo "nn_NO CP865" # not CP850 ??
|
||||
echo "no CP865" # not CP850 ??
|
||||
echo "no_NO CP865" # not CP850 ??
|
||||
echo "pt CP850"
|
||||
echo "pt_BR CP850"
|
||||
echo "pt_PT CP850"
|
||||
echo "sv CP850"
|
||||
echo "sv_SE CP850"
|
||||
# ISO-8859-2 languages
|
||||
echo "cs CP852"
|
||||
echo "cs_CZ CP852"
|
||||
echo "hr CP852"
|
||||
echo "hr_HR CP852"
|
||||
echo "hu CP852"
|
||||
echo "hu_HU CP852"
|
||||
echo "pl CP852"
|
||||
echo "pl_PL CP852"
|
||||
echo "ro CP852"
|
||||
echo "ro_RO CP852"
|
||||
echo "sk CP852"
|
||||
echo "sk_SK CP852"
|
||||
echo "sl CP852"
|
||||
echo "sl_SI CP852"
|
||||
echo "sq CP852"
|
||||
echo "sq_AL CP852"
|
||||
echo "sr CP852" # CP852 or CP866 or CP855 ??
|
||||
echo "sr_CS CP852" # CP852 or CP866 or CP855 ??
|
||||
echo "sr_YU CP852" # CP852 or CP866 or CP855 ??
|
||||
# ISO-8859-3 languages
|
||||
echo "mt CP850"
|
||||
echo "mt_MT CP850"
|
||||
# ISO-8859-5 languages
|
||||
echo "be CP866"
|
||||
echo "be_BE CP866"
|
||||
echo "bg CP866" # not CP855 ??
|
||||
echo "bg_BG CP866" # not CP855 ??
|
||||
echo "mk CP866" # not CP855 ??
|
||||
echo "mk_MK CP866" # not CP855 ??
|
||||
echo "ru CP866"
|
||||
echo "ru_RU CP866"
|
||||
echo "uk CP1125"
|
||||
echo "uk_UA CP1125"
|
||||
# ISO-8859-6 languages
|
||||
echo "ar CP864"
|
||||
echo "ar_AE CP864"
|
||||
echo "ar_DZ CP864"
|
||||
echo "ar_EG CP864"
|
||||
echo "ar_IQ CP864"
|
||||
echo "ar_IR CP864"
|
||||
echo "ar_JO CP864"
|
||||
echo "ar_KW CP864"
|
||||
echo "ar_MA CP864"
|
||||
echo "ar_OM CP864"
|
||||
echo "ar_QA CP864"
|
||||
echo "ar_SA CP864"
|
||||
echo "ar_SY CP864"
|
||||
# ISO-8859-7 languages
|
||||
echo "el CP869"
|
||||
echo "el_GR CP869"
|
||||
# ISO-8859-8 languages
|
||||
echo "he CP862"
|
||||
echo "he_IL CP862"
|
||||
# ISO-8859-9 languages
|
||||
echo "tr CP857"
|
||||
echo "tr_TR CP857"
|
||||
# Japanese
|
||||
echo "ja CP932"
|
||||
echo "ja_JP CP932"
|
||||
# Chinese
|
||||
echo "zh_CN GBK"
|
||||
echo "zh_TW CP950" # not CP938 ??
|
||||
# Korean
|
||||
echo "kr CP949" # not CP934 ??
|
||||
echo "kr_KR CP949" # not CP934 ??
|
||||
# Thai
|
||||
echo "th CP874"
|
||||
echo "th_TH CP874"
|
||||
# Other
|
||||
echo "eo CP850"
|
||||
echo "eo_EO CP850"
|
||||
;;
|
||||
esac
|
|
@ -37,9 +37,9 @@ char *dir_name (char const *file);
|
|||
# endif
|
||||
|
||||
char *mdir_name (char const *file);
|
||||
size_t base_len (char const *file);
|
||||
size_t dir_len (char const *file);
|
||||
char *last_component (char const *file);
|
||||
size_t base_len (char const *file) _GL_ATTRIBUTE_PURE;
|
||||
size_t dir_len (char const *file) _GL_ATTRIBUTE_PURE;
|
||||
char *last_component (char const *file) _GL_ATTRIBUTE_PURE;
|
||||
|
||||
bool strip_trailing_slashes (char *file);
|
||||
|
||||
|
|
116
lib/errno.in.h
116
lib/errno.in.h
|
@ -33,50 +33,106 @@
|
|||
/* On native Windows platforms, many macros are not defined. */
|
||||
# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
|
||||
|
||||
/* POSIX says that EAGAIN and EWOULDBLOCK may have the same value. */
|
||||
# define EWOULDBLOCK EAGAIN
|
||||
/* These are the same values as defined by MSVC 10, for interoperability. */
|
||||
|
||||
/* Values >= 100 seem safe to use. */
|
||||
# define ETXTBSY 100
|
||||
# define GNULIB_defined_ETXTBSY 1
|
||||
# ifndef ENOMSG
|
||||
# define ENOMSG 122
|
||||
# define GNULIB_defined_ENOMSG 1
|
||||
# endif
|
||||
|
||||
# ifndef EIDRM
|
||||
# define EIDRM 111
|
||||
# define GNULIB_defined_EIDRM 1
|
||||
# endif
|
||||
|
||||
# ifndef ENOLINK
|
||||
# define ENOLINK 121
|
||||
# define GNULIB_defined_ENOLINK 1
|
||||
# endif
|
||||
|
||||
# ifndef EPROTO
|
||||
# define EPROTO 134
|
||||
# define GNULIB_defined_EPROTO 1
|
||||
# endif
|
||||
|
||||
# ifndef EBADMSG
|
||||
# define EBADMSG 104
|
||||
# define GNULIB_defined_EBADMSG 1
|
||||
# endif
|
||||
|
||||
# ifndef EOVERFLOW
|
||||
# define EOVERFLOW 132
|
||||
# define GNULIB_defined_EOVERFLOW 1
|
||||
# endif
|
||||
|
||||
# ifndef ENOTSUP
|
||||
# define ENOTSUP 129
|
||||
# define GNULIB_defined_ENOTSUP 1
|
||||
# endif
|
||||
|
||||
# ifndef ENETRESET
|
||||
# define ENETRESET 117
|
||||
# define GNULIB_defined_ENETRESET 1
|
||||
# endif
|
||||
|
||||
# ifndef ECONNABORTED
|
||||
# define ECONNABORTED 106
|
||||
# define GNULIB_defined_ECONNABORTED 1
|
||||
# endif
|
||||
|
||||
# ifndef ECANCELED
|
||||
# define ECANCELED 105
|
||||
# define GNULIB_defined_ECANCELED 1
|
||||
# endif
|
||||
|
||||
# ifndef EINPROGRESS
|
||||
# define EINPROGRESS 112
|
||||
# define EALREADY 103
|
||||
# define ENOTSOCK 128
|
||||
# define EDESTADDRREQ 109
|
||||
# define EMSGSIZE 115
|
||||
# define EPROTOTYPE 136
|
||||
# define ENOPROTOOPT 123
|
||||
# define EPROTONOSUPPORT 135
|
||||
# define EOPNOTSUPP 130
|
||||
# define EAFNOSUPPORT 102
|
||||
# define EADDRINUSE 100
|
||||
# define EADDRNOTAVAIL 101
|
||||
# define ENETDOWN 116
|
||||
# define ENETUNREACH 118
|
||||
# define ECONNRESET 108
|
||||
# define ENOBUFS 119
|
||||
# define EISCONN 113
|
||||
# define ENOTCONN 126
|
||||
# define ETIMEDOUT 138
|
||||
# define ECONNREFUSED 107
|
||||
# define ELOOP 114
|
||||
# define EHOSTUNREACH 110
|
||||
# define EWOULDBLOCK 140
|
||||
# define ETXTBSY 139
|
||||
# define ENODATA 120 /* not required by POSIX */
|
||||
# define ENOSR 124 /* not required by POSIX */
|
||||
# define ENOSTR 125 /* not required by POSIX */
|
||||
# define ENOTRECOVERABLE 127 /* not required by POSIX */
|
||||
# define EOWNERDEAD 133 /* not required by POSIX */
|
||||
# define ETIME 137 /* not required by POSIX */
|
||||
# define EOTHER 131 /* not required by POSIX */
|
||||
# define GNULIB_defined_ESOCK 1
|
||||
# endif
|
||||
|
||||
/* These are intentionally the same values as the WSA* error numbers, defined
|
||||
in <winsock2.h>. */
|
||||
# define EINPROGRESS 10036
|
||||
# define EALREADY 10037
|
||||
# define ENOTSOCK 10038
|
||||
# define EDESTADDRREQ 10039
|
||||
# define EMSGSIZE 10040
|
||||
# define EPROTOTYPE 10041
|
||||
# define ENOPROTOOPT 10042
|
||||
# define EPROTONOSUPPORT 10043
|
||||
# define ESOCKTNOSUPPORT 10044 /* not required by POSIX */
|
||||
# define EOPNOTSUPP 10045
|
||||
# define EPFNOSUPPORT 10046 /* not required by POSIX */
|
||||
# define EAFNOSUPPORT 10047
|
||||
# define EADDRINUSE 10048
|
||||
# define EADDRNOTAVAIL 10049
|
||||
# define ENETDOWN 10050
|
||||
# define ENETUNREACH 10051
|
||||
# define ENETRESET 10052
|
||||
# define ECONNABORTED 10053
|
||||
# define ECONNRESET 10054
|
||||
# define ENOBUFS 10055
|
||||
# define EISCONN 10056
|
||||
# define ENOTCONN 10057
|
||||
# define ESHUTDOWN 10058 /* not required by POSIX */
|
||||
# define ETOOMANYREFS 10059 /* not required by POSIX */
|
||||
# define ETIMEDOUT 10060
|
||||
# define ECONNREFUSED 10061
|
||||
# define ELOOP 10062
|
||||
# define EHOSTDOWN 10064 /* not required by POSIX */
|
||||
# define EHOSTUNREACH 10065
|
||||
# define EPROCLIM 10067 /* not required by POSIX */
|
||||
# define EUSERS 10068 /* not required by POSIX */
|
||||
# define EDQUOT 10069
|
||||
# define ESTALE 10070
|
||||
# define EREMOTE 10071 /* not required by POSIX */
|
||||
# define GNULIB_defined_ESOCK 1
|
||||
# define GNULIB_defined_EWINSOCK 1
|
||||
|
||||
# endif
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
/* Specification. */
|
||||
#ifdef USE_LONG_DOUBLE
|
||||
/* Specification found in math.h or isnanl-nolibm.h. */
|
||||
extern int rpl_isnanl (long double x);
|
||||
extern int rpl_isnanl (long double x) _GL_ATTRIBUTE_CONST;
|
||||
#elif ! defined USE_FLOAT
|
||||
/* Specification found in math.h or isnand-nolibm.h. */
|
||||
extern int rpl_isnand (double x);
|
||||
|
|
617
lib/localcharset.c
Normal file
617
lib/localcharset.c
Normal file
|
@ -0,0 +1,617 @@
|
|||
/* Determine a canonical name for the current locale's character encoding.
|
||||
|
||||
Copyright (C) 2000-2006, 2008-2011 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License along
|
||||
with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||
|
||||
/* Written by Bruno Haible <bruno@clisp.org>. */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
/* Specification. */
|
||||
#include "localcharset.h"
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#if defined __APPLE__ && defined __MACH__ && HAVE_LANGINFO_CODESET
|
||||
# define DARWIN7 /* Darwin 7 or newer, i.e. MacOS X 10.3 or newer */
|
||||
#endif
|
||||
|
||||
#if defined _WIN32 || defined __WIN32__
|
||||
# define WIN32_NATIVE
|
||||
#endif
|
||||
|
||||
#if defined __EMX__
|
||||
/* Assume EMX program runs on OS/2, even if compiled under DOS. */
|
||||
# ifndef OS2
|
||||
# define OS2
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if !defined WIN32_NATIVE
|
||||
# include <unistd.h>
|
||||
# if HAVE_LANGINFO_CODESET
|
||||
# include <langinfo.h>
|
||||
# else
|
||||
# if 0 /* see comment below */
|
||||
# include <locale.h>
|
||||
# endif
|
||||
# endif
|
||||
# ifdef __CYGWIN__
|
||||
# define WIN32_LEAN_AND_MEAN
|
||||
# include <windows.h>
|
||||
# endif
|
||||
#elif defined WIN32_NATIVE
|
||||
# define WIN32_LEAN_AND_MEAN
|
||||
# include <windows.h>
|
||||
#endif
|
||||
#if defined OS2
|
||||
# define INCL_DOS
|
||||
# include <os2.h>
|
||||
#endif
|
||||
|
||||
#if ENABLE_RELOCATABLE
|
||||
# include "relocatable.h"
|
||||
#else
|
||||
# define relocate(pathname) (pathname)
|
||||
#endif
|
||||
|
||||
/* Get LIBDIR. */
|
||||
#ifndef LIBDIR
|
||||
# include "configmake.h"
|
||||
#endif
|
||||
|
||||
/* Define O_NOFOLLOW to 0 on platforms where it does not exist. */
|
||||
#ifndef O_NOFOLLOW
|
||||
# define O_NOFOLLOW 0
|
||||
#endif
|
||||
|
||||
#if defined _WIN32 || defined __WIN32__ || defined __CYGWIN__ || defined __EMX__ || defined __DJGPP__
|
||||
/* Win32, Cygwin, OS/2, DOS */
|
||||
# define ISSLASH(C) ((C) == '/' || (C) == '\\')
|
||||
#endif
|
||||
|
||||
#ifndef DIRECTORY_SEPARATOR
|
||||
# define DIRECTORY_SEPARATOR '/'
|
||||
#endif
|
||||
|
||||
#ifndef ISSLASH
|
||||
# define ISSLASH(C) ((C) == DIRECTORY_SEPARATOR)
|
||||
#endif
|
||||
|
||||
#if HAVE_DECL_GETC_UNLOCKED
|
||||
# undef getc
|
||||
# define getc getc_unlocked
|
||||
#endif
|
||||
|
||||
/* The following static variable is declared 'volatile' to avoid a
|
||||
possible multithread problem in the function get_charset_aliases. If we
|
||||
are running in a threaded environment, and if two threads initialize
|
||||
'charset_aliases' simultaneously, both will produce the same value,
|
||||
and everything will be ok if the two assignments to 'charset_aliases'
|
||||
are atomic. But I don't know what will happen if the two assignments mix. */
|
||||
#if __STDC__ != 1
|
||||
# define volatile /* empty */
|
||||
#endif
|
||||
/* Pointer to the contents of the charset.alias file, if it has already been
|
||||
read, else NULL. Its format is:
|
||||
ALIAS_1 '\0' CANONICAL_1 '\0' ... ALIAS_n '\0' CANONICAL_n '\0' '\0' */
|
||||
static const char * volatile charset_aliases;
|
||||
|
||||
/* Return a pointer to the contents of the charset.alias file. */
|
||||
static const char *
|
||||
get_charset_aliases (void)
|
||||
{
|
||||
const char *cp;
|
||||
|
||||
cp = charset_aliases;
|
||||
if (cp == NULL)
|
||||
{
|
||||
#if !(defined DARWIN7 || defined VMS || defined WIN32_NATIVE || defined __CYGWIN__)
|
||||
const char *dir;
|
||||
const char *base = "charset.alias";
|
||||
char *file_name;
|
||||
|
||||
/* Make it possible to override the charset.alias location. This is
|
||||
necessary for running the testsuite before "make install". */
|
||||
dir = getenv ("CHARSETALIASDIR");
|
||||
if (dir == NULL || dir[0] == '\0')
|
||||
dir = relocate (LIBDIR);
|
||||
|
||||
/* Concatenate dir and base into freshly allocated file_name. */
|
||||
{
|
||||
size_t dir_len = strlen (dir);
|
||||
size_t base_len = strlen (base);
|
||||
int add_slash = (dir_len > 0 && !ISSLASH (dir[dir_len - 1]));
|
||||
file_name = (char *) malloc (dir_len + add_slash + base_len + 1);
|
||||
if (file_name != NULL)
|
||||
{
|
||||
memcpy (file_name, dir, dir_len);
|
||||
if (add_slash)
|
||||
file_name[dir_len] = DIRECTORY_SEPARATOR;
|
||||
memcpy (file_name + dir_len + add_slash, base, base_len + 1);
|
||||
}
|
||||
}
|
||||
|
||||
if (file_name == NULL)
|
||||
/* Out of memory. Treat the file as empty. */
|
||||
cp = "";
|
||||
else
|
||||
{
|
||||
int fd;
|
||||
|
||||
/* Open the file. Reject symbolic links on platforms that support
|
||||
O_NOFOLLOW. This is a security feature. Without it, an attacker
|
||||
could retrieve parts of the contents (namely, the tail of the
|
||||
first line that starts with "* ") of an arbitrary file by placing
|
||||
a symbolic link to that file under the name "charset.alias" in
|
||||
some writable directory and defining the environment variable
|
||||
CHARSETALIASDIR to point to that directory. */
|
||||
fd = open (file_name,
|
||||
O_RDONLY | (HAVE_WORKING_O_NOFOLLOW ? O_NOFOLLOW : 0));
|
||||
if (fd < 0)
|
||||
/* File not found. Treat it as empty. */
|
||||
cp = "";
|
||||
else
|
||||
{
|
||||
FILE *fp;
|
||||
|
||||
fp = fdopen (fd, "r");
|
||||
if (fp == NULL)
|
||||
{
|
||||
/* Out of memory. Treat the file as empty. */
|
||||
close (fd);
|
||||
cp = "";
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Parse the file's contents. */
|
||||
char *res_ptr = NULL;
|
||||
size_t res_size = 0;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
int c;
|
||||
char buf1[50+1];
|
||||
char buf2[50+1];
|
||||
size_t l1, l2;
|
||||
char *old_res_ptr;
|
||||
|
||||
c = getc (fp);
|
||||
if (c == EOF)
|
||||
break;
|
||||
if (c == '\n' || c == ' ' || c == '\t')
|
||||
continue;
|
||||
if (c == '#')
|
||||
{
|
||||
/* Skip comment, to end of line. */
|
||||
do
|
||||
c = getc (fp);
|
||||
while (!(c == EOF || c == '\n'));
|
||||
if (c == EOF)
|
||||
break;
|
||||
continue;
|
||||
}
|
||||
ungetc (c, fp);
|
||||
if (fscanf (fp, "%50s %50s", buf1, buf2) < 2)
|
||||
break;
|
||||
l1 = strlen (buf1);
|
||||
l2 = strlen (buf2);
|
||||
old_res_ptr = res_ptr;
|
||||
if (res_size == 0)
|
||||
{
|
||||
res_size = l1 + 1 + l2 + 1;
|
||||
res_ptr = (char *) malloc (res_size + 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
res_size += l1 + 1 + l2 + 1;
|
||||
res_ptr = (char *) realloc (res_ptr, res_size + 1);
|
||||
}
|
||||
if (res_ptr == NULL)
|
||||
{
|
||||
/* Out of memory. */
|
||||
res_size = 0;
|
||||
free (old_res_ptr);
|
||||
break;
|
||||
}
|
||||
strcpy (res_ptr + res_size - (l2 + 1) - (l1 + 1), buf1);
|
||||
strcpy (res_ptr + res_size - (l2 + 1), buf2);
|
||||
}
|
||||
fclose (fp);
|
||||
if (res_size == 0)
|
||||
cp = "";
|
||||
else
|
||||
{
|
||||
*(res_ptr + res_size) = '\0';
|
||||
cp = res_ptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
free (file_name);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
# if defined DARWIN7
|
||||
/* To avoid the trouble of installing a file that is shared by many
|
||||
GNU packages -- many packaging systems have problems with this --,
|
||||
simply inline the aliases here. */
|
||||
cp = "ISO8859-1" "\0" "ISO-8859-1" "\0"
|
||||
"ISO8859-2" "\0" "ISO-8859-2" "\0"
|
||||
"ISO8859-4" "\0" "ISO-8859-4" "\0"
|
||||
"ISO8859-5" "\0" "ISO-8859-5" "\0"
|
||||
"ISO8859-7" "\0" "ISO-8859-7" "\0"
|
||||
"ISO8859-9" "\0" "ISO-8859-9" "\0"
|
||||
"ISO8859-13" "\0" "ISO-8859-13" "\0"
|
||||
"ISO8859-15" "\0" "ISO-8859-15" "\0"
|
||||
"KOI8-R" "\0" "KOI8-R" "\0"
|
||||
"KOI8-U" "\0" "KOI8-U" "\0"
|
||||
"CP866" "\0" "CP866" "\0"
|
||||
"CP949" "\0" "CP949" "\0"
|
||||
"CP1131" "\0" "CP1131" "\0"
|
||||
"CP1251" "\0" "CP1251" "\0"
|
||||
"eucCN" "\0" "GB2312" "\0"
|
||||
"GB2312" "\0" "GB2312" "\0"
|
||||
"eucJP" "\0" "EUC-JP" "\0"
|
||||
"eucKR" "\0" "EUC-KR" "\0"
|
||||
"Big5" "\0" "BIG5" "\0"
|
||||
"Big5HKSCS" "\0" "BIG5-HKSCS" "\0"
|
||||
"GBK" "\0" "GBK" "\0"
|
||||
"GB18030" "\0" "GB18030" "\0"
|
||||
"SJIS" "\0" "SHIFT_JIS" "\0"
|
||||
"ARMSCII-8" "\0" "ARMSCII-8" "\0"
|
||||
"PT154" "\0" "PT154" "\0"
|
||||
/*"ISCII-DEV" "\0" "?" "\0"*/
|
||||
"*" "\0" "UTF-8" "\0";
|
||||
# endif
|
||||
|
||||
# if defined VMS
|
||||
/* To avoid the troubles of an extra file charset.alias_vms in the
|
||||
sources of many GNU packages, simply inline the aliases here. */
|
||||
/* The list of encodings is taken from the OpenVMS 7.3-1 documentation
|
||||
"Compaq C Run-Time Library Reference Manual for OpenVMS systems"
|
||||
section 10.7 "Handling Different Character Sets". */
|
||||
cp = "ISO8859-1" "\0" "ISO-8859-1" "\0"
|
||||
"ISO8859-2" "\0" "ISO-8859-2" "\0"
|
||||
"ISO8859-5" "\0" "ISO-8859-5" "\0"
|
||||
"ISO8859-7" "\0" "ISO-8859-7" "\0"
|
||||
"ISO8859-8" "\0" "ISO-8859-8" "\0"
|
||||
"ISO8859-9" "\0" "ISO-8859-9" "\0"
|
||||
/* Japanese */
|
||||
"eucJP" "\0" "EUC-JP" "\0"
|
||||
"SJIS" "\0" "SHIFT_JIS" "\0"
|
||||
"DECKANJI" "\0" "DEC-KANJI" "\0"
|
||||
"SDECKANJI" "\0" "EUC-JP" "\0"
|
||||
/* Chinese */
|
||||
"eucTW" "\0" "EUC-TW" "\0"
|
||||
"DECHANYU" "\0" "DEC-HANYU" "\0"
|
||||
"DECHANZI" "\0" "GB2312" "\0"
|
||||
/* Korean */
|
||||
"DECKOREAN" "\0" "EUC-KR" "\0";
|
||||
# endif
|
||||
|
||||
# if defined WIN32_NATIVE || defined __CYGWIN__
|
||||
/* To avoid the troubles of installing a separate file in the same
|
||||
directory as the DLL and of retrieving the DLL's directory at
|
||||
runtime, simply inline the aliases here. */
|
||||
|
||||
cp = "CP936" "\0" "GBK" "\0"
|
||||
"CP1361" "\0" "JOHAB" "\0"
|
||||
"CP20127" "\0" "ASCII" "\0"
|
||||
"CP20866" "\0" "KOI8-R" "\0"
|
||||
"CP20936" "\0" "GB2312" "\0"
|
||||
"CP21866" "\0" "KOI8-RU" "\0"
|
||||
"CP28591" "\0" "ISO-8859-1" "\0"
|
||||
"CP28592" "\0" "ISO-8859-2" "\0"
|
||||
"CP28593" "\0" "ISO-8859-3" "\0"
|
||||
"CP28594" "\0" "ISO-8859-4" "\0"
|
||||
"CP28595" "\0" "ISO-8859-5" "\0"
|
||||
"CP28596" "\0" "ISO-8859-6" "\0"
|
||||
"CP28597" "\0" "ISO-8859-7" "\0"
|
||||
"CP28598" "\0" "ISO-8859-8" "\0"
|
||||
"CP28599" "\0" "ISO-8859-9" "\0"
|
||||
"CP28605" "\0" "ISO-8859-15" "\0"
|
||||
"CP38598" "\0" "ISO-8859-8" "\0"
|
||||
"CP51932" "\0" "EUC-JP" "\0"
|
||||
"CP51936" "\0" "GB2312" "\0"
|
||||
"CP51949" "\0" "EUC-KR" "\0"
|
||||
"CP51950" "\0" "EUC-TW" "\0"
|
||||
"CP54936" "\0" "GB18030" "\0"
|
||||
"CP65001" "\0" "UTF-8" "\0";
|
||||
# endif
|
||||
#endif
|
||||
|
||||
charset_aliases = cp;
|
||||
}
|
||||
|
||||
return cp;
|
||||
}
|
||||
|
||||
/* Determine the current locale's character encoding, and canonicalize it
|
||||
into one of the canonical names listed in config.charset.
|
||||
The result must not be freed; it is statically allocated.
|
||||
If the canonical name cannot be determined, the result is a non-canonical
|
||||
name. */
|
||||
|
||||
#ifdef STATIC
|
||||
STATIC
|
||||
#endif
|
||||
const char *
|
||||
locale_charset (void)
|
||||
{
|
||||
const char *codeset;
|
||||
const char *aliases;
|
||||
|
||||
#if !(defined WIN32_NATIVE || defined OS2)
|
||||
|
||||
# if HAVE_LANGINFO_CODESET
|
||||
|
||||
/* Most systems support nl_langinfo (CODESET) nowadays. */
|
||||
codeset = nl_langinfo (CODESET);
|
||||
|
||||
# ifdef __CYGWIN__
|
||||
/* Cygwin < 1.7 does not have locales. nl_langinfo (CODESET) always
|
||||
returns "US-ASCII". Return the suffix of the locale name from the
|
||||
environment variables (if present) or the codepage as a number. */
|
||||
if (codeset != NULL && strcmp (codeset, "US-ASCII") == 0)
|
||||
{
|
||||
const char *locale;
|
||||
static char buf[2 + 10 + 1];
|
||||
|
||||
locale = getenv ("LC_ALL");
|
||||
if (locale == NULL || locale[0] == '\0')
|
||||
{
|
||||
locale = getenv ("LC_CTYPE");
|
||||
if (locale == NULL || locale[0] == '\0')
|
||||
locale = getenv ("LANG");
|
||||
}
|
||||
if (locale != NULL && locale[0] != '\0')
|
||||
{
|
||||
/* If the locale name contains an encoding after the dot, return
|
||||
it. */
|
||||
const char *dot = strchr (locale, '.');
|
||||
|
||||
if (dot != NULL)
|
||||
{
|
||||
const char *modifier;
|
||||
|
||||
dot++;
|
||||
/* Look for the possible @... trailer and remove it, if any. */
|
||||
modifier = strchr (dot, '@');
|
||||
if (modifier == NULL)
|
||||
return dot;
|
||||
if (modifier - dot < sizeof (buf))
|
||||
{
|
||||
memcpy (buf, dot, modifier - dot);
|
||||
buf [modifier - dot] = '\0';
|
||||
return buf;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Woe32 has a function returning the locale's codepage as a number:
|
||||
GetACP(). This encoding is used by Cygwin, unless the user has set
|
||||
the environment variable CYGWIN=codepage:oem (which very few people
|
||||
do).
|
||||
Output directed to console windows needs to be converted (to
|
||||
GetOEMCP() if the console is using a raster font, or to
|
||||
GetConsoleOutputCP() if it is using a TrueType font). Cygwin does
|
||||
this conversion transparently (see winsup/cygwin/fhandler_console.cc),
|
||||
converting to GetConsoleOutputCP(). This leads to correct results,
|
||||
except when SetConsoleOutputCP has been called and a raster font is
|
||||
in use. */
|
||||
sprintf (buf, "CP%u", GetACP ());
|
||||
codeset = buf;
|
||||
}
|
||||
# endif
|
||||
|
||||
# else
|
||||
|
||||
/* On old systems which lack it, use setlocale or getenv. */
|
||||
const char *locale = NULL;
|
||||
|
||||
/* But most old systems don't have a complete set of locales. Some
|
||||
(like SunOS 4 or DJGPP) have only the C locale. Therefore we don't
|
||||
use setlocale here; it would return "C" when it doesn't support the
|
||||
locale name the user has set. */
|
||||
# if 0
|
||||
locale = setlocale (LC_CTYPE, NULL);
|
||||
# endif
|
||||
if (locale == NULL || locale[0] == '\0')
|
||||
{
|
||||
locale = getenv ("LC_ALL");
|
||||
if (locale == NULL || locale[0] == '\0')
|
||||
{
|
||||
locale = getenv ("LC_CTYPE");
|
||||
if (locale == NULL || locale[0] == '\0')
|
||||
locale = getenv ("LANG");
|
||||
}
|
||||
}
|
||||
|
||||
/* On some old systems, one used to set locale = "iso8859_1". On others,
|
||||
you set it to "language_COUNTRY.charset". In any case, we resolve it
|
||||
through the charset.alias file. */
|
||||
codeset = locale;
|
||||
|
||||
# endif
|
||||
|
||||
#elif defined WIN32_NATIVE
|
||||
|
||||
static char buf[2 + 10 + 1];
|
||||
|
||||
/* Woe32 has a function returning the locale's codepage as a number:
|
||||
GetACP().
|
||||
When the output goes to a console window, it needs to be provided in
|
||||
GetOEMCP() encoding if the console is using a raster font, or in
|
||||
GetConsoleOutputCP() encoding if it is using a TrueType font.
|
||||
But in GUI programs and for output sent to files and pipes, GetACP()
|
||||
encoding is the best bet. */
|
||||
sprintf (buf, "CP%u", GetACP ());
|
||||
codeset = buf;
|
||||
|
||||
#elif defined OS2
|
||||
|
||||
const char *locale;
|
||||
static char buf[2 + 10 + 1];
|
||||
ULONG cp[3];
|
||||
ULONG cplen;
|
||||
|
||||
/* Allow user to override the codeset, as set in the operating system,
|
||||
with standard language environment variables. */
|
||||
locale = getenv ("LC_ALL");
|
||||
if (locale == NULL || locale[0] == '\0')
|
||||
{
|
||||
locale = getenv ("LC_CTYPE");
|
||||
if (locale == NULL || locale[0] == '\0')
|
||||
locale = getenv ("LANG");
|
||||
}
|
||||
if (locale != NULL && locale[0] != '\0')
|
||||
{
|
||||
/* If the locale name contains an encoding after the dot, return it. */
|
||||
const char *dot = strchr (locale, '.');
|
||||
|
||||
if (dot != NULL)
|
||||
{
|
||||
const char *modifier;
|
||||
|
||||
dot++;
|
||||
/* Look for the possible @... trailer and remove it, if any. */
|
||||
modifier = strchr (dot, '@');
|
||||
if (modifier == NULL)
|
||||
return dot;
|
||||
if (modifier - dot < sizeof (buf))
|
||||
{
|
||||
memcpy (buf, dot, modifier - dot);
|
||||
buf [modifier - dot] = '\0';
|
||||
return buf;
|
||||
}
|
||||
}
|
||||
|
||||
/* Resolve through the charset.alias file. */
|
||||
codeset = locale;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* OS/2 has a function returning the locale's codepage as a number. */
|
||||
if (DosQueryCp (sizeof (cp), cp, &cplen))
|
||||
codeset = "";
|
||||
else
|
||||
{
|
||||
sprintf (buf, "CP%u", cp[0]);
|
||||
codeset = buf;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
if (codeset == NULL)
|
||||
/* The canonical name cannot be determined. */
|
||||
codeset = "";
|
||||
|
||||
/* Resolve alias. */
|
||||
for (aliases = get_charset_aliases ();
|
||||
*aliases != '\0';
|
||||
aliases += strlen (aliases) + 1, aliases += strlen (aliases) + 1)
|
||||
if (strcmp (codeset, aliases) == 0
|
||||
|| (aliases[0] == '*' && aliases[1] == '\0'))
|
||||
{
|
||||
codeset = aliases + strlen (aliases) + 1;
|
||||
break;
|
||||
}
|
||||
|
||||
/* Don't return an empty string. GNU libc and GNU libiconv interpret
|
||||
the empty string as denoting "the locale's character encoding",
|
||||
thus GNU libiconv would call this function a second time. */
|
||||
if (codeset[0] == '\0')
|
||||
codeset = "ASCII";
|
||||
|
||||
return codeset;
|
||||
}
|
||||
|
||||
/* A variant of the above, without calls to `setlocale', `nl_langinfo',
|
||||
etc. */
|
||||
const char *
|
||||
environ_locale_charset (void)
|
||||
{
|
||||
static char buf[2 + 10 + 1];
|
||||
const char *codeset, *aliases;
|
||||
const char *locale = NULL;
|
||||
|
||||
locale = getenv ("LC_ALL");
|
||||
if (locale == NULL || locale[0] == '\0')
|
||||
{
|
||||
locale = getenv ("LC_CTYPE");
|
||||
if (locale == NULL || locale[0] == '\0')
|
||||
locale = getenv ("LANG");
|
||||
}
|
||||
|
||||
if (locale != NULL && locale[0] != '\0')
|
||||
{
|
||||
/* If the locale name contains an encoding after the dot, return it. */
|
||||
const char *dot = strchr (locale, '.');
|
||||
|
||||
if (dot != NULL)
|
||||
{
|
||||
const char *modifier;
|
||||
|
||||
dot++;
|
||||
/* Look for the possible @... trailer and remove it, if any. */
|
||||
modifier = strchr (dot, '@');
|
||||
if (modifier == NULL)
|
||||
return dot;
|
||||
if (modifier - dot < sizeof (buf))
|
||||
{
|
||||
memcpy (buf, dot, modifier - dot);
|
||||
buf [modifier - dot] = '\0';
|
||||
return buf;
|
||||
}
|
||||
}
|
||||
else if (strcmp (locale, "C") == 0)
|
||||
{
|
||||
strcpy (buf, "ASCII");
|
||||
return buf;
|
||||
}
|
||||
|
||||
/* Resolve through the charset.alias file. */
|
||||
codeset = locale;
|
||||
}
|
||||
else
|
||||
codeset = "";
|
||||
|
||||
/* Resolve alias. */
|
||||
for (aliases = get_charset_aliases ();
|
||||
*aliases != '\0';
|
||||
aliases += strlen (aliases) + 1, aliases += strlen (aliases) + 1)
|
||||
if (strcmp (codeset, aliases) == 0
|
||||
|| (aliases[0] == '*' && aliases[1] == '\0'))
|
||||
{
|
||||
codeset = aliases + strlen (aliases) + 1;
|
||||
break;
|
||||
}
|
||||
|
||||
/* Don't return an empty string. GNU libc and GNU libiconv interpret
|
||||
the empty string as denoting "the locale's character encoding",
|
||||
thus GNU libiconv would call this function a second time. */
|
||||
if (codeset[0] == '\0')
|
||||
codeset = "ASCII";
|
||||
|
||||
return codeset;
|
||||
}
|
47
lib/localcharset.h
Normal file
47
lib/localcharset.h
Normal file
|
@ -0,0 +1,47 @@
|
|||
/* Determine a canonical name for the current locale's character encoding.
|
||||
Copyright (C) 2000-2003, 2009-2011 Free Software Foundation, Inc.
|
||||
This file is part of the GNU CHARSET Library.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License along
|
||||
with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||
|
||||
#ifndef _LOCALCHARSET_H
|
||||
#define _LOCALCHARSET_H
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/* Determine the current locale's character encoding, and canonicalize it
|
||||
into one of the canonical names listed in config.charset.
|
||||
The result must not be freed; it is statically allocated.
|
||||
If the canonical name cannot be determined, the result is a non-canonical
|
||||
name. */
|
||||
extern const char * locale_charset (void);
|
||||
|
||||
/* Same as above, but only look at environment variables, avoiding calls to
|
||||
`setlocale', `nl_langinfo', etc. See
|
||||
<http://lists.gnu.org/archive/html/guile-devel/2011-11/msg00040.html> for
|
||||
the rationale. */
|
||||
extern const char * environ_locale_charset (void);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* _LOCALCHARSET_H */
|
|
@ -507,6 +507,80 @@ _GL_WARN_ON_USE (floorl, "floorl is unportable - "
|
|||
#endif
|
||||
|
||||
|
||||
#if @GNULIB_FMAF@
|
||||
# if @REPLACE_FMAF@
|
||||
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
||||
# undef fmaf
|
||||
# define fmaf rpl_fmaf
|
||||
# endif
|
||||
_GL_FUNCDECL_RPL (fmaf, float, (float x, float y, float z));
|
||||
_GL_CXXALIAS_RPL (fmaf, float, (float x, float y, float z));
|
||||
# else
|
||||
# if !@HAVE_FMAF@
|
||||
_GL_FUNCDECL_SYS (fmaf, float, (float x, float y, float z));
|
||||
# endif
|
||||
_GL_CXXALIAS_SYS (fmaf, float, (float x, float y, float z));
|
||||
# endif
|
||||
_GL_CXXALIASWARN (fmaf);
|
||||
#elif defined GNULIB_POSIXCHECK
|
||||
# undef fmaf
|
||||
# if HAVE_RAW_DECL_FMAF
|
||||
_GL_WARN_ON_USE (fmaf, "fmaf is unportable - "
|
||||
"use gnulib module fmaf for portability");
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if @GNULIB_FMA@
|
||||
# if @REPLACE_FMA@
|
||||
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
||||
# undef fma
|
||||
# define fma rpl_fma
|
||||
# endif
|
||||
_GL_FUNCDECL_RPL (fma, double, (double x, double y, double z));
|
||||
_GL_CXXALIAS_RPL (fma, double, (double x, double y, double z));
|
||||
# else
|
||||
# if !@HAVE_FMA@
|
||||
_GL_FUNCDECL_SYS (fma, double, (double x, double y, double z));
|
||||
# endif
|
||||
_GL_CXXALIAS_SYS (fma, double, (double x, double y, double z));
|
||||
# endif
|
||||
_GL_CXXALIASWARN (fma);
|
||||
#elif defined GNULIB_POSIXCHECK
|
||||
# undef fma
|
||||
# if HAVE_RAW_DECL_FMA
|
||||
_GL_WARN_ON_USE (fma, "fma is unportable - "
|
||||
"use gnulib module fma for portability");
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if @GNULIB_FMAL@
|
||||
# if @REPLACE_FMAL@
|
||||
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
||||
# undef fmal
|
||||
# define fmal rpl_fmal
|
||||
# endif
|
||||
_GL_FUNCDECL_RPL (fmal, long double,
|
||||
(long double x, long double y, long double z));
|
||||
_GL_CXXALIAS_RPL (fmal, long double,
|
||||
(long double x, long double y, long double z));
|
||||
# else
|
||||
# if !@HAVE_FMAL@
|
||||
_GL_FUNCDECL_SYS (fmal, long double,
|
||||
(long double x, long double y, long double z));
|
||||
# endif
|
||||
_GL_CXXALIAS_SYS (fmal, long double,
|
||||
(long double x, long double y, long double z));
|
||||
# endif
|
||||
_GL_CXXALIASWARN (fmal);
|
||||
#elif defined GNULIB_POSIXCHECK
|
||||
# undef fmal
|
||||
# if HAVE_RAW_DECL_FMAL
|
||||
_GL_WARN_ON_USE (fmal, "fmal is unportable - "
|
||||
"use gnulib module fmal for portability");
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
||||
#if @GNULIB_FMODF@
|
||||
# if !@HAVE_FMODF@
|
||||
# undef fmodf
|
||||
|
@ -1172,7 +1246,7 @@ _GL_EXTERN_C int isnand (double x);
|
|||
/* Test whether X is a NaN. */
|
||||
# undef isnanl
|
||||
# define isnanl rpl_isnanl
|
||||
_GL_EXTERN_C int isnanl (long double x);
|
||||
_GL_EXTERN_C int isnanl (long double x) _GL_ATTRIBUTE_CONST;
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
@ -1198,7 +1272,7 @@ _GL_EXTERN_C int rpl_isnand (double x);
|
|||
# if @HAVE_ISNANL@ && __GNUC__ >= 4
|
||||
# define gl_isnan_l(x) __builtin_isnanl ((long double)(x))
|
||||
# else
|
||||
_GL_EXTERN_C int rpl_isnanl (long double x);
|
||||
_GL_EXTERN_C int rpl_isnanl (long double x) _GL_ATTRIBUTE_CONST;
|
||||
# define gl_isnan_l(x) rpl_isnanl (x)
|
||||
# endif
|
||||
# undef isnan
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
|
||||
#if _LIBC
|
||||
# if HAVE_GNU_LD
|
||||
# define environ __environ
|
||||
# define environ __environ
|
||||
# else
|
||||
extern char **environ;
|
||||
# endif
|
||||
|
|
30
lib/ref-add.sin
Normal file
30
lib/ref-add.sin
Normal file
|
@ -0,0 +1,30 @@
|
|||
# Add this package to a list of references stored in a text file.
|
||||
#
|
||||
# Copyright (C) 2000, 2009-2011 Free Software Foundation, Inc.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Lesser General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Lesser General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public License along
|
||||
# with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# Written by Bruno Haible <haible@clisp.cons.org>.
|
||||
#
|
||||
/^# Packages using this file: / {
|
||||
s/# Packages using this file://
|
||||
ta
|
||||
:a
|
||||
s/ @PACKAGE@ / @PACKAGE@ /
|
||||
tb
|
||||
s/ $/ @PACKAGE@ /
|
||||
:b
|
||||
s/^/# Packages using this file:/
|
||||
}
|
25
lib/ref-del.sin
Normal file
25
lib/ref-del.sin
Normal file
|
@ -0,0 +1,25 @@
|
|||
# Remove this package from a list of references stored in a text file.
|
||||
#
|
||||
# Copyright (C) 2000, 2009-2011 Free Software Foundation, Inc.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Lesser General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Lesser General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public License along
|
||||
# with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# Written by Bruno Haible <haible@clisp.cons.org>.
|
||||
#
|
||||
/^# Packages using this file: / {
|
||||
s/# Packages using this file://
|
||||
s/ @PACKAGE@ / /
|
||||
s/^/# Packages using this file:/
|
||||
}
|
|
@ -26,8 +26,17 @@
|
|||
#define SOCKETS_2_1 0x201
|
||||
#define SOCKETS_2_2 0x202
|
||||
|
||||
int gl_sockets_startup (int version);
|
||||
int gl_sockets_cleanup (void);
|
||||
int gl_sockets_startup (int version)
|
||||
#if !WINDOWS_SOCKETS
|
||||
_GL_ATTRIBUTE_CONST
|
||||
#endif
|
||||
;
|
||||
|
||||
int gl_sockets_cleanup (void)
|
||||
#if !WINDOWS_SOCKETS
|
||||
_GL_ATTRIBUTE_CONST
|
||||
#endif
|
||||
;
|
||||
|
||||
/* This function is useful it you create a socket using gnulib's
|
||||
Winsock wrappers but needs to pass on the socket handle to some
|
||||
|
|
89
lib/stdalign.in.h
Normal file
89
lib/stdalign.in.h
Normal file
|
@ -0,0 +1,89 @@
|
|||
/* A substitute for ISO C 1x <stdalign.h>.
|
||||
|
||||
Copyright 2011 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||
|
||||
/* Written by Paul Eggert and Bruno Haible. */
|
||||
|
||||
#ifndef _GL_STDALIGN_H
|
||||
#define _GL_STDALIGN_H
|
||||
|
||||
/* ISO C1X <stdalign.h> for platforms that lack it.
|
||||
|
||||
References:
|
||||
ISO C1X <http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1570.pdf>
|
||||
sections 6.5.3.4, 6.7.5, 7.15.
|
||||
C++0X <http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2011/n3242.pdf>
|
||||
section 18.10. */
|
||||
|
||||
/* alignof (TYPE), also known as _Alignof (TYPE), yields the alignment
|
||||
requirement of a structure member (i.e., slot or field) that is of
|
||||
type TYPE, as an integer constant expression.
|
||||
|
||||
This differs from GCC's __alignof__ operator, which can yield a
|
||||
better-performing alignment for an object of that type. For
|
||||
example, on x86 with GCC, __alignof__ (double) and __alignof__
|
||||
(long long) are 8, whereas alignof (double) and alignof (long long)
|
||||
are 4 unless the option '-malign-double' is used.
|
||||
|
||||
The result cannot be used as a value for an 'enum' constant, if you
|
||||
want to be portable to HP-UX 10.20 cc and AIX 3.2.5 xlc. */
|
||||
#include <stddef.h>
|
||||
#if defined __cplusplus
|
||||
template <class __t> struct __alignof_helper { char __a; __t __b; };
|
||||
# define _Alignof(type) offsetof (__alignof_helper<type>, __b)
|
||||
#else
|
||||
# define _Alignof(type) offsetof (struct { char __a; type __b; }, __b)
|
||||
#endif
|
||||
#define alignof _Alignof
|
||||
#define __alignof_is_defined 1
|
||||
|
||||
/* alignas (A), also known as _Alignas (A), aligns a variable or type
|
||||
to the alignment A, where A is an integer constant expression. For
|
||||
example:
|
||||
|
||||
int alignas (8) foo;
|
||||
struct s { int a; int alignas (8) bar; };
|
||||
|
||||
aligns the address of FOO and the offset of BAR to be multiples of 8.
|
||||
|
||||
A should be a power of two that is at least the type's alignment
|
||||
and at most the implementation's alignment limit. This limit is
|
||||
2**28 on typical GNUish hosts, and 2**13 on MSVC. To be portable
|
||||
to MSVC through at least version 10.0, A should be an integer
|
||||
constant, as MSVC does not support expressions such as 1 << 3.
|
||||
To be portable to Sun C 5.11, do not align auto variables to
|
||||
anything stricter than their default alignment.
|
||||
|
||||
The following draft C1X requirements are not supported here:
|
||||
|
||||
- If A is zero, alignas has no effect.
|
||||
- alignas can be used multiple times; the strictest one wins.
|
||||
- alignas (TYPE) is equivalent to alignas (alignof (TYPE)).
|
||||
|
||||
*/
|
||||
|
||||
#if __GNUC__ || __IBMC__ || __IBMCPP__ || 0x5110 <= __SUNPRO_C
|
||||
# define _Alignas(a) __attribute__ ((__aligned__ (a)))
|
||||
#elif 1300 <= _MSC_VER
|
||||
# define _Alignas(a) __declspec (align (a))
|
||||
#endif
|
||||
#ifdef _Alignas
|
||||
# define alignas _Alignas
|
||||
# define __alignas_is_defined 1
|
||||
#endif
|
||||
|
||||
#endif /* _GL_STDALIGN_H */
|
|
@ -49,6 +49,17 @@
|
|||
diagnostics. */
|
||||
# define __STDINT_H__
|
||||
# endif
|
||||
|
||||
/* Some pre-C++11 <stdint.h> implementations need this. */
|
||||
# ifdef __cplusplus
|
||||
# ifndef __STDC_CONSTANT_MACROS
|
||||
# define __STDC_CONSTANT_MACROS 1
|
||||
# endif
|
||||
# ifndef __STDC_LIMIT_MACROS
|
||||
# define __STDC_LIMIT_MACROS 1
|
||||
# endif
|
||||
# endif
|
||||
|
||||
/* Other systems may have an incomplete or buggy <stdint.h>.
|
||||
Include it before <inttypes.h>, since any "#include <stdint.h>"
|
||||
in <inttypes.h> would reinclude us, skipping our contents because
|
||||
|
@ -313,8 +324,6 @@ typedef int _verify_intmax_size[sizeof (intmax_t) == sizeof (uintmax_t)
|
|||
|
||||
/* 7.18.2. Limits of specified-width integer types */
|
||||
|
||||
#if ! defined __cplusplus || defined __STDC_LIMIT_MACROS
|
||||
|
||||
/* 7.18.2.1. Limits of exact-width integer types */
|
||||
|
||||
/* Here we assume a standard architecture where the hardware integer
|
||||
|
@ -534,12 +543,8 @@ typedef int _verify_intmax_size[sizeof (intmax_t) == sizeof (uintmax_t)
|
|||
#define WINT_MAX \
|
||||
_STDINT_MAX (@HAVE_SIGNED_WINT_T@, @BITSIZEOF_WINT_T@, 0@WINT_T_SUFFIX@)
|
||||
|
||||
#endif /* !defined __cplusplus || defined __STDC_LIMIT_MACROS */
|
||||
|
||||
/* 7.18.4. Macros for integer constants */
|
||||
|
||||
#if ! defined __cplusplus || defined __STDC_CONSTANT_MACROS
|
||||
|
||||
/* 7.18.4.1. Macros for minimum-width integer constants */
|
||||
/* According to ISO C 99 Technical Corrigendum 1 */
|
||||
|
||||
|
@ -600,7 +605,5 @@ typedef int _verify_intmax_size[sizeof (intmax_t) == sizeof (uintmax_t)
|
|||
# endif
|
||||
#endif
|
||||
|
||||
#endif /* !defined __cplusplus || defined __STDC_CONSTANT_MACROS */
|
||||
|
||||
#endif /* _@GUARD_PREFIX@_STDINT_H */
|
||||
#endif /* !defined _@GUARD_PREFIX@_STDINT_H && !defined _GL_JUST_INCLUDE_SYSTEM_STDINT_H */
|
||||
|
|
|
@ -247,7 +247,7 @@ _GL_CXXALIASWARN (grantpt);
|
|||
#elif defined GNULIB_POSIXCHECK
|
||||
# undef grantpt
|
||||
# if HAVE_RAW_DECL_GRANTPT
|
||||
_GL_WARN_ON_USE (ptsname, "grantpt is not portable - "
|
||||
_GL_WARN_ON_USE (grantpt, "grantpt is not portable - "
|
||||
"use gnulib module grantpt for portability");
|
||||
# endif
|
||||
#endif
|
||||
|
@ -455,6 +455,32 @@ _GL_WARN_ON_USE (ptsname, "ptsname is not portable - "
|
|||
# endif
|
||||
#endif
|
||||
|
||||
#if @GNULIB_PTSNAME_R@
|
||||
/* Set the pathname of the pseudo-terminal slave associated with
|
||||
the master FD is open on and return 0, or set errno and return
|
||||
non-zero on errors. */
|
||||
# if @REPLACE_PTSNAME_R@
|
||||
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
||||
# undef ptsname_r
|
||||
# define ptsname_r rpl_ptsname_r
|
||||
# endif
|
||||
_GL_FUNCDECL_RPL (ptsname_r, int, (int fd, char *buf, size_t len));
|
||||
_GL_CXXALIAS_RPL (ptsname_r, int, (int fd, char *buf, size_t len));
|
||||
# else
|
||||
# if !@HAVE_PTSNAME_R@
|
||||
_GL_FUNCDECL_SYS (ptsname_r, int, (int fd, char *buf, size_t len));
|
||||
# endif
|
||||
_GL_CXXALIAS_SYS (ptsname_r, int, (int fd, char *buf, size_t len));
|
||||
# endif
|
||||
_GL_CXXALIASWARN (ptsname_r);
|
||||
#elif defined GNULIB_POSIXCHECK
|
||||
# undef ptsname_r
|
||||
# if HAVE_RAW_DECL_PTSNAME_R
|
||||
_GL_WARN_ON_USE (ptsname_r, "ptsname_r is not portable - "
|
||||
"use gnulib module ptsname_r for portability");
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if @GNULIB_PUTENV@
|
||||
# if @REPLACE_PUTENV@
|
||||
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
||||
|
|
|
@ -85,7 +85,7 @@ typedef unsigned short sa_family_t;
|
|||
# endif
|
||||
# endif
|
||||
#else
|
||||
# include <alignof.h>
|
||||
# include <stdalign.h>
|
||||
/* Code taken from glibc sysdeps/unix/sysv/linux/bits/socket.h on
|
||||
2009-05-08, licensed under LGPLv2.1+, plus portability fixes. */
|
||||
# define __ss_aligntype unsigned long int
|
||||
|
|
|
@ -1268,6 +1268,33 @@ _GL_WARN_ON_USE (rmdir, "rmdir is unportable - "
|
|||
#endif
|
||||
|
||||
|
||||
#if @GNULIB_SETHOSTNAME@
|
||||
/* Set the host name of the machine.
|
||||
The host name may or may not be fully qualified.
|
||||
|
||||
Put LEN bytes of NAME into the host name.
|
||||
Return 0 if successful, otherwise, set errno and return -1.
|
||||
|
||||
Platforms with no ability to set the hostname return -1 and set
|
||||
errno = ENOSYS. */
|
||||
# if !@HAVE_SETHOSTNAME@ || !@HAVE_DECL_SETHOSTNAME@
|
||||
_GL_FUNCDECL_SYS (sethostname, int, (const char *name, size_t len)
|
||||
_GL_ARG_NONNULL ((1)));
|
||||
# endif
|
||||
/* Need to cast, because on Solaris 11 2011-10, MacOS X 10.5, IRIX 6.5
|
||||
and FreeBSD 6.4 the second parameter is int. On Solaris 11
|
||||
2011-10, the first parameter is not const. */
|
||||
_GL_CXXALIAS_SYS_CAST (sethostname, int, (const char *name, size_t len));
|
||||
_GL_CXXALIASWARN (sethostname);
|
||||
#elif defined GNULIB_POSIXCHECK
|
||||
# undef sethostname
|
||||
# if HAVE_RAW_DECL_SETHOSTNAME
|
||||
_GL_WARN_ON_USE (sethostname, "sethostname is unportable - "
|
||||
"use gnulib module sethostname for portability");
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
||||
#if @GNULIB_SLEEP@
|
||||
/* Pause the execution of the current thread for N seconds.
|
||||
Returns the number of seconds left to sleep.
|
||||
|
|
|
@ -48,15 +48,87 @@ set_winsock_errno (void)
|
|||
case WSA_INVALID_PARAMETER:
|
||||
errno = EINVAL;
|
||||
break;
|
||||
case WSAEWOULDBLOCK:
|
||||
errno = EWOULDBLOCK;
|
||||
break;
|
||||
case WSAENAMETOOLONG:
|
||||
errno = ENAMETOOLONG;
|
||||
break;
|
||||
case WSAENOTEMPTY:
|
||||
errno = ENOTEMPTY;
|
||||
break;
|
||||
case WSAEWOULDBLOCK:
|
||||
errno = EWOULDBLOCK;
|
||||
break;
|
||||
case WSAEINPROGRESS:
|
||||
errno = EINPROGRESS;
|
||||
break;
|
||||
case WSAEALREADY:
|
||||
errno = EALREADY;
|
||||
break;
|
||||
case WSAENOTSOCK:
|
||||
errno = ENOTSOCK;
|
||||
break;
|
||||
case WSAEDESTADDRREQ:
|
||||
errno = EDESTADDRREQ;
|
||||
break;
|
||||
case WSAEMSGSIZE:
|
||||
errno = EMSGSIZE;
|
||||
break;
|
||||
case WSAEPROTOTYPE:
|
||||
errno = EPROTOTYPE;
|
||||
break;
|
||||
case WSAENOPROTOOPT:
|
||||
errno = ENOPROTOOPT;
|
||||
break;
|
||||
case WSAEPROTONOSUPPORT:
|
||||
errno = EPROTONOSUPPORT;
|
||||
break;
|
||||
case WSAEOPNOTSUPP:
|
||||
errno = EOPNOTSUPP;
|
||||
break;
|
||||
case WSAEAFNOSUPPORT:
|
||||
errno = EAFNOSUPPORT;
|
||||
break;
|
||||
case WSAEADDRINUSE:
|
||||
errno = EADDRINUSE;
|
||||
break;
|
||||
case WSAEADDRNOTAVAIL:
|
||||
errno = EADDRNOTAVAIL;
|
||||
break;
|
||||
case WSAENETDOWN:
|
||||
errno = ENETDOWN;
|
||||
break;
|
||||
case WSAENETUNREACH:
|
||||
errno = ENETUNREACH;
|
||||
break;
|
||||
case WSAENETRESET:
|
||||
errno = ENETRESET;
|
||||
break;
|
||||
case WSAECONNABORTED:
|
||||
errno = ECONNABORTED;
|
||||
break;
|
||||
case WSAECONNRESET:
|
||||
errno = ECONNRESET;
|
||||
break;
|
||||
case WSAENOBUFS:
|
||||
errno = ENOBUFS;
|
||||
break;
|
||||
case WSAEISCONN:
|
||||
errno = EISCONN;
|
||||
break;
|
||||
case WSAENOTCONN:
|
||||
errno = ENOTCONN;
|
||||
break;
|
||||
case WSAETIMEDOUT:
|
||||
errno = ETIMEDOUT;
|
||||
break;
|
||||
case WSAECONNREFUSED:
|
||||
errno = ECONNREFUSED;
|
||||
break;
|
||||
case WSAELOOP:
|
||||
errno = ELOOP;
|
||||
break;
|
||||
case WSAEHOSTUNREACH:
|
||||
errno = EHOSTUNREACH;
|
||||
break;
|
||||
default:
|
||||
errno = (err > 10000 && err < 10025) ? err - 10000 : err;
|
||||
break;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
/* Copyright (C) 1995,1996,1998,1999,2000,2001,2002, 2003, 2004, 2006, 2007, 2009, 2011 Free Software Foundation, Inc.
|
||||
*
|
||||
/* Copyright (C) 1995, 1996, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
|
||||
* 2006, 2007, 2009, 2011 Free Software Foundation, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public License
|
||||
* as published by the Free Software Foundation; either version 3 of
|
||||
|
@ -36,7 +37,8 @@
|
|||
|
||||
|
||||
|
||||
static SCM progargs_fluid;
|
||||
SCM scm_program_arguments_fluid;
|
||||
|
||||
static SCM features_var;
|
||||
|
||||
void
|
||||
|
@ -58,7 +60,7 @@ SCM_DEFINE (scm_program_arguments, "program-arguments", 0, 0, 0,
|
|||
"options like @code{-e} and @code{-l}.")
|
||||
#define FUNC_NAME s_scm_program_arguments
|
||||
{
|
||||
return scm_fluid_ref (progargs_fluid);
|
||||
return scm_fluid_ref (scm_program_arguments_fluid);
|
||||
}
|
||||
#undef FUNC_NAME
|
||||
|
||||
|
@ -74,7 +76,7 @@ scm_set_program_arguments (int argc, char **argv, char *first)
|
|||
SCM args = scm_makfromstrs (argc, argv);
|
||||
if (first)
|
||||
args = scm_cons (scm_from_locale_string (first), args);
|
||||
scm_fluid_set_x (progargs_fluid, args);
|
||||
scm_fluid_set_x (scm_program_arguments_fluid, args);
|
||||
}
|
||||
|
||||
SCM_DEFINE (scm_set_program_arguments_scm, "set-program-arguments", 1, 0, 0,
|
||||
|
@ -89,7 +91,7 @@ SCM_DEFINE (scm_set_program_arguments_scm, "set-program-arguments", 1, 0, 0,
|
|||
"strings within it are copied, so should not be modified later.")
|
||||
#define FUNC_NAME s_scm_set_program_arguments_scm
|
||||
{
|
||||
return scm_fluid_set_x (progargs_fluid, lst);
|
||||
return scm_fluid_set_x (scm_program_arguments_fluid, lst);
|
||||
}
|
||||
#undef FUNC_NAME
|
||||
|
||||
|
@ -99,7 +101,7 @@ SCM_DEFINE (scm_set_program_arguments_scm, "set-program-arguments", 1, 0, 0,
|
|||
void
|
||||
scm_init_feature()
|
||||
{
|
||||
progargs_fluid = scm_make_fluid ();
|
||||
scm_program_arguments_fluid = scm_make_fluid ();
|
||||
|
||||
features_var = scm_c_define ("*features*", SCM_EOL);
|
||||
#ifndef _Windows
|
||||
|
|
|
@ -3,7 +3,8 @@
|
|||
#ifndef SCM_FEATURE_H
|
||||
#define SCM_FEATURE_H
|
||||
|
||||
/* Copyright (C) 1995,1996,1999,2000,2001, 2006, 2007, 2008 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1995, 1996, 1999, 2000, 2001, 2006, 2007, 2008,
|
||||
* 2011 Free Software Foundation, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public License
|
||||
|
@ -29,6 +30,8 @@ SCM_API void scm_add_feature (const char* str);
|
|||
SCM_API SCM scm_program_arguments (void);
|
||||
SCM_API void scm_set_program_arguments (int argc, char **argv, char *first);
|
||||
SCM_API SCM scm_set_program_arguments_scm (SCM lst);
|
||||
|
||||
SCM_INTERNAL SCM scm_program_arguments_fluid;
|
||||
SCM_INTERNAL void scm_init_feature (void);
|
||||
|
||||
#endif /* SCM_FEATURE_H */
|
||||
|
|
|
@ -451,32 +451,32 @@ SCM_DEFINE (scm_alignof, "alignof", 1, 0, 0, (SCM type),
|
|||
switch (SCM_I_INUM (type))
|
||||
{
|
||||
case SCM_FOREIGN_TYPE_FLOAT:
|
||||
return scm_from_size_t (alignof (float));
|
||||
return scm_from_size_t (alignof_type (float));
|
||||
case SCM_FOREIGN_TYPE_DOUBLE:
|
||||
return scm_from_size_t (alignof (double));
|
||||
return scm_from_size_t (alignof_type (double));
|
||||
case SCM_FOREIGN_TYPE_UINT8:
|
||||
return scm_from_size_t (alignof (scm_t_uint8));
|
||||
return scm_from_size_t (alignof_type (scm_t_uint8));
|
||||
case SCM_FOREIGN_TYPE_INT8:
|
||||
return scm_from_size_t (alignof (scm_t_int8));
|
||||
return scm_from_size_t (alignof_type (scm_t_int8));
|
||||
case SCM_FOREIGN_TYPE_UINT16:
|
||||
return scm_from_size_t (alignof (scm_t_uint16));
|
||||
return scm_from_size_t (alignof_type (scm_t_uint16));
|
||||
case SCM_FOREIGN_TYPE_INT16:
|
||||
return scm_from_size_t (alignof (scm_t_int16));
|
||||
return scm_from_size_t (alignof_type (scm_t_int16));
|
||||
case SCM_FOREIGN_TYPE_UINT32:
|
||||
return scm_from_size_t (alignof (scm_t_uint32));
|
||||
return scm_from_size_t (alignof_type (scm_t_uint32));
|
||||
case SCM_FOREIGN_TYPE_INT32:
|
||||
return scm_from_size_t (alignof (scm_t_int32));
|
||||
return scm_from_size_t (alignof_type (scm_t_int32));
|
||||
case SCM_FOREIGN_TYPE_UINT64:
|
||||
return scm_from_size_t (alignof (scm_t_uint64));
|
||||
return scm_from_size_t (alignof_type (scm_t_uint64));
|
||||
case SCM_FOREIGN_TYPE_INT64:
|
||||
return scm_from_size_t (alignof (scm_t_int64));
|
||||
return scm_from_size_t (alignof_type (scm_t_int64));
|
||||
default:
|
||||
scm_wrong_type_arg (FUNC_NAME, 1, type);
|
||||
}
|
||||
}
|
||||
else if (scm_is_eq (type, sym_asterisk))
|
||||
/* a pointer */
|
||||
return scm_from_size_t (alignof (void*));
|
||||
return scm_from_size_t (alignof_type (void*));
|
||||
else if (scm_is_pair (type))
|
||||
{
|
||||
/* TYPE is a structure. Section 3-3 of the i386, x86_64, PowerPC,
|
||||
|
@ -704,12 +704,12 @@ make_cif (SCM return_type, SCM arg_types, const char *caller)
|
|||
|
||||
/* then ffi_type pointers: one for each arg, one for each struct
|
||||
element, and one for each struct (for null-termination) */
|
||||
cif_len = (ROUND_UP (cif_len, alignof(void*))
|
||||
cif_len = (ROUND_UP (cif_len, alignof_type (void *))
|
||||
+ (nargs + n_structs + n_struct_elts)*sizeof(void*));
|
||||
|
||||
/* then the ffi_type structs themselves, one per arg and struct element, and
|
||||
one for the return val */
|
||||
cif_len = (ROUND_UP (cif_len, alignof(ffi_type))
|
||||
cif_len = (ROUND_UP (cif_len, alignof_type (ffi_type))
|
||||
+ (nargs + n_struct_elts + 1)*sizeof(ffi_type));
|
||||
|
||||
mem = scm_gc_malloc_pointerless (cif_len, "foreign");
|
||||
|
@ -718,11 +718,11 @@ make_cif (SCM return_type, SCM arg_types, const char *caller)
|
|||
cif = (ffi_cif *) mem;
|
||||
|
||||
/* reuse cif_len to walk through the mem */
|
||||
cif_len = ROUND_UP (sizeof (ffi_cif), alignof(void*));
|
||||
cif_len = ROUND_UP (sizeof (ffi_cif), alignof_type (void *));
|
||||
type_ptrs = (ffi_type**)(mem + cif_len);
|
||||
cif_len = ROUND_UP (cif_len
|
||||
+ (nargs + n_structs + n_struct_elts)*sizeof(void*),
|
||||
alignof(ffi_type));
|
||||
alignof_type (ffi_type));
|
||||
types = (ffi_type*)(mem + cif_len);
|
||||
|
||||
/* whew. now knit the pointers together. */
|
||||
|
@ -910,7 +910,7 @@ cif_to_procedure (SCM cif, SCM func_ptr)
|
|||
|
||||
/* Set *LOC to the foreign representation of X with TYPE. */
|
||||
static void
|
||||
unpack (const ffi_type *type, void *loc, SCM x)
|
||||
unpack (const ffi_type *type, void *loc, SCM x, int return_value_p)
|
||||
#define FUNC_NAME "scm_i_foreign_call"
|
||||
{
|
||||
switch (type->type)
|
||||
|
@ -921,23 +921,45 @@ unpack (const ffi_type *type, void *loc, SCM x)
|
|||
case FFI_TYPE_DOUBLE:
|
||||
*(double *) loc = scm_to_double (x);
|
||||
break;
|
||||
|
||||
/* For integer return values smaller than `int', libffi expects the
|
||||
result in an `ffi_arg'-long buffer. */
|
||||
|
||||
case FFI_TYPE_UINT8:
|
||||
*(scm_t_uint8 *) loc = scm_to_uint8 (x);
|
||||
if (return_value_p)
|
||||
*(ffi_arg *) loc = scm_to_uint8 (x);
|
||||
else
|
||||
*(scm_t_uint8 *) loc = scm_to_uint8 (x);
|
||||
break;
|
||||
case FFI_TYPE_SINT8:
|
||||
*(scm_t_int8 *) loc = scm_to_int8 (x);
|
||||
if (return_value_p)
|
||||
*(ffi_arg *) loc = scm_to_int8 (x);
|
||||
else
|
||||
*(scm_t_int8 *) loc = scm_to_int8 (x);
|
||||
break;
|
||||
case FFI_TYPE_UINT16:
|
||||
*(scm_t_uint16 *) loc = scm_to_uint16 (x);
|
||||
if (return_value_p)
|
||||
*(ffi_arg *) loc = scm_to_uint16 (x);
|
||||
else
|
||||
*(scm_t_uint16 *) loc = scm_to_uint16 (x);
|
||||
break;
|
||||
case FFI_TYPE_SINT16:
|
||||
*(scm_t_int16 *) loc = scm_to_int16 (x);
|
||||
if (return_value_p)
|
||||
*(ffi_arg *) loc = scm_to_int16 (x);
|
||||
else
|
||||
*(scm_t_int16 *) loc = scm_to_int16 (x);
|
||||
break;
|
||||
case FFI_TYPE_UINT32:
|
||||
*(scm_t_uint32 *) loc = scm_to_uint32 (x);
|
||||
if (return_value_p)
|
||||
*(ffi_arg *) loc = scm_to_uint32 (x);
|
||||
else
|
||||
*(scm_t_uint32 *) loc = scm_to_uint32 (x);
|
||||
break;
|
||||
case FFI_TYPE_SINT32:
|
||||
*(scm_t_int32 *) loc = scm_to_int32 (x);
|
||||
if (return_value_p)
|
||||
*(ffi_arg *) loc = scm_to_int32 (x);
|
||||
else
|
||||
*(scm_t_int32 *) loc = scm_to_int32 (x);
|
||||
break;
|
||||
case FFI_TYPE_UINT64:
|
||||
*(scm_t_uint64 *) loc = scm_to_uint64 (x);
|
||||
|
@ -1073,7 +1095,7 @@ scm_i_foreign_call (SCM foreign, const SCM *argv)
|
|||
args[i] = (void *) ROUND_UP ((scm_t_uintptr) data + off,
|
||||
cif->arg_types[i]->alignment);
|
||||
assert ((scm_t_uintptr) args[i] % cif->arg_types[i]->alignment == 0);
|
||||
unpack (cif->arg_types[i], args[i], argv[i]);
|
||||
unpack (cif->arg_types[i], args[i], argv[i], 0);
|
||||
}
|
||||
|
||||
/* Prepare space for the return value. On some platforms, such as
|
||||
|
@ -1112,7 +1134,7 @@ invoke_closure (ffi_cif *cif, void *ret, void **args, void *data)
|
|||
|
||||
result = scm_call_n (proc, argv, cif->nargs);
|
||||
|
||||
unpack (cif->rtype, ret, result);
|
||||
unpack (cif->rtype, ret, result, 1);
|
||||
}
|
||||
|
||||
SCM_DEFINE (scm_procedure_to_pointer, "procedure->pointer", 3, 0, 0,
|
||||
|
|
|
@ -331,7 +331,7 @@ invoke_main_func (void *body_data)
|
|||
{
|
||||
struct main_func_closure *closure = (struct main_func_closure *) body_data;
|
||||
|
||||
scm_set_program_arguments (closure->argc, closure->argv, 0);
|
||||
scm_i_set_boot_program_arguments (closure->argc, closure->argv);
|
||||
(*closure->main_func) (closure->closure, closure->argc, closure->argv);
|
||||
|
||||
scm_restore_signals ();
|
||||
|
|
|
@ -22,10 +22,12 @@
|
|||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <localcharset.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
#include <ctype.h>
|
||||
#include <uniconv.h>
|
||||
|
||||
#include "libguile/_scm.h"
|
||||
#include "libguile/eval.h"
|
||||
|
@ -368,6 +370,41 @@ scm_shell_usage (int fatal, char *message)
|
|||
: SCM_BOOL_F));
|
||||
}
|
||||
|
||||
/* Return a list of strings from ARGV, which contains ARGC strings
|
||||
assumed to be encoded in the current locale. Use
|
||||
`environ_locale_charset' instead of relying on
|
||||
`scm_from_locale_string' because the user hasn't had a change to call
|
||||
(setlocale LC_ALL "") yet.
|
||||
|
||||
XXX: This hack is for 2.0 and will be removed in the next stable
|
||||
series where the `setlocale' call will be implicit. See
|
||||
<http://lists.gnu.org/archive/html/guile-devel/2011-11/msg00040.html>
|
||||
for details. */
|
||||
static SCM
|
||||
locale_arguments_to_string_list (int argc, char **const argv)
|
||||
{
|
||||
int i;
|
||||
SCM lst;
|
||||
const char *encoding;
|
||||
|
||||
encoding = environ_locale_charset ();
|
||||
for (i = argc - 1, lst = SCM_EOL;
|
||||
i >= 0;
|
||||
i--)
|
||||
lst = scm_cons (scm_from_stringn (argv[i], (size_t) -1, encoding,
|
||||
SCM_FAILED_CONVERSION_ESCAPE_SEQUENCE),
|
||||
lst);
|
||||
|
||||
return lst;
|
||||
}
|
||||
|
||||
/* Set the value returned by `program-arguments', given ARGC and ARGV. */
|
||||
void
|
||||
scm_i_set_boot_program_arguments (int argc, char *argv[])
|
||||
{
|
||||
scm_fluid_set_x (scm_program_arguments_fluid,
|
||||
locale_arguments_to_string_list (argc, argv));
|
||||
}
|
||||
|
||||
/* Given an array of command-line switches, return a Scheme expression
|
||||
to carry out the actions specified by the switches.
|
||||
|
@ -378,7 +415,7 @@ scm_compile_shell_switches (int argc, char **argv)
|
|||
{
|
||||
return scm_call_2 (scm_c_public_ref ("ice-9 command-line",
|
||||
"compile-shell-switches"),
|
||||
scm_makfromstrs (argc, argv),
|
||||
locale_arguments_to_string_list (argc, argv),
|
||||
(scm_usage_name
|
||||
? scm_from_locale_string (scm_usage_name)
|
||||
: scm_from_latin1_string ("guile")));
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#ifndef SCM_SCRIPT_H
|
||||
#define SCM_SCRIPT_H
|
||||
|
||||
/* Copyright (C) 1997,1998,2000, 2006, 2008 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1997,1998,2000, 2006, 2008, 2011 Free Software Foundation, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public License
|
||||
|
@ -37,6 +37,7 @@ SCM_API void scm_shell_usage (int fatal, char *message);
|
|||
SCM_API SCM scm_compile_shell_switches (int argc, char **argv);
|
||||
SCM_API void scm_shell (int argc, char **argv);
|
||||
SCM_API char *scm_usage_name;
|
||||
SCM_INTERNAL void scm_i_set_boot_program_arguments (int argc, char *argv[]);
|
||||
SCM_INTERNAL void scm_init_script (void);
|
||||
|
||||
#endif /* SCM_SCRIPT_H */
|
||||
|
|
|
@ -727,7 +727,7 @@ VM_DEFINE_INSTRUCTION (176, slot_set, "slot-set", 0, 3, 0)
|
|||
|
||||
/* Return true (non-zero) if PTR has suitable alignment for TYPE. */
|
||||
#define ALIGNED_P(ptr, type) \
|
||||
((scm_t_uintptr) (ptr) % alignof (type) == 0)
|
||||
((scm_t_uintptr) (ptr) % alignof_type (type) == 0)
|
||||
|
||||
VM_DEFINE_FUNCTION (177, bv_u16_ref, "bv-u16-ref", 3)
|
||||
BV_REF_WITH_ENDIANNESS (u16, u16)
|
||||
|
|
23
m4/codeset.m4
Normal file
23
m4/codeset.m4
Normal file
|
@ -0,0 +1,23 @@
|
|||
# codeset.m4 serial 5 (gettext-0.18.2)
|
||||
dnl Copyright (C) 2000-2002, 2006, 2008-2011 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 From Bruno Haible.
|
||||
|
||||
AC_DEFUN([AM_LANGINFO_CODESET],
|
||||
[
|
||||
AC_CACHE_CHECK([for nl_langinfo and CODESET], [am_cv_langinfo_codeset],
|
||||
[AC_LINK_IFELSE(
|
||||
[AC_LANG_PROGRAM(
|
||||
[[#include <langinfo.h>]],
|
||||
[[char* cs = nl_langinfo(CODESET); return !cs;]])],
|
||||
[am_cv_langinfo_codeset=yes],
|
||||
[am_cv_langinfo_codeset=no])
|
||||
])
|
||||
if test $am_cv_langinfo_codeset = yes; then
|
||||
AC_DEFINE([HAVE_LANGINFO_CODESET], [1],
|
||||
[Define if you have <langinfo.h> and nl_langinfo(CODESET).])
|
||||
fi
|
||||
])
|
50
m4/configmake.m4
Normal file
50
m4/configmake.m4
Normal file
|
@ -0,0 +1,50 @@
|
|||
# configmake.m4 serial 1
|
||||
dnl Copyright (C) 2010-2011 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.
|
||||
|
||||
# gl_CONFIGMAKE_PREP
|
||||
# ------------------
|
||||
# Guarantee all of the standard directory variables, even when used with
|
||||
# autoconf 2.59 (datarootdir wasn't supported until 2.59c) or automake
|
||||
# 1.9.6 (pkglibexecdir wasn't supported until 1.10b.).
|
||||
AC_DEFUN([gl_CONFIGMAKE_PREP],
|
||||
[
|
||||
dnl Technically, datadir should default to datarootdir. But if
|
||||
dnl autoconf is too old to provide datarootdir, then reversing the
|
||||
dnl definition is a reasonable compromise. Only AC_SUBST a variable
|
||||
dnl if it was not already defined earlier by autoconf.
|
||||
if test "x$datarootdir" = x; then
|
||||
AC_SUBST([datarootdir], ['${datadir}'])
|
||||
fi
|
||||
dnl Copy the approach used in autoconf 2.60.
|
||||
if test "x$docdir" = x; then
|
||||
AC_SUBST([docdir], [m4_ifset([AC_PACKAGE_TARNAME],
|
||||
['${datarootdir}/doc/${PACKAGE_TARNAME}'],
|
||||
['${datarootdir}/doc/${PACKAGE}'])])
|
||||
fi
|
||||
dnl The remaining variables missing from autoconf 2.59 are easier.
|
||||
if test "x$htmldir" = x; then
|
||||
AC_SUBST([htmldir], ['${docdir}'])
|
||||
fi
|
||||
if test "x$dvidir" = x; then
|
||||
AC_SUBST([dvidir], ['${docdir}'])
|
||||
fi
|
||||
if test "x$pdfdir" = x; then
|
||||
AC_SUBST([pdfdir], ['${docdir}'])
|
||||
fi
|
||||
if test "x$psdir" = x; then
|
||||
AC_SUBST([psdir], ['${docdir}'])
|
||||
fi
|
||||
if test "x$lispdir" = x; then
|
||||
AC_SUBST([lispdir], ['${datarootdir}/emacs/site-lisp'])
|
||||
fi
|
||||
if test "x$localedir" = x; then
|
||||
AC_SUBST([localedir], ['${datarootdir}/locale'])
|
||||
fi
|
||||
|
||||
dnl Automake 1.9.6 only lacks pkglibexecdir; and since 1.11 merely
|
||||
dnl provides it without AC_SUBST, this blind use of AC_SUBST is safe.
|
||||
AC_SUBST([pkglibexecdir], ['${libexecdir}/${PACKAGE}'])
|
||||
])
|
34
m4/glibc21.m4
Normal file
34
m4/glibc21.m4
Normal file
|
@ -0,0 +1,34 @@
|
|||
# glibc21.m4 serial 5
|
||||
dnl Copyright (C) 2000-2002, 2004, 2008, 2010-2011 Free Software Foundation,
|
||||
dnl 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.
|
||||
|
||||
# Test for the GNU C Library, version 2.1 or newer, or uClibc.
|
||||
# From Bruno Haible.
|
||||
|
||||
AC_DEFUN([gl_GLIBC21],
|
||||
[
|
||||
AC_CACHE_CHECK([whether we are using the GNU C Library >= 2.1 or uClibc],
|
||||
[ac_cv_gnu_library_2_1],
|
||||
[AC_EGREP_CPP([Lucky],
|
||||
[
|
||||
#include <features.h>
|
||||
#ifdef __GNU_LIBRARY__
|
||||
#if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2)
|
||||
Lucky GNU user
|
||||
#endif
|
||||
#endif
|
||||
#ifdef __UCLIBC__
|
||||
Lucky user
|
||||
#endif
|
||||
],
|
||||
[ac_cv_gnu_library_2_1=yes],
|
||||
[ac_cv_gnu_library_2_1=no])
|
||||
]
|
||||
)
|
||||
AC_SUBST([GLIBC21])
|
||||
GLIBC21="$ac_cv_gnu_library_2_1"
|
||||
]
|
||||
)
|
|
@ -27,10 +27,10 @@
|
|||
|
||||
|
||||
# Specification in the form of a command-line invocation:
|
||||
# gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --lgpl=3 --no-conditional-dependencies --libtool --macro-prefix=gl --no-vc-files accept alignof alloca-opt announce-gen autobuild bind byteswap canonicalize-lgpl ceil close connect duplocale environ extensions flock floor fpieee frexp full-read full-write func gendocs getaddrinfo getpeername getsockname getsockopt git-version-gen gitlog-to-changelog gnu-web-doc-update gnupload havelib iconv_open-utf inet_ntop inet_pton isinf isnan largefile ldexp lib-symbol-versions lib-symbol-visibility libunistring listen locale log1p maintainer-makefile malloc-gnu malloca nproc open pipe2 putenv recv recvfrom rename send sendto setsockopt shutdown socket stat-time stdlib strftime striconveh string sys_stat trunc verify vsnprintf warnings wchar
|
||||
# gnulib-tool --import --dir=. --local-dir=gnulib-local --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --lgpl=3 --no-conditional-dependencies --libtool --macro-prefix=gl --no-vc-files accept alignof alloca-opt announce-gen autobuild bind byteswap canonicalize-lgpl ceil close connect duplocale environ extensions flock floor fpieee frexp full-read full-write func gendocs getaddrinfo getpeername getsockname getsockopt git-version-gen gitlog-to-changelog gnu-web-doc-update gnupload havelib iconv_open-utf inet_ntop inet_pton isinf isnan ldexp lib-symbol-versions lib-symbol-visibility libunistring listen localcharset locale log1p maintainer-makefile malloc-gnu malloca nproc open pipe2 putenv recv recvfrom rename send sendto setsockopt shutdown socket stat-time stdlib strftime striconveh string sys_stat trunc verify vsnprintf warnings wchar
|
||||
|
||||
# Specification in the form of a few gnulib-tool.m4 macro invocations:
|
||||
gl_LOCAL_DIR([])
|
||||
gl_LOCAL_DIR([gnulib-local])
|
||||
gl_MODULES([
|
||||
accept
|
||||
alignof
|
||||
|
@ -74,6 +74,7 @@ gl_MODULES([
|
|||
lib-symbol-visibility
|
||||
libunistring
|
||||
listen
|
||||
localcharset
|
||||
locale
|
||||
log1p
|
||||
maintainer-makefile
|
||||
|
|
|
@ -18,7 +18,7 @@ AC_DEFUN([gl_COMMON_BODY], [
|
|||
# if (3 <= __GNUC__ || (__GNUC__ == 2 && 8 <= __GNUC_MINOR__) \
|
||||
|| 0x5110 <= __SUNPRO_C)
|
||||
# define _Noreturn __attribute__ ((__noreturn__))
|
||||
# elif 1200 <= _MSC_VER
|
||||
# elif defined _MSC_VER && 1200 <= _MSC_VER
|
||||
# define _Noreturn __declspec (noreturn)
|
||||
# else
|
||||
# define _Noreturn
|
||||
|
|
|
@ -56,6 +56,7 @@ AC_DEFUN([gl_EARLY],
|
|||
# Code from module ceil:
|
||||
# Code from module chdir:
|
||||
# Code from module close:
|
||||
# Code from module configmake:
|
||||
# Code from module connect:
|
||||
# Code from module dirname-lgpl:
|
||||
# Code from module dosname:
|
||||
|
@ -112,6 +113,7 @@ AC_DEFUN([gl_EARLY],
|
|||
# Code from module lib-symbol-visibility:
|
||||
# Code from module libunistring:
|
||||
# Code from module listen:
|
||||
# Code from module localcharset:
|
||||
# Code from module locale:
|
||||
# Code from module log1p:
|
||||
# Code from module lstat:
|
||||
|
@ -162,6 +164,7 @@ AC_DEFUN([gl_EARLY],
|
|||
# Code from module ssize_t:
|
||||
# Code from module stat:
|
||||
# Code from module stat-time:
|
||||
# Code from module stdalign:
|
||||
# Code from module stdbool:
|
||||
# Code from module stddef:
|
||||
# Code from module stdint:
|
||||
|
@ -244,6 +247,7 @@ if test $REPLACE_CLOSE = 1; then
|
|||
AC_LIBOBJ([close])
|
||||
fi
|
||||
gl_UNISTD_MODULE_INDICATOR([close])
|
||||
gl_CONFIGMAKE_PREP
|
||||
AC_REQUIRE([gl_HEADER_SYS_SOCKET])
|
||||
if test "$ac_cv_header_winsock2_h" = yes; then
|
||||
AC_LIBOBJ([connect])
|
||||
|
@ -401,6 +405,9 @@ if test "$ac_cv_header_winsock2_h" = yes; then
|
|||
AC_LIBOBJ([listen])
|
||||
fi
|
||||
gl_SYS_SOCKET_MODULE_INDICATOR([listen])
|
||||
gl_LOCALCHARSET
|
||||
LOCALCHARSET_TESTS_ENVIRONMENT="CHARSETALIASDIR=\"\$(abs_top_builddir)/$gl_source_base\""
|
||||
AC_SUBST([LOCALCHARSET_TESTS_ENVIRONMENT])
|
||||
gl_LOCALE_H
|
||||
gl_COMMON_DOUBLE_MATHFUNC([log1p])
|
||||
gl_FUNC_LSTAT
|
||||
|
@ -548,6 +555,7 @@ fi
|
|||
gl_SYS_STAT_MODULE_INDICATOR([stat])
|
||||
gl_STAT_TIME
|
||||
gl_STAT_BIRTHTIME
|
||||
gl_STDALIGN_H
|
||||
AM_STDBOOL_H
|
||||
gl_STDDEF_H
|
||||
gl_STDINT_H
|
||||
|
@ -776,6 +784,7 @@ AC_DEFUN([gl_FILE_LIST], [
|
|||
lib/canonicalize-lgpl.c
|
||||
lib/ceil.c
|
||||
lib/close.c
|
||||
lib/config.charset
|
||||
lib/connect.c
|
||||
lib/dirname-lgpl.c
|
||||
lib/dirname.h
|
||||
|
@ -823,6 +832,8 @@ AC_DEFUN([gl_FILE_LIST], [
|
|||
lib/itold.c
|
||||
lib/libunistring.valgrind
|
||||
lib/listen.c
|
||||
lib/localcharset.c
|
||||
lib/localcharset.h
|
||||
lib/locale.in.h
|
||||
lib/lstat.c
|
||||
lib/malloc.c
|
||||
|
@ -853,6 +864,8 @@ AC_DEFUN([gl_FILE_LIST], [
|
|||
lib/readlink.c
|
||||
lib/recv.c
|
||||
lib/recvfrom.c
|
||||
lib/ref-add.sin
|
||||
lib/ref-del.sin
|
||||
lib/rename.c
|
||||
lib/rmdir.c
|
||||
lib/safe-read.c
|
||||
|
@ -872,6 +885,7 @@ AC_DEFUN([gl_FILE_LIST], [
|
|||
lib/sockets.h
|
||||
lib/stat-time.h
|
||||
lib/stat.c
|
||||
lib/stdalign.in.h
|
||||
lib/stdbool.in.h
|
||||
lib/stddef.in.h
|
||||
lib/stdint.in.h
|
||||
|
@ -921,6 +935,8 @@ AC_DEFUN([gl_FILE_LIST], [
|
|||
m4/ceil.m4
|
||||
m4/check-math-lib.m4
|
||||
m4/close.m4
|
||||
m4/codeset.m4
|
||||
m4/configmake.m4
|
||||
m4/dirname.m4
|
||||
m4/double-slash-root.m4
|
||||
m4/duplocale.m4
|
||||
|
@ -941,6 +957,7 @@ AC_DEFUN([gl_FILE_LIST], [
|
|||
m4/fstat.m4
|
||||
m4/func.m4
|
||||
m4/getaddrinfo.m4
|
||||
m4/glibc21.m4
|
||||
m4/gnulib-common.m4
|
||||
m4/hostent.m4
|
||||
m4/iconv.m4
|
||||
|
@ -966,6 +983,7 @@ AC_DEFUN([gl_FILE_LIST], [
|
|||
m4/lib-prefix.m4
|
||||
m4/libunistring-base.m4
|
||||
m4/libunistring.m4
|
||||
m4/localcharset.m4
|
||||
m4/locale_h.m4
|
||||
m4/longlong.m4
|
||||
m4/lstat.m4
|
||||
|
@ -1006,6 +1024,7 @@ AC_DEFUN([gl_FILE_LIST], [
|
|||
m4/ssize_t.m4
|
||||
m4/stat-time.m4
|
||||
m4/stat.m4
|
||||
m4/stdalign.m4
|
||||
m4/stdbool.m4
|
||||
m4/stddef_h.m4
|
||||
m4/stdint.m4
|
||||
|
|
17
m4/localcharset.m4
Normal file
17
m4/localcharset.m4
Normal file
|
@ -0,0 +1,17 @@
|
|||
# localcharset.m4 serial 7
|
||||
dnl Copyright (C) 2002, 2004, 2006, 2009-2011 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.
|
||||
|
||||
AC_DEFUN([gl_LOCALCHARSET],
|
||||
[
|
||||
dnl Prerequisites of lib/localcharset.c.
|
||||
AC_REQUIRE([AM_LANGINFO_CODESET])
|
||||
AC_REQUIRE([gl_FCNTL_O_FLAGS])
|
||||
AC_CHECK_DECLS_ONCE([getc_unlocked])
|
||||
|
||||
dnl Prerequisites of the lib/Makefile.am snippet.
|
||||
AC_REQUIRE([AC_CANONICAL_HOST])
|
||||
AC_REQUIRE([gl_GLIBC21])
|
||||
])
|
13
m4/math_h.m4
13
m4/math_h.m4
|
@ -1,4 +1,4 @@
|
|||
# math_h.m4 serial 53
|
||||
# math_h.m4 serial 56
|
||||
dnl Copyright (C) 2007-2011 Free Software Foundation, Inc.
|
||||
dnl This file is free software; the Free Software Foundation
|
||||
dnl gives unlimited permission to copy and/or distribute it,
|
||||
|
@ -41,7 +41,7 @@ AC_DEFUN([gl_MATH_H],
|
|||
gl_WARN_ON_USE_PREPARE([[#include <math.h>]],
|
||||
[acosf acosl asinf asinl atanf atanl
|
||||
ceilf ceill copysign copysignf copysignl cosf cosl coshf
|
||||
expf expl fabsf floorf floorl fmodf frexpf frexpl
|
||||
expf expl fabsf floorf floorl fma fmaf fmal fmodf frexpf frexpl
|
||||
ldexpf ldexpl logb logf logl log10f modff powf
|
||||
rint rintf rintl round roundf roundl sinf sinl sinhf sqrtf sqrtl
|
||||
tanf tanl tanhf trunc truncf truncl])
|
||||
|
@ -80,6 +80,9 @@ AC_DEFUN([gl_MATH_H_DEFAULTS],
|
|||
GNULIB_FLOOR=0; AC_SUBST([GNULIB_FLOOR])
|
||||
GNULIB_FLOORF=0; AC_SUBST([GNULIB_FLOORF])
|
||||
GNULIB_FLOORL=0; AC_SUBST([GNULIB_FLOORL])
|
||||
GNULIB_FMA=0; AC_SUBST([GNULIB_FMA])
|
||||
GNULIB_FMAF=0; AC_SUBST([GNULIB_FMAF])
|
||||
GNULIB_FMAL=0; AC_SUBST([GNULIB_FMAL])
|
||||
GNULIB_FMODF=0; AC_SUBST([GNULIB_FMODF])
|
||||
GNULIB_FREXPF=0; AC_SUBST([GNULIB_FREXPF])
|
||||
GNULIB_FREXP=0; AC_SUBST([GNULIB_FREXP])
|
||||
|
@ -133,6 +136,9 @@ AC_DEFUN([gl_MATH_H_DEFAULTS],
|
|||
HAVE_EXPF=1; AC_SUBST([HAVE_EXPF])
|
||||
HAVE_EXPL=1; AC_SUBST([HAVE_EXPL])
|
||||
HAVE_FABSF=1; AC_SUBST([HAVE_FABSF])
|
||||
HAVE_FMA=1; AC_SUBST([HAVE_FMA])
|
||||
HAVE_FMAF=1; AC_SUBST([HAVE_FMAF])
|
||||
HAVE_FMAL=1; AC_SUBST([HAVE_FMAL])
|
||||
HAVE_FMODF=1; AC_SUBST([HAVE_FMODF])
|
||||
HAVE_FREXPF=1; AC_SUBST([HAVE_FREXPF])
|
||||
HAVE_ISNANF=1; AC_SUBST([HAVE_ISNANF])
|
||||
|
@ -183,6 +189,9 @@ AC_DEFUN([gl_MATH_H_DEFAULTS],
|
|||
REPLACE_FLOOR=0; AC_SUBST([REPLACE_FLOOR])
|
||||
REPLACE_FLOORF=0; AC_SUBST([REPLACE_FLOORF])
|
||||
REPLACE_FLOORL=0; AC_SUBST([REPLACE_FLOORL])
|
||||
REPLACE_FMA=0; AC_SUBST([REPLACE_FMA])
|
||||
REPLACE_FMAF=0; AC_SUBST([REPLACE_FMAF])
|
||||
REPLACE_FMAL=0; AC_SUBST([REPLACE_FMAL])
|
||||
REPLACE_FREXPF=0; AC_SUBST([REPLACE_FREXPF])
|
||||
REPLACE_FREXP=0; AC_SUBST([REPLACE_FREXP])
|
||||
REPLACE_FREXPL=0; AC_SUBST([REPLACE_FREXPL])
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
# mathfunc.m4 serial 9
|
||||
# mathfunc.m4 serial 10
|
||||
dnl Copyright (C) 2010-2011 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.
|
||||
|
||||
# gl_MATHFUNC(FUNC, RETTYPE, PARAMTYPES [, EXTRA-CODE])
|
||||
# -----------------------------------------------------
|
||||
# gl_MATHFUNC(FUNC, RETTYPE, PARAMTYPES [, INCLUDES] [, EXTRA-CODE])
|
||||
# ------------------------------------------------------------------
|
||||
# tests whether the function FUNC is available in libc or libm.
|
||||
# RETTYPE is the return type. PARAMTYPES is a parameter list, with parentheses.
|
||||
# It sets FUNC_LIBM to empty or "-lm" accordingly.
|
||||
|
@ -38,15 +38,17 @@ AC_DEFUN([gl_MATHFUNC],
|
|||
[m4_bpatsubst(
|
||||
[m4_bpatsubst(
|
||||
[m4_bpatsubst(
|
||||
[$3],
|
||||
[int \*], [&i_ret])],
|
||||
[float \*], [&f_ret])],
|
||||
[double \*], [&d_ret])],
|
||||
[long double \*], [&l_ret])],
|
||||
[int], [2])],
|
||||
[float], [1.618034f])],
|
||||
[long double], [1.618033988749894848L])],
|
||||
[double], [1.6180339887])])
|
||||
[m4_bpatsubst(
|
||||
[$3],
|
||||
[int \*], [&i_ret])],
|
||||
[float \*], [&f_ret])],
|
||||
[double \*], [&d_ret])],
|
||||
[long double \*], [&l_ret])],
|
||||
[int], [2])],
|
||||
[float], [1.618034f])],
|
||||
[long double], [1.618033988749894848L])],
|
||||
[double], [1.6180339887])],
|
||||
[void], [])])
|
||||
FUNC[]_LIBM=
|
||||
AC_CACHE_CHECK([whether func() can be used without linking with libm],
|
||||
[gl_cv_func_]func[_no_libm],
|
||||
|
@ -57,13 +59,14 @@ AC_DEFUN([gl_MATHFUNC],
|
|||
# define __NO_MATH_INLINES 1 /* for glibc */
|
||||
#endif
|
||||
#include <math.h>
|
||||
$4
|
||||
$2 (*funcptr) $3 = ]func[;
|
||||
int i_ret;
|
||||
float f_ret;
|
||||
double d_ret;
|
||||
long double l_ret;]],
|
||||
[[$2 y = funcptr ]ARGS[ + ]func[ ]ARGS[;
|
||||
$4
|
||||
$5
|
||||
return y < 0.3 || y > 1.7;
|
||||
]])],
|
||||
[gl_cv_func_]func[_no_libm=yes],
|
||||
|
@ -81,13 +84,14 @@ AC_DEFUN([gl_MATHFUNC],
|
|||
# define __NO_MATH_INLINES 1 /* for glibc */
|
||||
#endif
|
||||
#include <math.h>
|
||||
$4
|
||||
$2 (*funcptr) $3 = ]func[;
|
||||
int i_ret;
|
||||
float f_ret;
|
||||
double d_ret;
|
||||
long double l_ret;]],
|
||||
[[$2 y = funcptr ]ARGS[ + ]func[ ]ARGS[;
|
||||
$4
|
||||
$5
|
||||
return y < 0.3 || y > 1.7;
|
||||
]])],
|
||||
[gl_cv_func_]func[_in_libm=yes],
|
||||
|
|
37
m4/stdalign.m4
Normal file
37
m4/stdalign.m4
Normal file
|
@ -0,0 +1,37 @@
|
|||
# Check for stdalign.h that conforms to C1x.
|
||||
|
||||
dnl Copyright 2011 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.
|
||||
|
||||
# Prepare for substituting <stdalign.h> if it is not supported.
|
||||
|
||||
AC_DEFUN([gl_STDALIGN_H],
|
||||
[
|
||||
AC_CACHE_CHECK([for working stdalign.h],
|
||||
[gl_cv_header_working_stdalign_h],
|
||||
[AC_COMPILE_IFELSE(
|
||||
[AC_LANG_PROGRAM(
|
||||
[[#include <stdalign.h>
|
||||
int align_int = alignof (int) + _Alignof (double);
|
||||
|
||||
/* Test _Alignas only on platforms where gnulib can help. */
|
||||
#if \
|
||||
(__GNUC__ || __IBMC__ || __IBMCPP__ \
|
||||
|| 0x5110 <= __SUNPRO_C || 1300 <= _MSC_VER)
|
||||
int alignas (8) alignas_int = 1;
|
||||
#endif
|
||||
]])],
|
||||
[gl_cv_header_working_stdalign_h=yes],
|
||||
[gl_cv_header_working_stdalign_h=no])])
|
||||
|
||||
if test $gl_cv_header_working_stdalign_h = yes; then
|
||||
STDALIGN_H=''
|
||||
else
|
||||
STDALIGN_H='stdalign.h'
|
||||
fi
|
||||
|
||||
AC_SUBST([STDALIGN_H])
|
||||
AM_CONDITIONAL([GL_GENERATE_STDALIGN_H], [test -n "$STDALIGN_H"])
|
||||
])
|
10
m4/stdint.m4
10
m4/stdint.m4
|
@ -1,4 +1,4 @@
|
|||
# stdint.m4 serial 41
|
||||
# stdint.m4 serial 42
|
||||
dnl Copyright (C) 2001-2011 Free Software Foundation, Inc.
|
||||
dnl This file is free software; the Free Software Foundation
|
||||
dnl gives unlimited permission to copy and/or distribute it,
|
||||
|
@ -69,8 +69,8 @@ AC_DEFUN_ONCE([gl_STDINT_H],
|
|||
[gl_cv_header_working_stdint_h=no
|
||||
AC_COMPILE_IFELSE([
|
||||
AC_LANG_PROGRAM([[
|
||||
#define __STDC_LIMIT_MACROS 1 /* to make it work also in C++ mode */
|
||||
#define __STDC_CONSTANT_MACROS 1 /* to make it work also in C++ mode */
|
||||
#define __STDC_LIMIT_MACROS 1 /* to make it work also in C++ before C++11 */
|
||||
#define __STDC_CONSTANT_MACROS 1 /* to make it work also in C++ before C++11 */
|
||||
#define _GL_JUST_INCLUDE_SYSTEM_STDINT_H 1 /* work if build isn't clean */
|
||||
#include <stdint.h>
|
||||
/* Dragonfly defines WCHAR_MIN, WCHAR_MAX only in <wchar.h>. */
|
||||
|
@ -219,8 +219,8 @@ struct s {
|
|||
dnl This detects a bug on HP-UX 11.23/ia64.
|
||||
AC_RUN_IFELSE([
|
||||
AC_LANG_PROGRAM([[
|
||||
#define __STDC_LIMIT_MACROS 1 /* to make it work also in C++ mode */
|
||||
#define __STDC_CONSTANT_MACROS 1 /* to make it work also in C++ mode */
|
||||
#define __STDC_LIMIT_MACROS 1 /* to make it work also in C++ before C++11 */
|
||||
#define __STDC_CONSTANT_MACROS 1 /* to make it work also in C++ before C++11 */
|
||||
#define _GL_JUST_INCLUDE_SYSTEM_STDINT_H 1 /* work if build isn't clean */
|
||||
#include <stdint.h>
|
||||
]
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# stdlib_h.m4 serial 37
|
||||
# stdlib_h.m4 serial 39
|
||||
dnl Copyright (C) 2007-2011 Free Software Foundation, Inc.
|
||||
dnl This file is free software; the Free Software Foundation
|
||||
dnl gives unlimited permission to copy and/or distribute it,
|
||||
|
@ -21,8 +21,8 @@ AC_DEFUN([gl_STDLIB_H],
|
|||
#endif
|
||||
]], [_Exit atoll canonicalize_file_name getloadavg getsubopt grantpt
|
||||
initstate_r mkdtemp mkostemp mkostemps mkstemp mkstemps posix_openpt
|
||||
ptsname random_r realpath rpmatch setenv setstate_r srandom_r strtod
|
||||
strtoll strtoull unlockpt unsetenv])
|
||||
ptsname ptsname_r random_r realpath rpmatch setenv setstate_r srandom_r
|
||||
strtod strtoll strtoull unlockpt unsetenv])
|
||||
])
|
||||
|
||||
AC_DEFUN([gl_STDLIB_MODULE_INDICATOR],
|
||||
|
@ -52,6 +52,7 @@ AC_DEFUN([gl_STDLIB_H_DEFAULTS],
|
|||
GNULIB_MKSTEMPS=0; AC_SUBST([GNULIB_MKSTEMPS])
|
||||
GNULIB_POSIX_OPENPT=0; AC_SUBST([GNULIB_POSIX_OPENPT])
|
||||
GNULIB_PTSNAME=0; AC_SUBST([GNULIB_PTSNAME])
|
||||
GNULIB_PTSNAME_R=0; AC_SUBST([GNULIB_PTSNAME_R])
|
||||
GNULIB_PUTENV=0; AC_SUBST([GNULIB_PUTENV])
|
||||
GNULIB_RANDOM_R=0; AC_SUBST([GNULIB_RANDOM_R])
|
||||
GNULIB_REALLOC_POSIX=0; AC_SUBST([GNULIB_REALLOC_POSIX])
|
||||
|
@ -79,6 +80,7 @@ AC_DEFUN([gl_STDLIB_H_DEFAULTS],
|
|||
HAVE_MKSTEMPS=1; AC_SUBST([HAVE_MKSTEMPS])
|
||||
HAVE_POSIX_OPENPT=1; AC_SUBST([HAVE_POSIX_OPENPT])
|
||||
HAVE_PTSNAME=1; AC_SUBST([HAVE_PTSNAME])
|
||||
HAVE_PTSNAME_R=1; AC_SUBST([HAVE_PTSNAME_R])
|
||||
HAVE_RANDOM_H=1; AC_SUBST([HAVE_RANDOM_H])
|
||||
HAVE_RANDOM_R=1; AC_SUBST([HAVE_RANDOM_R])
|
||||
HAVE_REALPATH=1; AC_SUBST([HAVE_REALPATH])
|
||||
|
@ -97,6 +99,7 @@ AC_DEFUN([gl_STDLIB_H_DEFAULTS],
|
|||
REPLACE_MALLOC=0; AC_SUBST([REPLACE_MALLOC])
|
||||
REPLACE_MBTOWC=0; AC_SUBST([REPLACE_MBTOWC])
|
||||
REPLACE_MKSTEMP=0; AC_SUBST([REPLACE_MKSTEMP])
|
||||
REPLACE_PTSNAME_R=0; AC_SUBST([REPLACE_PTSNAME_R])
|
||||
REPLACE_PUTENV=0; AC_SUBST([REPLACE_PUTENV])
|
||||
REPLACE_REALLOC=0; AC_SUBST([REPLACE_REALLOC])
|
||||
REPLACE_REALPATH=0; AC_SUBST([REPLACE_REALPATH])
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# unistd_h.m4 serial 61
|
||||
# unistd_h.m4 serial 62
|
||||
dnl Copyright (C) 2006-2011 Free Software Foundation, Inc.
|
||||
dnl This file is free software; the Free Software Foundation
|
||||
dnl gives unlimited permission to copy and/or distribute it,
|
||||
|
@ -43,8 +43,8 @@ AC_DEFUN([gl_UNISTD_H],
|
|||
fdatasync fsync ftruncate getcwd getdomainname getdtablesize getgroups
|
||||
gethostname getlogin getlogin_r getpagesize getusershell setusershell
|
||||
endusershell group_member lchown link linkat lseek pipe pipe2 pread pwrite
|
||||
readlink readlinkat rmdir sleep symlink symlinkat ttyname_r unlink unlinkat
|
||||
usleep])
|
||||
readlink readlinkat rmdir sethostname sleep symlink symlinkat ttyname_r
|
||||
unlink unlinkat usleep])
|
||||
])
|
||||
|
||||
AC_DEFUN([gl_UNISTD_MODULE_INDICATOR],
|
||||
|
@ -94,11 +94,11 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS],
|
|||
GNULIB_READLINK=0; AC_SUBST([GNULIB_READLINK])
|
||||
GNULIB_READLINKAT=0; AC_SUBST([GNULIB_READLINKAT])
|
||||
GNULIB_RMDIR=0; AC_SUBST([GNULIB_RMDIR])
|
||||
GNULIB_SETHOSTNAME=0; AC_SUBST([GNULIB_SETHOSTNAME])
|
||||
GNULIB_SLEEP=0; AC_SUBST([GNULIB_SLEEP])
|
||||
GNULIB_SYMLINK=0; AC_SUBST([GNULIB_SYMLINK])
|
||||
GNULIB_SYMLINKAT=0; AC_SUBST([GNULIB_SYMLINKAT])
|
||||
GNULIB_TTYNAME_R=0; AC_SUBST([GNULIB_TTYNAME_R])
|
||||
GNULIB_UNISTD_H_GETOPT=0; AC_SUBST([GNULIB_UNISTD_H_GETOPT])
|
||||
GNULIB_UNISTD_H_NONBLOCKING=0; AC_SUBST([GNULIB_UNISTD_H_NONBLOCKING])
|
||||
GNULIB_UNISTD_H_SIGPIPE=0; AC_SUBST([GNULIB_UNISTD_H_SIGPIPE])
|
||||
GNULIB_UNLINK=0; AC_SUBST([GNULIB_UNLINK])
|
||||
|
@ -131,6 +131,7 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS],
|
|||
HAVE_PWRITE=1; AC_SUBST([HAVE_PWRITE])
|
||||
HAVE_READLINK=1; AC_SUBST([HAVE_READLINK])
|
||||
HAVE_READLINKAT=1; AC_SUBST([HAVE_READLINKAT])
|
||||
HAVE_SETHOSTNAME=1; AC_SUBST([HAVE_SETHOSTNAME])
|
||||
HAVE_SLEEP=1; AC_SUBST([HAVE_SLEEP])
|
||||
HAVE_SYMLINK=1; AC_SUBST([HAVE_SYMLINK])
|
||||
HAVE_SYMLINKAT=1; AC_SUBST([HAVE_SYMLINKAT])
|
||||
|
@ -143,6 +144,7 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS],
|
|||
HAVE_DECL_GETLOGIN_R=1; AC_SUBST([HAVE_DECL_GETLOGIN_R])
|
||||
HAVE_DECL_GETPAGESIZE=1; AC_SUBST([HAVE_DECL_GETPAGESIZE])
|
||||
HAVE_DECL_GETUSERSHELL=1; AC_SUBST([HAVE_DECL_GETUSERSHELL])
|
||||
HAVE_DECL_SETHOSTNAME=1; AC_SUBST([HAVE_DECL_SETHOSTNAME])
|
||||
HAVE_DECL_TTYNAME_R=1; AC_SUBST([HAVE_DECL_TTYNAME_R])
|
||||
HAVE_OS_H=0; AC_SUBST([HAVE_OS_H])
|
||||
HAVE_SYS_PARAM_H=0; AC_SUBST([HAVE_SYS_PARAM_H])
|
||||
|
|
54
maint.mk
54
maint.mk
|
@ -21,8 +21,12 @@
|
|||
# ME := $(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST))
|
||||
ME := maint.mk
|
||||
|
||||
# Override this in cfg.mk if you use a non-standard build-aux directory.
|
||||
build_aux ?= $(srcdir)/build-aux
|
||||
# Diagnostic for continued use of deprecated variable.
|
||||
# Remove in 2013
|
||||
ifneq ($(build_aux),)
|
||||
$(error "$(ME): \
|
||||
set $$(_build-aux) relative to $$(srcdir) instead of $$(build_aux)")
|
||||
endif
|
||||
|
||||
# Do not save the original name or timestamp in the .tar.gz file.
|
||||
# Use --rsyncable if available.
|
||||
|
@ -34,7 +38,7 @@ GZIP_ENV = '--no-name --best $(gzip_rsyncable)'
|
|||
GIT = git
|
||||
VC = $(GIT)
|
||||
|
||||
VC_LIST = $(build_aux)/vc-list-files -C $(srcdir)
|
||||
VC_LIST = $(srcdir)/$(_build-aux)/vc-list-files -C $(srcdir)
|
||||
|
||||
# You can override this variable in cfg.mk to set your own regexp
|
||||
# matching files to ignore.
|
||||
|
@ -274,7 +278,7 @@ define _sc_search_regexp
|
|||
endef
|
||||
|
||||
sc_avoid_if_before_free:
|
||||
@$(build_aux)/useless-if-before-free \
|
||||
@$(srcdir)/$(_build-aux)/useless-if-before-free \
|
||||
$(useless_free_options) \
|
||||
$$($(VC_LIST_EXCEPT) | grep -v useless-if-before-free) && \
|
||||
{ echo '$(ME): found useless "if" before "free" above' 1>&2; \
|
||||
|
@ -618,7 +622,17 @@ _stddef_syms_re = NULL|offsetof|ptrdiff_t|size_t|wchar_t
|
|||
# Prohibit the inclusion of stddef.h without an actual use.
|
||||
sc_prohibit_stddef_without_use:
|
||||
@h='stddef.h' \
|
||||
re='\<($(_stddef_syms_re)) *\(' \
|
||||
re='\<($(_stddef_syms_re))\>' \
|
||||
$(_sc_header_without_use)
|
||||
|
||||
_de1 = dirfd|(close|(fd)?open|read|rewind|seek|tell)dir(64)?(_r)?
|
||||
_de2 = (versionsort|struct dirent|getdirentries|alphasort|scandir(at)?)(64)?
|
||||
_de3 = MAXNAMLEN|DIR|ino_t|d_ino|d_fileno|d_namlen
|
||||
_dirent_syms_re = $(_de1)|$(_de2)|$(_de3)
|
||||
# Prohibit the inclusion of dirent.h without an actual use.
|
||||
sc_prohibit_dirent_without_use:
|
||||
@h='dirent.h' \
|
||||
re='\<($(_dirent_syms_re))\>' \
|
||||
$(_sc_header_without_use)
|
||||
|
||||
# Prohibit the inclusion of verify.h without an actual use.
|
||||
|
@ -749,10 +763,12 @@ gl_other_headers_ ?= \
|
|||
|
||||
# Perl -lne code to extract "significant" cpp-defined symbols from a
|
||||
# gnulib header file, eliminating a few common false-positives.
|
||||
# The exempted names below are defined only conditionally in gnulib,
|
||||
# and hence sometimes must/may be defined in application code.
|
||||
gl_extract_significant_defines_ = \
|
||||
/^\# *define ([^_ (][^ (]*)(\s*\(|\s+\w+)/\
|
||||
&& $$2 !~ /(?:rpl_|_used_without_)/\
|
||||
&& $$1 !~ /^(?:NSIG)$$/\
|
||||
&& $$1 !~ /^(?:NSIG|ENODATA)$$/\
|
||||
&& $$1 !~ /^(?:SA_RESETHAND|SA_RESTART)$$/\
|
||||
and print $$1
|
||||
|
||||
|
@ -1141,6 +1157,16 @@ sc_cross_check_PATH_usage_in_tests:
|
|||
1>&2; exit 1; } || :; \
|
||||
fi
|
||||
|
||||
# BRE regex of file contents to identify a test script.
|
||||
_test_script_regex ?= \<init\.sh\>
|
||||
|
||||
# In tests, use "compare expected actual", not the reverse.
|
||||
sc_prohibit_reversed_compare_failure:
|
||||
@prohibit='\<compare [^ ]+ ([^ ]*exp|/dev/null)' \
|
||||
containing='$(_test_script_regex)' \
|
||||
halt='reversed compare arguments' \
|
||||
$(_sc_search_regexp)
|
||||
|
||||
# #if HAVE_... will evaluate to false for any non numeric string.
|
||||
# That would be flagged by using -Wundef, however gnulib currently
|
||||
# tests many undefined macros, and so we can't enable that option.
|
||||
|
@ -1187,9 +1213,9 @@ bootstrap-tools ?= autoconf,automake,gnulib
|
|||
# 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 ?= \
|
||||
$$(git cat-file tag v$(VERSION) > .ann-sig \
|
||||
&& gpgv .ann-sig - < /dev/null 2>&1 \
|
||||
| sed -n '/.*key ID \([0-9A-F]*\)/s//\1/p'; rm -f .ann-sig)
|
||||
$$(git cat-file tag v$(VERSION) \
|
||||
| gpgv --status-fd 1 --keyring /dev/null - - 2>/dev/null \
|
||||
| sed -n '/^\[GNUPG:\] ERRSIG /{s///;s/ .*//p;q}')
|
||||
|
||||
translation_project_ ?= coordinator@translationproject.org
|
||||
|
||||
|
@ -1208,7 +1234,7 @@ else
|
|||
endif
|
||||
|
||||
announcement: NEWS ChangeLog $(rel-files)
|
||||
@$(build_aux)/announce-gen \
|
||||
@$(srcdir)/$(_build-aux)/announce-gen \
|
||||
--mail-headers='$(announcement_mail_headers_)' \
|
||||
--release-type=$(RELEASE_TYPE) \
|
||||
--package=$(PACKAGE) \
|
||||
|
@ -1232,7 +1258,7 @@ upload_dest_dir_ ?= $(PACKAGE)
|
|||
emit_upload_commands:
|
||||
@echo =====================================
|
||||
@echo =====================================
|
||||
@echo "$(build_aux)/gnupload $(GNUPLOADFLAGS) \\"
|
||||
@echo "$(srcdir)/$(_build-aux)/gnupload $(GNUPLOADFLAGS) \\"
|
||||
@echo " --to $(gnu_rel_host):$(upload_dest_dir_) \\"
|
||||
@echo " $(rel-files)"
|
||||
@echo '# send the ~/announce-$(my_distdir) e-mail'
|
||||
|
@ -1327,7 +1353,7 @@ web-manual:
|
|||
@test -z "$(manual_title)" \
|
||||
&& { echo define manual_title in cfg.mk 1>&2; exit 1; } || :
|
||||
@cd '$(srcdir)/doc'; \
|
||||
$(SHELL) ../$(build_aux)/gendocs.sh $(gendocs_options_) \
|
||||
$(SHELL) ../$(_build-aux)/gendocs.sh $(gendocs_options_) \
|
||||
-o '$(abs_builddir)/doc/manual' \
|
||||
--email $(PACKAGE_BUGREPORT) $(PACKAGE) \
|
||||
"$(PACKAGE_NAME) - $(manual_title)"
|
||||
|
@ -1392,7 +1418,7 @@ update-copyright-env ?=
|
|||
update-copyright:
|
||||
grep -l -w Copyright \
|
||||
$$(export VC_LIST_EXCEPT_DEFAULT=COPYING && $(VC_LIST_EXCEPT)) \
|
||||
| $(update-copyright-env) xargs $(build_aux)/$@
|
||||
| $(update-copyright-env) xargs $(srcdir)/$(_build-aux)/$@
|
||||
|
||||
# This tight_scope test is skipped with a warning if $(_gl_TS_headers) is not
|
||||
# overridden and $(_gl_TS_dir)/Makefile.am does not mention noinst_HEADERS.
|
||||
|
@ -1422,7 +1448,7 @@ sc_tight_scope: tight-scope.mk
|
|||
|
||||
tight-scope.mk: $(ME)
|
||||
@rm -f $@ $@-t
|
||||
@perl -ne '/^# TS-start/.../^# TS-end/ and print' $(ME) > $@-t
|
||||
@perl -ne '/^# TS-start/.../^# TS-end/ and print' $(srcdir)/$(ME) > $@-t
|
||||
@chmod a=r $@-t && mv $@-t $@
|
||||
|
||||
ifeq (a,b)
|
||||
|
|
|
@ -17,4 +17,3 @@
|
|||
|
||||
(define-module (ice-9 deprecated)
|
||||
#:export ())
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
;;;; ftw.scm --- file system tree walk
|
||||
|
||||
;;;; Copyright (C) 2002, 2003, 2006 Free Software Foundation, Inc.
|
||||
;;;; Copyright (C) 2002, 2003, 2006, 2011 Free Software Foundation, Inc.
|
||||
;;;;
|
||||
;;;; This library is free software; you can redistribute it and/or
|
||||
;;;; modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -190,7 +190,14 @@
|
|||
;;; Code:
|
||||
|
||||
(define-module (ice-9 ftw)
|
||||
:export (ftw nftw))
|
||||
#:use-module (ice-9 match)
|
||||
#:use-module (ice-9 vlist)
|
||||
#:use-module (srfi srfi-1)
|
||||
#:autoload (ice-9 i18n) (string-locale<?)
|
||||
#:export (ftw nftw
|
||||
file-system-fold
|
||||
file-system-tree
|
||||
scandir))
|
||||
|
||||
(define (directory-files dir)
|
||||
(let ((dir-stream (opendir dir)))
|
||||
|
@ -377,4 +384,156 @@
|
|||
(chdir od)
|
||||
ret))))
|
||||
|
||||
|
||||
;;;
|
||||
;;; `file-system-fold' & co.
|
||||
;;;
|
||||
|
||||
(define* (file-system-fold enter? leaf down up skip init file-name
|
||||
#:optional (stat lstat))
|
||||
"Traverse the directory at FILE-NAME, recursively. Enter
|
||||
sub-directories only when (ENTER? PATH STAT RESULT) returns true. When
|
||||
a sub-directory is entered, call (DOWN PATH STAT RESULT), where PATH is
|
||||
the path of the sub-directory and STAT the result of (stat PATH); when
|
||||
it is left, call (UP PATH STAT RESULT). For each file in a directory,
|
||||
call (LEAF PATH STAT RESULT). When ENTER? returns false, call (SKIP
|
||||
PATH STAT RESULT). Return the result of these successive applications.
|
||||
When FILE-NAME names a flat file, (LEAF PATH STAT INIT) is returned.
|
||||
The optional STAT parameter defaults to `lstat'."
|
||||
|
||||
(define (mark v s)
|
||||
(vhash-cons (cons (stat:dev s) (stat:ino s)) #t v))
|
||||
|
||||
(define (visited? v s)
|
||||
(vhash-assoc (cons (stat:dev s) (stat:ino s)) v))
|
||||
|
||||
(let loop ((name file-name)
|
||||
(path "")
|
||||
(dir-stat (false-if-exception (stat file-name)))
|
||||
(result init)
|
||||
(visited vlist-null))
|
||||
|
||||
(define full-name
|
||||
(if (string=? path "")
|
||||
name
|
||||
(string-append path "/" name)))
|
||||
|
||||
(cond
|
||||
((not dir-stat)
|
||||
;; FILE-NAME is not readable.
|
||||
(leaf full-name dir-stat result))
|
||||
((visited? visited dir-stat)
|
||||
(values result visited))
|
||||
((eq? 'directory (stat:type dir-stat)) ; true except perhaps the 1st time
|
||||
(if (enter? full-name dir-stat result)
|
||||
(let ((dir (false-if-exception (opendir full-name)))
|
||||
(visited (mark visited dir-stat)))
|
||||
(if dir
|
||||
(let liip ((entry (readdir dir))
|
||||
(result (down full-name dir-stat result))
|
||||
(subdirs '()))
|
||||
(cond ((eof-object? entry)
|
||||
(begin
|
||||
(closedir dir)
|
||||
(let ((r+v
|
||||
(fold (lambda (subdir result+visited)
|
||||
(call-with-values
|
||||
(lambda ()
|
||||
(loop (car subdir)
|
||||
full-name
|
||||
(cdr subdir)
|
||||
(car result+visited)
|
||||
(cdr result+visited)))
|
||||
cons))
|
||||
(cons result visited)
|
||||
subdirs)))
|
||||
(values (up full-name dir-stat (car r+v))
|
||||
(cdr r+v)))))
|
||||
((or (string=? entry ".")
|
||||
(string=? entry ".."))
|
||||
(liip (readdir dir)
|
||||
result
|
||||
subdirs))
|
||||
(else
|
||||
(let* ((child (string-append full-name "/" entry))
|
||||
(st (false-if-exception (stat child))))
|
||||
(if (and st (eq? (stat:type st) 'directory))
|
||||
(liip (readdir dir)
|
||||
result
|
||||
(alist-cons entry st subdirs))
|
||||
(liip (readdir dir)
|
||||
(leaf child st result)
|
||||
subdirs))))))
|
||||
|
||||
;; Directory FULL-NAME not readable.
|
||||
;; XXX: It's up to the user to distinguish between not
|
||||
;; readable and not ENTER?.
|
||||
(values (skip full-name dir-stat result)
|
||||
visited)))
|
||||
(values (skip full-name dir-stat result)
|
||||
(mark visited dir-stat))))
|
||||
(else
|
||||
;; Caller passed a FILE-NAME that names a flat file, not a directory.
|
||||
(leaf full-name dir-stat result)))))
|
||||
|
||||
(define* (file-system-tree file-name
|
||||
#:optional (enter? (lambda (n s) #t))
|
||||
(stat lstat))
|
||||
"Return a tree of the form (FILE-NAME STAT CHILDREN ...) where STAT is
|
||||
the result of (stat FILE-NAME) and CHILDREN are similar structures for
|
||||
each file contained in FILE-NAME when it designates a directory. The
|
||||
optional ENTER? predicate is invoked as (ENTER? NAME STAT) and should
|
||||
return true to allow recursion into directory NAME; the default value is
|
||||
a procedure that always returns #t. When a directory does not match
|
||||
ENTER?, it nonetheless appears in the resulting tree, only with zero
|
||||
children. The optional STAT parameter defaults to `lstat'."
|
||||
(define (enter?* name stat result)
|
||||
(enter? name stat))
|
||||
(define (leaf name stat result)
|
||||
(match result
|
||||
(((siblings ...) rest ...)
|
||||
(cons (alist-cons (basename name) (cons stat '()) siblings)
|
||||
rest))))
|
||||
(define (down name stat result)
|
||||
(cons '() result))
|
||||
(define (up name stat result)
|
||||
(match result
|
||||
(((children ...) (siblings ...) rest ...)
|
||||
(cons (alist-cons (basename name) (cons stat children)
|
||||
siblings)
|
||||
rest))))
|
||||
(define skip ; keep an entry for skipped directories
|
||||
leaf)
|
||||
|
||||
(caar (file-system-fold enter?* leaf down up skip '(()) file-name stat)))
|
||||
|
||||
(define* (scandir name #:optional (select? (const #t))
|
||||
(entry<? string-locale<?))
|
||||
"Return the list of the names of files contained in directory NAME
|
||||
that match predicate SELECT? (by default, all files.) The returned list
|
||||
of file names is sorted according to ENTRY<?, which defaults to
|
||||
`string-locale<?'. Return #f when NAME is unreadable or is not a directory."
|
||||
(define (enter? dir stat result)
|
||||
(and stat (string=? dir name)))
|
||||
|
||||
(define (leaf name stat result)
|
||||
(if (select? name)
|
||||
(and (pair? result) ; must have a "." entry
|
||||
(cons (basename name) result))
|
||||
result))
|
||||
|
||||
(define (down name stat result)
|
||||
(list "."))
|
||||
|
||||
(define (up name stat result)
|
||||
(cons ".." result))
|
||||
|
||||
(define (skip name stat result)
|
||||
;; All the sub-directories are skipped.
|
||||
result)
|
||||
|
||||
(and=> (file-system-fold enter? leaf down up skip #f name stat)
|
||||
(lambda (files)
|
||||
(sort files entry<?))))
|
||||
|
||||
;;; ftw.scm ends here
|
||||
|
|
|
@ -99,46 +99,25 @@
|
|||
(or (proc (vlist-ref vlist i))
|
||||
(lp (1+ i)))))))
|
||||
|
||||
(define (singly-valued-expression? exp)
|
||||
(match exp
|
||||
(($ <const>) #t)
|
||||
(($ <lexical-ref>) #t)
|
||||
(($ <void>) #t)
|
||||
(($ <lexical-ref>) #t)
|
||||
(($ <primitive-ref>) #t)
|
||||
(($ <module-ref>) #t)
|
||||
(($ <toplevel-ref>) #t)
|
||||
(($ <primcall> _ (? singly-valued-primitive?)) #t)
|
||||
(($ <primcall> _ 'values (val)) #t)
|
||||
(($ <lambda>) #t)
|
||||
(else #f)))
|
||||
|
||||
(define (truncate-values x)
|
||||
"Discard all but the first value of X."
|
||||
(let loop ((x x))
|
||||
(match x
|
||||
(($ <const>) x)
|
||||
(($ <lexical-ref>) x)
|
||||
(($ <void>) x)
|
||||
(($ <lexical-ref>) x)
|
||||
(($ <primitive-ref>) x)
|
||||
(($ <module-ref>) x)
|
||||
(($ <toplevel-ref>) x)
|
||||
(($ <conditional> src condition subsequent alternate)
|
||||
(make-conditional src condition (loop subsequent) (loop alternate)))
|
||||
(($ <application> _ ($ <primitive-ref> _ 'values) (first _ ...))
|
||||
first)
|
||||
(($ <application> _ ($ <primitive-ref> _ 'values) (val))
|
||||
val)
|
||||
(($ <application> src
|
||||
(and prim ($ <primitive-ref> _ (? singly-valued-primitive?)))
|
||||
args)
|
||||
(make-application src prim (map loop args)))
|
||||
(($ <application> src proc args)
|
||||
(make-application src proc (map loop args)))
|
||||
(($ <sequence> src (exps ... last))
|
||||
(make-sequence src (append exps (list (loop last)))))
|
||||
(($ <lambda>) x)
|
||||
(($ <dynlet> src fluids vals body)
|
||||
(make-dynlet src fluids vals (loop body)))
|
||||
(($ <let> src names gensyms vals body)
|
||||
(make-let src names gensyms vals (loop body)))
|
||||
(($ <letrec> src in-order? names gensyms vals body)
|
||||
(make-letrec src in-order? names gensyms vals (loop body)))
|
||||
(($ <fix> src names gensyms vals body)
|
||||
(make-fix src names gensyms vals body))
|
||||
(($ <let-values> src exp body)
|
||||
(make-let-values src exp (loop body)))
|
||||
(else
|
||||
(make-application (tree-il-src x)
|
||||
(make-primitive-ref #f 'values)
|
||||
(list x))))))
|
||||
(if (singly-valued-expression? x)
|
||||
x
|
||||
(make-primcall (tree-il-src x) 'values (list x))))
|
||||
|
||||
;; Peval will do a one-pass analysis on the source program to determine
|
||||
;; the set of assigned lexicals, and to identify unreferenced and
|
||||
|
@ -315,13 +294,15 @@
|
|||
(visit-count operand-visit-count set-operand-visit-count!)
|
||||
(residualize? operand-residualize? set-operand-residualize?!)
|
||||
(copyable? operand-copyable? set-operand-copyable?!)
|
||||
(residual-value operand-residual-value set-operand-residual-value!)
|
||||
(residual-value operand-residual-value %set-operand-residual-value!)
|
||||
(constant-value operand-constant-value set-operand-constant-value!))
|
||||
|
||||
(define* (make-operand var sym #:optional source visit)
|
||||
;; Bind SYM to VAR, with value SOURCE.
|
||||
;; Bound operands are considered copyable until we prove otherwise.
|
||||
(let ((source (if source (truncate-values source) source)))
|
||||
;; Bind SYM to VAR, with value SOURCE. Bound operands are considered
|
||||
;; copyable until we prove otherwise. If we have a source expression,
|
||||
;; truncate it to one value. Copy propagation does not work on
|
||||
;; multiply-valued expressions.
|
||||
(let ((source (and=> source truncate-values)))
|
||||
(%make-operand var sym visit source 0 #f (and source #t) #f #f)))
|
||||
|
||||
(define (make-bound-operands vars syms sources visit)
|
||||
|
@ -330,6 +311,17 @@
|
|||
(define (make-unbound-operands vars syms)
|
||||
(map make-operand vars syms))
|
||||
|
||||
(define (set-operand-residual-value! op val)
|
||||
(%set-operand-residual-value!
|
||||
op
|
||||
(match val
|
||||
(($ <primcall> src 'values (first))
|
||||
;; The continuation of a residualized binding does not need the
|
||||
;; introduced `values' node, so undo the effects of truncation.
|
||||
first)
|
||||
(else
|
||||
val))))
|
||||
|
||||
(define* (visit-operand op counter ctx #:optional effort-limit size-limit)
|
||||
;; Peval is O(N) in call sites of the source program. However,
|
||||
;; visiting an operand can introduce new call sites. If we visit an
|
||||
|
@ -451,25 +443,23 @@ top-level bindings from ENV and return the resulting expression."
|
|||
(set-operand-residual-value! op val))
|
||||
(make-lexical-ref #f (var-name (operand-var op)) (operand-sym op)))
|
||||
|
||||
(define (apply-primitive name args)
|
||||
;; todo: further optimize commutative primitives
|
||||
(catch #t
|
||||
(lambda ()
|
||||
(call-with-values
|
||||
(lambda ()
|
||||
(apply (module-ref the-scm-module name) args))
|
||||
(lambda results
|
||||
(values #t results))))
|
||||
(lambda _
|
||||
(values #f '()))))
|
||||
|
||||
(define (make-values src values)
|
||||
(match values
|
||||
((single) single) ; 1 value
|
||||
((_ ...) ; 0, or 2 or more values
|
||||
(make-primcall src 'values values))))
|
||||
|
||||
(define (fold-constants src name args ctx)
|
||||
(define (apply-primitive name args)
|
||||
;; todo: further optimize commutative primitives
|
||||
(catch #t
|
||||
(lambda ()
|
||||
(call-with-values
|
||||
(lambda ()
|
||||
(apply (module-ref the-scm-module name) args))
|
||||
(lambda results
|
||||
(values #t results))))
|
||||
(lambda _
|
||||
(values #f '()))))
|
||||
(define (make-values src values)
|
||||
(match values
|
||||
((single) single) ; 1 value
|
||||
((_ ...) ; 0, or 2 or more values
|
||||
(make-primcall src 'values values))))
|
||||
(define (residualize-call)
|
||||
(make-primcall src name args))
|
||||
(cond
|
||||
|
@ -584,6 +574,9 @@ top-level bindings from ENV and return the resulting expression."
|
|||
(($ <primitive-ref>) #t)
|
||||
(($ <conditional> _ condition subsequent alternate)
|
||||
(and (loop condition) (loop subsequent) (loop alternate)))
|
||||
(($ <primcall> _ 'values exps)
|
||||
(and (not (null? exps))
|
||||
(every loop exps)))
|
||||
(($ <primcall> _ name args)
|
||||
(and (effect-free-primitive? name)
|
||||
(not (constructor-primitive? name))
|
||||
|
@ -705,7 +698,7 @@ top-level bindings from ENV and return the resulting expression."
|
|||
(let loop ((exp exp)
|
||||
(env vlist-null) ; vhash of gensym -> <operand>
|
||||
(counter #f) ; inlined call stack
|
||||
(ctx 'value)) ; effect, value, test, operator, or call
|
||||
(ctx 'values)) ; effect, value, values, test, operator, or call
|
||||
(define (lookup var)
|
||||
(cond
|
||||
((vhash-assq var env) => cdr)
|
||||
|
@ -715,6 +708,7 @@ top-level bindings from ENV and return the resulting expression."
|
|||
(loop exp env counter ctx))
|
||||
|
||||
(define (for-value exp) (visit exp 'value))
|
||||
(define (for-values exp) (visit exp 'values))
|
||||
(define (for-test exp) (visit exp 'test))
|
||||
(define (for-effect exp) (visit exp 'effect))
|
||||
(define (for-call exp) (visit exp 'call))
|
||||
|
@ -760,7 +754,8 @@ top-level bindings from ENV and return the resulting expression."
|
|||
(let ((val (operand-constant-value op)))
|
||||
(log 'memoized-constant gensym val)
|
||||
(for-tail val)))
|
||||
((visit-operand op counter ctx recursive-effort-limit operand-size-limit)
|
||||
((visit-operand op counter (if (eq? ctx 'values) 'value ctx)
|
||||
recursive-effort-limit operand-size-limit)
|
||||
=>
|
||||
;; If we end up deciding to residualize this value instead of
|
||||
;; copying it, save that residualized value.
|
||||
|
@ -783,7 +778,7 @@ top-level bindings from ENV and return the resulting expression."
|
|||
;; It could be this constant is the result of folding.
|
||||
;; If that is the case, cache it. This helps loop
|
||||
;; unrolling get farther.
|
||||
(if (eq? ctx 'value)
|
||||
(if (or (eq? ctx 'value) (eq? ctx 'values))
|
||||
(begin
|
||||
(log 'memoize-constant gensym val)
|
||||
(set-operand-constant-value! op val)))
|
||||
|
@ -897,7 +892,7 @@ top-level bindings from ENV and return the resulting expression."
|
|||
;; Peval the producer, then try to inline the consumer into
|
||||
;; the producer. If that succeeds, peval again. Otherwise
|
||||
;; reconstruct the let-values, pevaling the consumer.
|
||||
(let ((producer (for-value producer)))
|
||||
(let ((producer (for-values producer)))
|
||||
(or (match consumer
|
||||
(($ <lambda-case> src req #f #f #f () gensyms body #f)
|
||||
(cond
|
||||
|
@ -962,7 +957,6 @@ top-level bindings from ENV and return the resulting expression."
|
|||
_ req #f rest #f () gensyms body #f)))))
|
||||
(for-tail (make-let-values src (make-call src producer '())
|
||||
consumer)))
|
||||
|
||||
(($ <primcall> src 'dynamic-wind (w thunk u))
|
||||
(for-tail
|
||||
(cond
|
||||
|
@ -1006,6 +1000,19 @@ top-level bindings from ENV and return the resulting expression."
|
|||
(make-dynwind src w (make-call #f w '()) (make-call #f thunk '())
|
||||
(make-call #f u '()) u)))))
|
||||
|
||||
(($ <primcall> src 'values exps)
|
||||
(cond
|
||||
((null? exps)
|
||||
(if (eq? ctx 'effect)
|
||||
(make-void #f)
|
||||
exp))
|
||||
(else
|
||||
(let ((vals (map for-value exps)))
|
||||
(if (and (memq ctx '(value test effect))
|
||||
(every singly-valued-expression? vals))
|
||||
(for-tail (list->seq src (append (cdr vals) (list (car vals)))))
|
||||
(make-primcall src 'values vals))))))
|
||||
|
||||
(($ <primcall> src (? constructor-primitive? name) args)
|
||||
(cond
|
||||
((and (memq ctx '(effect test))
|
||||
|
@ -1199,7 +1206,7 @@ top-level bindings from ENV and return the resulting expression."
|
|||
((operator) exp)
|
||||
(else (record-source-expression!
|
||||
exp
|
||||
(make-lambda src meta (for-tail body))))))
|
||||
(make-lambda src meta (for-values body))))))
|
||||
(($ <lambda-case> src req opt rest kw inits gensyms body alt)
|
||||
(let* ((vars (map lookup-var gensyms))
|
||||
(new (fresh-gensyms vars))
|
||||
|
|
|
@ -209,6 +209,8 @@ LALR_EXTRA += \
|
|||
lalr/run-guile-test.sh
|
||||
|
||||
TESTS = $(LALR_TESTS)
|
||||
TESTS_ENVIRONMENT = $(top_builddir)/meta/guile --no-auto-compile
|
||||
TESTS_ENVIRONMENT = \
|
||||
@LOCALCHARSET_TESTS_ENVIRONMENT@ \
|
||||
$(top_builddir)/meta/guile --no-auto-compile
|
||||
|
||||
EXTRA_DIST += $(LALR_EXTRA) $(LALR_TESTS) tests/sxml-match-tests.ss
|
||||
|
|
|
@ -33,6 +33,7 @@ EXTRA_DIST =
|
|||
TESTS_ENVIRONMENT = \
|
||||
srcdir="$(srcdir)" \
|
||||
builddir="$(builddir)" \
|
||||
@LOCALCHARSET_TESTS_ENVIRONMENT@ \
|
||||
GUILE_AUTO_COMPILE=0 "${top_builddir}/meta/uninstalled-env"
|
||||
|
||||
## Check for headers in $(srcdir) and bulid dir before $(CPPFLAGS), which
|
||||
|
@ -81,6 +82,9 @@ TESTS += test-import-order
|
|||
EXTRA_DIST += test-import-order-a.scm test-import-order-b.scm \
|
||||
test-import-order-c.scm test-import-order-d.scm
|
||||
|
||||
check_SCRIPTS += test-command-line-encoding
|
||||
TESTS += test-command-line-encoding
|
||||
|
||||
# test-num2integral
|
||||
test_num2integral_SOURCES = test-num2integral.c
|
||||
test_num2integral_CFLAGS = ${test_cflags}
|
||||
|
|
24
test-suite/standalone/test-command-line-encoding
Executable file
24
test-suite/standalone/test-command-line-encoding
Executable file
|
@ -0,0 +1,24 @@
|
|||
#!/bin/sh
|
||||
|
||||
# Choose a UTF-8 locale. The locale doesn't have to be available on the
|
||||
# system since `environ_locale_charset' does not actually try to set it.
|
||||
LC_ALL="en_US.UTF-8"
|
||||
export LC_ALL
|
||||
unset LANG
|
||||
unset LC_CTYPE
|
||||
|
||||
exec guile -q -s "$0" "λ"
|
||||
!#
|
||||
|
||||
;; Make sure our first argument is a lower-case lambda.
|
||||
;;
|
||||
;; Up to Guile 2.0.3 included, command-line arguments would not be converted
|
||||
;; according to the locale settings; see
|
||||
;; <http://lists.gnu.org/archive/html/guile-devel/2011-11/msg00026.html> for
|
||||
;; details.
|
||||
(exit (string=? (cadr (program-arguments)) "λ"))
|
||||
|
||||
;; Local Variables:
|
||||
;; mode: scheme
|
||||
;; coding: utf-8
|
||||
;; End:
|
|
@ -1,6 +1,6 @@
|
|||
;;;; ftw.test --- exercise ice-9/ftw.scm -*- scheme -*-
|
||||
;;;;
|
||||
;;;; Copyright 2006 Free Software Foundation, Inc.
|
||||
;;;; Copyright 2006, 2011 Free Software Foundation, Inc.
|
||||
;;;;
|
||||
;;;; This library is free software; you can redistribute it and/or
|
||||
;;;; modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -18,7 +18,10 @@
|
|||
|
||||
(define-module (test-suite test-ice-9-ftw)
|
||||
#:use-module (test-suite lib)
|
||||
#:use-module (ice-9 ftw))
|
||||
#:use-module (ice-9 ftw)
|
||||
#:use-module (ice-9 match)
|
||||
#:use-module (srfi srfi-1)
|
||||
#:use-module (srfi srfi-26))
|
||||
|
||||
|
||||
;; the procedure-source checks here ensure the vector indexes we write match
|
||||
|
@ -72,3 +75,105 @@
|
|||
(pass-if "5 7 - 2nd" (eq? #t (try-visited? 5 7)))
|
||||
(pass-if "7 5 - 2nd" (eq? #t (try-visited? 7 5)))
|
||||
(pass-if "7 7 - 2nd" (eq? #t (try-visited? 7 7)))))
|
||||
|
||||
|
||||
;;;
|
||||
;;; `file-system-fold' & co.
|
||||
;;;
|
||||
|
||||
(define %top-srcdir
|
||||
(assq-ref %guile-build-info 'top_srcdir))
|
||||
|
||||
(define %test-dir
|
||||
(string-append %top-srcdir "/test-suite"))
|
||||
|
||||
(with-test-prefix "file-system-fold"
|
||||
|
||||
(pass-if "test-suite"
|
||||
(let ((enter? (lambda (n s r)
|
||||
;; Enter only `test-suite/tests/'.
|
||||
(if (member `(down ,%test-dir) r)
|
||||
(string=? (basename n) "tests")
|
||||
(string=? (basename n) "test-suite"))))
|
||||
(leaf (lambda (n s r) (cons `(leaf ,n) r)))
|
||||
(down (lambda (n s r) (cons `(down ,n) r)))
|
||||
(up (lambda (n s r) (cons `(up ,n) r)))
|
||||
(skip (lambda (n s r) (cons `(skip ,n) r))))
|
||||
(define seq
|
||||
(reverse
|
||||
(file-system-fold enter? leaf down up skip '() %test-dir)))
|
||||
|
||||
(match seq
|
||||
((('down (? (cut string=? <> %test-dir)))
|
||||
between ...
|
||||
('up (? (cut string=? <> %test-dir))))
|
||||
(and (any (match-lambda (('leaf (= basename "lib.scm")) #t) (_ #f))
|
||||
between)
|
||||
(any (match-lambda (('down (= basename "tests")) #t) (_ #f))
|
||||
between)
|
||||
(any (match-lambda (('leaf (= basename "alist.test")) #t) (_ #f))
|
||||
between)
|
||||
(any (match-lambda (('up (= basename "tests")) #t) (_ #f))
|
||||
between)
|
||||
(any (match-lambda (('skip (= basename "vm")) #t) (_ #f))
|
||||
between))))))
|
||||
|
||||
(pass-if "test-suite (never enter)"
|
||||
(let ((enter? (lambda (n s r) #f))
|
||||
(leaf (lambda (n s r) (cons `(leaf ,n) r)))
|
||||
(down (lambda (n s r) (cons `(down ,n) r)))
|
||||
(up (lambda (n s r) (cons `(up ,n) r)))
|
||||
(skip (lambda (n s r) (cons `(skip ,n) r))))
|
||||
(equal? (file-system-fold enter? leaf down up skip '() %test-dir)
|
||||
`((skip , %test-dir)))))
|
||||
|
||||
(pass-if "test-suite/lib.scm (flat file)"
|
||||
(let ((enter? (lambda (n s r) #t))
|
||||
(leaf (lambda (n s r) (cons `(leaf ,n) r)))
|
||||
(down (lambda (n s r) (cons `(down ,n) r)))
|
||||
(up (lambda (n s r) (cons `(up ,n) r)))
|
||||
(skip (lambda (n s r) (cons `(skip ,n) r)))
|
||||
(name (string-append %test-dir "/lib.scm")))
|
||||
(equal? (file-system-fold enter? leaf down up skip '() name)
|
||||
`((leaf ,name))))))
|
||||
|
||||
(with-test-prefix "file-system-tree"
|
||||
|
||||
(pass-if "test-suite (never enter)"
|
||||
(match (file-system-tree %test-dir (lambda (n s) #f))
|
||||
(("test-suite" (= stat:type 'directory)) ; no children
|
||||
#t)))
|
||||
|
||||
(pass-if "test-suite/*"
|
||||
(match (file-system-tree %test-dir (lambda (n s)
|
||||
(string=? n %test-dir)))
|
||||
(("test-suite" (= stat:type 'directory) children ...)
|
||||
(any (match-lambda
|
||||
(("tests" (= stat:type 'directory)) ; no children
|
||||
#t)
|
||||
(_ #f))
|
||||
children))))
|
||||
|
||||
(pass-if "test-suite (recursive)"
|
||||
(match (file-system-tree %test-dir)
|
||||
(("test-suite" (= stat:type 'directory) children ...)
|
||||
(any (match-lambda
|
||||
(("tests" (= stat:type 'directory) (= car files) ...)
|
||||
(let ((expected '("alist.test" "bytevectors.test"
|
||||
"ftw.test" "gc.test" "vlist.test")))
|
||||
(lset= string=?
|
||||
(lset-intersection string=? files expected)
|
||||
expected)))
|
||||
(_ #f))
|
||||
children)))))
|
||||
|
||||
(with-test-prefix "scandir"
|
||||
|
||||
(pass-if "test-suite"
|
||||
(let ((select? (cut string-suffix? ".test" <>)))
|
||||
(match (scandir (string-append %test-dir "/tests") select?)
|
||||
(("." ".." "00-initial-env.test" (? select?) ...)
|
||||
#t))))
|
||||
|
||||
(pass-if "flat file"
|
||||
(not (scandir (string-append %test-dir "/Makefile.am")))))
|
||||
|
|
|
@ -661,19 +661,19 @@
|
|||
(+ a b))))
|
||||
(const 3))
|
||||
|
||||
(pass-if-peval resolve-primitives
|
||||
(pass-if-peval
|
||||
;; First order, multiple values.
|
||||
(let ((x 1) (y 2))
|
||||
(values x y))
|
||||
(apply (primitive values) (const 1) (const 2)))
|
||||
(primcall values (const 1) (const 2)))
|
||||
|
||||
(pass-if-peval resolve-primitives
|
||||
(pass-if-peval
|
||||
;; First order, multiple values truncated.
|
||||
(let ((x (values 1 'a)) (y 2))
|
||||
(values x y))
|
||||
(apply (primitive values) (const 1) (const 2)))
|
||||
(primcall values (const 1) (const 2)))
|
||||
|
||||
(pass-if-peval resolve-primitives
|
||||
(pass-if-peval
|
||||
;; First order, multiple values truncated.
|
||||
(or (values 1 2) 3)
|
||||
(const 1))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue