1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-04-30 03:40:34 +02:00

Merge remote-tracking branch 'origin/stable-2.0'

Conflicts:
	GUILE-VERSION
	libguile/deprecated.c
	libguile/gc-malloc.c
	module/language/tree-il/peval.scm
This commit is contained in:
Andy Wingo 2011-10-27 13:45:04 +02:00
commit 4938d3cb74
170 changed files with 5301 additions and 2839 deletions

1
.gitignore vendored
View file

@ -143,3 +143,4 @@ INSTALL
/test-suite/standalone/test-pthread-create
/test-suite/standalone/test-pthread-create-secondary
/lib/fcntl.h
/lib/sys/uio.h

100
NEWS
View file

@ -5,6 +5,106 @@ See the end for copying conditions.
Please send Guile bug reports to bug-guile@gnu.org.
Changes in 2.0.3 (since 2.0.2):
* Speed improvements
** Guile has a new optimizer, `peval'.
`Peval' is a partial evaluator that performs constant folding, dead code
elimination, copy propagation, and inlining. By default it runs on
every piece of code that Guile compiles, to fold computations that can
happen at compile-time, so they don't have to happen at runtime.
If we did our job right, the only impact you would see would be your
programs getting faster. But if you notice slowdowns or bloated code,
please send a mail to bug-guile@gnu.org with details.
Thanks to William R. Cook, Oscar Waddell, and Kent Dybvig for inspiring
peval and its implementation.
You can see what peval does on a given piece of code by running the new
`,optimize' REPL meta-command, and comparing it to the output of
`,expand'. See "Compile Commands" in the manual, for more.
** Fewer calls to `stat'.
Guile now stats only the .go file and the .scm file when loading a fresh
compiled file.
* Notable changes
** New module: `(web client)', a simple synchronous web client.
See "Web Client" in the manual, for more.
** Users can now install compiled `.go' files.
See "Installing Site Packages" in the manual.
** Remove Front-Cover and Back-Cover text from the manual.
The manual is still under the GNU Free Documentation License, but no
longer has any invariant sections.
** More helpful `guild help'.
`guild' is Guile's multi-tool, for use in shell scripting. Now it has a
nicer interface for querying the set of existing commands, and getting
help on those commands. Try it out and see!
** New macro: `define-syntax-rule'
`define-syntax-rule' is a shorthand to make a `syntax-rules' macro with
one clause. See "Syntax Rules" in the manual, for more.
** The `,time' REPL meta-command now has more precision.
The output of this command now has microsecond precision, instead of
10-millisecond precision.
** `(ice-9 match)' can now match records.
See "Pattern Matching" in the manual, for more on matching records.
** New module: `(language tree-il debug)'.
This module provides a tree-il verifier. This is useful for people that
generate tree-il, usually as part of a language compiler.
** New functions: `scm_is_exact', `scm_is_inexact'.
These provide a nice C interface for Scheme's `exact?' and `inexact?',
respectively.
* Bugs fixed
See the git log (or the ChangeLog) for more details on these bugs.
** Fix order of importing modules and resolving duplicates handlers.
** Fix a number of bugs involving extended (merged) generics.
** Fix invocation of merge-generics duplicate handler.
** Fix write beyond array end in arrays.c.
** Fix read beyond end of hashtable size array in hashtab.c.
** (web http): Locale-independent parsing and serialization of dates.
** Ensure presence of Host header in HTTP/1.1 requests.
** Fix take-right and drop-right for improper lists.
** Fix leak in get_current_locale().
** Fix recursive define-inlinable expansions.
** Check that srfi-1 procedure arguments are procedures.
** Fix r6rs `map' for multiple returns.
** Fix scm_tmpfile leak on POSIX platforms.
** Fix a couple of leaks (objcode->bytecode, make-boot-program).
** Fix guile-lib back-compatibility for module-stexi-documentation.
** Fix --listen option to allow other ports.
** Fix scm_to_latin1_stringn for substrings.
** Fix compilation of untyped arrays of rank not 1.
** Fix unparse-tree-il of <dynset>.
** Fix reading of #||||#.
** Fix segfault in GOOPS when class fields are redefined.
** Prefer poll(2) over select(2) to allow file descriptors above FD_SETSIZE.
Changes in 2.0.2 (since 2.0.1):
* Notable changes

View file

@ -1,6 +1,6 @@
#!/bin/sh
# Print a version string.
scriptversion=2011-02-19.19; # UTC
scriptversion=2011-08-11.12; # UTC
# Copyright (C) 2007-2011 Free Software Foundation, Inc.
#
@ -44,8 +44,10 @@ scriptversion=2011-02-19.19; # UTC
# files to pick up a version string change; and leave it stale to
# minimize rebuild time after unrelated changes to configure sources.
#
# It is probably wise to add these two files to .gitignore, so that you
# don't accidentally commit either generated file.
# As with any generated file in a VC'd directory, you should add
# /.version to .gitignore, so that you don't accidentally commit it.
# .tarball-version is never generated in a VC'd directory, so needn't
# be listed there.
#
# Use the following line in your configure.ac, so that $(VERSION) will
# automatically be up-to-date each time configure is run (and note that
@ -57,9 +59,10 @@ scriptversion=2011-02-19.19; # UTC
# [bug-project@example])
#
# Then use the following lines in your Makefile.am, so that .version
# will be present for dependencies, and so that .tarball-version will
# exist in distribution tarballs.
# will be present for dependencies, and so that .version and
# .tarball-version will exist in distribution tarballs.
#
# EXTRA_DIST = $(top_srcdir)/.version
# BUILT_SOURCES = $(top_srcdir)/.version
# $(top_srcdir)/.version:
# echo $(VERSION) > $@-t && mv $@-t $@

View file

@ -0,0 +1,10 @@
#ifndef _Noreturn
# if (3 <= __GNUC__ || (__GNUC__ == 2 && 8 <= __GNUC_MINOR__) \
|| 0x5110 <= __SUNPRO_C)
# define _Noreturn __attribute__ ((__noreturn__))
# elif 1200 <= _MSC_VER
# define _Noreturn __declspec (noreturn)
# else
# define _Noreturn
# endif
#endif

View file

@ -29,6 +29,7 @@ info_TEXINFOS = guile.texi
guile_TEXINFOS = preface.texi \
intro.texi \
tour.texi \
libguile-parallel.texi \
libguile-program.texi \
scheme-intro.texi \
api-scm.texi \
@ -74,7 +75,7 @@ guile_TEXINFOS = preface.texi \
match.texi \
misc-modules.texi \
api-compound.texi \
autoconf.texi \
libguile-autoconf.texi \
autoconf-macros.texi \
tools.texi \
history.texi \
@ -113,7 +114,7 @@ EXTRA_DIST = ChangeLog-2008 $(PICTURES)
# Automated snarfing
autoconf.texi: autoconf-macros.texi
libguile-autoconf.texi: autoconf-macros.texi
autoconf-macros.texi: $(top_srcdir)/meta/guile.m4
GUILE_AUTO_COMPILE=0 $(top_builddir)/meta/uninstalled-env guild \
snarf-guile-m4-docs $(top_srcdir)/meta/guile.m4 \

View file

@ -801,11 +801,31 @@ setter or an operator struct.
@node Inlinable Procedures
@subsection Inlinable Procedures
@cindex inlining
@cindex procedure inlining
You can define an @dfn{inlinable procedure} by using
@code{define-inlinable} instead of @code{define}. An inlinable
procedure behaves the same as a regular procedure, but direct calls will
result in the procedure body being inlined into the caller.
@cindex partial evaluator
Bear in mind that starting from version 2.0.3, Guile has a partial
evaluator that can inline the body of inner procedures when deemed
appropriate:
@example
scheme@@(guile-user)> ,optimize (define (foo x)
(define (bar) (+ x 3))
(* (bar) 2))
$1 = (define foo
(lambda (#@{x 94@}#) (* (+ #@{x 94@}# 3) 2)))
@end example
@noindent
The partial evaluator does not inline top-level bindings, though, so
this is a situation where you may find it interesting to use
@code{define-inlinable}.
Procedures defined with @code{define-inlinable} are @emph{always}
inlined, at all direct call sites. This eliminates function call
overhead at the expense of an increase in code size. Additionally, the

View file

@ -1,272 +0,0 @@
@c -*-texinfo-*-
@c This is part of the GNU Guile Reference Manual.
@c Copyright (C) 1996, 1997, 2000, 2001, 2002, 2003, 2004, 2009, 2011
@c Free Software Foundation, Inc.
@c See the file guile.texi for copying conditions.
@page
@node Autoconf Support
@chapter Autoconf Support
When Guile is installed, a pkg-config description file and a set of
Autoconf macros is installed. This chapter documents pkg-config and
Autoconf support, as well as the high-level guile-tool Autofrisk.
@menu
* Autoconf Background:: Why use autoconf?
* Autoconf Macros:: The GUILE_* macros.
* Using Autoconf Macros:: How to use them, plus examples.
* Autofrisk:: AUTOFRISK_CHECKS and AUTOFRISK_SUMMARY.
* Using Autofrisk:: Example modules.af files.
@end menu
@node Autoconf Background
@section Autoconf Background
As explained in the @cite{GNU Autoconf Manual}, any package needs
configuration at build-time (@pxref{Top, ,Introduction,autoconf,The GNU
Autoconf Manual}). If your package uses Guile (or uses a package that
in turn uses Guile), you probably need to know what specific Guile
features are available and details about them.
The way to do this is to write feature tests and arrange for their execution
by the @file{configure} script, typically by adding the tests to
@file{configure.ac}, and running @code{autoconf} to create @file{configure}.
Users of your package then run @file{configure} in the normal way.
Macros are a way to make common feature tests easy to express.
Autoconf provides a wide range of macros
(@pxref{Existing Tests,,,autoconf,The GNU Autoconf Manual}),
and Guile installation provides Guile-specific tests in the areas of:
program detection, compilation flags reporting, and Scheme module
checks.
@node Autoconf Macros
@section Autoconf Macros
@cindex pkg-config
@cindex autoconf
GNU Guile provides a @dfn{pkg-config} description file, which contains
all the information necessary to compile and link C applications that
use Guile. The @code{pkg-config} program is able to read this file
and provide this information to application programmers; it can be
obtained at @url{http://pkg-config.freedesktop.org/}.
The following command lines give respectively the C compilation and link
flags needed to build Guile-using programs:
@example
pkg-config guile-@value{EFFECTIVE-VERSION} --cflags
pkg-config guile-@value{EFFECTIVE-VERSION} --libs
@end example
To ease use of pkg-config with Autoconf, pkg-config comes with a
convenient Autoconf macro. The following example looks for Guile and
sets the @code{GUILE_CFLAGS} and @code{GUILE_LIBS} variables
accordingly, or prints an error and exits if Guile was not found:
@findex PKG_CHECK_MODULES
@example
PKG_CHECK_MODULES([GUILE], [guile-@value{EFFECTIVE-VERSION}])
@end example
Guile comes with additional Autoconf macros providing more information,
installed as @file{@var{prefix}/share/aclocal/guile.m4}. Their names
all begin with @code{GUILE_}.
@c see Makefile.am
@include autoconf-macros.texi
@node Using Autoconf Macros
@section Using Autoconf Macros
Using the autoconf macros is straightforward: Add the macro "calls" (actually
instantiations) to @file{configure.ac}, run @code{aclocal}, and finally,
run @code{autoconf}. If your system doesn't have guile.m4 installed, place
the desired macro definitions (@code{AC_DEFUN} forms) in @file{acinclude.m4},
and @code{aclocal} will do the right thing.
Some of the macros can be used inside normal shell constructs: @code{if foo ;
then GUILE_BAZ ; fi}, but this is not guaranteed. It's probably a good idea
to instantiate macros at top-level.
We now include two examples, one simple and one complicated.
The first example is for a package that uses libguile, and thus needs to
know how to compile and link against it. So we use
@code{PKG_CHECK_MODULES} to set the vars @code{GUILE_CFLAGS} and
@code{GUILE_LIBS}, which are automatically substituted in the Makefile.
@example
In configure.ac:
PKG_CHECK_MODULES([GUILE], [guile-@value{EFFECTIVE-VERSION}])
In Makefile.in:
GUILE_CFLAGS = @@GUILE_CFLAGS@@
GUILE_LIBS = @@GUILE_LIBS@@
myprog.o: myprog.c
$(CC) -o $@ $(GUILE_CFLAGS) $<
myprog: myprog.o
$(CC) -o $@ $< $(GUILE_LIBS)
@end example
The second example is for a package of Guile Scheme modules that uses an
external program and other Guile Scheme modules (some might call this a "pure
scheme" package). So we use the @code{GUILE_SITE_DIR} macro, a regular
@code{AC_PATH_PROG} macro, and the @code{GUILE_MODULE_AVAILABLE} macro.
@example
In configure.ac:
GUILE_SITE_DIR
probably_wont_work=""
# pgtype pgtable
GUILE_MODULE_AVAILABLE(have_guile_pg, (database postgres))
test $have_guile_pg = no &&
probably_wont_work="(my pgtype) (my pgtable) $probably_wont_work"
# gpgutils
AC_PATH_PROG(GNUPG,gpg)
test x"$GNUPG" = x &&
probably_wont_work="(my gpgutils) $probably_wont_work"
if test ! "$probably_wont_work" = "" ; then
p=" ***"
echo
echo "$p"
echo "$p NOTE:"
echo "$p The following modules probably won't work:"
echo "$p $probably_wont_work"
echo "$p They can be installed anyway, and will work if their"
echo "$p dependencies are installed later. Please see README."
echo "$p"
echo
fi
In Makefile.in:
instdir = @@GUILE_SITE@@/my
install:
$(INSTALL) my/*.scm $(instdir)
@end example
@node Autofrisk
@section Autofrisk
The @dfn{guild autofrisk} command looks for the file @file{modules.af}
in the current directory and writes out @file{modules.af.m4} containing
autoconf definitions for @code{AUTOFRISK_CHECKS} and
@code{AUTOFRISK_SUMMARY}. @xref{Autoconf Background}, and @xref{Using
Autoconf Macros}, for more info.
The modules.af file consists of a series of configuration forms (Scheme
lists), which have one of the following formats:
@example
(files-glob PATTERN ...) ;; required
(non-critical-external MODULE ...) ;; optional
(non-critical-internal MODULE ...) ;; optional
(programs (MODULE PROG ...) ...) ;; optional
(pww-varname VARNAME) ;; optional
@end example
@var{pattern} is a string that may contain "*" and "?" characters to be
expanded into filenames. @var{module} is a list of symbols naming a module,
such as `(srfi srfi-1)'. @var{varname} is a shell-safe name to use instead of
@code{probably_wont_work}, the default. This var is passed to `AC_SUBST'.
@var{prog} is a string that names a program, such as "gpg".
Autofrisk expands the @code{files-glob} pattern(s) into a list of files, scans
each file's module definition form(s), and constructs a module dependency
graph wherein modules defined by @code{define-module} are considered
@dfn{internal} and the remaining, @dfn{external}. For each external module
that has an internal dependency, Autofrisk emits a
@code{GUILE_MODULE_REQUIRED} check (@pxref{Autoconf Macros}), which altogether
form the body of @code{AUTOFRISK_CHECKS}.
@code{GUILE_MODULE_REQUIRED} causes the @file{configure} script to exit with
an error message if the specified module is not available; it enforces a
strong dependency. You can temper dependency strength by using the
@code{non-critical-external} and @code{non-critical-internal} configuration
forms in modules.af. For graph edges that touch such non-critical modules,
Autofrisk uses @code{GUILE_MODULE_AVAILABLE}, and arranges for
@code{AUTOFRISK_SUMMARY} to display a warning if they are not found.
The shell code resulting from the expansion of @code{AUTOFRISK_CHECKS} and
@code{AUTOFRISK_SUMMARY} uses the shell variable @code{probably_wont_work} to
collect the names of unfound non-critical modules. If this bothers you, use
configuration form @code{(pww-name foo)} in modules.af.
Although Autofrisk does not detect when a module uses a program (for example,
in a @code{system} call), it can generate @code{AC_PATH_PROG} forms anyway if
you use the @code{programs} configuration form in modules.af. These are
collected into @code{AUTOCONF_CHECKS}.
@xref{Using Autofrisk}, for some modules.af examples.
@node Using Autofrisk
@section Using Autofrisk
Using Autofrisk (@pxref{Autofrisk}) involves writing @file{modules.af} and
adding two macro calls to @file{configure.in}. Here is an example of the
latter:
@example
AUTOFRISK_CHECKS
AUTOFRISK_SUMMARY
@end example
Here is an adaptation of the second "GUILE_*" example (@pxref{Using Autoconf
Macros}) that does basically the same thing.
@example
(files-glob "my/*.scm")
(non-critical-external (database postgres))
(programs ((my gpgutils) "gpg")) ;; (my gpgutils) uses "gpg"
@end example
If the SRFI modules (@pxref{SRFI Support}) were a separate package, we could
use @code{guild frisk} to find out its dependencies:
@example
$ guild frisk srfi/*.scm
13 files, 18 modules (13 internal, 5 external), 9 edges
x (ice-9 and-let-star)
regular (srfi srfi-2)
x (ice-9 syncase)
regular (srfi srfi-11)
x (ice-9 rdelim)
regular (srfi srfi-10)
x (ice-9 receive)
regular (srfi srfi-8)
regular (srfi srfi-1)
x (ice-9 session)
regular (srfi srfi-1)
@end example
Then, we could use the following modules.af to help configure it:
@example
(files-glob "srfi/*.scm")
(non-critical-external ;; relatively recent
(ice-9 rdelim)
(ice-9 receive)
(ice-9 and-let-star))
(pww-varname not_fully_supported)
@end example
@c autoconf.texi ends here

View file

@ -182,8 +182,6 @@ x
* Guile Implementation::
* Autoconf Support::
Appendices
* GNU Free Documentation License:: The license of this manual.
@ -229,6 +227,7 @@ on that make up Guile's application programming interface (API), see
* Using Guile Interactively:: Guile's REPL features.
* Using Guile in Emacs:: Guile and Emacs.
* Using Guile Tools:: A guild of scheming wizards.
* Installing Site Packages:: Installing Scheme code.
@end menu
@include scheme-intro.texi
@ -264,20 +263,25 @@ etc. that make up Guile's application programming interface (API),
@xref{API Reference}.
@menu
* Parallel Installations:: Finding the right Guile.
* Linking Programs With Guile:: More precisely, with the libguile library.
* Linking Guile with Libraries:: To extend Guile itself.
* General Libguile Concepts:: General concepts for using libguile.
* Defining New Types (Smobs):: Adding new types to Guile.
* Function Snarfing:: A way to define new functions.
* Programming Overview:: An overview of Guile programming.
* Autoconf Support:: Putting m4 to good use.
@end menu
@include libguile-parallel.texi
@include libguile-linking.texi
@include libguile-extensions.texi
@include libguile-concepts.texi
@include libguile-smobs.texi
@include libguile-snarf.texi
@include libguile-program.texi
@include libguile-autoconf.texi
@node API Reference
@chapter API Reference
@ -426,8 +430,6 @@ merely familiar with Scheme to being a real hacker.
@include vm.texi
@include compiler.texi
@include autoconf.texi
@node GNU Free Documentation License
@appendix GNU Free Documentation License

View file

@ -0,0 +1,151 @@
@c -*-texinfo-*-
@c This is part of the GNU Guile Reference Manual.
@c Copyright (C) 1996, 1997, 2000, 2001, 2002, 2003, 2004, 2009, 2011
@c Free Software Foundation, Inc.
@c See the file guile.texi for copying conditions.
@page
@node Autoconf Support
@section Autoconf Support
Autoconf, a part of the GNU build system, makes it easy for users to
build your package. This section documents Guile's Autoconf support.
@menu
* Autoconf Background:: Why use autoconf?
* Autoconf Macros:: The GUILE_* macros.
* Using Autoconf Macros:: How to use them, plus examples.
@end menu
@node Autoconf Background
@subsection Autoconf Background
As explained in the @cite{GNU Autoconf Manual}, any package needs
configuration at build-time (@pxref{Top, ,Introduction,autoconf,The GNU
Autoconf Manual}). If your package uses Guile (or uses a package that
in turn uses Guile), you probably need to know what specific Guile
features are available and details about them.
The way to do this is to write feature tests and arrange for their execution
by the @file{configure} script, typically by adding the tests to
@file{configure.ac}, and running @code{autoconf} to create @file{configure}.
Users of your package then run @file{configure} in the normal way.
Macros are a way to make common feature tests easy to express.
Autoconf provides a wide range of macros
(@pxref{Existing Tests,,,autoconf,The GNU Autoconf Manual}),
and Guile installation provides Guile-specific tests in the areas of:
program detection, compilation flags reporting, and Scheme module
checks.
@node Autoconf Macros
@subsection Autoconf Macros
As mentioned earlier in this chapter, Guile supports parallel
installation, and uses @code{pkg-config} to let the user choose which
version of Guile they are interested in. @code{pkg-config} has its own
set of Autoconf macros that are probably installed on most every
development system. The most useful of these macros is
@code{PKG_CHECK_MODULES}.
@findex PKG_CHECK_MODULES
@example
PKG_CHECK_MODULES([GUILE], [guile-@value{EFFECTIVE-VERSION}])
@end example
This example looks for Guile and sets the @code{GUILE_CFLAGS} and
@code{GUILE_LIBS} variables accordingly, or prints an error and exits if
Guile was not found.
Guile comes with additional Autoconf macros providing more information,
installed as @file{@var{prefix}/share/aclocal/guile.m4}. Their names
all begin with @code{GUILE_}.
@c see Makefile.am
@include autoconf-macros.texi
@node Using Autoconf Macros
@subsection Using Autoconf Macros
Using the autoconf macros is straightforward: Add the macro "calls" (actually
instantiations) to @file{configure.ac}, run @code{aclocal}, and finally,
run @code{autoconf}. If your system doesn't have guile.m4 installed, place
the desired macro definitions (@code{AC_DEFUN} forms) in @file{acinclude.m4},
and @code{aclocal} will do the right thing.
Some of the macros can be used inside normal shell constructs: @code{if foo ;
then GUILE_BAZ ; fi}, but this is not guaranteed. It's probably a good idea
to instantiate macros at top-level.
We now include two examples, one simple and one complicated.
The first example is for a package that uses libguile, and thus needs to
know how to compile and link against it. So we use
@code{PKG_CHECK_MODULES} to set the vars @code{GUILE_CFLAGS} and
@code{GUILE_LIBS}, which are automatically substituted in the Makefile.
@example
In configure.ac:
PKG_CHECK_MODULES([GUILE], [guile-@value{EFFECTIVE-VERSION}])
In Makefile.in:
GUILE_CFLAGS = @@GUILE_CFLAGS@@
GUILE_LIBS = @@GUILE_LIBS@@
myprog.o: myprog.c
$(CC) -o $@ $(GUILE_CFLAGS) $<
myprog: myprog.o
$(CC) -o $@ $< $(GUILE_LIBS)
@end example
The second example is for a package of Guile Scheme modules that uses an
external program and other Guile Scheme modules (some might call this a "pure
scheme" package). So we use the @code{GUILE_SITE_DIR} macro, a regular
@code{AC_PATH_PROG} macro, and the @code{GUILE_MODULE_AVAILABLE} macro.
@example
In configure.ac:
GUILE_SITE_DIR
probably_wont_work=""
# pgtype pgtable
GUILE_MODULE_AVAILABLE(have_guile_pg, (database postgres))
test $have_guile_pg = no &&
probably_wont_work="(my pgtype) (my pgtable) $probably_wont_work"
# gpgutils
AC_PATH_PROG(GNUPG,gpg)
test x"$GNUPG" = x &&
probably_wont_work="(my gpgutils) $probably_wont_work"
if test ! "$probably_wont_work" = "" ; then
p=" ***"
echo
echo "$p"
echo "$p NOTE:"
echo "$p The following modules probably won't work:"
echo "$p $probably_wont_work"
echo "$p They can be installed anyway, and will work if their"
echo "$p dependencies are installed later. Please see README."
echo "$p"
echo
fi
In Makefile.in:
instdir = @@GUILE_SITE@@/my
install:
$(INSTALL) my/*.scm $(instdir)
@end example
@c autoconf.texi ends here

View file

@ -16,23 +16,15 @@ head of any C source file that uses identifiers described in this
manual. Once you've compiled your source files, you need to link them
against the Guile object code library, @code{libguile}.
@code{<libguile.h>} is not in the default search path for headers,
because Guile supports parallel installation of multiple versions of
Guile, with each version's headers under their own directories. This is
to allow development against, say, both Guile 2.0 and 2.2.
As noted in the previous section, @code{<libguile.h>} is not in the
default search path for headers. The following command lines give
respectively the C compilation and link flags needed to build programs
using Guile @value{EFFECTIVE-VERSION}:
To compile code that includes @code{<libguile.h>}, or links to
@code{libguile}, you need to select the effective version you are
interested in, and then ask @code{pkg-config} for the compilation flags
or linking instructions. For effective version
@value{EFFECTIVE-VERSION}, for example, you would invoke
@code{pkg-config --cflags --libs guile-@value{EFFECTIVE-VERSION}} to get
the compilation and linking flags necessary to link to version
@value{EFFECTIVE-VERSION} of Guile. You would typically run
@code{pkg-config} during the configuration phase of your program and
use the obtained information in the Makefile.
See the @code{pkg-config} man page, for more information.
@example
pkg-config guile-@value{EFFECTIVE-VERSION} --cflags
pkg-config guile-@value{EFFECTIVE-VERSION} --libs
@end example
@menu
* Guile Initialization Functions:: What to call first.

View file

@ -0,0 +1,69 @@
@c -*-texinfo-*-
@c This is part of the GNU Guile Reference Manual.
@c Copyright (C) 1996, 1997, 2000, 2001, 2002, 2003, 2004, 2005, 2010, 2011
@c Free Software Foundation, Inc.
@c See the file guile.texi for copying conditions.
@node Parallel Installations
@section Parallel Installations
@cindex pkg-config
@cindex effective version
Guile provides strong API and ABI stability guarantees during stable
series, so that if a user writes a program against Guile version 2.0.3,
it will be compatible with some future version 2.0.7. We say in this
case that 2.0 is the @dfn{effective version}, composed of the major and
minor versions, in this case 2 and 0.
Users may install multiple effective versions of Guile, with each
version's headers, libraries, and Scheme files under their own
directories. This provides the necessary stability guarantee for users,
while also allowing Guile developers to evolve the language and its
implementation.
However, parallel installability does have a down-side, in that users
need to know which version of Guile to ask for, when they build against
Guile. Guile solves this problem by installing a file to be read by the
@code{pkg-config} utility, a tool to query installed packages by name.
Guile encodes the version into its pkg-config name, so that users can
ask for @code{guile-2.0} or @code{guile-2.2}, as appropriate.
For effective version @value{EFFECTIVE-VERSION}, for example, you would
invoke @code{pkg-config --cflags --libs guile-@value{EFFECTIVE-VERSION}}
to get the compilation and linking flags necessary to link to version
@value{EFFECTIVE-VERSION} of Guile. You would typically run
@code{pkg-config} during the configuration phase of your program and use
the obtained information in the Makefile.
Guile's @code{pkg-config} file,
@file{guile-@value{EFFECTIVE-VERSION}.pc}, defines additional useful
variables:
@table @code
@item sitedir
@cindex @code{sitedir}
The default directory where Guile looks for Scheme source and compiled
files (@pxref{Installing Site Packages, %site-dir}). Run
@command{pkg-config guile-@value{EFFECTIVE-VERSION} --variable=sitedir}
to see its value. @xref{Autoconf Macros, GUILE_SITE_DIR}, for more on
how to use it from Autoconf.
@item extensiondir
@cindex @code{extensiondir}
The default directory where Guile looks for extensions---i.e., shared
libraries providing additional features (@pxref{Modules and
Extensions}). Run @command{pkg-config guile-@value{EFFECTIVE-VERSION}
--variable=extensiondir} to see its value.
@end table
@noindent
See the @code{pkg-config} man page, for more information, or its web
site, @url{http://pkg-config.freedesktop.org/}.
@xref{Autoconf Support}, for more on checking for Guile from within a
@code{configure.ac} file.
@c Local Variables:
@c TeX-master: "guile.texi"
@c End:

View file

@ -271,6 +271,14 @@ Generate compiled code.
Compile a file.
@end deffn
@deffn {REPL Command} expand exp
Expand any macros in a form.
@end deffn
@deffn {REPL Command} optimize exp
Run the optimizer on a piece of code and print the result.
@end deffn
@deffn {REPL Command} disassemble exp
Disassemble a compiled procedure.
@end deffn
@ -724,6 +732,64 @@ using a CPAN-like system.
A complete list of guild scripts can be had by invoking @code{guild
list}, or simply @code{guild}.
@node Installing Site Packages
@section Installing Site Packages
@cindex site
@cindex site path
@cindex load path
@findex %site-dir
At some point, you will probably want to share your code with other
people. To do so effectively, it is important to follow a set of common
conventions, to make it easy for the user to install and use your
package.
The first thing to do is to install your Scheme files where Guile can
find them. When Guile goes to find a Scheme file, it will search a
@dfn{load path} to find the file: first in Guile's own path, then in
paths for @dfn{site packages}. A site package is any Scheme code that
is installed and not part of Guile itself. @xref{Loading}, for more on
load paths.
There are several site paths, for historical reasons, but the one that
should generally be used can be obtained by invoking the
@code{%site-dir} procedure. @xref{Build Config}. If Guile
@value{EFFECTIVE-VERSION} is installed on your system in @code{/usr/},
then @code{(%site-dir)} will be
@code{/usr/share/guile/site/@value{EFFECTIVE-VERSION}}. Scheme files
should be installed there.
If you do not install compiled @code{.go} files, Guile will compile your
modules and programs when they are first used, and cache them in the
user's home directory. @xref{Compilation}, for more on
auto-compilation. However, it is better to compile the files before
they are installed, and to just copy the files to a place that Guile can
find them.
As with Scheme files, Guile searches a path to find compiled @code{.go}
files, the @code{%load-compiled-path}. By default, this path has two
entries: a path for Guile's files, and a path for site packages. You
should install your @code{.go} files into the latter. Currently there
is no procedure to get at this path, which is probably a bug. As in the
previous example, if Guile @value{EFFECTIVE-VERSION} is installed on
your system in @code{/usr/}, then the place to put compiled files for
site packages will be
@code{/usr/lib/guile/@value{EFFECTIVE-VERSION}/site-ccache}.
Note that a @code{.go} file will only be loaded in preference to a
@code{.scm} file if it is newer. For that reason, you should install
your Scheme files first, and your compiled files second.
Finally, although this section is only about Scheme, sometimes you need
to install C extensions too. Shared libraries should be installed in
the @dfn{extensions dir}. This value can be had from the build config
(@pxref{Build Config}). Again, if Guile @value{EFFECTIVE-VERSION} is
installed on your system in @code{/usr/}, then the extensions dir will
be @code{/usr/lib/guile/@value{EFFECTIVE-VERSION}/extensions}.
@c Local Variables:
@c TeX-master: "guile.texi"
@c End:

View file

@ -181,6 +181,9 @@ scheme@@(guile-user)> (j0 2)
$1 = 0.223890779141236
@end smallexample
For more on how to install your extension, @pxref{Installing Site
Packages}.
@node Using the Guile Module System
@subsection Using the Guile Module System
@ -235,7 +238,7 @@ in a location where Guile can automatically find it. The following
session shows a simple example.
@smallexample
$ cat /usr/local/share/guile/foo/bar.scm
$ cat /usr/local/share/guile/site/foo/bar.scm
(define-module (foo bar)
#:export (frob))
@ -248,6 +251,10 @@ scheme@@(guile-user)> (frob 12)
$1 = 24
@end smallexample
For more on how to install your module, @pxref{Installing Site
Packages}.
@node Putting Extensions into Modules
@subsubsection Putting Extensions into Modules
@ -258,14 +265,14 @@ You do this by writing a small Scheme file that defines the module and
call @code{load-extension} directly in the body of the module.
@smallexample
$ cat /usr/local/share/guile/math/bessel.scm
$ cat /usr/local/share/guile/site/math/bessel.scm
(define-module (math bessel)
#:export (j0))
(load-extension "libguile-bessel" "init_bessel")
$ file /usr/local/lib/libguile-bessel.so
$ file /usr/local/lib/guile/@value{EFFECTIVE-VERSION}/extensions/libguile-bessel.so
@dots{} ELF 32-bit LSB shared object @dots{}
$ guile
scheme@@(guile-user)> (use-modules (math bessel))

View file

@ -39,6 +39,7 @@ back.
* HTTP Headers:: How Guile represents specific header values.
* Requests:: HTTP requests.
* Responses:: HTTP responses.
* Web Client:: Accessing web resources over HTTP.
* Web Server:: Serving HTTP to the internet.
* Web Examples:: How to use this thing.
@end menu
@ -303,8 +304,8 @@ types by providing a number of low-level parsers and unparsers for
elements of the HTTP protocol.
If you are want to skip the low-level details for now and move on to web
pages, @pxref{Web Server}. Otherwise, load the HTTP module, and read
on.
pages, @pxref{Web Client}, and @pxref{Web Server}. Otherwise, load the
HTTP module, and read on.
@example
(use-modules (web http))
@ -1281,6 +1282,40 @@ Return the given response header, or @var{default} if none was present.
@end deffn
@node Web Client
@subsection Web Client
@code{(web client)} provides a simple, synchronous HTTP client, built on
the lower-level HTTP, request, and response modules.
@deffn {Scheme Procedure} open-socket-for-uri uri
@end deffn
@deffn {Scheme Procedure} http-get uri [#:port=(open-socket-for-uri uri)] [#:version='(1 . 1)] [#:keep-alive?=#f] [#:extra-headers='()] [#:decode-body=#t]
Connect to the server corresponding to @var{uri} and ask for the
resource, using the @code{GET} method. If you already have a port open,
pass it as @var{port}. The port will be closed at the end of the
request unless @var{keep-alive?} is true. Any extra headers in the
alist @var{extra-headers} will be added to the request.
If @var{decode-body?} is true, as is the default, the body of the
response will be decoded to string, if it is a textual content-type.
Otherwise it will be returned as a bytevector.
@end deffn
@code{http-get} is useful for making one-off requests to web sites. If
you are writing a web spider or some other client that needs to handle a
number of requests in parallel, it's better to build an event-driven URL
fetcher, similar in structure to the web server (@pxref{Web Server}).
Another option, good but not as performant, would be to use threads,
possibly via par-map or futures.
More helper procedures for the other common HTTP verbs would be a good
addition to this module. Send your code to
@email{guile-user@@gnu.org}.
@node Web Server
@subsection Web Server

View file

@ -2,10 +2,22 @@
## Process this file with automake to produce Makefile.in.
# Copyright (C) 2002-2011 Free Software Foundation, Inc.
#
# This file is free software, distributed under the terms of the GNU
# General Public License. As a special exception to the GNU General
# Public License, this file may be distributed as part of a program
# that contains a configuration script generated by Autoconf, under
# This file is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This file 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this file. If not, see <http://www.gnu.org/licenses/>.
#
# As a special exception to the GNU General Public License,
# this file may be distributed as part of a program that
# contains a configuration script generated by Autoconf, under
# the same distribution terms as the rest of that program.
#
# Generated by gnulib-tool.
@ -102,30 +114,6 @@ EXTRA_DIST += $(top_srcdir)/build-aux/announce-gen
## end gnulib module announce-gen
## begin gnulib module arg-nonnull
# The BUILT_SOURCES created by this Makefile snippet are not used via #include
# statements but through direct file reference. Therefore this snippet must be
# present in all Makefile.am that need it. This is ensured by the applicability
# 'all' defined above.
BUILT_SOURCES += arg-nonnull.h
# The arg-nonnull.h that gets inserted into generated .h files is the same as
# build-aux/arg-nonnull.h, except that it has the copyright header cut off.
arg-nonnull.h: $(top_srcdir)/build-aux/arg-nonnull.h
$(AM_V_GEN)rm -f $@-t $@ && \
sed -n -e '/GL_ARG_NONNULL/,$$p' \
< $(top_srcdir)/build-aux/arg-nonnull.h \
> $@-t && \
mv $@-t $@
MOSTLYCLEANFILES += arg-nonnull.h arg-nonnull.h-t
ARG_NONNULL_H=arg-nonnull.h
EXTRA_DIST += $(top_srcdir)/build-aux/arg-nonnull.h
## end gnulib module arg-nonnull
## begin gnulib module arpa_inet
BUILT_SOURCES += arpa/inet.h
@ -147,6 +135,8 @@ arpa/inet.h: arpa_inet.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(WARN_ON
-e 's/@''GNULIB_INET_PTON''@/$(GNULIB_INET_PTON)/g' \
-e 's|@''HAVE_DECL_INET_NTOP''@|$(HAVE_DECL_INET_NTOP)|g' \
-e 's|@''HAVE_DECL_INET_PTON''@|$(HAVE_DECL_INET_PTON)|g' \
-e 's|@''REPLACE_INET_NTOP''@|$(REPLACE_INET_NTOP)|g' \
-e 's|@''REPLACE_INET_PTON''@|$(REPLACE_INET_PTON)|g' \
-e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
-e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
-e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
@ -198,30 +188,6 @@ EXTRA_DIST += byteswap.in.h
## end gnulib module byteswap
## begin gnulib module c++defs
# The BUILT_SOURCES created by this Makefile snippet are not used via #include
# statements but through direct file reference. Therefore this snippet must be
# present in all Makefile.am that need it. This is ensured by the applicability
# 'all' defined above.
BUILT_SOURCES += c++defs.h
# The c++defs.h that gets inserted into generated .h files is the same as
# build-aux/c++defs.h, except that it has the copyright header cut off.
c++defs.h: $(top_srcdir)/build-aux/c++defs.h
$(AM_V_GEN)rm -f $@-t $@ && \
sed -n -e '/_GL_CXXDEFS/,$$p' \
< $(top_srcdir)/build-aux/c++defs.h \
> $@-t && \
mv $@-t $@
MOSTLYCLEANFILES += c++defs.h c++defs.h-t
CXXDEFS_H=c++defs.h
EXTRA_DIST += $(top_srcdir)/build-aux/c++defs.h
## end gnulib module c++defs
## begin gnulib module c-ctype
libgnu_la_SOURCES += c-ctype.h c-ctype.c
@ -335,15 +301,6 @@ EXTRA_DIST += errno.in.h
## end gnulib module errno
## begin gnulib module fclose
EXTRA_DIST += fclose.c
EXTRA_libgnu_la_SOURCES += fclose.c
## end gnulib module fclose
## begin gnulib module fcntl-h
BUILT_SOURCES += fcntl.h
@ -387,15 +344,6 @@ EXTRA_DIST += fd-hook.h
## end gnulib module fd-hook
## begin gnulib module fflush
EXTRA_DIST += fflush.c stdio-impl.h
EXTRA_libgnu_la_SOURCES += fflush.c
## end gnulib module fflush
## begin gnulib module float
BUILT_SOURCES += $(FLOAT_H)
@ -411,6 +359,7 @@ float.h: float.in.h $(top_builddir)/config.status
-e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
-e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-e 's|@''NEXT_FLOAT_H''@|$(NEXT_FLOAT_H)|g' \
-e 's|@''REPLACE_ITOLD''@|$(REPLACE_ITOLD)|g' \
< $(srcdir)/float.in.h; \
} > $@-t && \
mv $@-t $@
@ -420,9 +369,9 @@ float.h: $(top_builddir)/config.status
endif
MOSTLYCLEANFILES += float.h float.h-t
EXTRA_DIST += float.c float.in.h
EXTRA_DIST += float.c float.in.h itold.c
EXTRA_libgnu_la_SOURCES += float.c
EXTRA_libgnu_la_SOURCES += float.c itold.c
## end gnulib module float
@ -444,23 +393,6 @@ EXTRA_libgnu_la_SOURCES += floor.c
## end gnulib module floor
## begin gnulib module fpurge
EXTRA_DIST += fpurge.c stdio-impl.h
EXTRA_libgnu_la_SOURCES += fpurge.c
## end gnulib module fpurge
## begin gnulib module freading
libgnu_la_SOURCES += freading.c
EXTRA_DIST += freading.h stdio-impl.h
## end gnulib module freading
## begin gnulib module frexp
@ -470,41 +402,14 @@ EXTRA_libgnu_la_SOURCES += frexp.c
## end gnulib module frexp
## begin gnulib module fseek
## begin gnulib module fstat
EXTRA_DIST += fseek.c
EXTRA_DIST += fstat.c
EXTRA_libgnu_la_SOURCES += fseek.c
EXTRA_libgnu_la_SOURCES += fstat.c
## end gnulib module fseek
## begin gnulib module fseeko
EXTRA_DIST += fseeko.c stdio-impl.h
EXTRA_libgnu_la_SOURCES += fseeko.c
## end gnulib module fseeko
## begin gnulib module ftell
EXTRA_DIST += ftell.c
EXTRA_libgnu_la_SOURCES += ftell.c
## end gnulib module ftell
## begin gnulib module ftello
EXTRA_DIST += ftello.c stdio-impl.h
EXTRA_libgnu_la_SOURCES += ftello.c
## end gnulib module ftello
## end gnulib module fstat
## begin gnulib module full-read
@ -807,15 +712,6 @@ EXTRA_DIST += locale.in.h
## end gnulib module locale
## begin gnulib module lseek
EXTRA_DIST += lseek.c
EXTRA_libgnu_la_SOURCES += lseek.c
## end gnulib module lseek
## begin gnulib module lstat
@ -871,17 +767,30 @@ math.h: math.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(
-e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
-e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-e 's|@''NEXT_AS_FIRST_DIRECTIVE_MATH_H''@|$(NEXT_AS_FIRST_DIRECTIVE_MATH_H)|g' \
-e 's/@''GNULIB_ACOSF''@/$(GNULIB_ACOSF)/g' \
-e 's/@''GNULIB_ACOSL''@/$(GNULIB_ACOSL)/g' \
-e 's/@''GNULIB_ASINF''@/$(GNULIB_ASINF)/g' \
-e 's/@''GNULIB_ASINL''@/$(GNULIB_ASINL)/g' \
-e 's/@''GNULIB_ATANF''@/$(GNULIB_ATANF)/g' \
-e 's/@''GNULIB_ATANL''@/$(GNULIB_ATANL)/g' \
-e 's/@''GNULIB_ATAN2F''@/$(GNULIB_ATAN2F)/g' \
-e 's/@''GNULIB_CEIL''@/$(GNULIB_CEIL)/g' \
-e 's/@''GNULIB_CEILF''@/$(GNULIB_CEILF)/g' \
-e 's/@''GNULIB_CEILL''@/$(GNULIB_CEILL)/g' \
-e 's/@''GNULIB_COPYSIGN''@/$(GNULIB_COPYSIGN)/g' \
-e 's/@''GNULIB_COPYSIGNF''@/$(GNULIB_COPYSIGNF)/g' \
-e 's/@''GNULIB_COPYSIGNL''@/$(GNULIB_COPYSIGNL)/g' \
-e 's/@''GNULIB_COSF''@/$(GNULIB_COSF)/g' \
-e 's/@''GNULIB_COSL''@/$(GNULIB_COSL)/g' \
-e 's/@''GNULIB_COSHF''@/$(GNULIB_COSHF)/g' \
-e 's/@''GNULIB_EXPF''@/$(GNULIB_EXPF)/g' \
-e 's/@''GNULIB_EXPL''@/$(GNULIB_EXPL)/g' \
-e 's/@''GNULIB_FABSF''@/$(GNULIB_FABSF)/g' \
-e 's/@''GNULIB_FLOOR''@/$(GNULIB_FLOOR)/g' \
-e 's/@''GNULIB_FLOORF''@/$(GNULIB_FLOORF)/g' \
-e 's/@''GNULIB_FLOORL''@/$(GNULIB_FLOORL)/g' \
-e 's/@''GNULIB_FMODF''@/$(GNULIB_FMODF)/g' \
-e 's/@''GNULIB_FREXPF''@/$(GNULIB_FREXPF)/g' \
-e 's/@''GNULIB_FREXP''@/$(GNULIB_FREXP)/g' \
-e 's/@''GNULIB_FREXPL''@/$(GNULIB_FREXPL)/g' \
-e 's/@''GNULIB_ISFINITE''@/$(GNULIB_ISFINITE)/g' \
@ -890,32 +799,71 @@ math.h: math.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(
-e 's/@''GNULIB_ISNANF''@/$(GNULIB_ISNANF)/g' \
-e 's/@''GNULIB_ISNAND''@/$(GNULIB_ISNAND)/g' \
-e 's/@''GNULIB_ISNANL''@/$(GNULIB_ISNANL)/g' \
-e 's/@''GNULIB_LDEXPF''@/$(GNULIB_LDEXPF)/g' \
-e 's/@''GNULIB_LDEXPL''@/$(GNULIB_LDEXPL)/g' \
-e 's/@''GNULIB_LOGB''@/$(GNULIB_LOGB)/g' \
-e 's/@''GNULIB_LOGF''@/$(GNULIB_LOGF)/g' \
-e 's/@''GNULIB_LOGL''@/$(GNULIB_LOGL)/g' \
-e 's/@''GNULIB_LOG10F''@/$(GNULIB_LOG10F)/g' \
-e 's/@''GNULIB_MODFF''@/$(GNULIB_MODFF)/g' \
-e 's/@''GNULIB_POWF''@/$(GNULIB_POWF)/g' \
-e 's/@''GNULIB_RINT''@/$(GNULIB_RINT)/g' \
-e 's/@''GNULIB_RINTF''@/$(GNULIB_RINTF)/g' \
-e 's/@''GNULIB_RINTL''@/$(GNULIB_RINTL)/g' \
-e 's/@''GNULIB_ROUND''@/$(GNULIB_ROUND)/g' \
-e 's/@''GNULIB_ROUNDF''@/$(GNULIB_ROUNDF)/g' \
-e 's/@''GNULIB_ROUNDL''@/$(GNULIB_ROUNDL)/g' \
-e 's/@''GNULIB_SIGNBIT''@/$(GNULIB_SIGNBIT)/g' \
-e 's/@''GNULIB_SINF''@/$(GNULIB_SINF)/g' \
-e 's/@''GNULIB_SINL''@/$(GNULIB_SINL)/g' \
-e 's/@''GNULIB_SINHF''@/$(GNULIB_SINHF)/g' \
-e 's/@''GNULIB_SQRTF''@/$(GNULIB_SQRTF)/g' \
-e 's/@''GNULIB_SQRTL''@/$(GNULIB_SQRTL)/g' \
-e 's/@''GNULIB_TANF''@/$(GNULIB_TANF)/g' \
-e 's/@''GNULIB_TANL''@/$(GNULIB_TANL)/g' \
-e 's/@''GNULIB_TANHF''@/$(GNULIB_TANHF)/g' \
-e 's/@''GNULIB_TRUNC''@/$(GNULIB_TRUNC)/g' \
-e 's/@''GNULIB_TRUNCF''@/$(GNULIB_TRUNCF)/g' \
-e 's/@''GNULIB_TRUNCL''@/$(GNULIB_TRUNCL)/g' \
< $(srcdir)/math.in.h | \
sed -e 's|@''HAVE_ACOSL''@|$(HAVE_ACOSL)|g' \
sed -e 's|@''HAVE_ACOSF''@|$(HAVE_ACOSF)|g' \
-e 's|@''HAVE_ACOSL''@|$(HAVE_ACOSL)|g' \
-e 's|@''HAVE_ASINF''@|$(HAVE_ASINF)|g' \
-e 's|@''HAVE_ASINL''@|$(HAVE_ASINL)|g' \
-e 's|@''HAVE_ATANF''@|$(HAVE_ATANF)|g' \
-e 's|@''HAVE_ATANL''@|$(HAVE_ATANL)|g' \
-e 's|@''HAVE_ATAN2F''@|$(HAVE_ATAN2F)|g' \
-e 's|@''HAVE_COPYSIGN''@|$(HAVE_COPYSIGN)|g' \
-e 's|@''HAVE_COPYSIGNF''@|$(HAVE_COPYSIGNF)|g' \
-e 's|@''HAVE_COPYSIGNL''@|$(HAVE_COPYSIGNL)|g' \
-e 's|@''HAVE_COSF''@|$(HAVE_COSF)|g' \
-e 's|@''HAVE_COSL''@|$(HAVE_COSL)|g' \
-e 's|@''HAVE_COSHF''@|$(HAVE_COSHF)|g' \
-e 's|@''HAVE_EXPF''@|$(HAVE_EXPF)|g' \
-e 's|@''HAVE_EXPL''@|$(HAVE_EXPL)|g' \
-e 's|@''HAVE_FABSF''@|$(HAVE_FABSF)|g' \
-e 's|@''HAVE_FMODF''@|$(HAVE_FMODF)|g' \
-e 's|@''HAVE_FREXPF''@|$(HAVE_FREXPF)|g' \
-e 's|@''HAVE_ISNANF''@|$(HAVE_ISNANF)|g' \
-e 's|@''HAVE_ISNAND''@|$(HAVE_ISNAND)|g' \
-e 's|@''HAVE_ISNANL''@|$(HAVE_ISNANL)|g' \
-e 's|@''HAVE_LDEXPF''@|$(HAVE_LDEXPF)|g' \
-e 's|@''HAVE_LOGF''@|$(HAVE_LOGF)|g' \
-e 's|@''HAVE_LOGL''@|$(HAVE_LOGL)|g' \
-e 's|@''HAVE_LOG10F''@|$(HAVE_LOG10F)|g' \
-e 's|@''HAVE_MODFF''@|$(HAVE_MODFF)|g' \
-e 's|@''HAVE_POWF''@|$(HAVE_POWF)|g' \
-e 's|@''HAVE_RINT''@|$(HAVE_RINT)|g' \
-e 's|@''HAVE_RINTF''@|$(HAVE_RINTF)|g' \
-e 's|@''HAVE_RINTL''@|$(HAVE_RINTL)|g' \
-e 's|@''HAVE_SINF''@|$(HAVE_SINF)|g' \
-e 's|@''HAVE_SINL''@|$(HAVE_SINL)|g' \
-e 's|@''HAVE_SINHF''@|$(HAVE_SINHF)|g' \
-e 's|@''HAVE_SQRTF''@|$(HAVE_SQRTF)|g' \
-e 's|@''HAVE_SQRTL''@|$(HAVE_SQRTL)|g' \
-e 's|@''HAVE_TANF''@|$(HAVE_TANF)|g' \
-e 's|@''HAVE_TANL''@|$(HAVE_TANL)|g' \
-e 's|@''HAVE_TANHF''@|$(HAVE_TANHF)|g' \
-e 's|@''HAVE_DECL_ACOSL''@|$(HAVE_DECL_ACOSL)|g' \
-e 's|@''HAVE_DECL_ASINL''@|$(HAVE_DECL_ASINL)|g' \
-e 's|@''HAVE_DECL_ATANL''@|$(HAVE_DECL_ATANL)|g' \
@ -945,12 +893,14 @@ 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_FREXPF''@|$(REPLACE_FREXPF)|g' \
-e 's|@''REPLACE_FREXP''@|$(REPLACE_FREXP)|g' \
-e 's|@''REPLACE_FREXPL''@|$(REPLACE_FREXPL)|g' \
-e 's|@''REPLACE_HUGE_VAL''@|$(REPLACE_HUGE_VAL)|g' \
-e 's|@''REPLACE_ISFINITE''@|$(REPLACE_ISFINITE)|g' \
-e 's|@''REPLACE_ISINF''@|$(REPLACE_ISINF)|g' \
-e 's|@''REPLACE_ISNAN''@|$(REPLACE_ISNAN)|g' \
-e 's|@''REPLACE_ITOLD''@|$(REPLACE_ITOLD)|g' \
-e 's|@''REPLACE_LDEXPL''@|$(REPLACE_LDEXPL)|g' \
-e 's|@''REPLACE_NAN''@|$(REPLACE_NAN)|g' \
-e 's|@''REPLACE_ROUND''@|$(REPLACE_ROUND)|g' \
@ -981,6 +931,24 @@ EXTRA_libgnu_la_SOURCES += memchr.c
## end gnulib module memchr
## begin gnulib module msvc-inval
EXTRA_DIST += msvc-inval.c msvc-inval.h
EXTRA_libgnu_la_SOURCES += msvc-inval.c
## end gnulib module msvc-inval
## begin gnulib module msvc-nothrow
EXTRA_DIST += msvc-nothrow.c msvc-nothrow.h
EXTRA_libgnu_la_SOURCES += msvc-nothrow.c
## end gnulib module msvc-nothrow
## begin gnulib module netdb
BUILT_SOURCES += netdb.h
@ -1085,6 +1053,15 @@ EXTRA_libgnu_la_SOURCES += putenv.c
## end gnulib module putenv
## begin gnulib module raise
EXTRA_DIST += raise.c
EXTRA_libgnu_la_SOURCES += raise.c
## end gnulib module raise
## begin gnulib module read
@ -1200,12 +1177,160 @@ EXTRA_libgnu_la_SOURCES += shutdown.c
## end gnulib module shutdown
## begin gnulib module signal-h
BUILT_SOURCES += signal.h
# We need the following in order to create <signal.h> when the system
# doesn't have a complete one.
signal.h: signal.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
$(AM_V_GEN)rm -f $@-t $@ && \
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
sed -e 's|@''GUARD_PREFIX''@|GL|g' \
-e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
-e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
-e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-e 's|@''NEXT_SIGNAL_H''@|$(NEXT_SIGNAL_H)|g' \
-e 's|@''GNULIB_PTHREAD_SIGMASK''@|$(GNULIB_PTHREAD_SIGMASK)|g' \
-e 's|@''GNULIB_RAISE''@|$(GNULIB_RAISE)|g' \
-e 's/@''GNULIB_SIGNAL_H_SIGPIPE''@/$(GNULIB_SIGNAL_H_SIGPIPE)/g' \
-e 's/@''GNULIB_SIGPROCMASK''@/$(GNULIB_SIGPROCMASK)/g' \
-e 's/@''GNULIB_SIGACTION''@/$(GNULIB_SIGACTION)/g' \
-e 's|@''HAVE_POSIX_SIGNALBLOCKING''@|$(HAVE_POSIX_SIGNALBLOCKING)|g' \
-e 's|@''HAVE_PTHREAD_SIGMASK''@|$(HAVE_PTHREAD_SIGMASK)|g' \
-e 's|@''HAVE_RAISE''@|$(HAVE_RAISE)|g' \
-e 's|@''HAVE_SIGSET_T''@|$(HAVE_SIGSET_T)|g' \
-e 's|@''HAVE_SIGINFO_T''@|$(HAVE_SIGINFO_T)|g' \
-e 's|@''HAVE_SIGACTION''@|$(HAVE_SIGACTION)|g' \
-e 's|@''HAVE_STRUCT_SIGACTION_SA_SIGACTION''@|$(HAVE_STRUCT_SIGACTION_SA_SIGACTION)|g' \
-e 's|@''HAVE_TYPE_VOLATILE_SIG_ATOMIC_T''@|$(HAVE_TYPE_VOLATILE_SIG_ATOMIC_T)|g' \
-e 's|@''HAVE_SIGHANDLER_T''@|$(HAVE_SIGHANDLER_T)|g' \
-e 's|@''REPLACE_PTHREAD_SIGMASK''@|$(REPLACE_PTHREAD_SIGMASK)|g' \
-e 's|@''REPLACE_RAISE''@|$(REPLACE_RAISE)|g' \
-e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
-e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
-e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
< $(srcdir)/signal.in.h; \
} > $@-t && \
mv $@-t $@
MOSTLYCLEANFILES += signal.h signal.h-t
EXTRA_DIST += signal.in.h
## end gnulib module signal-h
## begin gnulib module size_max
libgnu_la_SOURCES += size_max.h
## end gnulib module size_max
## begin gnulib module snippet/_Noreturn
# Because this Makefile snippet defines a variable used by other
# gnulib Makefile snippets, it must be present in all Makefile.am that
# need it. This is ensured by the applicability 'all' defined above.
_NORETURN_H=$(top_srcdir)/build-aux/snippet/_Noreturn.h
EXTRA_DIST += $(top_srcdir)/build-aux/snippet/_Noreturn.h
## end gnulib module snippet/_Noreturn
## begin gnulib module snippet/arg-nonnull
# The BUILT_SOURCES created by this Makefile snippet are not used via #include
# statements but through direct file reference. Therefore this snippet must be
# present in all Makefile.am that need it. This is ensured by the applicability
# 'all' defined above.
BUILT_SOURCES += arg-nonnull.h
# The arg-nonnull.h that gets inserted into generated .h files is the same as
# build-aux/snippet/arg-nonnull.h, except that it has the copyright header cut
# off.
arg-nonnull.h: $(top_srcdir)/build-aux/snippet/arg-nonnull.h
$(AM_V_GEN)rm -f $@-t $@ && \
sed -n -e '/GL_ARG_NONNULL/,$$p' \
< $(top_srcdir)/build-aux/snippet/arg-nonnull.h \
> $@-t && \
mv $@-t $@
MOSTLYCLEANFILES += arg-nonnull.h arg-nonnull.h-t
ARG_NONNULL_H=arg-nonnull.h
EXTRA_DIST += $(top_srcdir)/build-aux/snippet/arg-nonnull.h
## end gnulib module snippet/arg-nonnull
## begin gnulib module snippet/c++defs
# The BUILT_SOURCES created by this Makefile snippet are not used via #include
# statements but through direct file reference. Therefore this snippet must be
# present in all Makefile.am that need it. This is ensured by the applicability
# 'all' defined above.
BUILT_SOURCES += c++defs.h
# The c++defs.h that gets inserted into generated .h files is the same as
# build-aux/snippet/c++defs.h, except that it has the copyright header cut off.
c++defs.h: $(top_srcdir)/build-aux/snippet/c++defs.h
$(AM_V_GEN)rm -f $@-t $@ && \
sed -n -e '/_GL_CXXDEFS/,$$p' \
< $(top_srcdir)/build-aux/snippet/c++defs.h \
> $@-t && \
mv $@-t $@
MOSTLYCLEANFILES += c++defs.h c++defs.h-t
CXXDEFS_H=c++defs.h
EXTRA_DIST += $(top_srcdir)/build-aux/snippet/c++defs.h
## end gnulib module snippet/c++defs
## begin gnulib module snippet/unused-parameter
# The BUILT_SOURCES created by this Makefile snippet are not used via #include
# statements but through direct file reference. Therefore this snippet must be
# present in all Makefile.am that need it. This is ensured by the applicability
# 'all' defined above.
BUILT_SOURCES += unused-parameter.h
# The unused-parameter.h that gets inserted into generated .h files is the same
# as build-aux/snippet/unused-parameter.h, except that it has the copyright
# header cut off.
unused-parameter.h: $(top_srcdir)/build-aux/snippet/unused-parameter.h
$(AM_V_GEN)rm -f $@-t $@ && \
sed -n -e '/GL_UNUSED_PARAMETER/,$$p' \
< $(top_srcdir)/build-aux/snippet/unused-parameter.h \
> $@-t && \
mv $@-t $@
MOSTLYCLEANFILES += unused-parameter.h unused-parameter.h-t
UNUSED_PARAMETER_H=unused-parameter.h
EXTRA_DIST += $(top_srcdir)/build-aux/snippet/unused-parameter.h
## end gnulib module snippet/unused-parameter
## begin gnulib module snippet/warn-on-use
BUILT_SOURCES += warn-on-use.h
# The warn-on-use.h that gets inserted into generated .h files is the same as
# build-aux/snippet/warn-on-use.h, except that it has the copyright header cut
# off.
warn-on-use.h: $(top_srcdir)/build-aux/snippet/warn-on-use.h
$(AM_V_GEN)rm -f $@-t $@ && \
sed -n -e '/^.ifndef/,$$p' \
< $(top_srcdir)/build-aux/snippet/warn-on-use.h \
> $@-t && \
mv $@-t $@
MOSTLYCLEANFILES += warn-on-use.h warn-on-use.h-t
WARN_ON_USE_H=warn-on-use.h
EXTRA_DIST += $(top_srcdir)/build-aux/snippet/warn-on-use.h
## end gnulib module snippet/warn-on-use
## begin gnulib module snprintf
@ -1367,6 +1492,7 @@ stdio.h: stdio.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H)
-e 's|@''NEXT_STDIO_H''@|$(NEXT_STDIO_H)|g' \
-e 's/@''GNULIB_DPRINTF''@/$(GNULIB_DPRINTF)/g' \
-e 's/@''GNULIB_FCLOSE''@/$(GNULIB_FCLOSE)/g' \
-e 's/@''GNULIB_FDOPEN''@/$(GNULIB_FDOPEN)/g' \
-e 's/@''GNULIB_FFLUSH''@/$(GNULIB_FFLUSH)/g' \
-e 's/@''GNULIB_FGETC''@/$(GNULIB_FGETC)/g' \
-e 's/@''GNULIB_FGETS''@/$(GNULIB_FGETS)/g' \
@ -1391,6 +1517,7 @@ stdio.h: stdio.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H)
-e 's/@''GNULIB_GETS''@/$(GNULIB_GETS)/g' \
-e 's/@''GNULIB_OBSTACK_PRINTF''@/$(GNULIB_OBSTACK_PRINTF)/g' \
-e 's/@''GNULIB_OBSTACK_PRINTF_POSIX''@/$(GNULIB_OBSTACK_PRINTF_POSIX)/g' \
-e 's/@''GNULIB_PCLOSE''@/$(GNULIB_PCLOSE)/g' \
-e 's/@''GNULIB_PERROR''@/$(GNULIB_PERROR)/g' \
-e 's/@''GNULIB_POPEN''@/$(GNULIB_POPEN)/g' \
-e 's/@''GNULIB_PRINTF''@/$(GNULIB_PRINTF)/g' \
@ -1429,11 +1556,14 @@ stdio.h: stdio.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H)
-e 's|@''HAVE_DPRINTF''@|$(HAVE_DPRINTF)|g' \
-e 's|@''HAVE_FSEEKO''@|$(HAVE_FSEEKO)|g' \
-e 's|@''HAVE_FTELLO''@|$(HAVE_FTELLO)|g' \
-e 's|@''HAVE_PCLOSE''@|$(HAVE_PCLOSE)|g' \
-e 's|@''HAVE_POPEN''@|$(HAVE_POPEN)|g' \
-e 's|@''HAVE_RENAMEAT''@|$(HAVE_RENAMEAT)|g' \
-e 's|@''HAVE_VASPRINTF''@|$(HAVE_VASPRINTF)|g' \
-e 's|@''HAVE_VDPRINTF''@|$(HAVE_VDPRINTF)|g' \
-e 's|@''REPLACE_DPRINTF''@|$(REPLACE_DPRINTF)|g' \
-e 's|@''REPLACE_FCLOSE''@|$(REPLACE_FCLOSE)|g' \
-e 's|@''REPLACE_FDOPEN''@|$(REPLACE_FDOPEN)|g' \
-e 's|@''REPLACE_FFLUSH''@|$(REPLACE_FFLUSH)|g' \
-e 's|@''REPLACE_FOPEN''@|$(REPLACE_FOPEN)|g' \
-e 's|@''REPLACE_FPRINTF''@|$(REPLACE_FPRINTF)|g' \
@ -1481,7 +1611,8 @@ BUILT_SOURCES += stdlib.h
# We need the following in order to create <stdlib.h> when the system
# doesn't have one that works with the given compiler.
stdlib.h: stdlib.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
stdlib.h: stdlib.in.h $(top_builddir)/config.status $(CXXDEFS_H) \
$(_NORETURN_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
$(AM_V_GEN)rm -f $@-t $@ && \
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
sed -e 's|@''GUARD_PREFIX''@|GL|g' \
@ -1503,6 +1634,7 @@ stdlib.h: stdlib.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H
-e 's/@''GNULIB_MKOSTEMPS''@/$(GNULIB_MKOSTEMPS)/g' \
-e 's/@''GNULIB_MKSTEMP''@/$(GNULIB_MKSTEMP)/g' \
-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_PUTENV''@/$(GNULIB_PUTENV)/g' \
-e 's/@''GNULIB_RANDOM_R''@/$(GNULIB_RANDOM_R)/g' \
@ -1529,6 +1661,7 @@ stdlib.h: stdlib.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H
-e 's|@''HAVE_MKOSTEMPS''@|$(HAVE_MKOSTEMPS)|g' \
-e 's|@''HAVE_MKSTEMP''@|$(HAVE_MKSTEMP)|g' \
-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_RANDOM_H''@|$(HAVE_RANDOM_H)|g' \
-e 's|@''HAVE_RANDOM_R''@|$(HAVE_RANDOM_R)|g' \
@ -1555,6 +1688,7 @@ stdlib.h: stdlib.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H
-e 's|@''REPLACE_UNSETENV''@|$(REPLACE_UNSETENV)|g' \
-e 's|@''REPLACE_WCTOMB''@|$(REPLACE_WCTOMB)|g' \
-e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
-e '/definition of _Noreturn/r $(_NORETURN_H)' \
-e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
-e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)'; \
} > $@-t && \
@ -1598,6 +1732,8 @@ string.h: string.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H
-e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
-e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-e 's|@''NEXT_STRING_H''@|$(NEXT_STRING_H)|g' \
-e 's/@''GNULIB_FFSL''@/$(GNULIB_FFSL)/g' \
-e 's/@''GNULIB_FFSLL''@/$(GNULIB_FFSLL)/g' \
-e 's/@''GNULIB_MBSLEN''@/$(GNULIB_MBSLEN)/g' \
-e 's/@''GNULIB_MBSNLEN''@/$(GNULIB_MBSNLEN)/g' \
-e 's/@''GNULIB_MBSCHR''@/$(GNULIB_MBSCHR)/g' \
@ -1634,7 +1770,9 @@ string.h: string.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H
-e 's/@''GNULIB_STRSIGNAL''@/$(GNULIB_STRSIGNAL)/g' \
-e 's/@''GNULIB_STRVERSCMP''@/$(GNULIB_STRVERSCMP)/g' \
< $(srcdir)/string.in.h | \
sed -e 's|@''HAVE_MBSLEN''@|$(HAVE_MBSLEN)|g' \
sed -e 's|@''HAVE_FFSL''@|$(HAVE_FFSL)|g' \
-e 's|@''HAVE_FFSLL''@|$(HAVE_FFSLL)|g' \
-e 's|@''HAVE_MBSLEN''@|$(HAVE_MBSLEN)|g' \
-e 's|@''HAVE_MEMCHR''@|$(HAVE_MEMCHR)|g' \
-e 's|@''HAVE_DECL_MEMMEM''@|$(HAVE_DECL_MEMMEM)|g' \
-e 's|@''HAVE_MEMPCPY''@|$(HAVE_MEMPCPY)|g' \
@ -1776,6 +1914,7 @@ sys/stat.h: sys_stat.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNU
-e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-e 's|@''NEXT_SYS_STAT_H''@|$(NEXT_SYS_STAT_H)|g' \
-e 's/@''GNULIB_FCHMODAT''@/$(GNULIB_FCHMODAT)/g' \
-e 's/@''GNULIB_FSTAT''@/$(GNULIB_FSTAT)/g' \
-e 's/@''GNULIB_FSTATAT''@/$(GNULIB_FSTATAT)/g' \
-e 's/@''GNULIB_FUTIMENS''@/$(GNULIB_FUTIMENS)/g' \
-e 's/@''GNULIB_LCHMOD''@/$(GNULIB_LCHMOD)/g' \
@ -1837,6 +1976,7 @@ sys/time.h: sys_time.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNU
-e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-e 's|@''NEXT_SYS_TIME_H''@|$(NEXT_SYS_TIME_H)|g' \
-e 's/@''GNULIB_GETTIMEOFDAY''@/$(GNULIB_GETTIMEOFDAY)/g' \
-e 's|@''HAVE_WINSOCK2_H''@|$(HAVE_WINSOCK2_H)|g' \
-e 's/@''HAVE_GETTIMEOFDAY''@/$(HAVE_GETTIMEOFDAY)/g' \
-e 's/@''HAVE_STRUCT_TIMEVAL''@/$(HAVE_STRUCT_TIMEVAL)/g' \
-e 's/@''REPLACE_GETTIMEOFDAY''@/$(REPLACE_GETTIMEOFDAY)/g' \
@ -1852,6 +1992,30 @@ EXTRA_DIST += sys_time.in.h
## end gnulib module sys_time
## begin gnulib module sys_types
BUILT_SOURCES += sys/types.h
# We need the following in order to create <sys/types.h> when the system
# doesn't have one that works with the given compiler.
sys/types.h: sys_types.in.h $(top_builddir)/config.status
$(AM_V_at)$(MKDIR_P) sys
$(AM_V_GEN)rm -f $@-t $@ && \
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
sed -e 's|@''GUARD_PREFIX''@|GL|g' \
-e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
-e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
-e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-e 's|@''NEXT_SYS_TYPES_H''@|$(NEXT_SYS_TYPES_H)|g' \
< $(srcdir)/sys_types.in.h; \
} > $@-t && \
mv $@-t $@
MOSTLYCLEANFILES += sys/types.h sys/types.h-t
EXTRA_DIST += sys_types.in.h
## end gnulib module sys_types
## begin gnulib module sys_uio
BUILT_SOURCES += sys/uio.h
@ -1953,8 +2117,10 @@ unistd.h: unistd.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H
-e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
-e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-e 's|@''NEXT_UNISTD_H''@|$(NEXT_UNISTD_H)|g' \
-e 's/@''GNULIB_CHDIR''@/$(GNULIB_CHDIR)/g' \
-e 's/@''GNULIB_CHOWN''@/$(GNULIB_CHOWN)/g' \
-e 's/@''GNULIB_CLOSE''@/$(GNULIB_CLOSE)/g' \
-e 's/@''GNULIB_DUP''@/$(GNULIB_DUP)/g' \
-e 's/@''GNULIB_DUP2''@/$(GNULIB_DUP2)/g' \
-e 's/@''GNULIB_DUP3''@/$(GNULIB_DUP3)/g' \
-e 's/@''GNULIB_ENVIRON''@/$(GNULIB_ENVIRON)/g' \
@ -1962,6 +2128,7 @@ unistd.h: unistd.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H
-e 's/@''GNULIB_FACCESSAT''@/$(GNULIB_FACCESSAT)/g' \
-e 's/@''GNULIB_FCHDIR''@/$(GNULIB_FCHDIR)/g' \
-e 's/@''GNULIB_FCHOWNAT''@/$(GNULIB_FCHOWNAT)/g' \
-e 's/@''GNULIB_FDATASYNC''@/$(GNULIB_FDATASYNC)/g' \
-e 's/@''GNULIB_FSYNC''@/$(GNULIB_FSYNC)/g' \
-e 's/@''GNULIB_FTRUNCATE''@/$(GNULIB_FTRUNCATE)/g' \
-e 's/@''GNULIB_GETCWD''@/$(GNULIB_GETCWD)/g' \
@ -2005,6 +2172,7 @@ unistd.h: unistd.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H
-e 's|@''HAVE_FACCESSAT''@|$(HAVE_FACCESSAT)|g' \
-e 's|@''HAVE_FCHDIR''@|$(HAVE_FCHDIR)|g' \
-e 's|@''HAVE_FCHOWNAT''@|$(HAVE_FCHOWNAT)|g' \
-e 's|@''HAVE_FDATASYNC''@|$(HAVE_FDATASYNC)|g' \
-e 's|@''HAVE_FSYNC''@|$(HAVE_FSYNC)|g' \
-e 's|@''HAVE_FTRUNCATE''@|$(HAVE_FTRUNCATE)|g' \
-e 's|@''HAVE_GETDTABLESIZE''@|$(HAVE_GETDTABLESIZE)|g' \
@ -2029,6 +2197,7 @@ unistd.h: unistd.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H
-e 's|@''HAVE_USLEEP''@|$(HAVE_USLEEP)|g' \
-e 's|@''HAVE_DECL_ENVIRON''@|$(HAVE_DECL_ENVIRON)|g' \
-e 's|@''HAVE_DECL_FCHDIR''@|$(HAVE_DECL_FCHDIR)|g' \
-e 's|@''HAVE_DECL_FDATASYNC''@|$(HAVE_DECL_FDATASYNC)|g' \
-e 's|@''HAVE_DECL_GETDOMAINNAME''@|$(HAVE_DECL_GETDOMAINNAME)|g' \
-e 's|@''HAVE_DECL_GETLOGIN_R''@|$(HAVE_DECL_GETLOGIN_R)|g' \
-e 's|@''HAVE_DECL_GETPAGESIZE''@|$(HAVE_DECL_GETPAGESIZE)|g' \
@ -2148,31 +2317,6 @@ EXTRA_DIST += unitypes.in.h
## end gnulib module unitypes
## begin gnulib module unused-parameter
# The BUILT_SOURCES created by this Makefile snippet are not used via #include
# statements but through direct file reference. Therefore this snippet must be
# present in all Makefile.am that need it. This is ensured by the applicability
# 'all' defined above.
BUILT_SOURCES += unused-parameter.h
# The unused-parameter.h that gets inserted into generated .h files is the same
# as build-aux/unused-parameter.h, except that it has the copyright header cut
# off.
unused-parameter.h: $(top_srcdir)/build-aux/unused-parameter.h
$(AM_V_GEN)rm -f $@-t $@ && \
sed -n -e '/GL_UNUSED_PARAMETER/,$$p' \
< $(top_srcdir)/build-aux/unused-parameter.h \
> $@-t && \
mv $@-t $@
MOSTLYCLEANFILES += unused-parameter.h unused-parameter.h-t
UNUSED_PARAMETER_H=unused-parameter.h
EXTRA_DIST += $(top_srcdir)/build-aux/unused-parameter.h
## end gnulib module unused-parameter
## begin gnulib module useless-if-before-free
@ -2212,25 +2356,6 @@ EXTRA_libgnu_la_SOURCES += vsnprintf.c
## end gnulib module vsnprintf
## begin gnulib module warn-on-use
BUILT_SOURCES += warn-on-use.h
# The warn-on-use.h that gets inserted into generated .h files is the same as
# build-aux/warn-on-use.h, except that it has the copyright header cut off.
warn-on-use.h: $(top_srcdir)/build-aux/warn-on-use.h
$(AM_V_GEN)rm -f $@-t $@ && \
sed -n -e '/^.ifndef/,$$p' \
< $(top_srcdir)/build-aux/warn-on-use.h \
> $@-t && \
mv $@-t $@
MOSTLYCLEANFILES += warn-on-use.h warn-on-use.h-t
WARN_ON_USE_H=warn-on-use.h
EXTRA_DIST += $(top_srcdir)/build-aux/warn-on-use.h
## end gnulib module warn-on-use
## begin gnulib module wchar
BUILT_SOURCES += wchar.h

View file

@ -31,7 +31,16 @@
int
rpl_accept (int fd, struct sockaddr *addr, socklen_t *addrlen)
{
SOCKET fh = accept (FD_TO_SOCKET (fd), addr, addrlen);
SOCKET sock = FD_TO_SOCKET (fd);
if (sock == INVALID_SOCKET)
{
errno = EBADF;
return -1;
}
else
{
SOCKET fh = accept (sock, addr, addrlen);
if (fh == INVALID_SOCKET)
{
set_winsock_errno ();
@ -39,4 +48,5 @@ rpl_accept (int fd, struct sockaddr *addr, socklen_t *addrlen)
}
else
return SOCKET_TO_FD (fh);
}
}

View file

@ -58,7 +58,6 @@
#if @GNULIB_INET_NTOP@
# if !@HAVE_DECL_INET_NTOP@
/* Converts an internet address from internal format to a printable,
presentable format.
AF is an internet address family, such as AF_INET or AF_INET6.
@ -74,6 +73,20 @@
For more details, see the POSIX:2001 specification
<http://www.opengroup.org/susv3xsh/inet_ntop.html>. */
# if @REPLACE_INET_NTOP@
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# undef inet_ntop
# define inet_ntop rpl_inet_ntop
# endif
_GL_FUNCDECL_RPL (inet_ntop, const char *,
(int af, const void *restrict src,
char *restrict dst, socklen_t cnt)
_GL_ARG_NONNULL ((2, 3)));
_GL_CXXALIAS_RPL (inet_ntop, const char *,
(int af, const void *restrict src,
char *restrict dst, socklen_t cnt));
# else
# if !@HAVE_DECL_INET_NTOP@
_GL_FUNCDECL_SYS (inet_ntop, const char *,
(int af, const void *restrict src,
char *restrict dst, socklen_t cnt)
@ -84,6 +97,7 @@ _GL_FUNCDECL_SYS (inet_ntop, const char *,
_GL_CXXALIAS_SYS_CAST (inet_ntop, const char *,
(int af, const void *restrict src,
char *restrict dst, socklen_t cnt));
# endif
_GL_CXXALIASWARN (inet_ntop);
#elif defined GNULIB_POSIXCHECK
# undef inet_ntop
@ -94,6 +108,17 @@ _GL_WARN_ON_USE (inet_ntop, "inet_ntop is unportable - "
#endif
#if @GNULIB_INET_PTON@
# if @REPLACE_INET_PTON@
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# undef inet_pton
# define inet_pton rpl_inet_pton
# endif
_GL_FUNCDECL_RPL (inet_pton, int,
(int af, const char *restrict src, void *restrict dst)
_GL_ARG_NONNULL ((2, 3)));
_GL_CXXALIAS_RPL (inet_pton, int,
(int af, const char *restrict src, void *restrict dst));
# else
# if !@HAVE_DECL_INET_PTON@
_GL_FUNCDECL_SYS (inet_pton, int,
(int af, const char *restrict src, void *restrict dst)
@ -101,6 +126,7 @@ _GL_FUNCDECL_SYS (inet_pton, int,
# endif
_GL_CXXALIAS_SYS (inet_pton, int,
(int af, const char *restrict src, void *restrict dst));
# endif
_GL_CXXALIASWARN (inet_pton);
#elif defined GNULIB_POSIXCHECK
# undef inet_pton

View file

@ -32,9 +32,18 @@ int
rpl_bind (int fd, const struct sockaddr *sockaddr, socklen_t len)
{
SOCKET sock = FD_TO_SOCKET (fd);
if (sock == INVALID_SOCKET)
{
errno = EBADF;
return -1;
}
else
{
int r = bind (sock, sockaddr, len);
if (r < 0)
set_winsock_errno ();
return r;
}
}

View file

@ -125,7 +125,7 @@ __realpath (const char *name, char *resolved)
#else
path_max = pathconf (name, _PC_PATH_MAX);
if (path_max <= 0)
path_max = 1024;
path_max = 8192;
#endif
if (resolved == NULL)

View file

@ -16,7 +16,9 @@
/* Written by Bruno Haible <bruno@clisp.org>, 2007. */
#include <config.h>
#if ! defined USE_LONG_DOUBLE
# include <config.h>
#endif
/* Specification. */
#include <math.h>

View file

@ -19,18 +19,45 @@
/* Specification. */
#include <unistd.h>
#include <errno.h>
#include "fd-hook.h"
#include "msvc-inval.h"
#undef close
#if HAVE_MSVC_INVALID_PARAMETER_HANDLER
static int
close_nothrow (int fd)
{
int result;
TRY_MSVC_INVAL
{
result = close (fd);
}
CATCH_MSVC_INVAL
{
result = -1;
errno = EBADF;
}
DONE_MSVC_INVAL;
return result;
}
#else
# define close_nothrow close
#endif
/* Override close() to call into other gnulib modules. */
int
rpl_close (int fd)
#undef close
{
#if WINDOWS_SOCKETS
int retval = execute_all_close_hooks (close, fd);
int retval = execute_all_close_hooks (close_nothrow, fd);
#else
int retval = close (fd);
int retval = close_nothrow (fd);
#endif
#if REPLACE_FCHDIR

View file

@ -32,6 +32,14 @@ int
rpl_connect (int fd, const struct sockaddr *sockaddr, socklen_t len)
{
SOCKET sock = FD_TO_SOCKET (fd);
if (sock == INVALID_SOCKET)
{
errno = EBADF;
return -1;
}
else
{
int r = connect (sock, sockaddr, len);
if (r < 0)
{
@ -44,4 +52,5 @@ rpl_connect (int fd, const struct sockaddr *sockaddr, socklen_t len)
}
return r;
}
}

View file

@ -147,6 +147,16 @@
# define GNULIB_defined_ENOTSUP 1
# endif
# ifndef ENETRESET
# define ENETRESET 2011
# define GNULIB_defined_ENETRESET 1
# endif
# ifndef ECONNABORTED
# define ECONNABORTED 2012
# define GNULIB_defined_ECONNABORTED 1
# endif
# ifndef ESTALE
# define ESTALE 2009
# define GNULIB_defined_ESTALE 1

View file

@ -1,84 +0,0 @@
/* fclose replacement.
Copyright (C) 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 3 of the License, 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, see <http://www.gnu.org/licenses/>. */
#include <config.h>
/* Specification. */
#include <stdio.h>
#include <errno.h>
#include <unistd.h>
#include "freading.h"
/* Override fclose() to call the overridden fflush() or close(). */
int
rpl_fclose (FILE *fp)
#undef fclose
{
int saved_errno = 0;
int fd;
int result = 0;
/* Don't change behavior on memstreams. */
fd = fileno (fp);
if (fd < 0)
return fclose (fp);
/* We only need to flush the file if it is not reading or if it is
seekable. This only guarantees the file position of input files
if the fflush module is also in use. */
if ((!freading (fp) || lseek (fileno (fp), 0, SEEK_CUR) != -1)
&& fflush (fp))
saved_errno = errno;
/* fclose() calls close(), but we need to also invoke all hooks that our
overridden close() function invokes. See lib/close.c. */
#if WINDOWS_SOCKETS
/* Call the overridden close(), then the original fclose().
Note about multithread-safety: There is a race condition where some
other thread could open fd between our close and fclose. */
if (close (fd) < 0 && saved_errno == 0)
saved_errno = errno;
fclose (fp); /* will fail with errno = EBADF, if we did not lose a race */
#else /* !WINDOWS_SOCKETS */
/* Call fclose() and invoke all hooks of the overridden close(). */
# if REPLACE_FCHDIR
/* Note about multithread-safety: There is a race condition here as well.
Some other thread could open fd between our calls to fclose and
_gl_unregister_fd. */
result = fclose (fp);
if (result == 0)
_gl_unregister_fd (fd);
# else
/* No race condition here. */
result = fclose (fp);
# endif
#endif /* !WINDOWS_SOCKETS */
if (saved_errno != 0)
{
errno = saved_errno;
result = EOF;
}
return result;
}

View file

@ -1,218 +0,0 @@
/* fflush.c -- allow flushing input streams
Copyright (C) 2007-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 3 of the License, 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, see <http://www.gnu.org/licenses/>. */
/* Written by Eric Blake. */
#include <config.h>
/* Specification. */
#include <stdio.h>
#include <errno.h>
#include <unistd.h>
#include "freading.h"
#include "stdio-impl.h"
#undef fflush
#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
/* Clear the stream's ungetc buffer, preserving the value of ftello (fp). */
static inline void
clear_ungetc_buffer_preserving_position (FILE *fp)
{
if (fp->_flags & _IO_IN_BACKUP)
/* _IO_free_backup_area is a bit complicated. Simply call fseek. */
fseeko (fp, 0, SEEK_CUR);
}
#else
/* Clear the stream's ungetc buffer. May modify the value of ftello (fp). */
static inline void
clear_ungetc_buffer (FILE *fp)
{
# if defined __sferror || defined __DragonFly__ /* FreeBSD, NetBSD, OpenBSD, DragonFly, MacOS X, Cygwin */
if (HASUB (fp))
{
fp_->_p += fp_->_r;
fp_->_r = 0;
}
# elif defined __EMX__ /* emx+gcc */
if (fp->_ungetc_count > 0)
{
fp->_ungetc_count = 0;
fp->_rcount = - fp->_rcount;
}
# elif defined _IOERR /* AIX, HP-UX, IRIX, OSF/1, Solaris, OpenServer, mingw, NonStop Kernel */
/* Nothing to do. */
# else /* other implementations */
fseeko (fp, 0, SEEK_CUR);
# endif
}
#endif
#if (defined __sferror || defined __DragonFly__) && defined __SNPT /* FreeBSD, NetBSD, OpenBSD, DragonFly, MacOS X, Cygwin */
static inline int
disable_seek_optimization (FILE *fp)
{
int saved_flags = fp_->_flags & (__SOPT | __SNPT);
fp_->_flags = (fp_->_flags & ~__SOPT) | __SNPT;
return saved_flags;
}
static inline void
restore_seek_optimization (FILE *fp, int saved_flags)
{
fp_->_flags = (fp_->_flags & ~(__SOPT | __SNPT)) | saved_flags;
}
#endif
static inline void
update_fpos_cache (FILE *fp, off_t pos)
{
#if defined __sferror || defined __DragonFly__ /* FreeBSD, NetBSD, OpenBSD, DragonFly, MacOS X, Cygwin */
# if defined __CYGWIN__
/* fp_->_offset is typed as an integer. */
fp_->_offset = pos;
# else
/* fp_->_offset is an fpos_t. */
/* Use a union, since on NetBSD, the compilation flags determine
whether fpos_t is typedef'd to off_t or a struct containing a
single off_t member. */
union
{
fpos_t f;
off_t o;
} u;
u.o = pos;
fp_->_offset = u.f;
# endif
fp_->_flags |= __SOFF;
#endif
}
/* Flush all pending data on STREAM according to POSIX rules. Both
output and seekable input streams are supported. */
int
rpl_fflush (FILE *stream)
{
/* When stream is NULL, POSIX and C99 only require flushing of "output
streams and update streams in which the most recent operation was not
input", and all implementations do this.
When stream is "an output stream or an update stream in which the most
recent operation was not input", POSIX and C99 requires that fflush
writes out any buffered data, and all implementations do this.
When stream is, however, an input stream or an update stream in
which the most recent operation was input, C99 specifies nothing,
and POSIX only specifies behavior if the stream is seekable.
mingw, in particular, drops the input buffer, leaving the file
descriptor positioned at the end of the input buffer. I.e. ftell
(stream) is lost. We don't want to call the implementation's
fflush in this case.
We test ! freading (stream) here, rather than fwriting (stream), because
what we need to know is whether the stream holds a "read buffer", and on
mingw this is indicated by _IOREAD, regardless of _IOWRT. */
if (stream == NULL || ! freading (stream))
return fflush (stream);
#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
clear_ungetc_buffer_preserving_position (stream);
return fflush (stream);
#else
{
/* Notes about the file-position indicator:
1) The file position indicator is incremented by fgetc() and decremented
by ungetc():
<http://www.opengroup.org/susv3/functions/fgetc.html>
"... the fgetc() function shall ... advance the associated file
position indicator for the stream ..."
<http://www.opengroup.org/susv3/functions/ungetc.html>
"The file-position indicator is decremented by each successful
call to ungetc()..."
2) <http://www.opengroup.org/susv3/functions/ungetc.html> says:
"The value of the file-position indicator for the stream after
reading or discarding all pushed-back bytes shall be the same
as it was before the bytes were pushed back."
Here we are discarding all pushed-back bytes. But more specifically,
3) <http://www.opengroup.org/austin/aardvark/latest/xshbug3.txt> says:
"[After fflush(),] the file offset of the underlying open file
description shall be set to the file position of the stream, and
any characters pushed back onto the stream by ungetc() ... shall
be discarded." */
/* POSIX does not specify fflush behavior for non-seekable input
streams. Some implementations purge unread data, some return
EBADF, some do nothing. */
off_t pos = ftello (stream);
if (pos == -1)
{
errno = EBADF;
return EOF;
}
/* Clear the ungetc buffer. */
clear_ungetc_buffer (stream);
/* To get here, we must be flushing a seekable input stream, so the
semantics of fpurge are now appropriate to clear the buffer. To
avoid losing data, the lseek is also necessary. */
{
int result = fpurge (stream);
if (result != 0)
return result;
}
# if (defined __sferror || defined __DragonFly__) && defined __SNPT /* FreeBSD, NetBSD, OpenBSD, DragonFly, MacOS X, Cygwin */
{
/* Disable seek optimization for the next fseeko call. This tells the
following fseeko call to seek to the desired position directly, rather
than to seek to a block-aligned boundary. */
int saved_flags = disable_seek_optimization (stream);
int result = fseeko (stream, pos, SEEK_SET);
restore_seek_optimization (stream, saved_flags);
return result;
}
# else
pos = lseek (fileno (stream), pos, SEEK_SET);
if (pos == -1)
return EOF;
/* After a successful lseek, update the file descriptor's position cache
in the stream. */
update_fpos_cache (stream, pos);
return 0;
# endif
}
#endif
}

View file

@ -20,7 +20,7 @@
/* Specification. */
#include <float.h>
#if (defined _ARCH_PPC || defined _POWER) && defined _AIX && (LDBL_MANT_DIG == 106) && defined __GNUC__
#if (defined _ARCH_PPC || defined _POWER) && (defined _AIX || defined __linux__) && (LDBL_MANT_DIG == 106) && defined __GNUC__
const union gl_long_double_union gl_LDBL_MAX =
{ { DBL_MAX, DBL_MAX / (double)134217728UL / (double)134217728UL } };
#elif defined __i386__

View file

@ -109,7 +109,8 @@ extern const union gl_long_double_union gl_LDBL_MAX;
#endif
/* On AIX 7.1 with gcc 4.2, the values of LDBL_MIN_EXP, LDBL_MIN, LDBL_MAX are
wrong. */
wrong.
On Linux/PowerPC with gcc 4.4, the value of LDBL_MAX is wrong. */
#if (defined _ARCH_PPC || defined _POWER) && defined _AIX && (LDBL_MANT_DIG == 106) && defined __GNUC__
# undef LDBL_MIN_EXP
# define LDBL_MIN_EXP DBL_MIN_EXP
@ -117,6 +118,8 @@ extern const union gl_long_double_union gl_LDBL_MAX;
# define LDBL_MIN_10_EXP DBL_MIN_10_EXP
# undef LDBL_MIN
# define LDBL_MIN 2.22507385850720138309023271733240406422e-308L /* DBL_MIN = 2^-1022 */
#endif
#if (defined _ARCH_PPC || defined _POWER) && (defined _AIX || defined __linux__) && (LDBL_MANT_DIG == 106) && defined __GNUC__
# undef LDBL_MAX
/* LDBL_MAX is represented as { 0x7FEFFFFF, 0xFFFFFFFF, 0x7C8FFFFF, 0xFFFFFFFF }.
It is not easy to define:
@ -170,5 +173,16 @@ extern const union gl_long_double_union gl_LDBL_MAX;
# endif
#endif
#if @REPLACE_ITOLD@
/* Pull in a function that fixes the 'int' to 'long double' conversion
of glibc 2.7. */
extern
# ifdef __cplusplus
"C"
# endif
void _Qp_itoq (long double *, int);
static void (*_gl_float_fix_itold) (long double *, int) = _Qp_itoq;
#endif
#endif /* _@GUARD_PREFIX@_FLOAT_H */
#endif /* _@GUARD_PREFIX@_FLOAT_H */

View file

@ -26,15 +26,15 @@
#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
/* _get_osfhandle */
# include <io.h>
/* LockFileEx */
# define WIN32_LEAN_AND_MEAN
# include <windows.h>
# include <errno.h>
/* _get_osfhandle */
# include "msvc-nothrow.h"
/* Determine the current size of a file. Because the other braindead
* APIs we'll call need lower/upper 32 bit pairs, keep the file size
* like that too.

View file

@ -16,7 +16,9 @@
/* Written by Bruno Haible <bruno@clisp.org>, 2007. */
#include <config.h>
#if ! defined USE_LONG_DOUBLE
# include <config.h>
#endif
/* Specification. */
#include <math.h>

View file

@ -1,137 +0,0 @@
/* Flushing buffers of a FILE stream.
Copyright (C) 2007-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 3 of the License, 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, see <http://www.gnu.org/licenses/>. */
#include <config.h>
/* Specification. */
#include <stdio.h>
#if HAVE___FPURGE /* glibc >= 2.2, Haiku, Solaris >= 7 */
# include <stdio_ext.h>
#endif
#include <stdlib.h>
#include "stdio-impl.h"
int
fpurge (FILE *fp)
{
#if HAVE___FPURGE /* glibc >= 2.2, Haiku, Solaris >= 7 */
__fpurge (fp);
/* The __fpurge function does not have a return value. */
return 0;
#elif HAVE_FPURGE /* FreeBSD, NetBSD, OpenBSD, DragonFly, MacOS X, Cygwin 1.7 */
/* Call the system's fpurge function. */
# undef fpurge
# if !HAVE_DECL_FPURGE
extern int fpurge (FILE *);
# endif
int result = fpurge (fp);
# if defined __sferror || defined __DragonFly__ /* FreeBSD, NetBSD, OpenBSD, DragonFly, MacOS X, Cygwin */
if (result == 0)
/* Correct the invariants that fpurge broke.
<stdio.h> on BSD systems says:
"The following always hold: if _flags & __SRD, _w is 0."
If this invariant is not fulfilled and the stream is read-write but
currently reading, subsequent putc or fputc calls will write directly
into the buffer, although they shouldn't be allowed to. */
if ((fp_->_flags & __SRD) != 0)
fp_->_w = 0;
# endif
return result;
#else
/* Most systems provide FILE as a struct and the necessary bitmask in
<stdio.h>, because they need it for implementing getc() and putc() as
fast macros. */
# if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
fp->_IO_read_end = fp->_IO_read_ptr;
fp->_IO_write_ptr = fp->_IO_write_base;
/* Avoid memory leak when there is an active ungetc buffer. */
if (fp->_IO_save_base != NULL)
{
free (fp->_IO_save_base);
fp->_IO_save_base = NULL;
}
return 0;
# elif defined __sferror || defined __DragonFly__ /* FreeBSD, NetBSD, OpenBSD, DragonFly, MacOS X, Cygwin */
fp_->_p = fp_->_bf._base;
fp_->_r = 0;
fp_->_w = ((fp_->_flags & (__SLBF | __SNBF | __SRD)) == 0 /* fully buffered and not currently reading? */
? fp_->_bf._size
: 0);
/* Avoid memory leak when there is an active ungetc buffer. */
if (fp_ub._base != NULL)
{
if (fp_ub._base != fp_->_ubuf)
free (fp_ub._base);
fp_ub._base = NULL;
}
return 0;
# elif defined __EMX__ /* emx+gcc */
fp->_ptr = fp->_buffer;
fp->_rcount = 0;
fp->_wcount = 0;
fp->_ungetc_count = 0;
return 0;
# elif defined _IOERR /* AIX, HP-UX, IRIX, OSF/1, Solaris, OpenServer, mingw, NonStop Kernel */
fp->_ptr = fp->_base;
if (fp->_ptr != NULL)
fp->_cnt = 0;
return 0;
# elif defined __UCLIBC__ /* uClibc */
# ifdef __STDIO_BUFFERS
if (fp->__modeflags & __FLAG_WRITING)
fp->__bufpos = fp->__bufstart;
else if (fp->__modeflags & (__FLAG_READONLY | __FLAG_READING))
fp->__bufpos = fp->__bufread;
# endif
return 0;
# elif defined __QNX__ /* QNX */
fp->_Rback = fp->_Back + sizeof (fp->_Back);
fp->_Rsave = NULL;
if (fp->_Mode & 0x2000 /* _MWRITE */)
/* fp->_Buf <= fp->_Next <= fp->_Wend */
fp->_Next = fp->_Buf;
else
/* fp->_Buf <= fp->_Next <= fp->_Rend */
fp->_Rend = fp->_Next;
return 0;
# elif defined __MINT__ /* Atari FreeMiNT */
if (fp->__pushed_back)
{
fp->__bufp = fp->__pushback_bufp;
fp->__pushed_back = 0;
}
/* Preserve the current file position. */
if (fp->__target != -1)
fp->__target += fp->__bufp - fp->__buffer;
fp->__bufp = fp->__buffer;
/* Nothing in the buffer, next getc is nontrivial. */
fp->__get_limit = fp->__bufp;
/* Nothing in the buffer, next putc is nontrivial. */
fp->__put_limit = fp->__buffer;
return 0;
# else
# error "Please port gnulib fpurge.c to your platform! Look at the definitions of fflush, setvbuf and ungetc on your system, then report this to bug-gnulib."
# endif
#endif
}

View file

@ -1,68 +0,0 @@
/* Retrieve information about a FILE stream.
Copyright (C) 2007-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 3 of the License, 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, see <http://www.gnu.org/licenses/>. */
#include <config.h>
/* Specification. */
#include "freading.h"
#include "stdio-impl.h"
/* Don't use glibc's __freading function in glibc < 2.7, see
<http://sourceware.org/bugzilla/show_bug.cgi?id=4359> */
#if !(HAVE___FREADING && (!defined __GLIBC__ || defined __UCLIBC__ || __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 7)))
bool
freading (FILE *fp)
{
/* Most systems provide FILE as a struct and the necessary bitmask in
<stdio.h>, because they need it for implementing getc() and putc() as
fast macros. */
# if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
return ((fp->_flags & _IO_NO_WRITES) != 0
|| ((fp->_flags & (_IO_NO_READS | _IO_CURRENTLY_PUTTING)) == 0
&& fp->_IO_read_base != NULL));
# elif defined __sferror || defined __DragonFly__ /* FreeBSD, NetBSD, OpenBSD, DragonFly, MacOS X, Cygwin */
return (fp_->_flags & __SRD) != 0;
# elif defined __EMX__ /* emx+gcc */
return (fp->_flags & _IOREAD) != 0;
# elif defined _IOERR /* AIX, HP-UX, IRIX, OSF/1, Solaris, OpenServer, mingw, NonStop Kernel */
# if defined __sun /* Solaris */
return (fp->_flag & _IOREAD) != 0 && (fp->_flag & _IOWRT) == 0;
# else
return (fp->_flag & _IOREAD) != 0;
# endif
# elif defined __UCLIBC__ /* uClibc */
return (fp->__modeflags & (__FLAG_READONLY | __FLAG_READING)) != 0;
# elif defined __QNX__ /* QNX */
return ((fp->_Mode & 0x2 /* _MOPENW */) == 0
|| (fp->_Mode & 0x1000 /* _MREAD */) != 0);
# elif defined __MINT__ /* Atari FreeMiNT */
if (!fp->__mode.__write)
return 1;
if (!fp->__mode.__read)
return 0;
# ifdef _IO_CURRENTLY_GETTING /* Flag added on 2009-02-28 */
return (fp->__flags & _IO_CURRENTLY_GETTING) != 0;
# else
return (fp->__buffer < fp->__get_limit /*|| fp->__bufp == fp->__put_limit ??*/);
# endif
# else
# error "Please port gnulib freading.c to your platform!"
# endif
}
#endif

View file

@ -1,53 +0,0 @@
/* Retrieve information about a FILE stream.
Copyright (C) 2007-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 3 of the License, 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, see <http://www.gnu.org/licenses/>. */
#include <stdbool.h>
#include <stdio.h>
/* Return true if the stream STREAM is opened read-only, or if the
last operation on the stream was a read operation. Return false if
the stream is opened write-only or append-only, or if it supports
writing and there is no current read operation (such as fgetc).
freading and fwriting will never both be true. If STREAM supports
both reads and writes, then:
- both freading and fwriting might be false when the stream is first
opened, after read encounters EOF, or after fflush,
- freading might be false or true and fwriting might be false
after repositioning (such as fseek, fsetpos, or rewind),
depending on the underlying implementation.
STREAM must not be wide-character oriented. */
#if HAVE___FREADING && (!defined __GLIBC__ || defined __UCLIBC__ || __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 7))
/* Solaris >= 7, not glibc >= 2.2, but glibc >= 2.7 */
# include <stdio_ext.h>
# define freading(stream) (__freading (stream) != 0)
#else
# ifdef __cplusplus
extern "C" {
# endif
extern bool freading (FILE *stream);
# ifdef __cplusplus
}
# endif
#endif

View file

@ -17,7 +17,9 @@
/* Written by Paolo Bonzini <bonzini@gnu.org>, 2003, and
Bruno Haible <bruno@clisp.org>, 2007. */
#include <config.h>
#if ! defined USE_LONG_DOUBLE
# include <config.h>
#endif
/* Specification. */
#include <math.h>

View file

@ -1,146 +0,0 @@
/* An fseeko() function that, together with fflush(), is POSIX compliant.
Copyright (C) 2007-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. */
#include <config.h>
/* Specification. */
#include <stdio.h>
/* Get off_t and lseek. */
#include <unistd.h>
#include "stdio-impl.h"
int
fseeko (FILE *fp, off_t offset, int whence)
#undef fseeko
#if !HAVE_FSEEKO
# undef fseek
# define fseeko fseek
#endif
{
#if LSEEK_PIPE_BROKEN
/* mingw gives bogus answers rather than failure on non-seekable files. */
if (lseek (fileno (fp), 0, SEEK_CUR) == -1)
return EOF;
#endif
/* These tests are based on fpurge.c. */
#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
if (fp->_IO_read_end == fp->_IO_read_ptr
&& fp->_IO_write_ptr == fp->_IO_write_base
&& fp->_IO_save_base == NULL)
#elif defined __sferror || defined __DragonFly__ /* FreeBSD, NetBSD, OpenBSD, DragonFly, MacOS X, Cygwin */
# if defined __SL64 && defined __SCLE /* Cygwin */
if ((fp->_flags & __SL64) == 0)
{
/* Cygwin 1.5.0 through 1.5.24 failed to open stdin in 64-bit
mode; but has an fseeko that requires 64-bit mode. */
FILE *tmp = fopen ("/dev/null", "r");
if (!tmp)
return -1;
fp->_flags |= __SL64;
fp->_seek64 = tmp->_seek64;
fclose (tmp);
}
# endif
if (fp_->_p == fp_->_bf._base
&& fp_->_r == 0
&& fp_->_w == ((fp_->_flags & (__SLBF | __SNBF | __SRD)) == 0 /* fully buffered and not currently reading? */
? fp_->_bf._size
: 0)
&& fp_ub._base == NULL)
#elif defined __EMX__ /* emx+gcc */
if (fp->_ptr == fp->_buffer
&& fp->_rcount == 0
&& fp->_wcount == 0
&& fp->_ungetc_count == 0)
#elif defined _IOERR /* AIX, HP-UX, IRIX, OSF/1, Solaris, OpenServer, mingw, NonStop Kernel */
if (fp_->_ptr == fp_->_base
&& (fp_->_ptr == NULL || fp_->_cnt == 0))
#elif defined __UCLIBC__ /* uClibc */
if (((fp->__modeflags & __FLAG_WRITING) == 0
|| fp->__bufpos == fp->__bufstart)
&& ((fp->__modeflags & (__FLAG_READONLY | __FLAG_READING)) == 0
|| fp->__bufpos == fp->__bufread))
#elif defined __QNX__ /* QNX */
if ((fp->_Mode & 0x2000 /* _MWRITE */ ? fp->_Next == fp->_Buf : fp->_Next == fp->_Rend)
&& fp->_Rback == fp->_Back + sizeof (fp->_Back)
&& fp->_Rsave == NULL)
#elif defined __MINT__ /* Atari FreeMiNT */
if (fp->__bufp == fp->__buffer
&& fp->__get_limit == fp->__bufp
&& fp->__put_limit == fp->__bufp
&& !fp->__pushed_back)
#else
#error "Please port gnulib fseeko.c to your platform! Look at the code in fpurge.c, then report this to bug-gnulib."
#endif
{
/* We get here when an fflush() call immediately preceded this one. We
know there are no buffers.
POSIX requires us to modify the file descriptor's position.
But we cannot position beyond end of file here. */
off_t pos =
lseek (fileno (fp),
whence == SEEK_END && offset > 0 ? 0 : offset,
whence);
if (pos == -1)
{
#if defined __sferror || defined __DragonFly__ /* FreeBSD, NetBSD, OpenBSD, DragonFly, MacOS X, Cygwin */
fp_->_flags &= ~__SOFF;
#endif
return -1;
}
#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
fp->_flags &= ~_IO_EOF_SEEN;
#elif defined __sferror || defined __DragonFly__ /* FreeBSD, NetBSD, OpenBSD, DragonFly, MacOS X, Cygwin */
# if defined __CYGWIN__
/* fp_->_offset is typed as an integer. */
fp_->_offset = pos;
# else
/* fp_->_offset is an fpos_t. */
{
/* Use a union, since on NetBSD, the compilation flags
determine whether fpos_t is typedef'd to off_t or a struct
containing a single off_t member. */
union
{
fpos_t f;
off_t o;
} u;
u.o = pos;
fp_->_offset = u.f;
}
# endif
fp_->_flags |= __SOFF;
fp_->_flags &= ~__SEOF;
#elif defined __EMX__ /* emx+gcc */
fp->_flags &= ~_IOEOF;
#elif defined _IOERR /* AIX, HP-UX, IRIX, OSF/1, Solaris, OpenServer, mingw, NonStop Kernel */
fp->_flag &= ~_IOEOF;
#elif defined __MINT__ /* Atari FreeMiNT */
fp->__offset = pos;
fp->__eof = 0;
#endif
/* If we were not requested to position beyond end of file, we're
done. */
if (!(whence == SEEK_END && offset > 0))
return 0;
}
return fseeko (fp, offset, whence);
}

82
lib/fstat.c Normal file
View file

@ -0,0 +1,82 @@
/* fstat() replacement.
Copyright (C) 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 3 of the License, 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, see <http://www.gnu.org/licenses/>. */
/* If the user's config.h happens to include <sys/stat.h>, let it include only
the system's <sys/stat.h> here, so that orig_fstat doesn't recurse to
rpl_fstat. */
#define __need_system_sys_stat_h
#include <config.h>
/* Get the original definition of fstat. It might be defined as a macro. */
#include <sys/types.h>
#include <sys/stat.h>
#undef __need_system_sys_stat_h
static inline int
orig_fstat (int fd, struct stat *buf)
{
return fstat (fd, buf);
}
/* Specification. */
/* Write "sys/stat.h" here, not <sys/stat.h>, otherwise OSF/1 5.1 DTK cc
eliminates this include because of the preliminary #include <sys/stat.h>
above. */
#include "sys/stat.h"
#include <errno.h>
#include <unistd.h>
#if HAVE_MSVC_INVALID_PARAMETER_HANDLER
# include "msvc-inval.h"
#endif
#if HAVE_MSVC_INVALID_PARAMETER_HANDLER
static inline int
fstat_nothrow (int fd, struct stat *buf)
{
int result;
TRY_MSVC_INVAL
{
result = orig_fstat (fd, buf);
}
CATCH_MSVC_INVAL
{
result = -1;
errno = EBADF;
}
DONE_MSVC_INVAL;
return result;
}
#else
# define fstat_nothrow orig_fstat
#endif
int
rpl_fstat (int fd, struct stat *buf)
{
#if REPLACE_FCHDIR && REPLACE_OPEN_DIRECTORY
/* Handle the case when rpl_open() used a dummy file descriptor to work
around an open() that can't normally visit directories. */
const char *name = _gl_directory_name (fd);
if (name != NULL)
return stat (name, buf);
#endif
return fstat_nothrow (fd, buf);
}

View file

@ -1,38 +0,0 @@
/* An ftell() function that works around platform bugs.
Copyright (C) 2007-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 3 of the License, 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, see <http://www.gnu.org/licenses/>. */
#include <config.h>
/* Specification. */
#include <stdio.h>
#include <errno.h>
/* Get off_t. */
#include <unistd.h>
long
ftell (FILE *fp)
{
/* Use the replacement ftello function with all its workarounds. */
off_t offset = ftello (fp);
if (offset == (long)offset)
return (long)offset;
else
{
errno = EOVERFLOW;
return -1;
}
}

View file

@ -1,77 +0,0 @@
/* An ftello() function that works around platform bugs.
Copyright (C) 2007, 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 3 of the License, 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, see <http://www.gnu.org/licenses/>. */
#include <config.h>
/* Specification. */
#include <stdio.h>
/* Get lseek. */
#include <unistd.h>
#include "stdio-impl.h"
off_t
ftello (FILE *fp)
#undef ftello
#if !HAVE_FTELLO
# undef ftell
# define ftello ftell
#endif
{
#if LSEEK_PIPE_BROKEN
/* mingw gives bogus answers rather than failure on non-seekable files. */
if (lseek (fileno (fp), 0, SEEK_CUR) == -1)
return -1;
#endif
#if FTELLO_BROKEN_AFTER_SWITCHING_FROM_READ_TO_WRITE /* Solaris */
/* The Solaris stdio leaves the _IOREAD flag set after reading from a file
reaches EOF and the program then starts writing to the file. ftello
gets confused by this. */
if (fp_->_flag & _IOWRT)
{
off_t pos;
/* Call ftello nevertheless, for the side effects that it does on fp. */
ftello (fp);
/* Compute the file position ourselves. */
pos = lseek (fileno (fp), (off_t) 0, SEEK_CUR);
if (pos >= 0)
{
if ((fp_->_flag & _IONBF) == 0 && fp_->_base != NULL)
pos += fp_->_ptr - fp_->_base;
}
return pos;
}
#endif
#if defined __SL64 && defined __SCLE /* Cygwin */
if ((fp->_flags & __SL64) == 0)
{
/* Cygwin 1.5.0 through 1.5.24 failed to open stdin in 64-bit
mode; but has an ftello that requires 64-bit mode. */
FILE *tmp = fopen ("/dev/null", "r");
if (!tmp)
return -1;
fp->_flags |= __SL64;
fp->_seek64 = tmp->_seek64;
fclose (tmp);
}
#endif
return ftello (fp);
}

View file

@ -32,9 +32,18 @@ int
rpl_getpeername (int fd, struct sockaddr *addr, socklen_t *addrlen)
{
SOCKET sock = FD_TO_SOCKET (fd);
if (sock == INVALID_SOCKET)
{
errno = EBADF;
return -1;
}
else
{
int r = getpeername (sock, addr, addrlen);
if (r < 0)
set_winsock_errno ();
return r;
}
}

View file

@ -32,9 +32,18 @@ int
rpl_getsockname (int fd, struct sockaddr *addr, socklen_t *addrlen)
{
SOCKET sock = FD_TO_SOCKET (fd);
if (sock == INVALID_SOCKET)
{
errno = EBADF;
return -1;
}
else
{
int r = getsockname (sock, addr, addrlen);
if (r < 0)
set_winsock_errno ();
return r;
}
}

View file

@ -37,15 +37,25 @@
int
rpl_getsockopt (int fd, int level, int optname, void *optval, socklen_t *optlen)
{
int r;
SOCKET sock = FD_TO_SOCKET (fd);
if (level == SOL_SOCKET && (optname == SO_RCVTIMEO || optname == SO_SNDTIMEO))
if (sock == INVALID_SOCKET)
{
errno = EBADF;
return -1;
}
else
{
int r;
if (level == SOL_SOCKET
&& (optname == SO_RCVTIMEO || optname == SO_SNDTIMEO))
{
int milliseconds;
int milliseconds_len = sizeof (int);
struct timeval tv;
size_t n;
r = getsockopt (sock, level, optname, (char *) &milliseconds,
&milliseconds_len);
tv.tv_sec = milliseconds / 1000;
@ -65,4 +75,5 @@ rpl_getsockopt (int fd, int level, int optname, void *optval, socklen_t *optlen)
set_winsock_errno ();
return r;
}
}

View file

@ -185,7 +185,7 @@ npgettext_aux (const char *domain,
#include <string.h>
#define _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS \
(((__GNUC__ >= 3 || __GNUG__ >= 2) && !__STRICT_ANSI__) \
(((__GNUC__ >= 3 || __GNUG__ >= 2) && !defined __STRICT_ANSI__) \
/* || __STDC_VERSION__ >= 199901L */ )
#if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS

View file

@ -38,12 +38,25 @@
/* Specification. */
#include <arpa/inet.h>
#include <stdio.h>
#include <string.h>
#include <errno.h>
#if HAVE_DECL_INET_NTOP
#define NS_IN6ADDRSZ 16
#define NS_INT16SZ 2
# undef inet_ntop
const char *
rpl_inet_ntop (int af, const void *restrict src,
char *restrict dst, socklen_t cnt)
{
return inet_ntop (af, src, dst, cnt);
}
#else
# include <stdio.h>
# include <string.h>
# include <errno.h>
# define NS_IN6ADDRSZ 16
# define NS_INT16SZ 2
/*
* WARNING: Don't even consider trying to compile this on a system where
@ -52,9 +65,9 @@
typedef int verify_int_size[4 <= sizeof (int) ? 1 : -1];
static const char *inet_ntop4 (const unsigned char *src, char *dst, socklen_t size);
#if HAVE_IPV6
# if HAVE_IPV6
static const char *inet_ntop6 (const unsigned char *src, char *dst, socklen_t size);
#endif
# endif
/* char *
@ -71,15 +84,15 @@ inet_ntop (int af, const void *restrict src,
{
switch (af)
{
#if HAVE_IPV4
# if HAVE_IPV4
case AF_INET:
return (inet_ntop4 (src, dst, cnt));
#endif
# endif
#if HAVE_IPV6
# if HAVE_IPV6
case AF_INET6:
return (inet_ntop6 (src, dst, cnt));
#endif
# endif
default:
errno = EAFNOSUPPORT;
@ -118,7 +131,7 @@ inet_ntop4 (const unsigned char *src, char *dst, socklen_t size)
return strcpy (dst, tmp);
}
#if HAVE_IPV6
# if HAVE_IPV6
/* const char *
* inet_ntop6(src, dst, size)
@ -231,4 +244,6 @@ inet_ntop6 (const unsigned char *src, char *dst, socklen_t size)
return strcpy (dst, tmp);
}
# endif
#endif

View file

@ -37,13 +37,25 @@
/* Specification. */
#include <arpa/inet.h>
#include <c-ctype.h>
#include <string.h>
#include <errno.h>
#if HAVE_DECL_INET_PTON
#define NS_INADDRSZ 4
#define NS_IN6ADDRSZ 16
#define NS_INT16SZ 2
# undef inet_pton
int
rpl_inet_pton (int af, const char *restrict src, void *restrict dst)
{
return inet_pton (af, src, dst);
}
#else
# include <c-ctype.h>
# include <string.h>
# include <errno.h>
# define NS_INADDRSZ 4
# define NS_IN6ADDRSZ 16
# define NS_INT16SZ 2
/*
* WARNING: Don't even consider trying to compile this on a system where
@ -51,9 +63,9 @@
*/
static int inet_pton4 (const char *src, unsigned char *dst);
#if HAVE_IPV6
# if HAVE_IPV6
static int inet_pton6 (const char *src, unsigned char *dst);
#endif
# endif
/* int
* inet_pton(af, src, dst)
@ -74,10 +86,10 @@ inet_pton (int af, const char *restrict src, void *restrict dst)
case AF_INET:
return (inet_pton4 (src, dst));
#if HAVE_IPV6
# if HAVE_IPV6
case AF_INET6:
return (inet_pton6 (src, dst));
#endif
# endif
default:
errno = EAFNOSUPPORT;
@ -141,7 +153,7 @@ inet_pton4 (const char *restrict src, unsigned char *restrict dst)
return (1);
}
#if HAVE_IPV6
# if HAVE_IPV6
/* int
* inet_pton6(src, dst)
@ -250,4 +262,7 @@ inet_pton6 (const char *restrict src, unsigned char *restrict dst)
memcpy (dst, tmp, NS_IN6ADDRSZ);
return (1);
}
# endif
#endif

View file

@ -83,7 +83,7 @@ int
FUNC (DOUBLE x)
{
#ifdef KNOWN_EXPBIT0_LOCATION
# if defined USE_LONG_DOUBLE && ((defined __ia64 && LDBL_MANT_DIG == 64) || (defined __x86_64__ || defined __amd64__) || (defined __i386 || defined __i386__ || defined _I386 || defined _M_IX86 || defined _X86_))
# if defined USE_LONG_DOUBLE && ((defined __ia64 && LDBL_MANT_DIG == 64) || (defined __x86_64__ || defined __amd64__) || (defined __i386 || defined __i386__ || defined _I386 || defined _M_IX86 || defined _X86_)) && !HAVE_SAME_LONG_DOUBLE_AS_DOUBLE
/* Special CPU dependent code is needed to treat bit patterns outside the
IEEE 754 specification (such as Pseudo-NaNs, Pseudo-Infinities,
Pseudo-Zeroes, Unnormalized Numbers, and Pseudo-Denormals) as NaNs.
@ -117,17 +117,20 @@ FUNC (DOUBLE x)
# else
/* Be careful to not do any floating-point operation on x, such as x == x,
because x may be a signaling NaN. */
# if defined __TINYC__ || defined __SUNPRO_C || defined __DECC \
|| (defined __sgi && !defined __GNUC__) || defined __ICC
/* The Sun C 5.0, Intel ICC 10.0, and Compaq (ex-DEC) 6.4 compilers don't
recognize the initializers as constant expressions. The latter compiler
also fails when constant-folding 0.0 / 0.0 even when constant-folding is
not required. The SGI MIPSpro C compiler complains about "floating-point
operation result is out of range". */
# if defined __SUNPRO_C || defined __ICC || defined _MSC_VER \
|| defined __DECC || defined __TINYC__ \
|| (defined __sgi && !defined __GNUC__)
/* The Sun C 5.0, Intel ICC 10.0, Microsoft Visual C/C++ 9.0, Compaq (ex-DEC)
6.4, and TinyCC compilers don't recognize the initializers as constant
expressions. The Compaq compiler also fails when constant-folding
0.0 / 0.0 even when constant-folding is not required. The Microsoft
Visual C/C++ compiler also fails when constant-folding 1.0 / 0.0 even
when constant-folding is not required. The SGI MIPSpro C compiler
complains about "floating-point operation result is out of range". */
static DOUBLE zero = L_(0.0);
memory_double nan;
DOUBLE plus_inf = L_(1.0) / L_(0.0);
DOUBLE minus_inf = -L_(1.0) / L_(0.0);
DOUBLE plus_inf = L_(1.0) / zero;
DOUBLE minus_inf = -L_(1.0) / zero;
nan.value = zero / zero;
# else
static memory_double nan = { L_(0.0) / L_(0.0) };
@ -154,7 +157,7 @@ FUNC (DOUBLE x)
the signaling NaNs, handle only the quiet NaNs. */
if (x == x)
{
# if defined USE_LONG_DOUBLE && ((defined __ia64 && LDBL_MANT_DIG == 64) || (defined __x86_64__ || defined __amd64__) || (defined __i386 || defined __i386__ || defined _I386 || defined _M_IX86 || defined _X86_))
# if defined USE_LONG_DOUBLE && ((defined __ia64 && LDBL_MANT_DIG == 64) || (defined __x86_64__ || defined __amd64__) || (defined __i386 || defined __i386__ || defined _I386 || defined _M_IX86 || defined _X86_)) && !HAVE_SAME_LONG_DOUBLE_AS_DOUBLE
/* Detect any special bit patterns that pass ==; see comment above. */
memory_double m1;
memory_double m2;

View file

@ -1,5 +1,6 @@
/* An fseek() function that, together with fflush(), is POSIX compliant.
Copyright (C) 2007, 2009-2011 Free Software Foundation, Inc.
/* Replacement for 'int' to 'long double' conversion routine.
Copyright (C) 2011 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2011.
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
@ -17,14 +18,11 @@
#include <config.h>
/* Specification. */
#include <stdio.h>
#include <float.h>
/* Get off_t. */
#include <unistd.h>
int
fseek (FILE *fp, long offset, int whence)
void
_Qp_itoq (long double *result, int a)
{
/* Use the replacement fseeko function with all its workarounds. */
return fseeko (fp, (off_t)offset, whence);
/* Convert from 'int' to 'double', then from 'double' to 'long double'. */
*result = (double) a;
}

View file

@ -32,9 +32,18 @@ int
rpl_listen (int fd, int backlog)
{
SOCKET sock = FD_TO_SOCKET (fd);
if (sock == INVALID_SOCKET)
{
errno = EBADF;
return -1;
}
else
{
int r = listen (sock, backlog);
if (r < 0)
set_winsock_errno ();
return r;
}
}

View file

@ -1,62 +0,0 @@
/* An lseek() function that detects pipes.
Copyright (C) 2007, 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. */
#include <config.h>
/* Specification. */
#include <unistd.h>
#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
/* Windows platforms. */
/* Get GetFileType. */
# include <windows.h>
#else
# include <sys/stat.h>
#endif
#include <errno.h>
#undef lseek
off_t
rpl_lseek (int fd, off_t offset, int whence)
{
#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
/* mingw lseek mistakenly succeeds on pipes, sockets, and terminals. */
HANDLE h = (HANDLE) _get_osfhandle (fd);
if (h == INVALID_HANDLE_VALUE)
{
errno = EBADF;
return -1;
}
if (GetFileType (h) != FILE_TYPE_DISK)
{
errno = ESPIPE;
return -1;
}
#else
/* BeOS lseek mistakenly succeeds on pipes... */
struct stat statbuf;
if (fstat (fd, &statbuf) < 0)
return -1;
if (!S_ISREG (statbuf.st_mode))
{
errno = ESPIPE;
return -1;
}
#endif
return lseek (fd, offset, whence);
}

View file

@ -17,6 +17,10 @@
/* written by Jim Meyering */
/* If the user's config.h happens to include <sys/stat.h>, let it include only
the system's <sys/stat.h> here, so that orig_lstat doesn't recurse to
rpl_lstat. */
#define __need_system_sys_stat_h
#include <config.h>
#if !HAVE_LSTAT
@ -27,7 +31,6 @@ typedef int dummy;
#else /* HAVE_LSTAT */
/* Get the original definition of lstat. It might be defined as a macro. */
# define __need_system_sys_stat_h
# include <sys/types.h>
# include <sys/stat.h>
# undef __need_system_sys_stat_h
@ -39,7 +42,10 @@ orig_lstat (const char *filename, struct stat *buf)
}
/* Specification. */
# include <sys/stat.h>
/* Write "sys/stat.h" here, not <sys/stat.h>, otherwise OSF/1 5.1 DTK cc
eliminates this include because of the preliminary #include <sys/stat.h>
above. */
# include "sys/stat.h"
# include <string.h>
# include <errno.h>

View file

@ -35,6 +35,44 @@
/* The definition of _GL_WARN_ON_USE is copied here. */
#ifdef __cplusplus
/* Helper macros to define type-generic function FUNC as overloaded functions,
rather than as macros like in C. POSIX declares these with an argument of
real-floating (that is, one of float, double, or long double). */
# define _GL_MATH_CXX_REAL_FLOATING_DECL_1(func) \
static inline int \
_gl_cxx_ ## func ## f (float f) \
{ \
return func (f); \
} \
static inline int \
_gl_cxx_ ## func ## d (double d) \
{ \
return func (d); \
} \
static inline int \
_gl_cxx_ ## func ## l (long double l) \
{ \
return func (l); \
}
# define _GL_MATH_CXX_REAL_FLOATING_DECL_2(func) \
inline int \
func (float f) \
{ \
return _gl_cxx_ ## func ## f (f); \
} \
inline int \
func (double d) \
{ \
return _gl_cxx_ ## func ## d (d); \
} \
inline int \
func (long double l) \
{ \
return _gl_cxx_ ## func ## l (l); \
}
#endif
/* Helper macros to define a portability warning for the
classification macro FUNC called with VALUE. POSIX declares the
classification macros with an argument of real-floating (that is,
@ -67,6 +105,14 @@ _GL_WARN_ON_USE (rpl_ ## func ## l, #func " is unportable - " \
: rpl_ ## func ## l (value))
#if @REPLACE_ITOLD@
/* Pull in a function that fixes the 'int' to 'long double' conversion
of glibc 2.7. */
_GL_EXTERN_C void _Qp_itoq (long double *, int);
static void (*_gl_math_fix_itold) (long double *, int) = _Qp_itoq;
#endif
/* POSIX allows platforms that don't support NAN. But all major
machines in the past 15 years have supported something close to
IEEE NaN, so we define this unconditionally. We also must define
@ -75,8 +121,9 @@ _GL_WARN_ON_USE (rpl_ ## func ## l, #func " is unportable - " \
#if !defined NAN || @REPLACE_NAN@
# if !GNULIB_defined_NAN
# undef NAN
/* The Compaq (ex-DEC) C 6.4 compiler chokes on the expression 0.0 / 0.0. */
# ifdef __DECC
/* The Compaq (ex-DEC) C 6.4 compiler and the Microsoft MSVC 9 compiler
choke on the expression 0.0 / 0.0. */
# if defined __DECC || defined _MSC_VER
static float
_NaN ()
{
@ -99,45 +146,21 @@ _NaN ()
#endif
/* Write x as
x = mantissa * 2^exp
where
If x finite and nonzero: 0.5 <= |mantissa| < 1.0.
If x is zero: mantissa = x, exp = 0.
If x is infinite or NaN: mantissa = x, exp unspecified.
Store exp in *EXPPTR and return mantissa. */
#if @GNULIB_FREXP@
# if @REPLACE_FREXP@
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# define frexp rpl_frexp
#if @GNULIB_ACOSF@
# if !@HAVE_ACOSF@
# undef acosf
_GL_FUNCDECL_SYS (acosf, float, (float x));
# endif
_GL_FUNCDECL_RPL (frexp, double, (double x, int *expptr) _GL_ARG_NONNULL ((2)));
_GL_CXXALIAS_RPL (frexp, double, (double x, int *expptr));
# else
_GL_CXXALIAS_SYS (frexp, double, (double x, int *expptr));
# endif
_GL_CXXALIASWARN (frexp);
_GL_CXXALIAS_SYS (acosf, float, (float x));
_GL_CXXALIASWARN (acosf);
#elif defined GNULIB_POSIXCHECK
# undef frexp
/* Assume frexp is always declared. */
_GL_WARN_ON_USE (frexp, "frexp is unportable - "
"use gnulib module frexp for portability");
#endif
#if @GNULIB_LOGB@
# if !@HAVE_DECL_LOGB@
_GL_EXTERN_C double logb (double x);
# endif
#elif defined GNULIB_POSIXCHECK
# undef logb
# if HAVE_RAW_DECL_LOGB
_GL_WARN_ON_USE (logb, "logb is unportable - "
"use gnulib module logb for portability");
# undef acosf
# if HAVE_RAW_DECL_ACOSF
_GL_WARN_ON_USE (acosf, "acosf is unportable - "
"use gnulib module acosf for portability");
# endif
#endif
#if @GNULIB_ACOSL@
# if !@HAVE_ACOSL@ || !@HAVE_DECL_ACOSL@
_GL_FUNCDECL_SYS (acosl, long double, (long double x));
@ -153,6 +176,21 @@ _GL_WARN_ON_USE (acosl, "acosl is unportable - "
#endif
#if @GNULIB_ASINF@
# if !@HAVE_ASINF@
# undef asinf
_GL_FUNCDECL_SYS (asinf, float, (float x));
# endif
_GL_CXXALIAS_SYS (asinf, float, (float x));
_GL_CXXALIASWARN (asinf);
#elif defined GNULIB_POSIXCHECK
# undef asinf
# if HAVE_RAW_DECL_ASINF
_GL_WARN_ON_USE (asinf, "asinf is unportable - "
"use gnulib module asinf for portability");
# endif
#endif
#if @GNULIB_ASINL@
# if !@HAVE_ASINL@ || !@HAVE_DECL_ASINL@
_GL_FUNCDECL_SYS (asinl, long double, (long double x));
@ -168,6 +206,21 @@ _GL_WARN_ON_USE (asinl, "asinl is unportable - "
#endif
#if @GNULIB_ATANF@
# if !@HAVE_ATANF@
# undef atanf
_GL_FUNCDECL_SYS (atanf, float, (float x));
# endif
_GL_CXXALIAS_SYS (atanf, float, (float x));
_GL_CXXALIASWARN (atanf);
#elif defined GNULIB_POSIXCHECK
# undef atanf
# if HAVE_RAW_DECL_ATANF
_GL_WARN_ON_USE (atanf, "atanf is unportable - "
"use gnulib module atanf for portability");
# endif
#endif
#if @GNULIB_ATANL@
# if !@HAVE_ATANL@ || !@HAVE_DECL_ATANL@
_GL_FUNCDECL_SYS (atanl, long double, (long double x));
@ -183,9 +236,26 @@ _GL_WARN_ON_USE (atanl, "atanl is unportable - "
#endif
#if @GNULIB_ATAN2F@
# if !@HAVE_ATAN2F@
# undef atan2f
_GL_FUNCDECL_SYS (atan2f, float, (float y, float x));
# endif
_GL_CXXALIAS_SYS (atan2f, float, (float y, float x));
_GL_CXXALIASWARN (atan2f);
#elif defined GNULIB_POSIXCHECK
# undef atan2f
# if HAVE_RAW_DECL_ATAN2F
_GL_WARN_ON_USE (atan2f, "atan2f is unportable - "
"use gnulib module atan2f for portability");
# endif
#endif
#if @GNULIB_CEILF@
# if @REPLACE_CEILF@
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# undef ceilf
# define ceilf rpl_ceilf
# endif
_GL_FUNCDECL_RPL (ceilf, float, (float x));
@ -221,6 +291,7 @@ _GL_CXXALIASWARN (ceil);
#if @GNULIB_CEILL@
# if @REPLACE_CEILL@
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# undef ceill
# define ceill rpl_ceill
# endif
_GL_FUNCDECL_RPL (ceill, long double, (long double x));
@ -241,6 +312,64 @@ _GL_WARN_ON_USE (ceill, "ceill is unportable - "
#endif
#if @GNULIB_COPYSIGNF@
# if !@HAVE_COPYSIGNF@
_GL_FUNCDECL_SYS (copysignf, float, (float x, float y));
# endif
_GL_CXXALIAS_SYS (copysignf, float, (float x, float y));
_GL_CXXALIASWARN (copysignf);
#elif defined GNULIB_POSIXCHECK
# undef copysignf
# if HAVE_RAW_DECL_COPYSIGNF
_GL_WARN_ON_USE (copysignf, "copysignf is unportable - "
"use gnulib module copysignf for portability");
# endif
#endif
#if @GNULIB_COPYSIGN@
# if !@HAVE_COPYSIGN@
_GL_FUNCDECL_SYS (copysign, double, (double x, double y));
# endif
_GL_CXXALIAS_SYS (copysign, double, (double x, double y));
_GL_CXXALIASWARN (copysign);
#elif defined GNULIB_POSIXCHECK
# undef copysign
# if HAVE_RAW_DECL_COPYSIGN
_GL_WARN_ON_USE (copysign, "copysign is unportable - "
"use gnulib module copysign for portability");
# endif
#endif
#if @GNULIB_COPYSIGNL@
# if !@HAVE_COPYSIGNL@
_GL_FUNCDECL_SYS (copysignl, long double, (long double x, long double y));
# endif
_GL_CXXALIAS_SYS (copysignl, long double, (long double x, long double y));
_GL_CXXALIASWARN (copysignl);
#elif defined GNULIB_POSIXCHECK
# undef copysignl
# if HAVE_RAW_DECL_COPYSIGNL
_GL_WARN_ON_USE (copysign, "copysignl is unportable - "
"use gnulib module copysignl for portability");
# endif
#endif
#if @GNULIB_COSF@
# if !@HAVE_COSF@
# undef cosf
_GL_FUNCDECL_SYS (cosf, float, (float x));
# endif
_GL_CXXALIAS_SYS (cosf, float, (float x));
_GL_CXXALIASWARN (cosf);
#elif defined GNULIB_POSIXCHECK
# undef cosf
# if HAVE_RAW_DECL_COSF
_GL_WARN_ON_USE (cosf, "cosf is unportable - "
"use gnulib module cosf for portability");
# endif
#endif
#if @GNULIB_COSL@
# if !@HAVE_COSL@ || !@HAVE_DECL_COSL@
_GL_FUNCDECL_SYS (cosl, long double, (long double x));
@ -256,6 +385,37 @@ _GL_WARN_ON_USE (cosl, "cosl is unportable - "
#endif
#if @GNULIB_COSHF@
# if !@HAVE_COSHF@
# undef coshf
_GL_FUNCDECL_SYS (coshf, float, (float x));
# endif
_GL_CXXALIAS_SYS (coshf, float, (float x));
_GL_CXXALIASWARN (coshf);
#elif defined GNULIB_POSIXCHECK
# undef coshf
# if HAVE_RAW_DECL_COSHF
_GL_WARN_ON_USE (coshf, "coshf is unportable - "
"use gnulib module coshf for portability");
# endif
#endif
#if @GNULIB_EXPF@
# if !@HAVE_EXPF@
# undef expf
_GL_FUNCDECL_SYS (expf, float, (float x));
# endif
_GL_CXXALIAS_SYS (expf, float, (float x));
_GL_CXXALIASWARN (expf);
#elif defined GNULIB_POSIXCHECK
# undef expf
# if HAVE_RAW_DECL_EXPF
_GL_WARN_ON_USE (expf, "expf is unportable - "
"use gnulib module expf for portability");
# endif
#endif
#if @GNULIB_EXPL@
# if !@HAVE_EXPL@ || !@HAVE_DECL_EXPL@
_GL_FUNCDECL_SYS (expl, long double, (long double x));
@ -271,9 +431,26 @@ _GL_WARN_ON_USE (expl, "expl is unportable - "
#endif
#if @GNULIB_FABSF@
# if !@HAVE_FABSF@
# undef fabsf
_GL_FUNCDECL_SYS (fabsf, float, (float x));
# endif
_GL_CXXALIAS_SYS (fabsf, float, (float x));
_GL_CXXALIASWARN (fabsf);
#elif defined GNULIB_POSIXCHECK
# undef fabsf
# if HAVE_RAW_DECL_FABSF
_GL_WARN_ON_USE (fabsf, "fabsf is unportable - "
"use gnulib module fabsf for portability");
# endif
#endif
#if @GNULIB_FLOORF@
# if @REPLACE_FLOORF@
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# undef floorf
# define floorf rpl_floorf
# endif
_GL_FUNCDECL_RPL (floorf, float, (float x));
@ -309,6 +486,7 @@ _GL_CXXALIASWARN (floor);
#if @GNULIB_FLOORL@
# if @REPLACE_FLOORL@
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# undef floorl
# define floorl rpl_floorl
# endif
_GL_FUNCDECL_RPL (floorl, long double, (long double x));
@ -329,6 +507,78 @@ _GL_WARN_ON_USE (floorl, "floorl is unportable - "
#endif
#if @GNULIB_FMODF@
# if !@HAVE_FMODF@
# undef fmodf
_GL_FUNCDECL_SYS (fmodf, float, (float x, float y));
# endif
_GL_CXXALIAS_SYS (fmodf, float, (float x, float y));
_GL_CXXALIASWARN (fmodf);
#elif defined GNULIB_POSIXCHECK
# undef fmodf
# if HAVE_RAW_DECL_FMODF
_GL_WARN_ON_USE (fmodf, "fmodf is unportable - "
"use gnulib module fmodf for portability");
# endif
#endif
/* Write x as
x = mantissa * 2^exp
where
If x finite and nonzero: 0.5 <= |mantissa| < 1.0.
If x is zero: mantissa = x, exp = 0.
If x is infinite or NaN: mantissa = x, exp unspecified.
Store exp in *EXPPTR and return mantissa. */
#if @GNULIB_FREXPF@
# if @REPLACE_FREXPF@
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# undef frexpf
# define frexpf rpl_frexpf
# endif
_GL_FUNCDECL_RPL (frexpf, float, (float x, int *expptr) _GL_ARG_NONNULL ((2)));
_GL_CXXALIAS_RPL (frexpf, float, (float x, int *expptr));
# else
# if !@HAVE_FREXPF@
# undef frexpf
_GL_FUNCDECL_SYS (frexpf, float, (float x, int *expptr) _GL_ARG_NONNULL ((2)));
# endif
_GL_CXXALIAS_SYS (frexpf, float, (float x, int *expptr));
# endif
_GL_CXXALIASWARN (frexpf);
#elif defined GNULIB_POSIXCHECK
# undef frexpf
# if HAVE_RAW_DECL_FREXPF
_GL_WARN_ON_USE (frexpf, "frexpf is unportable - "
"use gnulib module frexpf for portability");
# endif
#endif
/* Write x as
x = mantissa * 2^exp
where
If x finite and nonzero: 0.5 <= |mantissa| < 1.0.
If x is zero: mantissa = x, exp = 0.
If x is infinite or NaN: mantissa = x, exp unspecified.
Store exp in *EXPPTR and return mantissa. */
#if @GNULIB_FREXP@
# if @REPLACE_FREXP@
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# define frexp rpl_frexp
# endif
_GL_FUNCDECL_RPL (frexp, double, (double x, int *expptr) _GL_ARG_NONNULL ((2)));
_GL_CXXALIAS_RPL (frexp, double, (double x, int *expptr));
# else
_GL_CXXALIAS_SYS (frexp, double, (double x, int *expptr));
# endif
_GL_CXXALIASWARN (frexp);
#elif defined GNULIB_POSIXCHECK
# undef frexp
/* Assume frexp is always declared. */
_GL_WARN_ON_USE (frexp, "frexp is unportable - "
"use gnulib module frexp for portability");
#endif
/* Write x as
x = mantissa * 2^exp
where
@ -338,6 +588,7 @@ _GL_WARN_ON_USE (floorl, "floorl is unportable - "
Store exp in *EXPPTR and return mantissa. */
#if @GNULIB_FREXPL@ && @REPLACE_FREXPL@
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# undef frexpl
# define frexpl rpl_frexpl
# endif
_GL_FUNCDECL_RPL (frexpl, long double,
@ -364,9 +615,26 @@ _GL_WARN_ON_USE (frexpl, "frexpl is unportable - "
#endif
/* Return x * 2^exp. */
#if @GNULIB_LDEXPF@
# if !@HAVE_LDEXPF@
# undef ldexpf
_GL_FUNCDECL_SYS (ldexpf, float, (float x, int exp));
# endif
_GL_CXXALIAS_SYS (ldexpf, float, (float x, int exp));
_GL_CXXALIASWARN (ldexpf);
#elif defined GNULIB_POSIXCHECK
# undef ldexpf
# if HAVE_RAW_DECL_LDEXPF
_GL_WARN_ON_USE (ldexpf, "ldexpf is unportable - "
"use gnulib module ldexpf for portability");
# endif
#endif
/* Return x * 2^exp. */
#if @GNULIB_LDEXPL@ && @REPLACE_LDEXPL@
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# undef ldexpl
# define ldexpl rpl_ldexpl
# endif
_GL_FUNCDECL_RPL (ldexpl, long double, (long double x, int exp));
@ -391,6 +659,34 @@ _GL_WARN_ON_USE (ldexpl, "ldexpl is unportable - "
#endif
#if @GNULIB_LOGB@
# if !@HAVE_DECL_LOGB@
_GL_EXTERN_C double logb (double x);
# endif
#elif defined GNULIB_POSIXCHECK
# undef logb
# if HAVE_RAW_DECL_LOGB
_GL_WARN_ON_USE (logb, "logb is unportable - "
"use gnulib module logb for portability");
# endif
#endif
#if @GNULIB_LOGF@
# if !@HAVE_LOGF@
# undef logf
_GL_FUNCDECL_SYS (logf, float, (float x));
# endif
_GL_CXXALIAS_SYS (logf, float, (float x));
_GL_CXXALIASWARN (logf);
#elif defined GNULIB_POSIXCHECK
# undef logf
# if HAVE_RAW_DECL_LOGF
_GL_WARN_ON_USE (logf, "logf is unportable - "
"use gnulib module logf for portability");
# endif
#endif
#if @GNULIB_LOGL@
# if !@HAVE_LOGL@ || !@HAVE_DECL_LOGL@
_GL_FUNCDECL_SYS (logl, long double, (long double x));
@ -406,6 +702,97 @@ _GL_WARN_ON_USE (logl, "logl is unportable - "
#endif
#if @GNULIB_LOG10F@
# if !@HAVE_LOG10F@
# undef log10f
_GL_FUNCDECL_SYS (log10f, float, (float x));
# endif
_GL_CXXALIAS_SYS (log10f, float, (float x));
_GL_CXXALIASWARN (log10f);
#elif defined GNULIB_POSIXCHECK
# undef log10f
# if HAVE_RAW_DECL_LOG10F
_GL_WARN_ON_USE (log10f, "log10f is unportable - "
"use gnulib module log10f for portability");
# endif
#endif
#if @GNULIB_MODFF@
# if !@HAVE_MODFF@
# undef modff
_GL_FUNCDECL_SYS (modff, float, (float x, float *iptr) _GL_ARG_NONNULL ((2)));
# endif
_GL_CXXALIAS_SYS (modff, float, (float x, float *iptr));
_GL_CXXALIASWARN (modff);
#elif defined GNULIB_POSIXCHECK
# undef modff
# if HAVE_RAW_DECL_MODFF
_GL_WARN_ON_USE (modff, "modff is unportable - "
"use gnulib module modff for portability");
# endif
#endif
#if @GNULIB_POWF@
# if !@HAVE_POWF@
# undef powf
_GL_FUNCDECL_SYS (powf, float, (float x, float y));
# endif
_GL_CXXALIAS_SYS (powf, float, (float x, float y));
_GL_CXXALIASWARN (powf);
#elif defined GNULIB_POSIXCHECK
# undef powf
# if HAVE_RAW_DECL_POWF
_GL_WARN_ON_USE (powf, "powf is unportable - "
"use gnulib module powf for portability");
# endif
#endif
#if @GNULIB_RINTF@
# if !@HAVE_RINTF@
_GL_FUNCDECL_SYS (rintf, float, (float x));
# endif
_GL_CXXALIAS_SYS (rintf, float, (float x));
_GL_CXXALIASWARN (rintf);
#elif defined GNULIB_POSIXCHECK
# undef rintf
# if HAVE_RAW_DECL_RINTF
_GL_WARN_ON_USE (rintf, "rintf is unportable - "
"use gnulib module rintf for portability");
# endif
#endif
#if @GNULIB_RINT@
# if !@HAVE_RINT@
_GL_FUNCDECL_SYS (rint, double, (double x));
# endif
_GL_CXXALIAS_SYS (rint, double, (double x));
_GL_CXXALIASWARN (rint);
#elif defined GNULIB_POSIXCHECK
# undef rint
# if HAVE_RAW_DECL_RINT
_GL_WARN_ON_USE (rint, "rint is unportable - "
"use gnulib module rint for portability");
# endif
#endif
#if @GNULIB_RINTL@
# if !@HAVE_RINTL@
_GL_FUNCDECL_SYS (rintl, long double, (long double x));
# endif
_GL_CXXALIAS_SYS (rintl, long double, (long double x));
_GL_CXXALIASWARN (rintl);
#elif defined GNULIB_POSIXCHECK
# undef rintl
# if HAVE_RAW_DECL_RINTL
_GL_WARN_ON_USE (rintl, "rintl is unportable - "
"use gnulib module rintl for portability");
# endif
#endif
#if @GNULIB_ROUNDF@
# if @REPLACE_ROUNDF@
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
@ -476,6 +863,21 @@ _GL_WARN_ON_USE (roundl, "roundl is unportable - "
#endif
#if @GNULIB_SINF@
# if !@HAVE_SINF@
# undef sinf
_GL_FUNCDECL_SYS (sinf, float, (float x));
# endif
_GL_CXXALIAS_SYS (sinf, float, (float x));
_GL_CXXALIASWARN (sinf);
#elif defined GNULIB_POSIXCHECK
# undef sinf
# if HAVE_RAW_DECL_SINF
_GL_WARN_ON_USE (sinf, "sinf is unportable - "
"use gnulib module sinf for portability");
# endif
#endif
#if @GNULIB_SINL@
# if !@HAVE_SINL@ || !@HAVE_DECL_SINL@
_GL_FUNCDECL_SYS (sinl, long double, (long double x));
@ -491,6 +893,37 @@ _GL_WARN_ON_USE (sinl, "sinl is unportable - "
#endif
#if @GNULIB_SINHF@
# if !@HAVE_SINHF@
# undef sinhf
_GL_FUNCDECL_SYS (sinhf, float, (float x));
# endif
_GL_CXXALIAS_SYS (sinhf, float, (float x));
_GL_CXXALIASWARN (sinhf);
#elif defined GNULIB_POSIXCHECK
# undef sinhf
# if HAVE_RAW_DECL_SINHF
_GL_WARN_ON_USE (sinhf, "sinhf is unportable - "
"use gnulib module sinhf for portability");
# endif
#endif
#if @GNULIB_SQRTF@
# if !@HAVE_SQRTF@
# undef sqrtf
_GL_FUNCDECL_SYS (sqrtf, float, (float x));
# endif
_GL_CXXALIAS_SYS (sqrtf, float, (float x));
_GL_CXXALIASWARN (sqrtf);
#elif defined GNULIB_POSIXCHECK
# undef sqrtf
# if HAVE_RAW_DECL_SQRTF
_GL_WARN_ON_USE (sqrtf, "sqrtf is unportable - "
"use gnulib module sqrtf for portability");
# endif
#endif
#if @GNULIB_SQRTL@
# if !@HAVE_SQRTL@ || !@HAVE_DECL_SQRTL@
_GL_FUNCDECL_SYS (sqrtl, long double, (long double x));
@ -506,6 +939,21 @@ _GL_WARN_ON_USE (sqrtl, "sqrtl is unportable - "
#endif
#if @GNULIB_TANF@
# if !@HAVE_TANF@
# undef tanf
_GL_FUNCDECL_SYS (tanf, float, (float x));
# endif
_GL_CXXALIAS_SYS (tanf, float, (float x));
_GL_CXXALIASWARN (tanf);
#elif defined GNULIB_POSIXCHECK
# undef tanf
# if HAVE_RAW_DECL_TANF
_GL_WARN_ON_USE (tanf, "tanf is unportable - "
"use gnulib module tanf for portability");
# endif
#endif
#if @GNULIB_TANL@
# if !@HAVE_TANL@ || !@HAVE_DECL_TANL@
_GL_FUNCDECL_SYS (tanl, long double, (long double x));
@ -521,6 +969,22 @@ _GL_WARN_ON_USE (tanl, "tanl is unportable - "
#endif
#if @GNULIB_TANHF@
# if !@HAVE_TANHF@
# undef tanhf
_GL_FUNCDECL_SYS (tanhf, float, (float x));
# endif
_GL_CXXALIAS_SYS (tanhf, float, (float x));
_GL_CXXALIASWARN (tanhf);
#elif defined GNULIB_POSIXCHECK
# undef tanhf
# if HAVE_RAW_DECL_TANHF
_GL_WARN_ON_USE (tanhf, "tanhf is unportable - "
"use gnulib module tanhf for portability");
# endif
#endif
#if @GNULIB_TRUNCF@
# if @REPLACE_TRUNCF@
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
@ -589,6 +1053,10 @@ _GL_WARN_ON_USE (truncl, "truncl is unportable - "
#endif
/* Definitions of function-like macros come here, after the function
declarations. */
#if @GNULIB_ISFINITE@
# if @REPLACE_ISFINITE@
_GL_EXTERN_C int gl_isfinitef (float x);
@ -600,6 +1068,13 @@ _GL_EXTERN_C int gl_isfinitel (long double x);
sizeof (x) == sizeof (double) ? gl_isfinited (x) : \
gl_isfinitef (x))
# endif
# ifdef __cplusplus
# ifdef isfinite
_GL_MATH_CXX_REAL_FLOATING_DECL_1 (isfinite)
# undef isfinite
_GL_MATH_CXX_REAL_FLOATING_DECL_2 (isfinite)
# endif
# endif
#elif defined GNULIB_POSIXCHECK
# if defined isfinite
_GL_WARN_REAL_FLOATING_DECL (isfinite);
@ -620,6 +1095,13 @@ _GL_EXTERN_C int gl_isinfl (long double x);
sizeof (x) == sizeof (double) ? gl_isinfd (x) : \
gl_isinff (x))
# endif
# ifdef __cplusplus
# ifdef isinf
_GL_MATH_CXX_REAL_FLOATING_DECL_1 (isinf)
# undef isinf
_GL_MATH_CXX_REAL_FLOATING_DECL_2 (isinf)
# endif
# endif
#elif defined GNULIB_POSIXCHECK
# if defined isinf
_GL_WARN_REAL_FLOATING_DECL (isinf);
@ -731,10 +1213,18 @@ _GL_EXTERN_C int rpl_isnanl (long double x);
sizeof (x) == sizeof (double) ? __builtin_isnan ((double)(x)) : \
__builtin_isnanf ((float)(x)))
# endif
# ifdef __cplusplus
# ifdef isnan
_GL_MATH_CXX_REAL_FLOATING_DECL_1 (isnan)
# undef isnan
_GL_MATH_CXX_REAL_FLOATING_DECL_2 (isnan)
# endif
# else
/* Ensure isnan is a macro. */
# ifndef isnan
# define isnan isnan
# endif
# endif
#elif defined GNULIB_POSIXCHECK
# if defined isnan
_GL_WARN_REAL_FLOATING_DECL (isnan);
@ -758,7 +1248,7 @@ _GL_WARN_REAL_FLOATING_DECL (isnan);
_GL_EXTERN_C int gl_signbitf (float arg);
_GL_EXTERN_C int gl_signbitd (double arg);
_GL_EXTERN_C int gl_signbitl (long double arg);
# if __GNUC__ >= 2 && !__STRICT_ANSI__
# if __GNUC__ >= 2 && !defined __STRICT_ANSI__
# define _GL_NUM_UINT_WORDS(type) \
((sizeof (type) + sizeof (unsigned int) - 1) / sizeof (unsigned int))
# if defined FLT_SIGNBIT_WORD && defined FLT_SIGNBIT_BIT && !defined gl_signbitf
@ -797,6 +1287,13 @@ _GL_EXTERN_C int gl_signbitl (long double arg);
sizeof (x) == sizeof (double) ? gl_signbitd (x) : \
gl_signbitf (x))
# endif
# ifdef __cplusplus
# ifdef signbit
_GL_MATH_CXX_REAL_FLOATING_DECL_1 (signbit)
# undef signbit
_GL_MATH_CXX_REAL_FLOATING_DECL_2 (signbit)
# endif
# endif
#elif defined GNULIB_POSIXCHECK
# if defined signbit
_GL_WARN_REAL_FLOATING_DECL (signbit);

130
lib/msvc-inval.c Normal file
View file

@ -0,0 +1,130 @@
/* Invalid parameter handler for MSVC runtime libraries.
Copyright (C) 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. */
#include <config.h>
/* Specification. */
#include "msvc-inval.h"
#if HAVE_MSVC_INVALID_PARAMETER_HANDLER \
&& !(MSVC_INVALID_PARAMETER_HANDLING == SANE_LIBRARY_HANDLING)
/* Get _invalid_parameter_handler type and _set_invalid_parameter_handler
declaration. */
# include <stdlib.h>
# if MSVC_INVALID_PARAMETER_HANDLING == DEFAULT_HANDLING
static void cdecl
gl_msvc_invalid_parameter_handler (const wchar_t *expression,
const wchar_t *function,
const wchar_t *file,
unsigned int line,
uintptr_t dummy)
{
}
# else
/* Get declarations of the Win32 API functions. */
# define WIN32_LEAN_AND_MEAN
# include <windows.h>
# if defined _MSC_VER
static void cdecl
gl_msvc_invalid_parameter_handler (const wchar_t *expression,
const wchar_t *function,
const wchar_t *file,
unsigned int line,
uintptr_t dummy)
{
RaiseException (STATUS_GNULIB_INVALID_PARAMETER, 0, 0, NULL);
}
# else
/* An index to thread-local storage. */
static DWORD tls_index;
static int tls_initialized /* = 0 */;
/* Used as a fallback only. */
static struct gl_msvc_inval_per_thread not_per_thread;
struct gl_msvc_inval_per_thread *
gl_msvc_inval_current (void)
{
if (!tls_initialized)
{
tls_index = TlsAlloc ();
tls_initialized = 1;
}
if (tls_index == TLS_OUT_OF_INDEXES)
/* TlsAlloc had failed. */
return &not_per_thread;
else
{
struct gl_msvc_inval_per_thread *pointer =
(struct gl_msvc_inval_per_thread *) TlsGetValue (tls_index);
if (pointer == NULL)
{
/* First call. Allocate a new 'struct gl_msvc_inval_per_thread'. */
pointer =
(struct gl_msvc_inval_per_thread *)
malloc (sizeof (struct gl_msvc_inval_per_thread));
if (pointer == NULL)
/* Could not allocate memory. Use the global storage. */
pointer = &not_per_thread;
TlsSetValue (tls_index, pointer);
}
return pointer;
}
}
static void cdecl
gl_msvc_invalid_parameter_handler (const wchar_t *expression,
const wchar_t *function,
const wchar_t *file,
unsigned int line,
uintptr_t dummy)
{
struct gl_msvc_inval_per_thread *current = gl_msvc_inval_current ();
if (current->restart_valid)
longjmp (current->restart, 1);
else
/* An invalid parameter notification from outside the gnulib code.
Give the caller a chance to intervene. */
RaiseException (STATUS_GNULIB_INVALID_PARAMETER, 0, 0, NULL);
}
# endif
# endif
static int gl_msvc_inval_initialized /* = 0 */;
void
gl_msvc_inval_ensure_handler (void)
{
if (gl_msvc_inval_initialized == 0)
{
_set_invalid_parameter_handler (gl_msvc_invalid_parameter_handler);
gl_msvc_inval_initialized = 1;
}
}
#endif

223
lib/msvc-inval.h Normal file
View file

@ -0,0 +1,223 @@
/* Invalid parameter handler for MSVC runtime libraries.
Copyright (C) 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. */
#ifndef _MSVC_INVAL_H
#define _MSVC_INVAL_H
/* With MSVC runtime libraries with the "invalid parameter handler" concept,
functions like fprintf(), dup2(), or close() crash when the caller passes
an invalid argument. But POSIX wants error codes (such as EINVAL or EBADF)
instead.
This file defines macros that turn such an invalid parameter notification
into a non-local exit. An error code can then be produced at the target
of this exit. You can thus write code like
TRY_MSVC_INVAL
{
<Code that can trigger an invalid parameter notification
but does not do 'return', 'break', 'continue', nor 'goto'.>
}
CATCH_MSVC_INVAL
{
<Code that handles an invalid parameter notification
but does not do 'return', 'break', 'continue', nor 'goto'.>
}
DONE_MSVC_INVAL;
This entire block expands to a single statement.
The handling of invalid parameters can be done in three ways:
* The default way, which is reasonable for programs (not libraries):
AC_DEFINE([MSVC_INVALID_PARAMETER_HANDLING], [DEFAULT_HANDLING])
* The way for libraries that make "hairy" calls (like close(-1), or
fclose(fp) where fileno(fp) is closed, or simply getdtablesize()):
AC_DEFINE([MSVC_INVALID_PARAMETER_HANDLING], [HAIRY_LIBRARY_HANDLING])
* The way for libraries that make no "hairy" calls:
AC_DEFINE([MSVC_INVALID_PARAMETER_HANDLING], [SANE_LIBRARY_HANDLING])
*/
#define DEFAULT_HANDLING 0
#define HAIRY_LIBRARY_HANDLING 1
#define SANE_LIBRARY_HANDLING 2
#if HAVE_MSVC_INVALID_PARAMETER_HANDLER \
&& !(MSVC_INVALID_PARAMETER_HANDLING == SANE_LIBRARY_HANDLING)
/* A native Windows platform with the "invalid parameter handler" concept,
and either DEFAULT_HANDLING or HAIRY_LIBRARY_HANDLING. */
# if MSVC_INVALID_PARAMETER_HANDLING == DEFAULT_HANDLING
/* Default handling. */
# ifdef __cplusplus
extern "C" {
# endif
/* Ensure that the invalid parameter handler in installed that just returns.
Because we assume no other part of the program installs a different
invalid parameter handler, this solution is multithread-safe. */
extern void gl_msvc_inval_ensure_handler (void);
# ifdef __cplusplus
}
# endif
# define TRY_MSVC_INVAL \
do \
{ \
gl_msvc_inval_ensure_handler (); \
if (1)
# define CATCH_MSVC_INVAL \
else
# define DONE_MSVC_INVAL \
} \
while (0)
# else
/* Handling for hairy libraries. */
# include <excpt.h>
/* Gnulib can define its own status codes, as described in the page
"Raising Software Exceptions" on microsoft.com
<http://msdn.microsoft.com/en-us/library/het71c37.aspx>.
Our status codes are composed of
- 0xE0000000, mandatory for all user-defined status codes,
- 0x474E550, a API identifier ("GNU"),
- 0, 1, 2, ..., used to distinguish different status codes from the
same API. */
# define STATUS_GNULIB_INVALID_PARAMETER (0xE0000000 + 0x474E550 + 0)
# if defined _MSC_VER
/* A compiler that supports __try/__except, as described in the page
"try-except statement" on microsoft.com
<http://msdn.microsoft.com/en-us/library/s58ftw19.aspx>.
With __try/__except, we can use the multithread-safe exception handling. */
# ifdef __cplusplus
extern "C" {
# endif
/* Ensure that the invalid parameter handler in installed that raises a
software exception with code STATUS_GNULIB_INVALID_PARAMETER.
Because we assume no other part of the program installs a different
invalid parameter handler, this solution is multithread-safe. */
extern void gl_msvc_inval_ensure_handler (void);
# ifdef __cplusplus
}
# endif
# define TRY_MSVC_INVAL \
do \
{ \
gl_msvc_inval_ensure_handler (); \
__try
# define CATCH_MSVC_INVAL \
__except (GetExceptionCode () == STATUS_GNULIB_INVALID_PARAMETER \
? EXCEPTION_EXECUTE_HANDLER \
: EXCEPTION_CONTINUE_SEARCH)
# define DONE_MSVC_INVAL \
} \
while (0)
# else
/* Any compiler.
We can only use setjmp/longjmp. */
# include <setjmp.h>
# ifdef __cplusplus
extern "C" {
# endif
struct gl_msvc_inval_per_thread
{
/* The restart that will resume execution at the code between
CATCH_MSVC_INVAL and DONE_MSVC_INVAL. It is enabled only between
TRY_MSVC_INVAL and CATCH_MSVC_INVAL. */
jmp_buf restart;
/* Tells whether the contents of restart is valid. */
int restart_valid;
};
/* Ensure that the invalid parameter handler in installed that passes
control to the gl_msvc_inval_restart if it is valid, or raises a
software exception with code STATUS_GNULIB_INVALID_PARAMETER otherwise.
Because we assume no other part of the program installs a different
invalid parameter handler, this solution is multithread-safe. */
extern void gl_msvc_inval_ensure_handler (void);
/* Return a pointer to the per-thread data for the current thread. */
extern struct gl_msvc_inval_per_thread *gl_msvc_inval_current (void);
# ifdef __cplusplus
}
# endif
# define TRY_MSVC_INVAL \
do \
{ \
struct gl_msvc_inval_per_thread *msvc_inval_current; \
gl_msvc_inval_ensure_handler (); \
msvc_inval_current = gl_msvc_inval_current (); \
/* First, initialize gl_msvc_inval_restart. */ \
if (setjmp (msvc_inval_current->restart) == 0) \
{ \
/* Then, mark it as valid. */ \
msvc_inval_current->restart_valid = 1;
# define CATCH_MSVC_INVAL \
/* Execution completed. \
Mark gl_msvc_inval_restart as invalid. */ \
msvc_inval_current->restart_valid = 0; \
} \
else \
{ \
/* Execution triggered an invalid parameter notification. \
Mark gl_msvc_inval_restart as invalid. */ \
msvc_inval_current->restart_valid = 0;
# define DONE_MSVC_INVAL \
} \
} \
while (0)
# endif
# endif
#else
/* A platform that does not need to the invalid parameter handler,
or when SANE_LIBRARY_HANDLING is desired. */
/* The braces here avoid GCC warnings like
"warning: suggest explicit braces to avoid ambiguous `else'". */
# define TRY_MSVC_INVAL \
do \
{ \
if (1)
# define CATCH_MSVC_INVAL \
else
# define DONE_MSVC_INVAL \
} \
while (0)
#endif
#endif /* _MSVC_INVAL_H */

50
lib/msvc-nothrow.c Normal file
View file

@ -0,0 +1,50 @@
/* Wrappers that don't throw invalid parameter notifications
with MSVC runtime libraries.
Copyright (C) 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. */
#include <config.h>
/* Specification. */
#include "msvc-nothrow.h"
/* Get declarations of the Win32 API functions. */
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include "msvc-inval.h"
#undef _get_osfhandle
#if HAVE_MSVC_INVALID_PARAMETER_HANDLER
intptr_t
_gl_nothrow_get_osfhandle (int fd)
{
intptr_t result;
TRY_MSVC_INVAL
{
result = _get_osfhandle (fd);
}
CATCH_MSVC_INVAL
{
result = (intptr_t) INVALID_HANDLE_VALUE;
}
DONE_MSVC_INVAL;
return result;
}
#endif

44
lib/msvc-nothrow.h Normal file
View file

@ -0,0 +1,44 @@
/* Wrappers that don't throw invalid parameter notifications
with MSVC runtime libraries.
Copyright (C) 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. */
#ifndef _MSVC_NOTHROW_H
#define _MSVC_NOTHROW_H
/* With MSVC runtime libraries with the "invalid parameter handler" concept,
functions like fprintf(), dup2(), or close() crash when the caller passes
an invalid argument. But POSIX wants error codes (such as EINVAL or EBADF)
instead.
This file defines wrappers that turn such an invalid parameter notification
into an error code. */
#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
/* Get original declaration of _get_osfhandle. */
# include <io.h>
# if HAVE_MSVC_INVALID_PARAMETER_HANDLER
/* Override _get_osfhandle. */
extern intptr_t _gl_nothrow_get_osfhandle (int fd);
# define _get_osfhandle _gl_nothrow_get_osfhandle
# endif
#endif
#endif /* _MSVC_NOTHROW_H */

View file

@ -16,13 +16,16 @@
/* Written by Bruno Haible <bruno@clisp.org>, 2007. */
/* If the user's config.h happens to include <fcntl.h>, let it include only
the system's <fcntl.h> here, so that orig_open doesn't recurse to
rpl_open. */
#define __need_system_fcntl_h
#include <config.h>
/* Get the original definition of open. It might be defined as a macro. */
#define __need_system_fcntl_h
#include <fcntl.h>
#undef __need_system_fcntl_h
#include <sys/types.h>
#undef __need_system_fcntl_h
static inline int
orig_open (const char *filename, int flags, mode_t mode)
@ -31,7 +34,9 @@ orig_open (const char *filename, int flags, mode_t mode)
}
/* Specification. */
#include <fcntl.h>
/* Write "fcntl.h" here, not <fcntl.h>, otherwise OSF/1 5.1 DTK cc eliminates
this include because of the preliminary #include <fcntl.h> above. */
#include "fcntl.h"
#include <errno.h>
#include <stdarg.h>

View file

@ -23,7 +23,22 @@
including the terminating NUL byte.
<http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/limits.h.html>
PATH_MAX is not defined on systems which have no limit on filename length,
such as GNU/Hurd. */
such as GNU/Hurd.
This file does *not* define PATH_MAX always. Programs that use this file
can handle the GNU/Hurd case in several ways:
- Either with a package-wide handling, or with a per-file handling,
- Either through a
#ifdef PATH_MAX
or through a fallback like
#ifndef PATH_MAX
# define PATH_MAX 8192
#endif
or through a fallback like
#ifndef PATH_MAX
# define PATH_MAX pathconf ("/", _PC_PATH_MAX)
#endif
*/
# include <unistd.h>
@ -33,11 +48,6 @@
# define _POSIX_PATH_MAX 256
# endif
# if !defined PATH_MAX && defined _PC_PATH_MAX && defined HAVE_PATHCONF
# define PATH_MAX (pathconf ("/", _PC_PATH_MAX) < 1 ? 1024 \
: pathconf ("/", _PC_PATH_MAX))
# endif
/* Don't include sys/param.h if it already has been. */
# if defined HAVE_SYS_PARAM_H && !defined PATH_MAX && !defined MAXPATHLEN
# include <sys/param.h>
@ -47,10 +57,6 @@
# define PATH_MAX MAXPATHLEN
# endif
# ifndef PATH_MAX
# define PATH_MAX _POSIX_PATH_MAX
# endif
# ifdef __hpux
/* On HP-UX, PATH_MAX designates the maximum number of bytes in a filename,
*not* including the terminating NUL byte, and is set to 1023.
@ -60,4 +66,19 @@
# define PATH_MAX 1024
# endif
# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
/* The page "Naming Files, Paths, and Namespaces" on msdn.microsoft.com,
section "Maximum Path Length Limitation",
<http://msdn.microsoft.com/en-us/library/aa365247(v=vs.85).aspx#maxpath>
explains that the maximum size of a filename, including the terminating
NUL byte, is 260 = 3 + 256 + 1.
This is the same value as
- FILENAME_MAX in <stdio.h>,
- _MAX_PATH in <stdlib.h>,
- MAX_PATH in <windef.h>.
Undefine the original value, because mingw's <limits.h> gets it wrong. */
# undef PATH_MAX
# define PATH_MAX 260
# endif
#endif /* _PATHMAX_H */

View file

@ -95,7 +95,9 @@ pipe2 (int fd[2], int flags)
goto fail;
}
# else
{
verify (O_NONBLOCK == 0);
}
# endif
return 0;
@ -151,6 +153,8 @@ pipe2 (int fd[2], int flags)
#endif
#if GNULIB_defined_O_NONBLOCK || \
!((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__)
fail:
{
int saved_errno = errno;
@ -161,4 +165,5 @@ pipe2 (int fd[2], int flags)
errno = saved_errno;
return -1;
}
#endif
}

View file

@ -34,10 +34,12 @@
#include <string.h>
#include <unistd.h>
#if HAVE_GNU_LD
#if _LIBC
# if HAVE_GNU_LD
# define environ __environ
#else
# else
extern char **environ;
# endif
#endif
#if _LIBC

79
lib/raise.c Normal file
View file

@ -0,0 +1,79 @@
/* Provide a non-threads replacement for the POSIX raise function.
Copyright (C) 2002-2003, 2005-2006, 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 3 of the License, 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, see <http://www.gnu.org/licenses/>. */
/* written by Jim Meyering and Bruno Haible */
#include <config.h>
/* Specification. */
#include <signal.h>
#if HAVE_RAISE
/* Native Windows platform. */
# include <errno.h>
# include "msvc-inval.h"
# undef raise
# if HAVE_MSVC_INVALID_PARAMETER_HANDLER
static inline int
raise_nothrow (int sig)
{
int result;
TRY_MSVC_INVAL
{
result = raise (sig);
}
CATCH_MSVC_INVAL
{
result = -1;
errno = EINVAL;
}
DONE_MSVC_INVAL;
return result;
}
# else
# define raise_nothrow raise
# endif
#else
/* An old Unix platform. */
# include <unistd.h>
# define rpl_raise raise
#endif
int
rpl_raise (int sig)
{
#if GNULIB_defined_signal_blocking && GNULIB_defined_SIGPIPE
if (sig == SIGPIPE)
return _gl_raise_SIGPIPE ();
#endif
#if HAVE_RAISE
return raise_nothrow (sig);
#else
return kill (getpid (), sig);
#endif
}

View file

@ -20,10 +20,7 @@
/* Specification. */
#include <unistd.h>
/* Replace this function only if module 'nonblocking' is requested. */
#if GNULIB_NONBLOCKING
# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
# include <errno.h>
# include <io.h>
@ -31,12 +28,40 @@
# define WIN32_LEAN_AND_MEAN /* avoid including junk */
# include <windows.h>
# include "msvc-inval.h"
# include "msvc-nothrow.h"
# undef read
# if HAVE_MSVC_INVALID_PARAMETER_HANDLER
static inline ssize_t
read_nothrow (int fd, void *buf, size_t count)
{
ssize_t result;
TRY_MSVC_INVAL
{
result = read (fd, buf, count);
}
CATCH_MSVC_INVAL
{
result = -1;
errno = EBADF;
}
DONE_MSVC_INVAL;
return result;
}
# else
# define read_nothrow read
# endif
ssize_t
rpl_read (int fd, void *buf, size_t count)
#undef read
{
ssize_t ret = read (fd, buf, count);
ssize_t ret = read_nothrow (fd, buf, count);
# if GNULIB_NONBLOCKING
if (ret < 0
&& GetLastError () == ERROR_NO_DATA)
{
@ -52,8 +77,9 @@ rpl_read (int fd, void *buf, size_t count)
errno = EAGAIN;
}
}
# endif
return ret;
}
# endif
#endif

View file

@ -32,9 +32,18 @@ ssize_t
rpl_recv (int fd, void *buf, size_t len, int flags)
{
SOCKET sock = FD_TO_SOCKET (fd);
if (sock == INVALID_SOCKET)
{
errno = EBADF;
return -1;
}
else
{
int r = recv (sock, buf, len, flags);
if (r < 0)
set_winsock_errno ();
return r;
}
}

View file

@ -32,17 +32,27 @@ ssize_t
rpl_recvfrom (int fd, void *buf, size_t len, int flags, struct sockaddr *from,
socklen_t *fromlen)
{
int frombufsize = (from != NULL ? *fromlen : 0);
SOCKET sock = FD_TO_SOCKET (fd);
if (sock == INVALID_SOCKET)
{
errno = EBADF;
return -1;
}
else
{
int frombufsize = (from != NULL ? *fromlen : 0);
int r = recvfrom (sock, buf, len, flags, from, fromlen);
if (r < 0)
set_winsock_errno ();
/* Winsock recvfrom() only returns a valid 'from' when the socket is
connectionless. POSIX gives a valid 'from' for all types of sockets. */
connectionless. POSIX gives a valid 'from' for all types of
sockets. */
else if (from != NULL && *fromlen == frombufsize)
rpl_getpeername (fd, from, fromlen);
return r;
}
}

View file

@ -14,6 +14,19 @@
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* Some system calls may be interrupted and fail with errno = EINTR in the
following situations:
- The process is stopped and restarted (signal SIGSTOP and SIGCONT, user
types Ctrl-Z) on some platforms: MacOS X.
- The process receives a signal for which a signal handler was installed
with sigaction() with an sa_flags field that does not contain
SA_RESTART.
- The process receives a signal for which a signal handler was installed
with signal() and for which no call to siginterrupt(sig,0) was done,
on some platforms: AIX, HP-UX, IRIX, OSF/1, Solaris.
This module provides a wrapper around read() that handles EINTR. */
#include <stddef.h>
#ifdef __cplusplus

View file

@ -14,6 +14,19 @@
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* Some system calls may be interrupted and fail with errno = EINTR in the
following situations:
- The process is stopped and restarted (signal SIGSTOP and SIGCONT, user
types Ctrl-Z) on some platforms: MacOS X.
- The process receives a signal for which a signal handler was installed
with sigaction() with an sa_flags field that does not contain
SA_RESTART.
- The process receives a signal for which a signal handler was installed
with signal() and for which no call to siginterrupt(sig,0) was done,
on some platforms: AIX, HP-UX, IRIX, OSF/1, Solaris.
This module provides a wrapper around write() that handles EINTR. */
#include <stddef.h>
#define SAFE_WRITE_ERROR ((size_t) -1)

View file

@ -32,9 +32,18 @@ ssize_t
rpl_send (int fd, const void *buf, size_t len, int flags)
{
SOCKET sock = FD_TO_SOCKET (fd);
if (sock == INVALID_SOCKET)
{
errno = EBADF;
return -1;
}
else
{
int r = send (sock, buf, len, flags);
if (r < 0)
set_winsock_errno ();
return r;
}
}

View file

@ -33,9 +33,18 @@ rpl_sendto (int fd, const void *buf, size_t len, int flags,
const struct sockaddr *to, socklen_t tolen)
{
SOCKET sock = FD_TO_SOCKET (fd);
if (sock == INVALID_SOCKET)
{
errno = EBADF;
return -1;
}
else
{
int r = sendto (sock, buf, len, flags, to, tolen);
if (r < 0)
set_winsock_errno ();
return r;
}
}

View file

@ -34,10 +34,18 @@
int
rpl_setsockopt (int fd, int level, int optname, const void *optval, socklen_t optlen)
{
int r;
SOCKET sock = FD_TO_SOCKET (fd);
int r;
if (level == SOL_SOCKET && (optname == SO_RCVTIMEO || optname == SO_SNDTIMEO))
if (sock == INVALID_SOCKET)
{
errno = EBADF;
return -1;
}
else
{
if (level == SOL_SOCKET
&& (optname == SO_RCVTIMEO || optname == SO_SNDTIMEO))
{
const struct timeval *tv = optval;
int milliseconds = tv->tv_sec * 1000 + tv->tv_usec / 1000;
@ -53,4 +61,5 @@ rpl_setsockopt (int fd, int level, int optname, const void *optval, socklen_t op
set_winsock_errno ();
return r;
}
}

View file

@ -32,9 +32,18 @@ int
rpl_shutdown (int fd, int how)
{
SOCKET sock = FD_TO_SOCKET (fd);
if (sock == INVALID_SOCKET)
{
errno = EBADF;
return -1;
}
else
{
int r = shutdown (sock, how);
if (r < 0)
set_winsock_errno ();
return r;
}
}

447
lib/signal.in.h Normal file
View file

@ -0,0 +1,447 @@
/* A GNU-like <signal.h>.
Copyright (C) 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 3 of the License, 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, see <http://www.gnu.org/licenses/>. */
#if __GNUC__ >= 3
@PRAGMA_SYSTEM_HEADER@
#endif
@PRAGMA_COLUMNS@
#if defined __need_sig_atomic_t || defined __need_sigset_t || defined _GL_ALREADY_INCLUDING_SIGNAL_H || (defined _SIGNAL_H && !defined __SIZEOF_PTHREAD_MUTEX_T)
/* Special invocation convention:
- Inside glibc header files.
- On glibc systems we have a sequence of nested includes
<signal.h> -> <ucontext.h> -> <signal.h>.
In this situation, the functions are not yet declared, therefore we cannot
provide the C++ aliases.
- On glibc systems with GCC 4.3 we have a sequence of nested includes
<csignal> -> </usr/include/signal.h> -> <sys/ucontext.h> -> <signal.h>.
In this situation, some of the functions are not yet declared, therefore
we cannot provide the C++ aliases. */
# @INCLUDE_NEXT@ @NEXT_SIGNAL_H@
#else
/* Normal invocation convention. */
#ifndef _@GUARD_PREFIX@_SIGNAL_H
#define _GL_ALREADY_INCLUDING_SIGNAL_H
/* Define pid_t, uid_t.
Also, mingw defines sigset_t not in <signal.h>, but in <sys/types.h>.
On Solaris 10, <signal.h> includes <sys/types.h>, which eventually includes
us; so include <sys/types.h> now, before the second inclusion guard. */
#include <sys/types.h>
/* The include_next requires a split double-inclusion guard. */
#@INCLUDE_NEXT@ @NEXT_SIGNAL_H@
#undef _GL_ALREADY_INCLUDING_SIGNAL_H
#ifndef _@GUARD_PREFIX@_SIGNAL_H
#define _@GUARD_PREFIX@_SIGNAL_H
/* MacOS X 10.3, FreeBSD 6.4, OpenBSD 3.8, OSF/1 4.0, Solaris 2.6 declare
pthread_sigmask in <pthread.h>, not in <signal.h>.
But avoid namespace pollution on glibc systems.*/
#if (@GNULIB_PTHREAD_SIGMASK@ || defined GNULIB_POSIXCHECK) \
&& ((defined __APPLE__ && defined __MACH__) || defined __FreeBSD__ || defined __OpenBSD__ || defined __osf__ || defined __sun) \
&& ! defined __GLIBC__
# include <pthread.h>
#endif
/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
/* The definition of _GL_ARG_NONNULL is copied here. */
/* The definition of _GL_WARN_ON_USE is copied here. */
/* On AIX, sig_atomic_t already includes volatile. C99 requires that
'volatile sig_atomic_t' ignore the extra modifier, but C89 did not.
Hence, redefine this to a non-volatile type as needed. */
#if ! @HAVE_TYPE_VOLATILE_SIG_ATOMIC_T@
# if !GNULIB_defined_sig_atomic_t
typedef int rpl_sig_atomic_t;
# undef sig_atomic_t
# define sig_atomic_t rpl_sig_atomic_t
# define GNULIB_defined_sig_atomic_t 1
# endif
#endif
/* A set or mask of signals. */
#if !@HAVE_SIGSET_T@
# if !GNULIB_defined_sigset_t
typedef unsigned int sigset_t;
# define GNULIB_defined_sigset_t 1
# endif
#endif
/* Define sighandler_t, the type of signal handlers. A GNU extension. */
#if !@HAVE_SIGHANDLER_T@
# ifdef __cplusplus
extern "C" {
# endif
# if !GNULIB_defined_sighandler_t
typedef void (*sighandler_t) (int);
# define GNULIB_defined_sighandler_t 1
# endif
# ifdef __cplusplus
}
# endif
#endif
#if @GNULIB_SIGNAL_H_SIGPIPE@
# ifndef SIGPIPE
/* Define SIGPIPE to a value that does not overlap with other signals. */
# define SIGPIPE 13
# define GNULIB_defined_SIGPIPE 1
/* To actually use SIGPIPE, you also need the gnulib modules 'sigprocmask',
'write', 'stdio'. */
# endif
#endif
/* Maximum signal number + 1. */
#ifndef NSIG
# if defined __TANDEM
# define NSIG 32
# endif
#endif
#if @GNULIB_PTHREAD_SIGMASK@
# if @REPLACE_PTHREAD_SIGMASK@
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# undef pthread_sigmask
# define pthread_sigmask rpl_pthread_sigmask
# endif
_GL_FUNCDECL_RPL (pthread_sigmask, int,
(int how, const sigset_t *new_mask, sigset_t *old_mask));
_GL_CXXALIAS_RPL (pthread_sigmask, int,
(int how, const sigset_t *new_mask, sigset_t *old_mask));
# else
# if !@HAVE_PTHREAD_SIGMASK@
_GL_FUNCDECL_SYS (pthread_sigmask, int,
(int how, const sigset_t *new_mask, sigset_t *old_mask));
# endif
_GL_CXXALIAS_SYS (pthread_sigmask, int,
(int how, const sigset_t *new_mask, sigset_t *old_mask));
# endif
_GL_CXXALIASWARN (pthread_sigmask);
#elif defined GNULIB_POSIXCHECK
# undef pthread_sigmask
# if HAVE_RAW_DECL_PTHREAD_SIGMASK
_GL_WARN_ON_USE (pthread_sigmask, "pthread_sigmask is not portable - "
"use gnulib module pthread_sigmask for portability");
# endif
#endif
#if @GNULIB_RAISE@
# if @REPLACE_RAISE@
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# undef raise
# define raise rpl_raise
# endif
_GL_FUNCDECL_RPL (raise, int, (int sig));
_GL_CXXALIAS_RPL (raise, int, (int sig));
# else
# if !@HAVE_RAISE@
_GL_FUNCDECL_SYS (raise, int, (int sig));
# endif
_GL_CXXALIAS_SYS (raise, int, (int sig));
# endif
_GL_CXXALIASWARN (raise);
#elif defined GNULIB_POSIXCHECK
# undef raise
/* Assume raise is always declared. */
_GL_WARN_ON_USE (raise, "raise can crash on native Windows - "
"use gnulib module raise for portability");
#endif
#if @GNULIB_SIGPROCMASK@
# if !@HAVE_POSIX_SIGNALBLOCKING@
# ifndef GNULIB_defined_signal_blocking
# define GNULIB_defined_signal_blocking 1
# endif
/* Maximum signal number + 1. */
# ifndef NSIG
# define NSIG 32
# endif
/* This code supports only 32 signals. */
# if !GNULIB_defined_verify_NSIG_constraint
typedef int verify_NSIG_constraint[NSIG <= 32 ? 1 : -1];
# define GNULIB_defined_verify_NSIG_constraint 1
# endif
# endif
/* Test whether a given signal is contained in a signal set. */
# if @HAVE_POSIX_SIGNALBLOCKING@
/* This function is defined as a macro on MacOS X. */
# if defined __cplusplus && defined GNULIB_NAMESPACE
# undef sigismember
# endif
# else
_GL_FUNCDECL_SYS (sigismember, int, (const sigset_t *set, int sig)
_GL_ARG_NONNULL ((1)));
# endif
_GL_CXXALIAS_SYS (sigismember, int, (const sigset_t *set, int sig));
_GL_CXXALIASWARN (sigismember);
/* Initialize a signal set to the empty set. */
# if @HAVE_POSIX_SIGNALBLOCKING@
/* This function is defined as a macro on MacOS X. */
# if defined __cplusplus && defined GNULIB_NAMESPACE
# undef sigemptyset
# endif
# else
_GL_FUNCDECL_SYS (sigemptyset, int, (sigset_t *set) _GL_ARG_NONNULL ((1)));
# endif
_GL_CXXALIAS_SYS (sigemptyset, int, (sigset_t *set));
_GL_CXXALIASWARN (sigemptyset);
/* Add a signal to a signal set. */
# if @HAVE_POSIX_SIGNALBLOCKING@
/* This function is defined as a macro on MacOS X. */
# if defined __cplusplus && defined GNULIB_NAMESPACE
# undef sigaddset
# endif
# else
_GL_FUNCDECL_SYS (sigaddset, int, (sigset_t *set, int sig)
_GL_ARG_NONNULL ((1)));
# endif
_GL_CXXALIAS_SYS (sigaddset, int, (sigset_t *set, int sig));
_GL_CXXALIASWARN (sigaddset);
/* Remove a signal from a signal set. */
# if @HAVE_POSIX_SIGNALBLOCKING@
/* This function is defined as a macro on MacOS X. */
# if defined __cplusplus && defined GNULIB_NAMESPACE
# undef sigdelset
# endif
# else
_GL_FUNCDECL_SYS (sigdelset, int, (sigset_t *set, int sig)
_GL_ARG_NONNULL ((1)));
# endif
_GL_CXXALIAS_SYS (sigdelset, int, (sigset_t *set, int sig));
_GL_CXXALIASWARN (sigdelset);
/* Fill a signal set with all possible signals. */
# if @HAVE_POSIX_SIGNALBLOCKING@
/* This function is defined as a macro on MacOS X. */
# if defined __cplusplus && defined GNULIB_NAMESPACE
# undef sigfillset
# endif
# else
_GL_FUNCDECL_SYS (sigfillset, int, (sigset_t *set) _GL_ARG_NONNULL ((1)));
# endif
_GL_CXXALIAS_SYS (sigfillset, int, (sigset_t *set));
_GL_CXXALIASWARN (sigfillset);
/* Return the set of those blocked signals that are pending. */
# if !@HAVE_POSIX_SIGNALBLOCKING@
_GL_FUNCDECL_SYS (sigpending, int, (sigset_t *set) _GL_ARG_NONNULL ((1)));
# endif
_GL_CXXALIAS_SYS (sigpending, int, (sigset_t *set));
_GL_CXXALIASWARN (sigpending);
/* If OLD_SET is not NULL, put the current set of blocked signals in *OLD_SET.
Then, if SET is not NULL, affect the current set of blocked signals by
combining it with *SET as indicated in OPERATION.
In this implementation, you are not allowed to change a signal handler
while the signal is blocked. */
# if !@HAVE_POSIX_SIGNALBLOCKING@
# define SIG_BLOCK 0 /* blocked_set = blocked_set | *set; */
# define SIG_SETMASK 1 /* blocked_set = *set; */
# define SIG_UNBLOCK 2 /* blocked_set = blocked_set & ~*set; */
_GL_FUNCDECL_SYS (sigprocmask, int,
(int operation, const sigset_t *set, sigset_t *old_set));
# endif
_GL_CXXALIAS_SYS (sigprocmask, int,
(int operation, const sigset_t *set, sigset_t *old_set));
_GL_CXXALIASWARN (sigprocmask);
/* Install the handler FUNC for signal SIG, and return the previous
handler. */
# ifdef __cplusplus
extern "C" {
# endif
# if !GNULIB_defined_function_taking_int_returning_void_t
typedef void (*_gl_function_taking_int_returning_void_t) (int);
# define GNULIB_defined_function_taking_int_returning_void_t 1
# endif
# ifdef __cplusplus
}
# endif
# if !@HAVE_POSIX_SIGNALBLOCKING@
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# define signal rpl_signal
# endif
_GL_FUNCDECL_RPL (signal, _gl_function_taking_int_returning_void_t,
(int sig, _gl_function_taking_int_returning_void_t func));
_GL_CXXALIAS_RPL (signal, _gl_function_taking_int_returning_void_t,
(int sig, _gl_function_taking_int_returning_void_t func));
# else
_GL_CXXALIAS_SYS (signal, _gl_function_taking_int_returning_void_t,
(int sig, _gl_function_taking_int_returning_void_t func));
# endif
_GL_CXXALIASWARN (signal);
# if !@HAVE_POSIX_SIGNALBLOCKING@ && GNULIB_defined_SIGPIPE
/* Raise signal SIGPIPE. */
_GL_EXTERN_C int _gl_raise_SIGPIPE (void);
# endif
#elif defined GNULIB_POSIXCHECK
# undef sigaddset
# if HAVE_RAW_DECL_SIGADDSET
_GL_WARN_ON_USE (sigaddset, "sigaddset is unportable - "
"use the gnulib module sigprocmask for portability");
# endif
# undef sigdelset
# if HAVE_RAW_DECL_SIGDELSET
_GL_WARN_ON_USE (sigdelset, "sigdelset is unportable - "
"use the gnulib module sigprocmask for portability");
# endif
# undef sigemptyset
# if HAVE_RAW_DECL_SIGEMPTYSET
_GL_WARN_ON_USE (sigemptyset, "sigemptyset is unportable - "
"use the gnulib module sigprocmask for portability");
# endif
# undef sigfillset
# if HAVE_RAW_DECL_SIGFILLSET
_GL_WARN_ON_USE (sigfillset, "sigfillset is unportable - "
"use the gnulib module sigprocmask for portability");
# endif
# undef sigismember
# if HAVE_RAW_DECL_SIGISMEMBER
_GL_WARN_ON_USE (sigismember, "sigismember is unportable - "
"use the gnulib module sigprocmask for portability");
# endif
# undef sigpending
# if HAVE_RAW_DECL_SIGPENDING
_GL_WARN_ON_USE (sigpending, "sigpending is unportable - "
"use the gnulib module sigprocmask for portability");
# endif
# undef sigprocmask
# if HAVE_RAW_DECL_SIGPROCMASK
_GL_WARN_ON_USE (sigprocmask, "sigprocmask is unportable - "
"use the gnulib module sigprocmask for portability");
# endif
#endif /* @GNULIB_SIGPROCMASK@ */
#if @GNULIB_SIGACTION@
# if !@HAVE_SIGACTION@
# if !@HAVE_SIGINFO_T@
# if !GNULIB_defined_siginfo_types
/* Present to allow compilation, but unsupported by gnulib. */
union sigval
{
int sival_int;
void *sival_ptr;
};
/* Present to allow compilation, but unsupported by gnulib. */
struct siginfo_t
{
int si_signo;
int si_code;
int si_errno;
pid_t si_pid;
uid_t si_uid;
void *si_addr;
int si_status;
long si_band;
union sigval si_value;
};
typedef struct siginfo_t siginfo_t;
# define GNULIB_defined_siginfo_types 1
# endif
# endif /* !@HAVE_SIGINFO_T@ */
/* We assume that platforms which lack the sigaction() function also lack
the 'struct sigaction' type, and vice versa. */
# if !GNULIB_defined_struct_sigaction
struct sigaction
{
union
{
void (*_sa_handler) (int);
/* Present to allow compilation, but unsupported by gnulib. POSIX
says that implementations may, but not must, make sa_sigaction
overlap with sa_handler, but we know of no implementation where
they do not overlap. */
void (*_sa_sigaction) (int, siginfo_t *, void *);
} _sa_func;
sigset_t sa_mask;
/* Not all POSIX flags are supported. */
int sa_flags;
};
# define sa_handler _sa_func._sa_handler
# define sa_sigaction _sa_func._sa_sigaction
/* Unsupported flags are not present. */
# define SA_RESETHAND 1
# define SA_NODEFER 2
# define SA_RESTART 4
# define GNULIB_defined_struct_sigaction 1
# endif
_GL_FUNCDECL_SYS (sigaction, int, (int, const struct sigaction *restrict,
struct sigaction *restrict));
# elif !@HAVE_STRUCT_SIGACTION_SA_SIGACTION@
# define sa_sigaction sa_handler
# endif /* !@HAVE_SIGACTION@, !@HAVE_STRUCT_SIGACTION_SA_SIGACTION@ */
_GL_CXXALIAS_SYS (sigaction, int, (int, const struct sigaction *restrict,
struct sigaction *restrict));
_GL_CXXALIASWARN (sigaction);
#elif defined GNULIB_POSIXCHECK
# undef sigaction
# if HAVE_RAW_DECL_SIGACTION
_GL_WARN_ON_USE (sigaction, "sigaction is unportable - "
"use the gnulib module sigaction for portability");
# endif
#endif
/* Some systems don't have SA_NODEFER. */
#ifndef SA_NODEFER
# define SA_NODEFER 0
#endif
#endif /* _@GUARD_PREFIX@_SIGNAL_H */
#endif /* _@GUARD_PREFIX@_SIGNAL_H */
#endif

View file

@ -28,6 +28,7 @@
# include <sys/socket.h>
# include "fd-hook.h"
# include "msvc-nothrow.h"
/* Get set_winsock_errno, FD_TO_SOCKET etc. */
# include "w32sock.h"

View file

@ -36,6 +36,8 @@ int gl_sockets_cleanup (void);
#include <sys/socket.h>
#include "msvc-nothrow.h"
static inline SOCKET
gl_fd_to_handle (int fd)
{

View file

@ -16,10 +16,13 @@
/* written by Eric Blake */
/* If the user's config.h happens to include <sys/stat.h>, let it include only
the system's <sys/stat.h> here, so that orig_stat doesn't recurse to
rpl_stat. */
#define __need_system_sys_stat_h
#include <config.h>
/* Get the original definition of stat. It might be defined as a macro. */
#define __need_system_sys_stat_h
#include <sys/types.h>
#include <sys/stat.h>
#undef __need_system_sys_stat_h
@ -31,7 +34,10 @@ orig_stat (const char *filename, struct stat *buf)
}
/* Specification. */
#include <sys/stat.h>
/* Write "sys/stat.h" here, not <sys/stat.h>, otherwise OSF/1 5.1 DTK cc
eliminates this include because of the preliminary #include <sys/stat.h>
above. */
#include "sys/stat.h"
#include <errno.h>
#include <limits.h>
@ -40,6 +46,15 @@ orig_stat (const char *filename, struct stat *buf)
#include "dosname.h"
#include "verify.h"
#if REPLACE_FUNC_STAT_DIR
# include "pathmax.h"
/* The only known systems where REPLACE_FUNC_STAT_DIR is needed also
have a constant PATH_MAX. */
# ifndef PATH_MAX
# error "Please port this replacement to your platform"
# endif
#endif
/* Store information about NAME into ST. Work around bugs with
trailing slashes. Mingw has other bugs (such as st_ino always
being 0 on success) which this wrapper does not work around. But
@ -64,11 +79,6 @@ rpl_stat (char const *name, struct stat *st)
}
#endif /* REPLACE_FUNC_STAT_FILE */
#if REPLACE_FUNC_STAT_DIR
/* The only known systems where REPLACE_FUNC_STAT_DIR is needed also
have a constant PATH_MAX. */
# ifndef PATH_MAX
# error "Please port this replacement to your platform"
# endif
if (result == -1 && errno == ENOENT)
{

View file

@ -270,26 +270,36 @@ typedef unsigned long int gl_uintptr_t;
/* Note: These types are compiler dependent. It may be unwise to use them in
public header files. */
#undef intmax_t
#if @HAVE_LONG_LONG_INT@ && LONG_MAX >> 30 == 1
/* If the system defines INTMAX_MAX, assume that intmax_t works, and
similarly for UINTMAX_MAX and uintmax_t. This avoids problems with
assuming one type where another is used by the system. */
#ifndef INTMAX_MAX
# undef INTMAX_C
# undef intmax_t
# if @HAVE_LONG_LONG_INT@ && LONG_MAX >> 30 == 1
typedef long long int gl_intmax_t;
# define intmax_t gl_intmax_t
#elif defined GL_INT64_T
# elif defined GL_INT64_T
# define intmax_t int64_t
#else
# else
typedef long int gl_intmax_t;
# define intmax_t gl_intmax_t
# endif
#endif
#undef uintmax_t
#if @HAVE_UNSIGNED_LONG_LONG_INT@ && ULONG_MAX >> 31 == 1
#ifndef UINTMAX_MAX
# undef UINTMAX_C
# undef uintmax_t
# if @HAVE_UNSIGNED_LONG_LONG_INT@ && ULONG_MAX >> 31 == 1
typedef unsigned long long int gl_uintmax_t;
# define uintmax_t gl_uintmax_t
#elif defined GL_UINT64_T
# elif defined GL_UINT64_T
# define uintmax_t uint64_t
#else
# else
typedef unsigned long int gl_uintmax_t;
# define uintmax_t gl_uintmax_t
# endif
#endif
/* Verify that intmax_t and uintmax_t have the same size. Too much code
@ -431,21 +441,23 @@ typedef int _verify_intmax_size[sizeof (intmax_t) == sizeof (uintmax_t)
/* 7.18.2.5. Limits of greatest-width integer types */
#undef INTMAX_MIN
#undef INTMAX_MAX
#ifdef INT64_MAX
#ifndef INTMAX_MAX
# undef INTMAX_MIN
# ifdef INT64_MAX
# define INTMAX_MIN INT64_MIN
# define INTMAX_MAX INT64_MAX
#else
# else
# define INTMAX_MIN INT32_MIN
# define INTMAX_MAX INT32_MAX
# endif
#endif
#undef UINTMAX_MAX
#ifdef UINT64_MAX
#ifndef UINTMAX_MAX
# ifdef UINT64_MAX
# define UINTMAX_MAX UINT64_MAX
#else
# else
# define UINTMAX_MAX UINT32_MAX
# endif
#endif
/* 7.18.3. Limits of other integer types */
@ -568,22 +580,24 @@ typedef int _verify_intmax_size[sizeof (intmax_t) == sizeof (uintmax_t)
/* 7.18.4.2. Macros for greatest-width integer constants */
#undef INTMAX_C
#if @HAVE_LONG_LONG_INT@ && LONG_MAX >> 30 == 1
#ifndef INTMAX_C
# if @HAVE_LONG_LONG_INT@ && LONG_MAX >> 30 == 1
# define INTMAX_C(x) x##LL
#elif defined GL_INT64_T
# elif defined GL_INT64_T
# define INTMAX_C(x) INT64_C(x)
#else
# else
# define INTMAX_C(x) x##L
# endif
#endif
#undef UINTMAX_C
#if @HAVE_UNSIGNED_LONG_LONG_INT@ && ULONG_MAX >> 31 == 1
#ifndef UINTMAX_C
# if @HAVE_UNSIGNED_LONG_LONG_INT@ && ULONG_MAX >> 31 == 1
# define UINTMAX_C(x) x##ULL
#elif defined GL_UINT64_T
# elif defined GL_UINT64_T
# define UINTMAX_C(x) UINT64_C(x)
#else
# else
# define UINTMAX_C(x) x##UL
# endif
#endif
#endif /* !defined __cplusplus || defined __STDC_CONSTANT_MACROS */

View file

@ -1,110 +0,0 @@
/* Implementation details of FILE streams.
Copyright (C) 2007-2008, 2010-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 3 of the License, 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, see <http://www.gnu.org/licenses/>. */
/* Many stdio implementations have the same logic and therefore can share
the same implementation of stdio extension API, except that some fields
have different naming conventions, or their access requires some casts. */
/* BSD stdio derived implementations. */
#if defined __NetBSD__ /* NetBSD */
/* Get __NetBSD_Version__. */
# include <sys/param.h>
#endif
#if defined __sferror || defined __DragonFly__ /* FreeBSD, NetBSD, OpenBSD, DragonFly, MacOS X, Cygwin */
# if defined __DragonFly__ /* DragonFly */
/* See <http://www.dragonflybsd.org/cvsweb/src/lib/libc/stdio/priv_stdio.h?rev=HEAD&content-type=text/x-cvsweb-markup>. */
# define fp_ ((struct { struct __FILE_public pub; \
struct { unsigned char *_base; int _size; } _bf; \
void *cookie; \
void *_close; \
void *_read; \
void *_seek; \
void *_write; \
struct { unsigned char *_base; int _size; } _ub; \
int _ur; \
unsigned char _ubuf[3]; \
unsigned char _nbuf[1]; \
struct { unsigned char *_base; int _size; } _lb; \
int _blksize; \
fpos_t _offset; \
/* More fields, not relevant here. */ \
} *) fp)
/* See <http://www.dragonflybsd.org/cvsweb/src/include/stdio.h?rev=HEAD&content-type=text/x-cvsweb-markup>. */
# define _p pub._p
# define _flags pub._flags
# define _r pub._r
# define _w pub._w
# else
# define fp_ fp
# endif
# if (defined __NetBSD__ && __NetBSD_Version__ >= 105270000) || defined __OpenBSD__ /* NetBSD >= 1.5ZA, OpenBSD */
/* See <http://cvsweb.netbsd.org/bsdweb.cgi/src/lib/libc/stdio/fileext.h?rev=HEAD&content-type=text/x-cvsweb-markup>
and <http://www.openbsd.org/cgi-bin/cvsweb/src/lib/libc/stdio/fileext.h?rev=HEAD&content-type=text/x-cvsweb-markup> */
struct __sfileext
{
struct __sbuf _ub; /* ungetc buffer */
/* More fields, not relevant here. */
};
# define fp_ub ((struct __sfileext *) fp->_ext._base)->_ub
# else /* FreeBSD, NetBSD <= 1.5Z, DragonFly, MacOS X, Cygwin */
# define fp_ub fp_->_ub
# endif
# define HASUB(fp) (fp_ub._base != NULL)
#endif
/* SystemV derived implementations. */
#ifdef __TANDEM /* NonStop Kernel */
# ifndef _IOERR
/* These values were determined by the program 'stdioext-flags' at
<http://lists.gnu.org/archive/html/bug-gnulib/2010-12/msg00165.html>. */
# define _IOERR 0x40
# define _IOREAD 0x80
# define _IOWRT 0x4
# define _IORW 0x100
# endif
#endif
#if defined _IOERR
# if defined __sun && defined _LP64 /* Solaris/{SPARC,AMD64} 64-bit */
# define fp_ ((struct { unsigned char *_ptr; \
unsigned char *_base; \
unsigned char *_end; \
long _cnt; \
int _file; \
unsigned int _flag; \
} *) fp)
# else
# define fp_ fp
# endif
# if defined _SCO_DS /* OpenServer */
# define _cnt __cnt
# define _ptr __ptr
# define _base __base
# define _flag __flag
# endif
#endif

View file

@ -170,6 +170,26 @@ _GL_WARN_ON_USE (fclose, "fclose is not always POSIX compliant - "
"use gnulib module fclose for portable POSIX compliance");
#endif
#if @GNULIB_FDOPEN@
# if @REPLACE_FDOPEN@
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# undef fdopen
# define fdopen rpl_fdopen
# endif
_GL_FUNCDECL_RPL (fdopen, FILE *, (int fd, const char *mode)
_GL_ARG_NONNULL ((2)));
_GL_CXXALIAS_RPL (fdopen, FILE *, (int fd, const char *mode));
# else
_GL_CXXALIAS_SYS (fdopen, FILE *, (int fd, const char *mode));
# endif
_GL_CXXALIASWARN (fdopen);
#elif defined GNULIB_POSIXCHECK
# undef fdopen
/* Assume fdopen is always declared. */
_GL_WARN_ON_USE (fdopen, "fdopen on Win32 platforms is not POSIX compatible - "
"use gnulib module fdopen for portability");
#endif
#if @GNULIB_FFLUSH@
/* Flush all pending data on STREAM according to POSIX rules. Both
output and seekable input streams are supported.
@ -750,6 +770,20 @@ _GL_CXXALIAS_SYS (obstack_vprintf, int,
_GL_CXXALIASWARN (obstack_vprintf);
#endif
#if @GNULIB_PCLOSE@
# if !@HAVE_PCLOSE@
_GL_FUNCDECL_SYS (pclose, int, (FILE *stream) _GL_ARG_NONNULL ((1)));
# endif
_GL_CXXALIAS_SYS (pclose, int, (FILE *stream));
_GL_CXXALIASWARN (pclose);
#elif defined GNULIB_POSIXCHECK
# undef pclose
# if HAVE_RAW_DECL_PCLOSE
_GL_WARN_ON_USE (pclose, "popen is unportable - "
"use gnulib module pclose for more portability");
# endif
#endif
#if @GNULIB_PERROR@
/* Print a message to standard error, describing the value of ERRNO,
(if STRING is not NULL and not empty) prefixed with STRING and ": ",
@ -781,6 +815,10 @@ _GL_FUNCDECL_RPL (popen, FILE *, (const char *cmd, const char *mode)
_GL_ARG_NONNULL ((1, 2)));
_GL_CXXALIAS_RPL (popen, FILE *, (const char *cmd, const char *mode));
# else
# if !@HAVE_POPEN@
_GL_FUNCDECL_SYS (popen, FILE *, (const char *cmd, const char *mode)
_GL_ARG_NONNULL ((1, 2)));
# endif
_GL_CXXALIAS_SYS (popen, FILE *, (const char *cmd, const char *mode));
# endif
_GL_CXXALIASWARN (popen);

View file

@ -89,11 +89,7 @@ struct random_data
# include <unistd.h>
#endif
#if 3 <= __GNUC__ || __GNUC__ == 2 && 8 <= __GNUC_MINOR__
# define _GL_ATTRIBUTE_NORETURN __attribute__ ((__noreturn__))
#else
# define _GL_ATTRIBUTE_NORETURN
#endif
/* The definition of _Noreturn is copied here. */
/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
@ -120,7 +116,7 @@ struct random_data
/* Terminate the current process with the given return code, without running
the 'atexit' handlers. */
# if !@HAVE__EXIT@
_GL_FUNCDECL_SYS (_Exit, void, (int status) _GL_ATTRIBUTE_NORETURN);
_GL_FUNCDECL_SYS (_Exit, _Noreturn void, (int status));
# endif
_GL_CXXALIAS_SYS (_Exit, void, (int status));
_GL_CXXALIASWARN (_Exit);
@ -427,6 +423,22 @@ _GL_WARN_ON_USE (mkstemps, "mkstemps is unportable - "
# endif
#endif
#if @GNULIB_POSIX_OPENPT@
/* Return an FD open to the master side of a pseudo-terminal. Flags should
include O_RDWR, and may also include O_NOCTTY. */
# if !@HAVE_POSIX_OPENPT@
_GL_FUNCDECL_SYS (posix_openpt, int, (int flags));
# endif
_GL_CXXALIAS_SYS (posix_openpt, int, (int flags));
_GL_CXXALIASWARN (posix_openpt);
#elif defined GNULIB_POSIXCHECK
# undef posix_openpt
# if HAVE_RAW_DECL_POSIX_OPENPT
_GL_WARN_ON_USE (posix_openpt, "posix_openpt is not portable - "
"use gnulib module posix_openpt for portability");
# endif
#endif
#if @GNULIB_PTSNAME@
/* Return the pathname of the pseudo-terminal slave associated with
the master FD is open on, or NULL on errors. */

View file

@ -59,6 +59,36 @@
/* The definition of _GL_WARN_ON_USE is copied here. */
/* Find the index of the least-significant set bit. */
#if @GNULIB_FFSL@
# if !@HAVE_FFSL@
_GL_FUNCDECL_SYS (ffsl, int, (long int i));
# endif
_GL_CXXALIAS_SYS (ffsl, int, (long int i));
_GL_CXXALIASWARN (ffsl);
#elif defined GNULIB_POSIXCHECK
# undef ffsl
# if HAVE_RAW_DECL_FFSL
_GL_WARN_ON_USE (ffsl, "ffsl is not portable - use the ffsl module");
# endif
#endif
/* Find the index of the least-significant set bit. */
#if @GNULIB_FFSLL@
# if !@HAVE_FFSLL@
_GL_FUNCDECL_SYS (ffsll, int, (long long int i));
# endif
_GL_CXXALIAS_SYS (ffsll, int, (long long int i));
_GL_CXXALIASWARN (ffsll);
#elif defined GNULIB_POSIXCHECK
# undef ffsll
# if HAVE_RAW_DECL_FFSLL
_GL_WARN_ON_USE (ffsll, "ffsll is not portable - use the ffsll module");
# endif
#endif
/* Return the first instance of C within N bytes of S, or NULL. */
#if @GNULIB_MEMCHR@
# if @REPLACE_MEMCHR@

View file

@ -194,6 +194,8 @@ struct msghdr {
#endif
/* Fix some definitions from <winsock2.h>. */
#if @HAVE_WINSOCK2_H@
# if !GNULIB_defined_rpl_fd_isset
@ -222,9 +224,10 @@ rpl_fd_isset (SOCKET fd, fd_set * set)
#endif
/* Wrap everything else to use libc file descriptors for sockets. */
/* Hide some function declarations from <winsock2.h>. */
#if @HAVE_WINSOCK2_H@ && !defined _@GUARD_PREFIX@_UNISTD_H
#if @HAVE_WINSOCK2_H@
# if !defined _@GUARD_PREFIX@_UNISTD_H
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# undef close
# define close close_used_without_including_unistd_h
@ -232,9 +235,6 @@ rpl_fd_isset (SOCKET fd, fd_set * set)
_GL_WARN_ON_USE (close,
"close() used without including <unistd.h>");
# endif
#endif
#if @HAVE_WINSOCK2_H@ && !defined _@GUARD_PREFIX@_UNISTD_H
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# undef gethostname
# define gethostname gethostname_used_without_including_unistd_h
@ -242,8 +242,20 @@ rpl_fd_isset (SOCKET fd, fd_set * set)
_GL_WARN_ON_USE (gethostname,
"gethostname() used without including <unistd.h>");
# endif
# endif
# if !defined _@GUARD_PREFIX@_SYS_SELECT_H
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# undef select
# define select select_used_without_including_sys_select_h
# else
_GL_WARN_ON_USE (select,
"select() used without including <sys/select.h>");
# endif
# endif
#endif
/* Wrap everything else to use libc file descriptors for sockets. */
#if @GNULIB_SOCKET@
# if @HAVE_WINSOCK2_H@
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
@ -633,16 +645,6 @@ _GL_WARN_ON_USE (shutdown, "shutdown is not always POSIX compliant - "
# endif
#endif
#if @HAVE_WINSOCK2_H@
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# undef select
# define select select_used_without_including_sys_select_h
# else
_GL_WARN_ON_USE (select,
"select() used without including <sys/select.h>");
# endif
#endif
#if @GNULIB_ACCEPT4@
/* Accept a connection on a socket, with specific opening flags.
The flags are a bitmask, possibly including O_CLOEXEC (defined in <fcntl.h>)

View file

@ -55,10 +55,17 @@
/* The definition of _GL_WARN_ON_USE is copied here. */
/* Before doing "#define mkdir rpl_mkdir" below, we need to include all
headers that may declare mkdir(). */
headers that may declare mkdir(). Native Windows platforms declare mkdir
in <io.h> and/or <direct.h>, not in <unistd.h>. */
#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
# include <io.h> /* mingw32, mingw64 */
# include <direct.h> /* mingw64 */
# include <direct.h> /* mingw64, MSVC 9 */
#endif
#ifndef S_IFIFO
# ifdef _S_IFIFO
# define S_IFIFO _S_IFIFO
# endif
#endif
#ifndef S_IFMT
@ -312,16 +319,25 @@ _GL_WARN_ON_USE (fchmodat, "fchmodat is not portable - "
#endif
#if @REPLACE_FSTAT@
#if @GNULIB_FSTAT@
# if @REPLACE_FSTAT@
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# undef fstat
# define fstat rpl_fstat
# endif
_GL_FUNCDECL_RPL (fstat, int, (int fd, struct stat *buf) _GL_ARG_NONNULL ((2)));
_GL_CXXALIAS_RPL (fstat, int, (int fd, struct stat *buf));
#else
# else
_GL_CXXALIAS_SYS (fstat, int, (int fd, struct stat *buf));
#endif
# endif
_GL_CXXALIASWARN (fstat);
#elif defined GNULIB_POSIXCHECK
# undef fstat
# if HAVE_RAW_DECL_FSTAT
_GL_WARN_ON_USE (fstat, "fstat has portability problems - "
"use gnulib module fstat for portability");
# endif
#endif
#if @GNULIB_FSTATAT@

View file

@ -40,6 +40,14 @@
# include <time.h>
# endif
/* On native Windows with MSVC:
Get the 'struct timeval' type. */
# if defined _MSC_VER && @HAVE_WINSOCK2_H@ && !defined _GL_INCLUDING_WINSOCK2_H
# define _GL_INCLUDING_WINSOCK2_H
# include <winsock2.h>
# undef _GL_INCLUDING_WINSOCK2_H
# endif
/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
/* The definition of _GL_ARG_NONNULL is copied here. */
@ -98,4 +106,95 @@ _GL_WARN_ON_USE (gettimeofday, "gettimeofday is unportable - "
# endif
# endif
/* Hide some function declarations from <winsock2.h>. */
# if defined _MSC_VER && @HAVE_WINSOCK2_H@
# if !defined _@GUARD_PREFIX@_UNISTD_H
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# undef close
# define close close_used_without_including_unistd_h
# else
_GL_WARN_ON_USE (close,
"close() used without including <unistd.h>");
# endif
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# undef gethostname
# define gethostname gethostname_used_without_including_unistd_h
# else
_GL_WARN_ON_USE (gethostname,
"gethostname() used without including <unistd.h>");
# endif
# endif
# if !defined _@GUARD_PREFIX@_SYS_SOCKET_H
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# undef socket
# define socket socket_used_without_including_sys_socket_h
# undef connect
# define connect connect_used_without_including_sys_socket_h
# undef accept
# define accept accept_used_without_including_sys_socket_h
# undef bind
# define bind bind_used_without_including_sys_socket_h
# undef getpeername
# define getpeername getpeername_used_without_including_sys_socket_h
# undef getsockname
# define getsockname getsockname_used_without_including_sys_socket_h
# undef getsockopt
# define getsockopt getsockopt_used_without_including_sys_socket_h
# undef listen
# define listen listen_used_without_including_sys_socket_h
# undef recv
# define recv recv_used_without_including_sys_socket_h
# undef send
# define send send_used_without_including_sys_socket_h
# undef recvfrom
# define recvfrom recvfrom_used_without_including_sys_socket_h
# undef sendto
# define sendto sendto_used_without_including_sys_socket_h
# undef setsockopt
# define setsockopt setsockopt_used_without_including_sys_socket_h
# undef shutdown
# define shutdown shutdown_used_without_including_sys_socket_h
# else
_GL_WARN_ON_USE (socket,
"socket() used without including <sys/socket.h>");
_GL_WARN_ON_USE (connect,
"connect() used without including <sys/socket.h>");
_GL_WARN_ON_USE (accept,
"accept() used without including <sys/socket.h>");
_GL_WARN_ON_USE (bind,
"bind() used without including <sys/socket.h>");
_GL_WARN_ON_USE (getpeername,
"getpeername() used without including <sys/socket.h>");
_GL_WARN_ON_USE (getsockname,
"getsockname() used without including <sys/socket.h>");
_GL_WARN_ON_USE (getsockopt,
"getsockopt() used without including <sys/socket.h>");
_GL_WARN_ON_USE (listen,
"listen() used without including <sys/socket.h>");
_GL_WARN_ON_USE (recv,
"recv() used without including <sys/socket.h>");
_GL_WARN_ON_USE (send,
"send() used without including <sys/socket.h>");
_GL_WARN_ON_USE (recvfrom,
"recvfrom() used without including <sys/socket.h>");
_GL_WARN_ON_USE (sendto,
"sendto() used without including <sys/socket.h>");
_GL_WARN_ON_USE (setsockopt,
"setsockopt() used without including <sys/socket.h>");
_GL_WARN_ON_USE (shutdown,
"shutdown() used without including <sys/socket.h>");
# endif
# endif
# if !defined _@GUARD_PREFIX@_SYS_SELECT_H
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# undef select
# define select select_used_without_including_sys_select_h
# else
_GL_WARN_ON_USE (select,
"select() used without including <sys/select.h>");
# endif
# endif
# endif
#endif /* _@GUARD_PREFIX@_SYS_TIME_H */

40
lib/sys_types.in.h Normal file
View file

@ -0,0 +1,40 @@
/* Provide a more complete sys/types.h.
Copyright (C) 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. */
#if __GNUC__ >= 3
@PRAGMA_SYSTEM_HEADER@
#endif
@PRAGMA_COLUMNS@
#ifndef _@GUARD_PREFIX@_SYS_TYPES_H
/* The include_next requires a split double-inclusion guard. */
#@INCLUDE_NEXT@ @NEXT_SYS_TYPES_H@
#ifndef _@GUARD_PREFIX@_SYS_TYPES_H
#define _@GUARD_PREFIX@_SYS_TYPES_H
/* MSVC 9 defines size_t in <stddef.h>, not in <sys/types.h>. */
/* But avoid namespace pollution on glibc systems. */
#if ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__) \
&& ! defined __GLIBC__
# include <stddef.h>
#endif
#endif /* _@GUARD_PREFIX@_SYS_TYPES_H */
#endif /* _@GUARD_PREFIX@_SYS_TYPES_H */

View file

@ -37,7 +37,7 @@
#if !@HAVE_SYS_UIO_H@
/* A platform that lacks <sys/uio.h>. */
/* Get 'ssize_t'. */
/* Get 'size_t' and 'ssize_t'. */
# include <sys/types.h>
# ifdef __cplusplus

View file

@ -16,7 +16,9 @@
/* Written by Bruno Haible <bruno@clisp.org>, 2007. */
#include <config.h>
#if ! defined USE_LONG_DOUBLE
# include <config.h>
#endif
/* Specification. */
#include <math.h>

View file

@ -75,17 +75,21 @@
#endif
/* mingw fails to declare _exit in <unistd.h>. */
/* mingw, BeOS, Haiku declare environ in <stdlib.h>, not in <unistd.h>. */
/* mingw, MSVC, BeOS, Haiku declare environ in <stdlib.h>, not in
<unistd.h>. */
/* Solaris declares getcwd not only in <unistd.h> but also in <stdlib.h>. */
/* But avoid namespace pollution on glibc systems. */
#ifndef __GLIBC__
# include <stdlib.h>
#endif
/* mingw declares getcwd in <io.h>, not in <unistd.h>. */
#if ((@GNULIB_GETCWD@ || defined GNULIB_POSIXCHECK) \
/* Native Windows platforms declare chdir, getcwd, rmdir in
<io.h> and/or <direct.h>, not in <unistd.h>. */
#if ((@GNULIB_CHDIR@ || @GNULIB_GETCWD@ || @GNULIB_RMDIR@ \
|| defined GNULIB_POSIXCHECK) \
&& ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__))
# include <io.h>
# include <io.h> /* mingw32, mingw64 */
# include <direct.h> /* mingw64, MSVC 9 */
#endif
/* AIX and OSF/1 5.1 declare getdomainname in <netdb.h>, not in <unistd.h>.
@ -97,6 +101,12 @@
# include <netdb.h>
#endif
/* MSVC defines off_t in <sys/types.h>. */
#if !@HAVE_UNISTD_H@
/* Get off_t. */
# include <sys/types.h>
#endif
#if (@GNULIB_READ@ || @GNULIB_WRITE@ \
|| @GNULIB_READLINK@ || @GNULIB_READLINKAT@ \
|| @GNULIB_PREAD@ || @GNULIB_PWRITE@ || defined GNULIB_POSIXCHECK)
@ -117,9 +127,9 @@
/* The definition of _GL_WARN_ON_USE is copied here. */
#if @GNULIB_GETHOSTNAME@
/* Get all possible declarations of gethostname(). */
# if @UNISTD_H_HAVE_WINSOCK2_H@
/* Hide some function declarations from <winsock2.h>. */
#if @GNULIB_GETHOSTNAME@ && @UNISTD_H_HAVE_WINSOCK2_H@
# if !defined _@GUARD_PREFIX@_SYS_SOCKET_H
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# undef socket
@ -190,7 +200,6 @@
"select() used without including <sys/select.h>");
# endif
# endif
# endif
#endif
@ -224,12 +233,24 @@ _GL_WARN_ON_USE (access, "the access function is a security risk - "
#endif
#if @GNULIB_CHDIR@
_GL_CXXALIAS_SYS (chdir, int, (const char *file) _GL_ARG_NONNULL ((1)));
_GL_CXXALIASWARN (chdir);
#elif defined GNULIB_POSIXCHECK
# undef chdir
# if HAVE_RAW_DECL_CHDIR
_GL_WARN_ON_USE (chown, "chdir is not always in <unistd.h> - "
"use gnulib module chdir for portability");
# endif
#endif
#if @GNULIB_CHOWN@
/* Change the owner of FILE to UID (if UID is not -1) and the group of FILE
to GID (if GID is not -1). Follow symbolic links.
Return 0 if successful, otherwise -1 and errno set.
See the POSIX:2001 specification
<http://www.opengroup.org/susv3xsh/chown.html>. */
See the POSIX:2008 specification
<http://pubs.opengroup.org/onlinepubs/9699919799/functions/chown.html. */
# if @REPLACE_CHOWN@
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# undef chown
@ -280,24 +301,32 @@ _GL_WARN_ON_USE (close, "close does not portably work on sockets - "
#endif
#if @REPLACE_DUP@
#if @GNULIB_DUP@
# if @REPLACE_DUP@
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# define dup rpl_dup
# endif
_GL_FUNCDECL_RPL (dup, int, (int oldfd));
_GL_CXXALIAS_RPL (dup, int, (int oldfd));
#else
# else
_GL_CXXALIAS_SYS (dup, int, (int oldfd));
#endif
# endif
_GL_CXXALIASWARN (dup);
#elif defined GNULIB_POSIXCHECK
# undef dup
# if HAVE_RAW_DECL_DUP
_GL_WARN_ON_USE (dup, "dup is unportable - "
"use gnulib module dup for portability");
# endif
#endif
#if @GNULIB_DUP2@
/* Copy the file descriptor OLDFD into file descriptor NEWFD. Do nothing if
NEWFD = OLDFD, otherwise close NEWFD first if it is open.
Return newfd if successful, otherwise -1 and errno set.
See the POSIX:2001 specification
<http://www.opengroup.org/susv3xsh/dup2.html>. */
See the POSIX:2008 specification
<http://pubs.opengroup.org/onlinepubs/9699919799/functions/dup2.html>. */
# if @REPLACE_DUP2@
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# define dup2 rpl_dup2
@ -426,8 +455,8 @@ _GL_WARN_ON_USE (faccessat, "faccessat is not portable - "
/* Change the process' current working directory to the directory on which
the given file descriptor is open.
Return 0 if successful, otherwise -1 and errno set.
See the POSIX:2001 specification
<http://www.opengroup.org/susv3xsh/fchdir.html>. */
See the POSIX:2008 specification
<http://pubs.opengroup.org/onlinepubs/9699919799/functions/fchdir.html>. */
# if ! @HAVE_FCHDIR@
_GL_FUNCDECL_SYS (fchdir, int, (int /*fd*/));
@ -484,11 +513,30 @@ _GL_WARN_ON_USE (fchownat, "fchownat is not portable - "
#endif
#if @GNULIB_FSYNC@
#if @GNULIB_FDATASYNC@
/* Synchronize changes to a file.
Return 0 if successful, otherwise -1 and errno set.
See POSIX:2001 specification
<http://www.opengroup.org/susv3xsh/fsync.html>. */
See POSIX:2008 specification
<http://pubs.opengroup.org/onlinepubs/9699919799/functions/fdatasync.html>. */
# if !@HAVE_FDATASYNC@ || !@HAVE_DECL_FDATASYNC@
_GL_FUNCDECL_SYS (fdatasync, int, (int fd));
# endif
_GL_CXXALIAS_SYS (fdatasync, int, (int fd));
_GL_CXXALIASWARN (fdatasync);
#elif defined GNULIB_POSIXCHECK
# undef fdatasync
# if HAVE_RAW_DECL_FDATASYNC
_GL_WARN_ON_USE (fdatasync, "fdatasync is unportable - "
"use gnulib module fdatasync for portability");
# endif
#endif
#if @GNULIB_FSYNC@
/* Synchronize changes, including metadata, to a file.
Return 0 if successful, otherwise -1 and errno set.
See POSIX:2008 specification
<http://pubs.opengroup.org/onlinepubs/9699919799/functions/fsync.html>. */
# if !@HAVE_FSYNC@
_GL_FUNCDECL_SYS (fsync, int, (int fd));
# endif
@ -506,8 +554,8 @@ _GL_WARN_ON_USE (fsync, "fsync is unportable - "
#if @GNULIB_FTRUNCATE@
/* Change the size of the file to which FD is opened to become equal to LENGTH.
Return 0 if successful, otherwise -1 and errno set.
See the POSIX:2001 specification
<http://www.opengroup.org/susv3xsh/ftruncate.html>. */
See the POSIX:2008 specification
<http://pubs.opengroup.org/onlinepubs/9699919799/functions/ftruncate.html>. */
# if !@HAVE_FTRUNCATE@
_GL_FUNCDECL_SYS (ftruncate, int, (int fd, off_t length));
# endif
@ -527,8 +575,8 @@ _GL_WARN_ON_USE (ftruncate, "ftruncate is unportable - "
of BUF.
Return BUF if successful, or NULL if the directory couldn't be determined
or SIZE was too small.
See the POSIX:2001 specification
<http://www.opengroup.org/susv3xsh/getcwd.html>.
See the POSIX:2008 specification
<http://pubs.opengroup.org/onlinepubs/9699919799/functions/getcwd.html>.
Additionally, the gnulib module 'getcwd' guarantees the following GNU
extension: If BUF is NULL, an array is allocated with 'malloc'; the array
is SIZE bytes long, unless SIZE == 0, in which case it is as big as
@ -891,8 +939,8 @@ _GL_WARN_ON_USE (group_member, "group_member is unportable - "
/* Change the owner of FILE to UID (if UID is not -1) and the group of FILE
to GID (if GID is not -1). Do not follow symbolic links.
Return 0 if successful, otherwise -1 and errno set.
See the POSIX:2001 specification
<http://www.opengroup.org/susv3xsh/lchown.html>. */
See the POSIX:2008 specification
<http://pubs.opengroup.org/onlinepubs/9699919799/functions/lchown.html>. */
# if @REPLACE_LCHOWN@
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# undef lchown
@ -921,8 +969,8 @@ _GL_WARN_ON_USE (lchown, "lchown is unportable to pre-POSIX.1-2001 systems - "
#if @GNULIB_LINK@
/* Create a new hard link for an existing file.
Return 0 if successful, otherwise -1 and errno set.
See POSIX:2001 specification
<http://www.opengroup.org/susv3xsh/link.html>. */
See POSIX:2008 specification
<http://pubs.opengroup.org/onlinepubs/9699919799/functions/link.html>. */
# if @REPLACE_LINK@
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# define link rpl_link
@ -987,8 +1035,8 @@ _GL_WARN_ON_USE (linkat, "linkat is unportable - "
#if @GNULIB_LSEEK@
/* Set the offset of FD relative to SEEK_SET, SEEK_CUR, or SEEK_END.
Return the new offset if successful, otherwise -1 and errno set.
See the POSIX:2001 specification
<http://www.opengroup.org/susv3xsh/lseek.html>. */
See the POSIX:2008 specification
<http://pubs.opengroup.org/onlinepubs/9699919799/functions/lseek.html>. */
# if @REPLACE_LSEEK@
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# define lseek rpl_lseek
@ -1058,8 +1106,9 @@ _GL_WARN_ON_USE (pipe2, "pipe2 is unportable - "
#if @GNULIB_PREAD@
/* Read at most BUFSIZE bytes from FD into BUF, starting at OFFSET.
Return the number of bytes placed into BUF if successful, otherwise
set errno and return -1. 0 indicates EOF. See the POSIX:2001
specification <http://www.opengroup.org/susv3xsh/pread.html>. */
set errno and return -1. 0 indicates EOF.
See the POSIX:2008 specification
<http://pubs.opengroup.org/onlinepubs/9699919799/functions/pread.html>. */
# if @REPLACE_PREAD@
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# undef pread
@ -1093,8 +1142,8 @@ _GL_WARN_ON_USE (pread, "pread is unportable - "
/* Write at most BUFSIZE bytes from BUF into FD, starting at OFFSET.
Return the number of bytes written if successful, otherwise
set errno and return -1. 0 indicates nothing written. See the
POSIX:2001 specification
<http://www.opengroup.org/susv3xsh/pwrite.html>. */
POSIX:2008 specification
<http://pubs.opengroup.org/onlinepubs/9699919799/functions/pwrite.html>. */
# if @REPLACE_PWRITE@
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# undef pwrite
@ -1126,9 +1175,9 @@ _GL_WARN_ON_USE (pwrite, "pwrite is unportable - "
#if @GNULIB_READ@
/* Read up to COUNT bytes from file descriptor FD into the buffer starting
at BUF. See the POSIX:2001 specification
<http://www.opengroup.org/susv3xsh/read.html>. */
# if @REPLACE_READ@ && @GNULIB_UNISTD_H_NONBLOCKING@
at BUF. See the POSIX:2008 specification
<http://pubs.opengroup.org/onlinepubs/9699919799/functions/read.html>. */
# if @REPLACE_READ@
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# undef read
# define read rpl_read
@ -1150,8 +1199,8 @@ _GL_CXXALIASWARN (read);
/* Read the contents of the symbolic link FILE and place the first BUFSIZE
bytes of it into BUF. Return the number of bytes placed into BUF if
successful, otherwise -1 and errno set.
See the POSIX:2001 specification
<http://www.opengroup.org/susv3xsh/readlink.html>. */
See the POSIX:2008 specification
<http://pubs.opengroup.org/onlinepubs/9699919799/functions/readlink.html>. */
# if @REPLACE_READLINK@
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# define readlink rpl_readlink
@ -1222,8 +1271,8 @@ _GL_WARN_ON_USE (rmdir, "rmdir is unportable - "
#if @GNULIB_SLEEP@
/* Pause the execution of the current thread for N seconds.
Returns the number of seconds left to sleep.
See the POSIX:2001 specification
<http://www.opengroup.org/susv3xsh/sleep.html>. */
See the POSIX:2008 specification
<http://pubs.opengroup.org/onlinepubs/9699919799/functions/sleep.html>. */
# if @REPLACE_SLEEP@
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# undef sleep
@ -1372,7 +1421,7 @@ _GL_WARN_ON_USE (unlinkat, "unlinkat is not portable - "
/* Pause the execution of the current thread for N microseconds.
Returns 0 on completion, or -1 on range error.
See the POSIX:2001 specification
<http://www.opengroup.org/susv3xsh/sleep.html>. */
<http://www.opengroup.org/susv3xsh/usleep.html>. */
# if @REPLACE_USLEEP@
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# undef usleep
@ -1398,9 +1447,9 @@ _GL_WARN_ON_USE (usleep, "usleep is unportable - "
#if @GNULIB_WRITE@
/* Write up to COUNT bytes starting at BUF to file descriptor FD.
See the POSIX:2001 specification
<http://www.opengroup.org/susv3xsh/write.html>. */
# if @REPLACE_WRITE@ && (@GNULIB_UNISTD_H_NONBLOCKING@ || @GNULIB_UNISTD_H_SIGPIPE@)
See the POSIX:2008 specification
<http://pubs.opengroup.org/onlinepubs/9699919799/functions/write.html>. */
# if @REPLACE_WRITE@
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# undef write
# define write rpl_write

View file

@ -553,6 +553,33 @@ divide (mpn_t a, mpn_t b, mpn_t *q)
size_t s;
{
mp_limb_t msd = b_ptr[b_len - 1]; /* = b[n-1], > 0 */
/* Determine s = GMP_LIMB_BITS - integer_length (msd).
Code copied from gnulib's integer_length.c. */
# if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
s = __builtin_clz (msd);
# else
# if defined DBL_EXPBIT0_WORD && defined DBL_EXPBIT0_BIT
if (GMP_LIMB_BITS <= DBL_MANT_BIT)
{
/* Use 'double' operations.
Assumes an IEEE 754 'double' implementation. */
# define DBL_EXP_MASK ((DBL_MAX_EXP - DBL_MIN_EXP) | 7)
# define DBL_EXP_BIAS (DBL_EXP_MASK / 2 - 1)
# define NWORDS \
((sizeof (double) + sizeof (unsigned int) - 1) / sizeof (unsigned int))
union { double value; unsigned int word[NWORDS]; } m;
/* Use a single integer to floating-point conversion. */
m.value = msd;
s = GMP_LIMB_BITS
- (((m.word[DBL_EXPBIT0_WORD] >> DBL_EXPBIT0_BIT) & DBL_EXP_MASK)
- DBL_EXP_BIAS);
}
else
# undef NWORDS
# endif
{
s = 31;
if (msd >= 0x10000)
{
@ -580,6 +607,8 @@ divide (mpn_t a, mpn_t b, mpn_t *q)
s -= 1;
}
}
# endif
}
/* 0 <= s < GMP_LIMB_BITS.
Copy b, shifting it left by s bits. */
if (s > 0)
@ -885,9 +914,9 @@ decode_long_double (long double x, int *ep, mpn_t *mp)
y = frexpl (x, &exp);
if (!(y >= 0.0L && y < 1.0L))
abort ();
/* x = 2^exp * y = 2^(exp - LDBL_MANT_BIT) * (y * LDBL_MANT_BIT), and the
/* x = 2^exp * y = 2^(exp - LDBL_MANT_BIT) * (y * 2^LDBL_MANT_BIT), and the
latter is an integer. */
/* Convert the mantissa (y * LDBL_MANT_BIT) to a sequence of limbs.
/* Convert the mantissa (y * 2^LDBL_MANT_BIT) to a sequence of limbs.
I'm not sure whether it's safe to cast a 'long double' value between
2^31 and 2^32 to 'unsigned int', therefore play safe and cast only
'long double' values between 0 and 2^16 (to 'unsigned int' or 'int',
@ -973,9 +1002,9 @@ decode_double (double x, int *ep, mpn_t *mp)
y = frexp (x, &exp);
if (!(y >= 0.0 && y < 1.0))
abort ();
/* x = 2^exp * y = 2^(exp - DBL_MANT_BIT) * (y * DBL_MANT_BIT), and the
/* x = 2^exp * y = 2^(exp - DBL_MANT_BIT) * (y * 2^DBL_MANT_BIT), and the
latter is an integer. */
/* Convert the mantissa (y * DBL_MANT_BIT) to a sequence of limbs.
/* Convert the mantissa (y * 2^DBL_MANT_BIT) to a sequence of limbs.
I'm not sure whether it's safe to cast a 'double' value between
2^31 and 2^32 to 'unsigned int', therefore play safe and cast only
'double' values between 0 and 2^16 (to 'unsigned int' or 'int',

View file

@ -22,9 +22,12 @@
/* Get O_RDWR and O_BINARY. */
#include <fcntl.h>
/* Get _get_osfhandle() and _open_osfhandle(). */
/* Get _open_osfhandle(). */
#include <io.h>
/* Get _get_osfhandle(). */
#include "msvc-nothrow.h"
#define FD_TO_SOCKET(fd) ((SOCKET) _get_osfhandle ((fd)))
#define SOCKET_TO_FD(fh) (_open_osfhandle ((long) (fh), O_RDWR | O_BINARY))

View file

@ -98,6 +98,18 @@
# define WEOF -1
# endif
#else
/* MSVC defines wint_t as 'unsigned short' in <crtdefs.h>.
This is too small: ISO C 99 section 7.24.1.(2) says that wint_t must be
"unchanged by default argument promotions". Override it. */
# if defined _MSC_VER
# if !GNULIB_defined_wint_t
# include <crtdefs.h>
typedef unsigned int rpl_wint_t;
# undef wint_t
# define wint_t rpl_wint_t
# define GNULIB_defined_wint_t 1
# endif
# endif
# ifndef WEOF
# define WEOF ((wint_t) -1)
# endif

View file

@ -20,16 +20,12 @@
/* Specification. */
#include <unistd.h>
/* Replace this function only if module 'nonblocking' or module 'sigpipe' is
requested. */
#if GNULIB_NONBLOCKING || GNULIB_SIGPIPE
/* On native Windows platforms, SIGPIPE does not exist. When write() is
called on a pipe with no readers, WriteFile() fails with error
GetLastError() = ERROR_NO_DATA, and write() in consequence fails with
error EINVAL. */
# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
# include <errno.h>
# include <signal.h>
@ -38,13 +34,40 @@
# define WIN32_LEAN_AND_MEAN /* avoid including junk */
# include <windows.h>
# include "msvc-inval.h"
# include "msvc-nothrow.h"
# undef write
# if HAVE_MSVC_INVALID_PARAMETER_HANDLER
static inline ssize_t
write_nothrow (int fd, const void *buf, size_t count)
{
ssize_t result;
TRY_MSVC_INVAL
{
result = write (fd, buf, count);
}
CATCH_MSVC_INVAL
{
result = -1;
errno = EBADF;
}
DONE_MSVC_INVAL;
return result;
}
# else
# define write_nothrow write
# endif
ssize_t
rpl_write (int fd, const void *buf, size_t count)
#undef write
{
for (;;)
{
ssize_t ret = write (fd, buf, count);
ssize_t ret = write_nothrow (fd, buf, count);
if (ret < 0)
{
@ -119,5 +142,4 @@ rpl_write (int fd, const void *buf, size_t count)
}
}
# endif
#endif

View file

@ -49,7 +49,9 @@
#ifdef HAVE_STRUCT_STAT_ST_BLKSIZE
#include <sys/stat.h>
#endif
#ifdef HAVE_POLL_H
#include <poll.h>
#endif
#include <errno.h>
#include <sys/types.h>
@ -580,8 +582,21 @@ scm_fdes_to_port (int fdes, char *mode, SCM name)
static int
fport_input_waiting (SCM port)
{
#ifdef HAVE_SELECT
int fdes = SCM_FSTREAM (port)->fdes;
/* `FD_SETSIZE', which is 1024 on GNU systems, effectively limits the
highest numerical value of file descriptors that can be monitored.
Thus, use poll(2) whenever that is possible. */
#ifdef HAVE_POLL
struct pollfd pollfd = { fdes, POLLIN, 0 };
if (poll (&pollfd, 1, 0) < 0)
scm_syserror ("fport_input_waiting");
return pollfd.revents & POLLIN ? 1 : 0;
#elif defined(HAVE_SELECT)
struct timeval timeout;
SELECT_TYPE read_set;
SELECT_TYPE write_set;

View file

@ -59,28 +59,43 @@
`sizeof (SCM *) == sizeof (SCM)', since pointers (the `link' parts) are
assumed to be as long as SCM objects. */
/* This structure maps to the contents of a VM stack frame. It can
alias a frame directly. */
struct scm_vm_frame
{
SCM *dynamic_link;
scm_t_uint8 *mv_return_address;
scm_t_uint8 *return_address;
SCM program;
SCM stack[1]; /* Variable-length */
};
#define SCM_FRAME_STRUCT(fp) ((struct scm_vm_frame*)(((SCM*)(fp)) - 4))
#define SCM_FRAME_DATA_ADDRESS(fp) (fp - 4)
#define SCM_FRAME_STACK_ADDRESS(fp) (fp)
#define SCM_FRAME_UPPER_ADDRESS(fp) (fp - 2)
#define SCM_FRAME_LOWER_ADDRESS(fp) (fp - 4)
#define SCM_FRAME_STACK_ADDRESS(fp) (SCM_FRAME_STRUCT (fp)->stack)
#define SCM_FRAME_UPPER_ADDRESS(fp) ((SCM*)&SCM_FRAME_STRUCT (fp)->return_address)
#define SCM_FRAME_LOWER_ADDRESS(fp) ((SCM*)SCM_FRAME_STRUCT (fp))
#define SCM_FRAME_BYTE_CAST(x) ((scm_t_uint8 *) SCM_UNPACK (x))
#define SCM_FRAME_STACK_CAST(x) ((SCM *) SCM_UNPACK (x))
#define SCM_FRAME_RETURN_ADDRESS(fp) \
(SCM_FRAME_BYTE_CAST (SCM_FRAME_DATA_ADDRESS (fp)[2]))
(SCM_FRAME_STRUCT (fp)->return_address)
#define SCM_FRAME_SET_RETURN_ADDRESS(fp, ra) \
((SCM_FRAME_DATA_ADDRESS (fp)[2])) = SCM_PACK (ra)
SCM_FRAME_STRUCT (fp)->return_address = (ra)
#define SCM_FRAME_MV_RETURN_ADDRESS(fp) \
(SCM_FRAME_BYTE_CAST (SCM_FRAME_DATA_ADDRESS (fp)[1]))
(SCM_FRAME_STRUCT (fp)->mv_return_address)
#define SCM_FRAME_SET_MV_RETURN_ADDRESS(fp, mvra) \
((SCM_FRAME_DATA_ADDRESS (fp)[1])) = SCM_PACK (mvra)
SCM_FRAME_STRUCT (fp)->mv_return_address = (mvra)
#define SCM_FRAME_DYNAMIC_LINK(fp) \
(SCM_FRAME_STACK_CAST (SCM_FRAME_DATA_ADDRESS (fp)[0]))
(SCM_FRAME_STRUCT (fp)->dynamic_link)
#define SCM_FRAME_SET_DYNAMIC_LINK(fp, dl) \
((SCM_FRAME_DATA_ADDRESS (fp)[0])) = SCM_PACK (dl)
#define SCM_FRAME_VARIABLE(fp,i) SCM_FRAME_STACK_ADDRESS (fp)[i]
#define SCM_FRAME_PROGRAM(fp) SCM_FRAME_STACK_ADDRESS (fp)[-1]
SCM_FRAME_STRUCT (fp)->dynamic_link = (dl)
#define SCM_FRAME_VARIABLE(fp,i) \
(SCM_FRAME_STRUCT (fp)->stack[i])
#define SCM_FRAME_PROGRAM(fp) \
(SCM_FRAME_STRUCT (fp)->program)
/*

View file

@ -1,4 +1,5 @@
/* Copyright (C) 1995,1996,1997,1998,1999,2000,2001, 2002, 2003, 2004, 2006, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
/* Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
* 2004, 2006, 2008, 2009, 2010, 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
@ -153,7 +154,7 @@ scm_gc_register_collectable_memory (void *mem, size_t size, const char *what)
/* Nothing to do. */
#ifdef GUILE_DEBUG_MALLOC
if (mem)
scm_malloc_register (mem);
scm_malloc_register (mem, what);
#endif
}

View file

@ -360,7 +360,7 @@ map (SCM (*proc) (SCM), SCM ls)
SCM res = scm_cons (proc (SCM_CAR (ls)), SCM_EOL);
SCM h = res;
ls = SCM_CDR (ls);
while (!scm_is_null (ls))
while (scm_is_pair (ls))
{
SCM_SETCDR (h, scm_cons (proc (SCM_CAR (ls)), SCM_EOL));
h = SCM_CDR (h);
@ -374,7 +374,7 @@ static SCM
filter_cpl (SCM ls)
{
SCM res = SCM_EOL;
while (!scm_is_null (ls))
while (scm_is_pair (ls))
{
SCM el = SCM_CAR (ls);
if (scm_is_false (scm_c_memq (el, res)))
@ -409,7 +409,7 @@ remove_duplicate_slots (SCM l, SCM res, SCM slots_already_seen)
{
SCM tmp;
if (scm_is_null (l))
if (!scm_is_pair (l))
return res;
tmp = SCM_CAAR (l);
@ -424,15 +424,63 @@ remove_duplicate_slots (SCM l, SCM res, SCM slots_already_seen)
return remove_duplicate_slots (SCM_CDR (l), res, slots_already_seen);
}
static void
check_cpl (SCM slots, SCM bslots)
{
for (; scm_is_pair (bslots); bslots = SCM_CDR (bslots))
if (scm_is_true (scm_assq (SCM_CAAR (bslots), slots)))
scm_misc_error ("init-object", "a predefined <class> inherited "
"field cannot be redefined", SCM_EOL);
}
static SCM
build_class_class_slots (void);
static SCM
build_slots_list (SCM dslots, SCM cpl)
{
register SCM res = dslots;
SCM bslots, class_slots;
int classp;
SCM res = dslots;
for (cpl = SCM_CDR (cpl); !scm_is_null (cpl); cpl = SCM_CDR (cpl))
res = scm_append (scm_list_2 (SCM_SLOT (SCM_CAR (cpl),
scm_si_direct_slots),
res));
class_slots = SCM_EOL;
classp = scm_is_true (scm_memq (scm_class_class, cpl));
if (classp)
{
bslots = build_class_class_slots ();
check_cpl (res, bslots);
}
else
bslots = SCM_EOL;
if (scm_is_pair (cpl))
{
for (cpl = SCM_CDR (cpl); scm_is_pair (cpl); cpl = SCM_CDR (cpl))
{
SCM new_slots = SCM_SLOT (SCM_CAR (cpl),
scm_si_direct_slots);
if (classp)
{
if (!scm_is_eq (SCM_CAR (cpl), scm_class_class))
check_cpl (new_slots, bslots);
else
{
/* Move class slots to the head of the list. */
class_slots = new_slots;
continue;
}
}
res = scm_append (scm_list_2 (new_slots, res));
}
}
else
scm_misc_error ("%compute-slots", "malformed cpl argument in "
"build_slots_list", SCM_EOL);
/* make sure to add the <class> slots to the head of the list */
if (classp)
res = scm_append (scm_list_2 (class_slots, res));
/* res contains a list of slots. Remove slots which appears more than once */
return remove_duplicate_slots (scm_reverse (res), SCM_EOL, SCM_EOL);
@ -444,6 +492,9 @@ maplist (SCM ls)
SCM orig = ls;
while (!scm_is_null (ls))
{
if (!scm_is_pair (ls))
scm_misc_error ("%compute-slots", "malformed ls argument in "
"maplist", SCM_EOL);
if (!scm_is_pair (SCM_CAR (ls)))
SCM_SETCAR (ls, scm_cons (SCM_CAR (ls), SCM_EOL));
ls = SCM_CDR (ls);
@ -869,7 +920,7 @@ SCM_SYMBOL (sym_nfields, "nfields");
static SCM
build_class_class_slots ()
build_class_class_slots (void)
{
/* has to be kept in sync with SCM_VTABLE_BASE_LAYOUT and
SCM_CLASS_CLASS_LAYOUT */

View file

@ -434,7 +434,8 @@ scm_i_init_guile (void *base)
scm_init_objprop ();
scm_init_promises (); /* requires smob_prehistory */
scm_init_hooks (); /* Requires smob_prehistory */
scm_init_gc (); /* Requires hooks */
scm_init_stime ();
scm_init_gc (); /* Requires hooks and `get_internal_run_time' */
scm_init_gc_protect_object (); /* requires threads_prehistory */
scm_init_gdbint (); /* Requires strports, gc_protect_object */
scm_init_gettext ();
@ -480,7 +481,6 @@ scm_i_init_guile (void *base)
scm_init_load (); /* Requires strings */
scm_init_print (); /* Requires strings, struct, smob */
scm_init_read ();
scm_init_stime ();
scm_init_strorder ();
scm_init_srfi_13 ();
scm_init_srfi_14 (); /* Requires smob_prehistory */

View file

@ -1,4 +1,4 @@
# absolute-header.m4 serial 12
# absolute-header.m4 serial 16
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,
@ -22,6 +22,8 @@ dnl From Derek Price.
AC_DEFUN([gl_ABSOLUTE_HEADER],
[AC_REQUIRE([AC_CANONICAL_HOST])
AC_LANG_PREPROC_REQUIRE()dnl
dnl FIXME: gl_absolute_header and ac_header_exists must be used unquoted
dnl until we can assume autoconf 2.64 or newer.
m4_foreach_w([gl_HEADER_NAME], [$1],
[AS_VAR_PUSHDEF([gl_absolute_header],
[gl_cv_absolute_]m4_defn([gl_HEADER_NAME]))dnl
@ -51,6 +53,7 @@ m4_foreach_w([gl_HEADER_NAME], [$1],
# - it is silent.
AC_DEFUN([gl_ABSOLUTE_HEADER_ONE],
[
AC_REQUIRE([AC_CANONICAL_HOST])
AC_LANG_CONFTEST([AC_LANG_SOURCE([[#include <]]m4_dquote([$1])[[>]])])
dnl AIX "xlc -E" and "cc -E" omit #line directives for header files
dnl that contain only a #include of other header files and no
@ -63,15 +66,37 @@ AC_DEFUN([gl_ABSOLUTE_HEADER_ONE],
aix*) gl_absname_cpp="$ac_cpp -C" ;;
*) gl_absname_cpp="$ac_cpp" ;;
esac
changequote(,)
case "$host_os" in
mingw*)
dnl For the sake of native Windows compilers (excluding gcc),
dnl treat backslash as a directory separator, like /.
dnl Actually, these compilers use a double-backslash as
dnl directory separator, inside the
dnl # line "filename"
dnl directives.
gl_dirsep_regex='[/\\]'
;;
*)
gl_dirsep_regex='\/'
;;
esac
dnl A sed expression that turns a string into a basic regular
dnl expression, for use within "/.../".
gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g'
gl_header_literal_regex=`echo '$1' \
| sed -e "$gl_make_literal_regex_sed"`
gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{
s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/
s|^/[^/]|//&|
p
q
}'
changequote([,])
dnl eval is necessary to expand gl_absname_cpp.
dnl Ultrix and Pyramid sh refuse to redirect output of eval,
dnl so use subshell.
AS_VAR_SET([gl_cv_absolute_]AS_TR_SH([[$1]]),
[`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&AS_MESSAGE_LOG_FD |
sed -n '\#/$1#{
s#.*"\(.*/$1\)".*#\1#
s#^/[^/]#//&#
p
q
}'`])
sed -n "$gl_absolute_header_sed"`])
])

View file

@ -1,4 +1,4 @@
# alloca.m4 serial 12
# alloca.m4 serial 13
dnl Copyright (C) 2002-2004, 2006-2007, 2009-2011 Free Software Foundation,
dnl Inc.
dnl This file is free software; the Free Software Foundation

View file

@ -1,4 +1,4 @@
# arpa_inet_h.m4 serial 12
# arpa_inet_h.m4 serial 13
dnl Copyright (C) 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,
@ -52,4 +52,6 @@ AC_DEFUN([gl_ARPA_INET_H_DEFAULTS],
dnl Assume proper GNU behavior unless another module says otherwise.
HAVE_DECL_INET_NTOP=1; AC_SUBST([HAVE_DECL_INET_NTOP])
HAVE_DECL_INET_PTON=1; AC_SUBST([HAVE_DECL_INET_PTON])
REPLACE_INET_NTOP=0; AC_SUBST([REPLACE_INET_NTOP])
REPLACE_INET_PTON=0; AC_SUBST([REPLACE_INET_PTON])
])

View file

@ -1,4 +1,4 @@
# close.m4 serial 5
# close.m4 serial 8
dnl Copyright (C) 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,
@ -6,21 +6,28 @@ dnl with or without modifications, as long as this notice is preserved.
AC_DEFUN([gl_FUNC_CLOSE],
[
AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
AC_REQUIRE([gl_MSVC_INVAL])
if test $HAVE_MSVC_INVALID_PARAMETER_HANDLER = 1; then
REPLACE_CLOSE=1
fi
m4_ifdef([gl_PREREQ_SYS_H_WINSOCK2], [
gl_PREREQ_SYS_H_WINSOCK2
if test $UNISTD_H_HAVE_WINSOCK2_H = 1; then
dnl Even if the 'socket' module is not used here, another part of the
dnl application may use it and pass file descriptors that refer to
dnl sockets to the close() function. So enable the support for sockets.
gl_REPLACE_CLOSE
REPLACE_CLOSE=1
fi
])
dnl Replace close() for supporting the gnulib-defined fchdir() function,
dnl to keep fchdir's bookkeeping up-to-date.
m4_ifdef([gl_FUNC_FCHDIR], [
if test $REPLACE_CLOSE = 0; then
gl_TEST_FCHDIR
if test $HAVE_FCHDIR = 0; then
REPLACE_CLOSE=1
fi
fi
])
])
AC_DEFUN([gl_REPLACE_CLOSE],
[
AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
REPLACE_CLOSE=1
AC_LIBOBJ([close])
gl_REPLACE_FCLOSE
])

Some files were not shown because too many files have changed in this diff Show more