-Sat Mar 1 20:21:31 1997 Miles Bader <miles@gnu.ai.mit.edu>
+1997-03-04 04:31 Ulrich Drepper <drepper@cygnus.com>
+
+ * Makerules: Add rules to handle versioning.
+ * config.h.in (DO_VERSIONING): New macro.
+ * config.make.in (versioning): New variable.
+ * configure.in: Add checks for .symver directive in gas and
+ --version-script option to ld. Define DO_VERSIONING and
+ versioning if appropriate.
+
+ * math/Makefile (routines): Add s_signbit, s_fpclassify, s_fmax,
+ s_fmin, and s_fdim.
+ * math/math.h: Define ISO C 9X constants, macros and functions.
+ * math/mathcalls.h: Likewise.
+ * sysdeps/libm-ieee754/s_fdim.c: New file.
+ * sysdeps/libm-ieee754/s_fdimf.c: New file.
+ * sysdeps/libm-ieee754/s_fdiml.c: New file.
+ * sysdeps/libm-ieee754/s_fmax.c: New file.
+ * sysdeps/libm-ieee754/s_fmaxf.c: New file.
+ * sysdeps/libm-ieee754/s_fmaxl.c: New file.
+ * sysdeps/libm-ieee754/s_fmin.c: New file.
+ * sysdeps/libm-ieee754/s_fminf.c: New file.
+ * sysdeps/libm-ieee754/s_fminl.c: New file.
+ * sysdeps/libm-ieee754/s_fpclassify.c: New file.
+ * sysdeps/libm-ieee754/s_fpclassifyf.c: New file.
+ * sysdeps/libm-ieee754/s_fpclassifyl.c: New file.
+ * sysdeps/libm-ieee754/s_signbit.c: New file.
+ * sysdeps/libm-ieee754/s_signbitf.c: New file.
+ * sysdeps/libm-ieee754/s_signbitl.c: New file.
+
+ * stdio-common/printf_fphex.c: Correct printing of decimal point
+ character.
+ Simplify conversion of mantissa to string.
+ * stdio-common/vfscanf.c: Handle %A format.
+ Optimize termination of floating-point scanning.
+ * stdio-common/tstscanf.c (main): Add new test to scanf to test
+ scanning float values with given width.
+ * stdlib/strtod.c: Add handling of floating-point numbers in
+ hexadecimal notation.
+
+ * stdlib/stdlib.h: Use __USE_ISOC9X feature macro for new long long
+ functions.
+ Pretty print #if directives.
+ * string/string.h: Pretty print #if directives.
+
+ * sysdeps/ieee754/dbl2mpn.c: Update copyright.
+ * sysdeps/ieee754/ldbl2mpn.c: Likewise.
+ * sysdeps/ieee754/mpn2dbl.c: Likewise.
+ * sysdeps/ieee754/mpn2flt.c: Likewise.
+ * sysdeps/ieee754/mpn2ldbl.c: Likewise.
+
+ * sysdeps/unix/sysv/linux/poll.c: Implement poll function by
+ falling back to select-based implementation if syscall isn't
+ available.
+ * sysdeps/unix/sysv/linux/syscalls.list: Add s_poll.
+
+ * time/leapseconds: Update from tzdata1997b.
+ * time/zic.c: Update from tzcode1997b.
+
+1997-03-01 15:08 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
+
+ * time/Makefile $(tzfiles:%=$(objpfx)z.%): Remove unneeded
+ depedencies between installed $(tzlinks) and $(tzbases) files.
+
+1997-03-01 14:27 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
+
+ * math/math.h: Make compatible with traditional preprocessor;
+ requires carefull placement of whitespace in macro arguments.
+ Use __CONCAT instead of ##.
+ Declare long double functions only if __STDC__ or __GNUC__.
+ * math/mathcall.h: Avoid whitespace before argument of macro call
+ that is used as function name.
+
+ * sysdeps/m68k/fpu/__math.h: Use __CONCAT instead of ##.
+ (__m81_u, __m81_inline): Depend on __LIBC_M81_MATH_INLINES instead
+ of __NO_M81_MATH_INLINES.
+ [!__LIBC_M81_MATH_INLINES]: Don't define internal functions
+ starting with __ieee754.
+ [!__NO_MATH_INLINES && __OPTIMIZE__]: Define user visible
+ functions as inlines.
+ (__m81_defun): Put __attribute__ between return type and function
+ name.
+ * math/math.h: Include <__math.h> also if __LIBC_M81_MATH_INLINES
+ is defined.
+ * sysdeps/m68k/fpu/e_acos.c: Define __LIBC_M81_MATH_INLINES
+ instead of __NO_M81_MATH_INLINES.
+ * sysdeps/m68k/fpu/e_fmod.c: Likewise.
+ * sysdeps/m68k/fpu/k_cos.c: Likewise.
+ * sysdeps/m68k/fpu/k_sin.c: Likewise.
+ * sysdeps/m68k/fpu/k_tan.c: Likewise.
+ * sysdeps/m68k/fpu/s_atan.c: Likewise. De-ANSI-declify.
+ * sysdeps/m68k/fpu/s_frexp.c: Likewise.
+ * sysdeps/m68k/fpu/s_ilogb.c: Likewise.
+ * sysdeps/m68k/fpu/s_isinf.c: Likewise.
+ * sysdeps/m68k/fpu/s_modf.c: Likewise.
+ * sysdeps/m68k/fpu/s_scalbn.c: Likewise.
+
+1997-02-27 21:51 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
+
+ * Makefile (tests): Cope with $PATH not including the current
+ directory.
+
+1997-02-27 18:04 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
+
+ * sysdeps/unix/Makefile ($(common-objpfx)mk-local_lim): Use
+ $(common-objdir-compile).
+ ($(common-objpfx)make-ioctls): Likewise.
+ (mk-local_lim-CFLAGS): Set this instead of local_lim-CFLAGS.
+ ($(common-objpfx)sys/param.h): Use $(make-target-directory).
+ ($(addprefix $(common-objpfx),$(sys/param.h-includes))):
+ Likewise.
+ ($(common-objpfx)sys/syscall.h): Likewise.
+ ($(common-objpfx)local_lim.h): Let make deal with command
+ failure.
+ ($(common-objpfx)param.h.dep): Use temporary file and update
+ target atomically.
+ ($(common-objpfx)errnos): Avoid the Useless Use of cat Award.
+ (include $(common-objpfx)param.h.dep): Ignore error.
+
+ * sysdeps/posix/Makefile ($(common-objpfx)mk-stdiolim): Use
+ $(common-objdir-compile).
+ (mk-stdiolim-CFLAGS): Renamed from cded-objdir-includes, use
+ $(shell pwd) instead of $$cwd.
+
+ * sysdeps/generic/Makefile ($(common-objpfx)det_endian): Use
+ $(common-objdir-compile).
+ ($(objpfx)make_siglist): Use $(native-compile).
+ (make_siglist-CFLAGS): New variable.
+
+ * Makerules (ALL_BUILD_CFLAGS): Renamed from BUILD_CFLAGS, leaving
+ the old name for the user to pass additional flags to the host
+ compiler. Fix reference to config header.
+ (native-compile, common-objdir-compile): Rewritten to make more
+ generally usable.
+ * sysdeps/unix/sysv/sysv4/solaris2/Makefile: Set ALL_BUILD_CFLAGS
+ instead of BUILD_CFLAGS.
+
+ * sysvips/sys/ipc.h: Warn if needed feature select macro are not
+ defined.
+
+1997-02-27 17:11 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
+
+ * sunrpc/Makefile ($(objpfx)rpc-proto.d, $(objpfx)rpc-proto.c):
+ New rules to generate dependencies for the RPC service objects.
+
+1997-02-27 16:26 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
+
+ * argp/argp-parse.c (parser_finalize): Always set *END_INDEX if
+ supplied.
+
+1997-02-28 03:27 Ulrich Drepper <drepper@cygnus.com>
+
+ * stdlib/strtod.c (STRTOF): Make sure return value is large enough
+ so that clearing second word is necessary.
+
+ * sysdeps/unix/sysv/linux/netinet/in_systm.h: Don't use kernel
+ header since it is wrong for 64 bit systems.
+ Patch by a sun <asun@zoology.washington.edu>.
+
+1997-02-27 10:34:11 Richard Henderson <rth@tamu.edu>
+
+ * sysdeps/unix/sysv/linux/alpha/brk.S: Support both the Linux/i386
+ and OSF/1 style brk syscalls. We may want to change Linux/Alpha
+ for the benefit of running foreign binaries.
+
+1997-03-01 20:21 Miles Bader <miles@gnu.ai.mit.edu>
* login/utmp_file.c (pututline_file): Correctly decide whether
LAST_ENTRY matches DATA.
* login/logout.c (logout): Change type of entry to be DEAD_PROCESS.
-Tue Feb 25 19:42:50 1997 Miles Bader <miles@gnu.ai.mit.edu>
+1997-02-25 19:42 Miles Bader <miles@gnu.ai.mit.edu>
* sysdeps/mach/hurd/fcntlbits.h (O_NORW): New macro.
lib: $(common-objpfx)libc.so
endif
+# We have a versioning file for libc.so.
+#libc-map = libc.map
+
all-Subdirs-files = $(wildcard $(addsuffix /Subdirs, $(config-sysdirs)))
$(objpfx)sysd-dirs: $(+sysdir_pfx)config.make $(all-Subdirs-files)
(echo define sysdep-subdirs; \
\f
# Run a test on the header files we use.
tests: $(objpfx)isomac
- $(objpfx)isomac $(CC) '$(+sysdep-includes)' >$(common-objpfx)isomac.out
+ $(objpfx)./isomac $(CC) '$(+sysdep-includes)' \
+ >$(common-objpfx)isomac.out
$(objpfx)isomac: isomac.c
$(native-compile)
no-whole-archive =
endif
+ifeq ($(versioning),yes)
+load-map-file = $($(@F:%.so=%)-map:%=-Wl,--version-script=%)
+else
+load-map-file =
+endif
+
interp-obj = $(common-objpfx)interp.so
$(interp-obj): $(common-objpfx)%.so: $(..)%.c
$(compile-command.c)
define build-shlib
$(LINK.o) -shared -o $@ $(sysdep-LDFLAGS) $(config-LDFLAGS) \
- -B$(csu-objpfx) \
+ -B$(csu-objpfx) $(load-map-file) \
-Wl,-soname=lib$(libprefix)$(@F:lib%.so=%).so$($(@F)-version) \
$(LDFLAGS.so) $(LDFLAGS-$(@F:lib%.so=%).so) \
-L$(subst :, -L,$(rpath-link)) -Wl,-rpath-link=$(rpath-link) \
\f
# Command to compile $< in $(objdir) using the native libraries.
define native-compile
-cwd=`pwd`; cd $(@D); $(BUILD_CC) $(BUILD_CFLAGS) \
- $(addprefix $$cwd/,$^) -o $(@F)
+$(make-target-directory)
+$(patsubst %/,cd %;,$(objpfx)) \
+$(BUILD_CC) $($(basename $(<F))-CFLAGS) $(ALL_BUILD_CFLAGS) \
+ $(firstword $(filter /%,$< $(shell pwd)/$<)) -o $(@F)
endef
# Command to compile $< in $(common-objdir) using the native libraries.
# We must cd to $(objdir) anyway so that $(..)config.h is valid.
define common-objdir-compile
-cd $(objpfx).; \
-$(BUILD_CC) $(BUILD_CFLAGS) $(<:$(common-objpfx)%=$(..)%) -o $(..)$(@F)
+$(patsubst %/,cd %;,$(objpfx)) \
+$(BUILD_CC) $($(basename $(<F))-CFLAGS) $(ALL_BUILD_CFLAGS) \
+ $(firstword $(filter /%,$< $(shell pwd)/$<)) -o $(..)$(@F)
endef
# We always want to use configuration definitions.
-BUILD_CFLAGS = -include $(common-objpfx)config.h
+# Note that this is only used for commands running in $(objpfx).
+ALL_BUILD_CFLAGS = $(BUILD_CFLAGS) -include $(..)config.h
# Support the GNU standard name for this target.
.PHONY: check
* Miles Bader provided the `argp' function family to support hierachical
command line argument parsing, layered on top of getopt.
+
+* strtod accepts new hexadecimal floating-point format from ISO C 9X
+
+* printf has two new specifiers %a and %A to print hexadecimal flaoting-point
+ numbers
+
+* scanf recognizes the %A format for scanning floating point numbers
\f
Version 2.0.2
if (err == EBADKEY)
err = 0; /* Some parser didn't understand. */
+
+ /* Tell the user that all arguments are parsed. */
+ if (end_index)
+ *end_index = parser->state.next;
}
else if (end_index)
/* Return any remaining arguments to the user. */
directive. */
#undef HAVE_ASM_POPSECTION_DIRECTIVE
+/* Define if versioning of the library is wanted. */
+#undef DO_VERSIONING
+
/*
\f */
elf = @elf@
have-initfini = @libc_cv_have_initfini@
+versioning = @VERSIONING@
+
have-no-whole-archive = @libc_cv_ld_no_whole_archive@
have-no-exceptions = @libc_cv_gcc_no_exceptions@
have-bash2 = @libc_cv_have_bash2@
fi
+echo $ac_n "checking for .symver assembler directive""... $ac_c" 1>&6
+echo "configure:1603: checking for .symver assembler directive" >&5
+if eval "test \"`echo '$''{'libc_cv_asm_symver_directive'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.s <<EOF
+.text
+_sym: ret
+.symver _sym,sym@VERS
+EOF
+if ${CC-cc} -c $CFLAGS $CPPFLAGS conftest.s 1>&5 2>&5; then
+ libc_cv_asm_symver_directive=yes
+else
+ libc_cv_asm_symver_directive=no
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$libc_cv_asm_symver_directive" 1>&6
+echo $ac_n "checking for ld --version-script""... $ac_c" 1>&6
+echo "configure:1622: checking for ld --version-script" >&5
+if eval "test \"`echo '$''{'libc_cv_ld_version_script_option'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test $libc_cv_asm_symver_directive = yes; then
+ cat > conftest.s <<EOF
+.text
+_sym: ret
+.symver _sym,sym@VERS
+EOF
+ cat > conftest.map <<EOF
+VERS {
+ global: sym;
+};
+EOF
+ if ${CC-cc} -c $CFLAGS $CPPFLAGS conftest.s 1>&5 2>&5; then
+ if { ac_try='${CC-cc} $CFLAGS --shared -o conftest.so conftest.o
+ -Wl,--version-script,conftest.map'; { (eval echo configure:1639: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; };
+ then
+ libc_cv_ld_version_script_option=yes
+ else
+ libc_cv_ld_version_script_option=no
+ fi
+ else
+ libc_cv_ld_version_script_option=no
+ fi
+else
+ libc_cv_ld_version_script_option=no
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$libc_cv_ld_version_script_option" 1>&6
+if test $libc_cv_asm_symver_directive = yes &&
+ test $libc_cv_ld_version_script_option = yes; then
+ VERSIONING=yes
+ cat >> confdefs.h <<\EOF
+#define DO_VERSIONING 1
+EOF
+
+else
+ VERSIONING=no
+fi
+
+
if test $elf = yes; then
echo $ac_n "checking for .previous assembler directive""... $ac_c" 1>&6
-echo "configure:1604: checking for .previous assembler directive" >&5
+echo "configure:1669: checking for .previous assembler directive" >&5
if eval "test \"`echo '$''{'libc_cv_asm_previous_directive'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
.section foo_section
.previous
EOF
- if { ac_try='${CC-cc} -c $CFLAGS conftest.s 1>&5'; { (eval echo configure:1612: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
+ if { ac_try='${CC-cc} -c $CFLAGS conftest.s 1>&5'; { (eval echo configure:1677: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
libc_cv_asm_previous_directive=yes
else
libc_cv_asm_previous_directive=no
else
echo $ac_n "checking for .popsection assembler directive""... $ac_c" 1>&6
-echo "configure:1628: checking for .popsection assembler directive" >&5
+echo "configure:1693: checking for .popsection assembler directive" >&5
if eval "test \"`echo '$''{'libc_cv_asm_popsection_directive'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
.pushsection foo_section
.popsection
EOF
- if { ac_try='${CC-cc} -c $CFLAGS conftest.s 1>&5'; { (eval echo configure:1636: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
+ if { ac_try='${CC-cc} -c $CFLAGS conftest.s 1>&5'; { (eval echo configure:1701: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
libc_cv_asm_popsection_directive=yes
else
libc_cv_asm_popsection_directive=no
if test $elf != yes; then
echo $ac_n "checking for .init and .fini sections""... $ac_c" 1>&6
-echo "configure:1656: checking for .init and .fini sections" >&5
+echo "configure:1721: checking for .init and .fini sections" >&5
if eval "test \"`echo '$''{'libc_cv_have_initfini'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1661 "configure"
+#line 1726 "configure"
#include "confdefs.h"
int main() {
asm (".text");
; return 0; }
EOF
-if { (eval echo configure:1670: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1735: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
libc_cv_have_initfini=yes
else
libc_cv_asm_underscores=no
else
echo $ac_n "checking for _ prefix on C symbol names""... $ac_c" 1>&6
-echo "configure:1695: checking for _ prefix on C symbol names" >&5
+echo "configure:1760: checking for _ prefix on C symbol names" >&5
if eval "test \"`echo '$''{'libc_cv_asm_underscores'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1700 "configure"
+#line 1765 "configure"
#include "confdefs.h"
asm ("_glibc_foobar:");
int main() {
glibc_foobar ();
; return 0; }
EOF
-if { (eval echo configure:1707: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:1772: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
libc_cv_asm_underscores=yes
else
libc_cv_asm_weakext_directive=no
else
echo $ac_n "checking for assembler .weak directive""... $ac_c" 1>&6
-echo "configure:1734: checking for assembler .weak directive" >&5
+echo "configure:1799: checking for assembler .weak directive" >&5
if eval "test \"`echo '$''{'libc_cv_asm_weak_directive'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
if test $libc_cv_asm_weak_directive = no; then
echo $ac_n "checking for assembler .weakext directive""... $ac_c" 1>&6
-echo "configure:1757: checking for assembler .weakext directive" >&5
+echo "configure:1822: checking for assembler .weakext directive" >&5
if eval "test \"`echo '$''{'libc_cv_asm_weakext_directive'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
fi
echo $ac_n "checking for ld --no-whole-archive""... $ac_c" 1>&6
-echo "configure:1794: checking for ld --no-whole-archive" >&5
+echo "configure:1859: checking for ld --no-whole-archive" >&5
if eval "test \"`echo '$''{'libc_cv_ld_no_whole_archive'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
EOF
if { ac_try='${CC-cc} $CFLAGS
-nostdlib -nostartfiles -Wl,--no-whole-archive
- -o conftest conftest.c'; { (eval echo configure:1805: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
+ -o conftest conftest.c'; { (eval echo configure:1870: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
libc_cv_ld_no_whole_archive=yes
else
libc_cv_ld_no_whole_archive=no
echo "$ac_t""$libc_cv_ld_no_whole_archive" 1>&6
echo $ac_n "checking for gcc -fno-exceptions""... $ac_c" 1>&6
-echo "configure:1816: checking for gcc -fno-exceptions" >&5
+echo "configure:1881: checking for gcc -fno-exceptions" >&5
if eval "test \"`echo '$''{'libc_cv_gcc_no_exceptions'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
EOF
if { ac_try='${CC-cc} $CFLAGS
-nostdlib -nostartfiles -fno-exceptions
- -o conftest conftest.c'; { (eval echo configure:1827: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
+ -o conftest conftest.c'; { (eval echo configure:1892: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
libc_cv_gcc_no_exceptions=yes
else
libc_cv_gcc_no_exceptions=no
fi
echo $ac_n "checking OS release for uname""... $ac_c" 1>&6
-echo "configure:1879: checking OS release for uname" >&5
+echo "configure:1944: checking OS release for uname" >&5
if eval "test \"`echo '$''{'libc_cv_uname_release'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
uname_release="$libc_cv_uname_release"
echo $ac_n "checking OS version for uname""... $ac_c" 1>&6
-echo "configure:1901: checking OS version for uname" >&5
+echo "configure:1966: checking OS version for uname" >&5
if eval "test \"`echo '$''{'libc_cv_uname_version'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
fi
echo $ac_n "checking stdio selection""... $ac_c" 1>&6
-echo "configure:1923: checking stdio selection" >&5
+echo "configure:1988: checking stdio selection" >&5
case $stdio in
libio) cat >> confdefs.h <<\EOF
s%@libc_cv_have_bash2@%$libc_cv_have_bash2%g
s%@KSH@%$KSH%g
s%@libc_cv_have_ksh@%$libc_cv_have_ksh%g
+s%@VERSIONING@%$VERSIONING%g
s%@libc_cv_have_initfini@%$libc_cv_have_initfini%g
s%@libc_cv_ld_no_whole_archive@%$libc_cv_ld_no_whole_archive%g
s%@libc_cv_gcc_no_exceptions@%$libc_cv_gcc_no_exceptions%g
AC_DEFINE(HAVE_ASM_SET_DIRECTIVE)
fi
+AC_CACHE_CHECK(for .symver assembler directive, libc_cv_asm_symver_directive,
+[cat > conftest.s <<EOF
+.text
+_sym: ret
+.symver _sym,sym@VERS
+EOF
+if ${CC-cc} -c $CFLAGS $CPPFLAGS conftest.s 1>&AC_FD_CC 2>&AC_FD_CC; then
+ libc_cv_asm_symver_directive=yes
+else
+ libc_cv_asm_symver_directive=no
+fi
+rm -f conftest*])
+AC_CACHE_CHECK(for ld --version-script, libc_cv_ld_version_script_option, [dnl
+if test $libc_cv_asm_symver_directive = yes; then
+ cat > conftest.s <<EOF
+.text
+_sym: ret
+.symver _sym,sym@VERS
+EOF
+ cat > conftest.map <<EOF
+VERS {
+ global: sym;
+};
+EOF
+ if ${CC-cc} -c $CFLAGS $CPPFLAGS conftest.s 1>&AC_FD_CC 2>&AC_FD_CC; then
+ if AC_TRY_COMMAND([${CC-cc} $CFLAGS --shared -o conftest.so conftest.o
+ -Wl,--version-script,conftest.map]);
+ then
+ libc_cv_ld_version_script_option=yes
+ else
+ libc_cv_ld_version_script_option=no
+ fi
+ else
+ libc_cv_ld_version_script_option=no
+ fi
+else
+ libc_cv_ld_version_script_option=no
+fi
+rm -f conftest*])
+if test $libc_cv_asm_symver_directive = yes &&
+ test $libc_cv_ld_version_script_option = yes; then
+ VERSIONING=yes
+ AC_DEFINE(DO_VERSIONING)
+else
+ VERSIONING=no
+fi
+AC_SUBST(VERSIONING)
+
if test $elf = yes; then
AC_CACHE_CHECK(for .previous assembler directive,
libc_cv_asm_previous_directive, [dnl
s_sin s_tan s_tanh w_acos w_acosh w_asin \
w_atan2 w_atanh w_cabs w_cosh w_drem w_exp w_fmod w_gamma \
w_gamma_r w_hypot w_j0 w_j1 w_jn w_lgamma w_lgamma_r \
- w_log w_log10 w_pow w_remainder w_scalb w_sinh w_sqrt
+ w_log w_log10 w_pow w_remainder w_scalb w_sinh w_sqrt \
+ s_signbit s_fpclassify s_fmax s_fmin s_fdim
libm-routines = $(libm-support) $(libm-calls) \
$(patsubst %_rf,%f_r,$(libm-calls:=f)) \
$(long-m-$(long-double-fcts))
and can declare the float versions `namef' and `__namef'. */
#define __MATHCALL(function,suffix, args) \
- __MATHDECL (_Mdouble_, function,suffix, args)
+ __MATHDECL (_Mdouble_,function,suffix, args)
#define __MATHDECL(type, function,suffix, args) \
__MATHDECL_1(type, function,suffix, args); \
- __MATHDECL_1(type, __##function,suffix, args)
+ __MATHDECL_1(type, __CONCAT(__,function),suffix, args)
#define __MATHDECL_1(type, function,suffix, args) \
extern type __MATH_PRECNAME(function,suffix) args
#define _Mdouble_ double
-#define __MATH_PRECNAME(name,r) name##r
+#define __MATH_PRECNAME(name,r) __CONCAT(name,r)
#include <mathcalls.h>
#undef _Mdouble_
#undef __MATH_PRECNAME
-#ifdef __USE_MISC
+#if defined __USE_MISC || defined __USE_ISOC9X
/* Include the file of declarations again, this time using `float'
#define _Mfloat_ float
#endif
#define _Mdouble_ _Mfloat_
+#ifdef __STDC__
#define __MATH_PRECNAME(name,r) name##f##r
+#else
+#define __MATH_PRECNAME(name,r) name/**/f/**/r
+#endif
#include <mathcalls.h>
#undef _Mdouble_
#undef __MATH_PRECNAME
+#if __STDC__ - 0 || __GNUC__ - 0
/* Include the file of declarations again, this time using `long double'
instead of `double' and appending l to each function name. */
#define _Mlong_double_ long double
#endif
#define _Mdouble_ _Mlong_double_
+#ifdef __STDC__
#define __MATH_PRECNAME(name,r) name##l##r
+#else
+#define __MATH_PRECNAME(name,r) name/**/l/**/r
+#endif
#include <mathcalls.h>
#undef _Mdouble_
#undef __MATH_PRECNAME
-#endif /* Use misc. */
+#endif /* __STDC__ || __GNUC__ */
+
+#endif /* Use misc or ISO C 9X. */
+
+
+/* ISO C 9X defines some generic macros which work on any data type. */
+#if __USE_ISOC9X
+
+/* All floating-point numbers can be put in one of these categories. */
+enum
+ {
+ FP_NAN,
+#define FP_NAN FP_NAN
+ FP_INFINITE,
+#define FP_INFINITE FP_INFINITE
+ FP_ZERO,
+#define FP_ZERO FP_ZERO
+ FP_SUBNORMAL,
+#define FP_SUBNORMAL FP_SUBNORMAL
+ FP_NORMAL
+#define FP_NORMAL FP_NORMAL
+ };
+
+/* Return number of classification appropriate for X. */
+#define fpclassify(x) \
+ (sizeof (x) == sizeof (float) ? \
+ __finitef (x) \
+ : sizeof (x) == sizeof (double) ? \
+ __finite (x) : __finitel (x))
+
+/* Return nonzero value if sign of X is negative. */
+#define signbit(x) \
+ (sizeof (x) == sizeof (float) ? \
+ __signbitf (x) \
+ : sizeof (x) == sizeof (double) ? \
+ __signbit (x) : __signbitl (x))
+
+/* Return nonzero value if X is not +-Inf or NaN. */
+#define isfinite(x) (fpclassify (x) >= FP_ZERO)
+
+/* Return nonzero value if X is neither zero, subnormal, Inf, nor NaN. */
+#define isnormal(x) (fpclassify (x) == FP_NORMAL)
+
+/* Return nonzero value if X is a NaN. We could use `fpclassify' but
+ we already have this functions `__isnan' and it is faster. */
+#define isnan(x) \
+ (sizeof (x) == sizeof (float) ? \
+ __isnanf (x) \
+ : sizeof (x) == sizeof (double) ? \
+ __isnan (x) : __isnanl (x))
+/* Conversion functions. */
+
+/* Round X to nearest integral value according to current rounding
+ direction. */
+extern long int rinttol __P ((double __x));
+extern long long int rinttoll __P ((double __x));
+
+/* Round X to nearest integral value, rounding halfway cases away from
+ zero. */
+extern long int roundtol __P ((double __x));
+extern long long int roundtoll __P ((double __x));
+
+
+/* Comparison macros. */
+
+/* Return nonzero value if X is greater than Y. */
+#define isgreater(x, y) (!isunordered ((x), (y)) && (x) > (y))
+
+/* Return nonzero value if X is greater than or equal to Y. */
+#define isgreaterequal(x, y) (!isunordered ((x), (y)) && (x) >= (y))
+
+/* Return nonzero value if X is less than Y. */
+#define isless(x, y) (!isunordered ((x), (y)) && (x) < (y))
+
+/* Return nonzero value if X is less than or equal to Y. */
+#define islessequal(x, y) (!isunordered ((x), (y)) && (x) <= (y))
+
+/* Return nonzero value if either X is less than Y or Y is less than X. */
+#define islessgreater(x, y) \
+ (!isunordered ((x), (y)) && ((x) < (y) || (y) < (x)))
+
+/* Return nonzero value if arguments are unordered. */
+#define isunordered(x, y) \
+ (fpclassify (x) == FP_NAN || fpclassify (y) == FP_NAN)
+
+#endif /* Use ISO C 9X. */
+
#ifdef __USE_MISC
/* Support for various different standard error handling behaviors. */
#define HUGE FLT_MAX
#include <float.h> /* Defines FLT_MAX. */
+#else /* !SVID */
+
+#ifdef __USE_XOPEN
+/* X/Open wants another strange constant. */
+#define MAXFLOAT FLT_MAX
+#include <float.h>
+#endif
+
#endif /* SVID */
/* Get machine-dependent inline versions (if there are any). */
-#if !defined __NO_MATH_INLINES && defined __OPTIMIZE__
+#if (!defined __NO_MATH_INLINES && defined __OPTIMIZE__) \
+ || defined __LIBC_M81_MATH_INLINES
#include <__math.h>
#endif
/* Hyperbolic tangent of X. */
__MATHCALL (tanh,, (_Mdouble_ __x));
-#if defined(__USE_MISC) || defined(__USE_XOPEN_EXTENDED)
+#if defined __USE_MISC || defined __USE_XOPEN_EXTENDED || defined __USE_ISOC9X
/* Hyperbolic arc cosine of X. */
__MATHCALL (acosh,, (_Mdouble_ __x));
/* Hyperbolic arc sine of X. */
/* Base-ten logarithm of X. */
__MATHCALL (log10,, (_Mdouble_ __x));
-#if defined(__USE_MISC) || defined(__USE_XOPEN_EXTENDED)
+/* Break VALUE into integral and fractional parts. */
+__MATHCALL (modf,, (_Mdouble_ __x, _Mdouble_ *__iptr));
+
+#if defined __USE_MISC || defined __USE_XOPEN_EXTENDED || defined __USE_ISOC9X
/* Return exp(X) - 1. */
__MATHCALL (expm1,, (_Mdouble_ __x));
__MATHCALL (logb,, (_Mdouble_ __x));
#endif
-/* Break VALUE into integral and fractional parts. */
-__MATHCALL (modf,, (_Mdouble_ __x, _Mdouble_ *__iptr));
+#ifdef __USE_ISOC9X
+/* Compute base-2 exponential of X. */
+__MATHCALL (exp2,, (_Mdouble_ __x));
+
+/* Compute base-2 logarithm of X. */
+__MATHCALL (log2,, (_Mdouble_ __x));
+#endif
/* Power functions. */
/* Return the square root of X. */
__MATHCALL (sqrt,, (_Mdouble_ __x));
-#if defined(__USE_MISC) || defined(__USE_XOPEN_EXTENDED)
+#if defined __USE_MISC || defined __USE_XOPEN_EXTENDED || defined __USE_ISOC9X
+/* Return `sqrt(X*X + Y*Y)'. */
+__MATHCALL (hypot,, (_Mdouble_ __x, _Mdouble_ __y));
+#endif
+
+#if defined __USE_MISC || defined __USE_XOPEN_EXTENDED
/* Return the cube root of X. */
__MATHCALL (cbrt,, (_Mdouble_ __x));
#endif
#ifdef __USE_MISC
-
/* Return 0 if VALUE is finite or NaN, +1 if it
is +Infinity, -1 if it is -Infinity. */
-__MATHDECL (int, isinf,, (_Mdouble_ __value));
+__MATHDECL (int,isinf,, (_Mdouble_ __value));
/* Return nonzero if VALUE is finite and not NaN. */
-__MATHDECL (int, finite,, (_Mdouble_ __value));
+__MATHDECL (int,finite,, (_Mdouble_ __value));
/* Deal with an infinite or NaN result.
If ERROR is ERANGE, result is +Inf;
and may return an infinity or NaN, or may do something else. */
__MATHCALL (infnan,, (int __error));
-/* Return X with its signed changed to Y's. */
-__MATHCALL (copysign,, (_Mdouble_ __x, _Mdouble_ __y));
-
/* Return X times (2 to the Nth power). */
__MATHCALL (scalbn,, (_Mdouble_ __x, int __n));
__MATHCALL (significand,, (_Mdouble_ __x));
#endif /* Use misc. */
+#if defined __USE_MISC || defined __USE_ISOC9X
+/* Return X with its signed changed to Y's. */
+__MATHCALL (copysign,, (_Mdouble_ __x, _Mdouble_ __y));
+#endif
+
+#ifdef __USE_ISOC9X
+/* Return representation of NaN for double type. */
+__MATHCALL (nan,, (__const char *__tagb));
+#endif
-#if defined(__USE_MISC) || defined(__USE_XOPEN)
+#if defined __USE_MISC || defined __USE_XOPEN
/* Return nonzero if VALUE is not a number. */
-__MATHDECL (int, isnan,, (_Mdouble_ __value));
+__MATHDECL (int,isnan,, (_Mdouble_ __value));
/* Return the binary exponent of X, which must be nonzero. */
-__MATHDECL (int, ilogb,, (_Mdouble_ __x));
+__MATHDECL (int,ilogb,, (_Mdouble_ __x));
-/* Return `sqrt(X*X + Y*Y)'. */
-__MATHCALL (hypot,, (_Mdouble_ __x, _Mdouble_ __y));
+/* Bessel functions. */
+__MATHCALL (j0,, (_Mdouble_));
+__MATHCALL (j1,, (_Mdouble_));
+__MATHCALL (jn,, (int, _Mdouble_));
+__MATHCALL (y0,, (_Mdouble_));
+__MATHCALL (y1,, (_Mdouble_));
+__MATHCALL (yn,, (int, _Mdouble_));
+#endif
+#if defined __USE_MISC || defined __USE_XOPEN || defined __USE_ISOC9X
/* Error, gamma, and Bessel functions. */
__MATHCALL (erf,, (_Mdouble_));
__MATHCALL (erfc,, (_Mdouble_));
__MATHCALL (gamma,, (_Mdouble_));
-__MATHCALL (j0,, (_Mdouble_));
-__MATHCALL (j1,, (_Mdouble_));
-__MATHCALL (jn,, (int, _Mdouble_));
__MATHCALL (lgamma,, (_Mdouble_));
-__MATHCALL (y0,, (_Mdouble_));
-__MATHCALL (y1,, (_Mdouble_));
-__MATHCALL (yn,, (int, _Mdouble_));
/* This variable is used by `gamma' and `lgamma'. */
extern int signgam;
#ifdef __USE_MISC
-
/* Reentrant versions of gamma and lgamma. Those functions use the global
variable `signgam'. The reentrant versions instead take a pointer and
store the value through it. */
__MATHCALL (lgamma,_r, (_Mdouble_, int *));
#endif
+#endif /* Use misc or X/Open. */
-#if defined(__USE_MISC) || defined(__USE_XOPEN_EXTENDED)
+#if defined __USE_MISC || defined __USE_XOPEN_EXTENDED || defined __USE_ISOC9X
/* Return the integer nearest X in the direction of the
prevailing rounding mode. */
__MATHCALL (rint,, (_Mdouble_ __x));
-/* Return X times (2 to the Nth power). */
-__MATHCALL (scalb,, (_Mdouble_ __x, _Mdouble_ __n));
-
/* Return X + epsilon if X < Y, X - epsilon if X > Y. */
__MATHCALL (nextafter,, (_Mdouble_ __x, _Mdouble_ __y));
__MATHCALL (remainder,, (_Mdouble_ __x, _Mdouble_ __y));
#endif
-#endif /* Use misc. */
+#if defined __USE_MISC || defined __USE_XOPEN_EXTENDED
+/* Return X times (2 to the Nth power). */
+__MATHCALL (scalb,, (_Mdouble_ __x, _Mdouble_ __n));
+#endif
+
+#ifdef __USE_ISOC9X
+/* Round X to integral valuein floating-point format using current
+ rounding direction, but do not raise inexact exception. */
+__MATHCALL (nearbyint,, (_Mdouble_ __x));
+
+/* Round X to nearest integral value, rounding halfway cases away from
+ zero. */
+__MATHCALL (round,, (_Mdouble_ __x));
+
+/* Round X to the integral value in floating-point format nearest but
+ not larger in magnitude. */
+__MATHCALL (trunc,, (_Mdouble_ __x));
+
+/* Compute remainder of X and Y and put in *QUO a value with sign of x/y
+ and magnitude congruent `mod 2^n' to the magnitude of the integral
+ quotient x/y, with n >= 3. */
+__MATHCALL (remquo,, (_Mdouble_ __x, _Mdouble_ __y, int *__quo));
+
+
+/* Return positive difference between X and Y. */
+__MATHCALL (fdim,, (_Mdouble_ __x, _Mdouble_ __y));
+
+/* Return minimum numeric value from X and Y. */
+__MATHCALL (fmax,, (_Mdouble_ __x, _Mdouble_ __y));
+
+/* Return maximum numeric value from X and Y. */
+__MATHCALL (fmin,, (_Mdouble_ __x, _Mdouble_ __y));
+
+
+/* Classify given number. */
+__MATHDECL_1 (int, __fpclassify,, (_Mdouble_ __value));
+
+/* Test for negative number. */
+__MATHDECL_1 (int, __signbit,, (_Mdouble_ __value));
+#endif /* Use ISO C 9X. */
52 bits are representable without rest using hexadecimal
digits we use only the implicit digits for the number before
the decimal point. */
- if (sizeof (unsigned long int) > 6)
- {
- unsigned long int num;
+ unsigned long long int num;
- num = (((unsigned long int) fpnum.dbl.ieee.mantissa0) << 32
- | fpnum.dbl.ieee.mantissa1);
+ num = (((unsigned long long int) fpnum.dbl.ieee.mantissa0) << 32
+ | fpnum.dbl.ieee.mantissa1);
- zero_mantissa = num == 0;
+ zero_mantissa = num == 0;
- numstr = _itoa_word (num, numbuf + sizeof numbuf, 16,
- info->spec == 'A');
- }
+ if (sizeof (unsigned long int) > 6)
+ numstr = _itoa_word (num, numbuf + sizeof numbuf, 16,
+ info->spec == 'A');
else
- {
- unsigned long long int num;
-
- num = (((unsigned long long int) fpnum.dbl.ieee.mantissa0) << 32
- | fpnum.dbl.ieee.mantissa1);
-
- zero_mantissa = num == 0;
-
- numstr = _itoa (num, numbuf + sizeof numbuf, 16, info->spec == 'A');
- }
+ numstr = _itoa (num, numbuf + sizeof numbuf, 16,
+ info->spec == 'A');
/* Fill with zeroes. */
while (numstr > numbuf + (sizeof numbuf - 13)) /* 52 ÷ 4 = 13 */
exponent = fpnum.dbl.ieee.exponent;
- if (exponent != 0 && exponent < IEEE754_DOUBLE_BIAS)
+ if ((exponent != 0 && exponent < IEEE754_DOUBLE_BIAS)
+ || (exponent == 0 && !zero_mantissa))
{
expnegative = 1;
exponent = abs (exponent - IEEE754_DOUBLE_BIAS);
{
/* The "strange" 80 bit format on ix86 and m68k has an explicit
leading digit in the 64 bit mantissa. */
- assert (sizeof (long double) == 12);
+ unsigned long long int num;
- if (sizeof (unsigned long int) > 6)
- {
- unsigned long int num;
+ assert (sizeof (long double) == 12);
- num = (((unsigned long int) fpnum.dbl.ieee.mantissa0) << 32
- | fpnum.dbl.ieee.mantissa1);
+ num = (((unsigned long long int) fpnum.ldbl.ieee.mantissa0) << 32
+ | fpnum.ldbl.ieee.mantissa1);
- zero_mantissa = num == 0;
+ zero_mantissa = num == 0;
- numstr = _itoa_word (num, numbuf + sizeof numbuf, 16,
- info->spec == 'A');
- }
+ if (sizeof (unsigned long int) > 6)
+ numstr = _itoa_word (num, numbuf + sizeof numbuf, 16,
+ info->spec == 'A');
else
- {
- unsigned long long int num;
-
- num = (((unsigned long long int) fpnum.ldbl.ieee.mantissa0) << 32
- | fpnum.ldbl.ieee.mantissa1);
-
- zero_mantissa = num == 0;
-
- numstr = _itoa (num, numbuf + sizeof numbuf, 16, info->spec == 'A');
- }
+ numstr = _itoa (num, numbuf + sizeof numbuf, 16, info->spec == 'A');
/* We use a full nibble for the leading digit. */
leading = *numstr++;
/* We have 3 bits from the mantissa in the leading nibble. */
exponent = fpnum.ldbl.ieee.exponent - 3;
- if (exponent != 0 && exponent < IEEE854_LONG_DOUBLE_BIAS)
+ if ((exponent != 0 && exponent < IEEE854_LONG_DOUBLE_BIAS)
+ || (exponent == 0 && !zero_mantissa))
{
expnegative = 1;
exponent = abs (exponent - IEEE854_LONG_DOUBLE_BIAS);
outchar (info->spec == 'A' ? 'X' : 'x');
outchar (leading);
- if (!zero_mantissa || precision != 0 || info->alt)
+ if (!zero_mantissa || precision > 0 || info->alt)
outchar (decimal);
- if (!zero_mantissa || precision != 0)
+ if (!zero_mantissa || precision > 0)
{
PRINT (numstr, MIN (numend - numstr, precision));
if (precision > numend - numstr)
return 1;
}
+ fputs ("Test 4:\n", out);
+ {
+ double a = 0, b = 0;
+ int res, n;
+
+ res = sscanf ("1234567", "%3lg%3lg%n", &a, &b, &n);
+ printf ("res = %d, a = %g, b = %g, n = %d\n", res, a, b, n);
+
+ if (res != 2 || a != 123 || b != 456 || n != 6)
+ return 1;
+ }
+
exit(EXIT_SUCCESS);
}
char got_dot, got_e, negative;
/* If a [...] is a [^...]. */
char not_in;
+#define exp_char not_in
/* Base for integral numbers. */
int base;
/* Signedness for integral numbers. */
int number_signed;
+#define is_hexa number_signed
/* Decimal point character. */
wchar_t decimal;
/* The thousands character of the current locale. */
case 'f':
case 'g':
case 'G':
+ case 'A':
c = inchar ();
if (c == EOF)
input_error ();
else
negative = 0;
+ if (c == '0' && tolower (c == inchar ()) == 'x')
+ {
+ /* It is a number in hexadecimal format. */
+ ADDW ('0');
+ ADDW ('x');
+
+ is_hexa = 1;
+ exp_char = 'p';
+
+ /* Grouping is not allowed. */
+ flags &= ~GROUP;
+ c = inchar ();
+ }
+ else
+ {
+ /* It not a hexadecimal prefix. */
+ is_hexa = 0;
+ exp_char = 'e';
+ }
+
got_dot = got_e = 0;
do
{
if (isdigit (c))
ADDW (c);
- else if (got_e && wp[wpsize - 1] == 'e'
+ else if (!got_e && is_hexa && isxdigit (c))
+ ADDW (c);
+ else if (got_e && wp[wpsize - 1] == exp_char
&& (c == '-' || c == '+'))
ADDW (c);
- else if (wpsize > 0 && !got_e && tolower (c) == 'e')
+ else if (wpsize > 0 && !got_e && tolower (c) == exp_char)
{
- ADDW ('e');
+ ADDW (exp_char);
got_e = got_dot = 1;
}
else if (c == decimal && !got_dot)
else if ((flags & GROUP) && c == thousands && !got_dot)
ADDW (c);
else
- break;
+ {
+ /* The last read character is not part of the number
+ anymore. */
+ ungetc (c, s);
+ break;
+ }
if (width > 0)
--width;
}
- while (inchar () != EOF && width != 0);
-
- /* The last read character is not part of the number anymore. */
- ungetc (c, s);
+ while (width != 0 && inchar () != EOF);
- if (wpsize == 0)
+ /* Have we read any character? If we try to read a number
+ in hexadecimal notation and we have read only the `0x'
+ prefix this is an error. */
+ if (wpsize == 0 || (is_hexa && wpsize == 2))
conv_error ();
/* Convert the number. */
Boston, MA 02111-1307, USA. */
/*
- * ISO S Standard: 4.10 GENERAL UTILITIES <stdlib.h>
+ * ISO C Standard: 4.10 GENERAL UTILITIES <stdlib.h>
*/
#ifndef _STDLIB_H
long int rem; /* Remainder. */
} ldiv_t;
-#ifdef __USE_GNU
+#ifdef __USE_ISOC9X
/* Returned by `lldiv'. */
typedef struct
{
int __group));
#endif /* GCC */
-#if defined (__OPTIMIZE__) && __GNUC__ >= 2
+#if defined __OPTIMIZE__ && __GNUC__ >= 2
/* Define inline functions which call the internal entry points. */
extern __inline double strtod (__const char *__restrict __nptr,
extern __inline long int atol (__const char *__nptr)
{ return strtol (__nptr, (char **) NULL, 10); }
-#ifdef __USE_MISC
+#if defined __USE_ISOC9X && (defined __GNUC__ || defined __USE_MISC)
extern __inline long long int atoll (__const char *__nptr)
{ return strtoll (__nptr, (char **) NULL, 10); }
#endif
#endif /* Optimizing GCC >=2. */
-#if defined(__USE_SVID) || defined(__USE_XOPEN_EXTENDED)
+#if defined __USE_SVID || defined __USE_XOPEN_EXTENDED
/* Convert N to base 64 using the digits "./0-9A-Za-z", least-significant
digit first. Returns a pointer to static storage overwritten by the
next call. */
#endif
-#if defined(__USE_SVID) || defined(__USE_XOPEN)
+#if defined __USE_SVID || defined __USE_XOPEN
/* System V style 48-bit random number generator functions. */
/* Return non-negative, double-precision floating-point value in [0.0,1.0). */
extern void cfree __P ((__ptr_t __ptr));
#endif /* Use misc. */
-#if defined(__USE_GNU) || defined(__USE_BSD) || defined(__USE_MISC)
+#if defined __USE_GNU || defined __USE_BSD || defined __USE_MISC
#include <alloca.h>
#endif /* Use GNU, BSD, or misc. */
-#if defined(__USE_BSD) || defined(__USE_XOPEN_EXTENDED)
+#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED
/* Allocate SIZE bytes on a page boundary. The storage cannot be freed. */
extern __ptr_t valloc __P ((size_t __size));
#endif
programs is running with SUID or SGID enabled. */
extern char *__secure_getenv __P ((__const char *__name));
-#if defined(__USE_SVID) || defined(__USE_XOPEN)
+#if defined __USE_SVID || defined __USE_XOPEN
/* The SVID says this is in <stdio.h>, but this seems a better place. */
/* Put STRING, which is of the form "NAME=VALUE", in the environment.
If there is no `=', remove NAME from the environment. */
#endif
-#if defined(__USE_MISC) || defined(__USE_XOPEN_EXTENDED)
+#if defined __USE_MISC || defined __USE_XOPEN_EXTENDED
/* Generate a unique temporary file name from TEMPLATE.
The last six characters of TEMPLATE must be "XXXXXX";
they are replaced with a string that makes the file name unique.
extern char *canonicalize_file_name __P ((__const char *__name));
#endif
-#if defined(__USE_BSD) || defined(__USE_XOPEN_EXTENDED)
+#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED
/* Return the canonical absolute name of file NAME. The last file name
component need not exist, and may be a symlink to a nonexistent file.
If RESOLVED is null, the result is malloc'd; otherwise, if the canonical
#endif
-#if defined(__USE_SVID) || defined(__USE_XOPEN_EXTENDED)
+#if defined __USE_SVID || defined __USE_XOPEN_EXTENDED
/* Convert floating point numbers to strings. The returned values are
valid only until another call to the same function. */
by WCHAR in S, returning its length. */
extern int wctomb __P ((char *__s, wchar_t __wchar));
-#if defined (__OPTIMIZE__) && __GNUC__ >= 2
+#if defined __OPTIMIZE__ && __GNUC__ >= 2
extern __inline int mblen (__const char *__s, size_t __n)
{ return mbtowc ((wchar_t *) NULL, __s, __n); }
#endif /* Optimizing GCC >=2. */
# define CHAR_TYPE wint_t
# define L_(Ch) L##Ch
# define ISSPACE(Ch) iswspace (Ch)
+# define ISDIGIT(Ch) iswdigit (Ch)
+# define ISXDIGIT(Ch) iswxdigit (Ch)
# define TOLOWER(Ch) towlower (Ch)
# define STRNCASECMP(S1, S2, N) __wcsncasecmp ((S1), (S2), (N))
#else
# define CHAR_TYPE char
# define L_(Ch) Ch
# define ISSPACE(Ch) isspace (Ch)
+# define ISDIGIT(Ch) isdigit (Ch)
+# define ISXDIGIT(Ch) isxdigit (Ch)
# define TOLOWER(Ch) tolower (Ch)
# define STRNCASECMP(S1, S2, N) __strncasecmp ((S1), (S2), (N))
#endif
#define SWAP(x, y) ({ typeof(x) _tmp = x; x = y; y = _tmp; })
#define NDIG (MAX_10_EXP - MIN_10_EXP + 2 * MANT_DIG)
+#define HEXNDIG ((MAX_EXP - MIN_EXP + 7) / 8 + 2 * MANT_DIG)
#define RETURN_LIMB_SIZE howmany (MANT_DIG, BITS_PER_MP_LIMB)
#define RETURN(val,end) \
/* Number of digits for actual limb. */
int cnt = 0;
mp_limb_t low = 0;
- mp_limb_t base;
+ mp_limb_t start;
*nsize = 0;
assert (digcnt > 0);
low = 0;
}
- /* There might be thousands separators or radix characters in the string.
- But these all can be ignored because we know the format of the number
- is correct and we have an exact number of characters to read. */
+ /* There might be thousands separators or radix characters in
+ the string. But these all can be ignored because we know the
+ format of the number is correct and we have an exact number
+ of characters to read. */
while (*str < L_('0') || *str > L_('9'))
++str;
low = low * 10 + *str++ - L_('0');
if (*exponent > 0 && cnt + *exponent <= MAX_DIG_PER_LIMB)
{
low *= _tens_in_limb[*exponent];
- base = _tens_in_limb[cnt + *exponent];
+ start = _tens_in_limb[cnt + *exponent];
*exponent = 0;
}
else
- base = _tens_in_limb[cnt];
+ start = _tens_in_limb[cnt];
if (*nsize == 0)
{
else
{
mp_limb_t cy;
- cy = __mpn_mul_1 (n, n, *nsize, base);
+ cy = __mpn_mul_1 (n, n, *nsize, start);
cy += __mpn_add_1 (n, n, *nsize, low);
if (cy != 0)
n[(*nsize)++] = cy;
}
+
return str;
}
MPN_VAR (num); /* MP representation of the number. */
int exponent; /* Exponent of the number. */
+ /* Numbers starting `0X' or `0x' have to be processed with base 16. */
+ int base = 10;
+
/* When we have to compute fractional digits we form a fraction with a
second multi-precision number (and we sometimes need a second for
temporary results). */
RETURN (0.0, nptr);
}
+ /* First look whether we are faced with a hexadecimal number. */
+ if (c == L_('0') && TOLOWER (cp[1]) == L_('x'))
+ {
+ /* Okay, it is a hexa-decimal number. Remember this and skip
+ the characters. BTW: hexadecimal numbers must not be
+ grouped. */
+ base = 16;
+ cp += 2;
+ c = *cp;
+ grouping = NULL;
+ }
+
/* Record the start of the digits, in case we will check their grouping. */
start_of_digits = startp = cp;
/* If no other digit but a '0' is found the result is 0.0.
Return current read pointer. */
- if ((c < L_('0') || c > L_('9')) && (wint_t) c != decimal
- && TOLOWER (c) != L_('e'))
+ if ((c < L_('0') || c > L_('9')) &&
+ (base == 16 && (c < TOLOWER (L_('a')) || c > TOLOWER (L_('f')))) &&
+ (wint_t) c != decimal &&
+ (base == 16 && (cp == start_of_digits || TOLOWER (c) != L_('p'))) &&
+ (base != 16 && TOLOWER (c) != L_('e')))
{
tp = correctly_grouped_prefix (start_of_digits, cp, thousands, grouping);
/* If TP is at the start of the digits, there was no correctly
grouped prefix of the string; so no number found. */
- RETURN (0.0, tp == start_of_digits ? nptr : tp);
+ RETURN (0.0, tp == start_of_digits ? (base == 16 ? cp - 1 : nptr) : tp);
}
/* Remember first significant digit and read following characters until the
decimal point, exponent character or any non-FP number character. */
startp = cp;
dig_no = 0;
- while (dig_no < NDIG ||
+ while (dig_no < (base == 16 ? HEXNDIG : NDIG) ||
/* If parsing grouping info, keep going past useful digits
so we can check all the grouping separators. */
grouping)
{
- if (c >= L_('0') && c <= L_('9'))
+ if ((c >= L_('0') && c <= L_('9'))
+ || (base == 16 && TOLOWER (c) >= L_('a') && TOLOWER (c) <= L_('f')))
++dig_no;
else if (thousands == L'\0' || (wint_t) c != thousands)
/* Not a digit or separator: end of the integer part. */
}
}
- if (dig_no >= NDIG)
+ if (dig_no >= (base == 16 ? HEXNDIG : NDIG))
/* Too many digits to be representable. Assigning this to EXPONENT
allows us to read the full number but return HUGE_VAL after parsing. */
exponent = MAX_10_EXP;
if ((wint_t) c == decimal)
{
c = *++cp;
- while (c >= L_('0') && c <= L_('9'))
+ while (c >= L_('0') && c <= L_('9') ||
+ (base == 16 && TOLOWER (c) >= L_('a') && TOLOWER (c) <= L_('f')))
{
if (c != L_('0') && lead_zero == -1)
lead_zero = dig_no - int_no;
expp = cp;
/* Read exponent. */
- if (TOLOWER (c) == L_('e'))
+ if (TOLOWER (c) == (base == 16 ? L_('p') : L_('e')))
{
int exp_negative = 0;
int exp_limit;
/* Get the exponent limit. */
- exp_limit = exp_negative ?
- -MIN_10_EXP + MANT_DIG - int_no :
- MAX_10_EXP - int_no + lead_zero;
+ if (base == 16)
+ exp_limit = (exp_negative ?
+ -MIN_EXP + MANT_DIG - 4 * int_no :
+ MAX_EXP - 4 * int_no + lead_zero);
+ else
+ exp_limit = (exp_negative ?
+ -MIN_10_EXP + MANT_DIG - int_no :
+ MAX_10_EXP - int_no + lead_zero);
do
{
/* The exponent is too large/small to represent a valid
number. */
{
- FLOAT retval;
+ FLOAT result;
/* Overflow or underflow. */
__set_errno (ERANGE);
- retval = (exp_negative ? 0.0 :
+ result = (exp_negative ? 0.0 :
negative ? -FLOAT_HUGE_VAL : FLOAT_HUGE_VAL);
/* Accept all following digits as part of the exponent. */
++cp;
while (*cp >= L_('0') && *cp <= L_('9'));
- RETURN (retval, cp);
+ RETURN (result, cp);
/* NOTREACHED */
}
while ((wint_t) *startp != decimal)
++startp;
startp += lead_zero + 1;
- exponent -= lead_zero;
+ exponent -= base == 16 ? 4 * lead_zero : lead_zero;
dig_no -= lead_zero;
}
+ /* If the BASE is 16 we can use a simpler algorithm. */
+ if (base == 16)
+ {
+ static const int nbits[16] = { 0, 1, 2, 2, 3, 3, 3, 3,
+ 4, 4, 4, 4, 4, 4, 4, 4 };
+ int idx = (MANT_DIG - 1) / BITS_PER_MP_LIMB;
+ int pos = (MANT_DIG - 1) % BITS_PER_MP_LIMB;
+ mp_limb_t val;
+
+ while (!ISXDIGIT (*startp))
+ ++startp;
+ if (ISDIGIT (*startp))
+ val = *startp++ - L_('0');
+ else
+ val = 10 + TOLOWER (*startp++) - L_('a');
+ bits = nbits[val];
+
+ if (pos + 1 >= 4)
+ {
+ /* We don't have to care for wrapping. This is the normal
+ case so we add this optimization. */
+ retval[idx] = val << (pos - bits + 1);
+ pos -= bits;
+ }
+ else
+ {
+ if (pos + 1 >= bits)
+ {
+ retval[idx] = val << (pos - bits + 1);
+ pos -= bits;
+ }
+ else
+ {
+ retval[idx--] = val >> (bits - pos - 1);
+ retval[idx] = val << (BITS_PER_MP_LIMB - (bits - pos - 1));
+ pos = BITS_PER_MP_LIMB - 1 - (bits - pos - 1);
+ }
+ }
+
+ while (--dig_no > 0 && idx >= 0)
+ {
+ while (!ISXDIGIT (*startp))
+ ++startp;
+ if (ISDIGIT (*startp))
+ val = *startp++ - L_('0');
+ else
+ val = 10 + TOLOWER (*startp++) - L_('a');
+
+ if (pos + 1 >= 4)
+ {
+ retval[idx] |= val << (pos - 4 + 1);
+ pos -= 4;
+ }
+ else
+ {
+ retval[idx--] |= val >> (4 - pos - 1);
+ val <<= BITS_PER_MP_LIMB - (4 - pos - 1);
+ if (idx < 0)
+ return round_and_return (retval, exponent, negative, val,
+ BITS_PER_MP_LIMB - 1, dig_no > 0);
+
+ retval[idx] = val;
+ pos = BITS_PER_MP_LIMB - 1 - (4 - pos - 1);
+ }
+ }
+
+ /* We ran out of digits. */
+ MPN_ZERO (retval, idx);
+
+ return round_and_return (retval, exponent, negative, 0, 0, 0);
+ }
+
/* Now we have the number of digits in total and the integer digits as well
as the exponent and its sign. We can decide whether the read digits are
really integer digits or belong to the fractional part; i.e. we normalize
123e-2 to 1.23. */
{
- register int incr = exponent < 0 ? MAX (-int_no, exponent)
- : MIN (dig_no - int_no, exponent);
+ register int incr = (exponent < 0 ? MAX (-int_no, exponent)
+ : MIN (dig_no - int_no, exponent));
int_no += incr;
exponent -= incr;
}
mp_limb_t cy;
exponent ^= expbit;
- /* FIXME: not the whole multiplication has to be done.
- If we have the needed number of bits we only need the
- information whether more non-zero bits follow. */
+ /* FIXME: not the whole multiplication has to be
+ done. If we have the needed number of bits we
+ only need the information whether more non-zero
+ bits follow. */
if (numsize >= ttab->arraysize - _FPIO_CONST_OFFSET)
cy = __mpn_mul (pdest, psrc, numsize,
&ttab->array[_FPIO_CONST_OFFSET],
assert (dig_no > int_no && exponent <= 0);
- /* For the fractional part we need not process too much digits. One
+ /* For the fractional part we need not process too many digits. One
decimal digits gives us log_2(10) ~ 3.32 bits. If we now compute
ceil(BITS / 3) =: N
digits we should have enough bits for the result. The remaining
for (i = RETURN_LIMB_SIZE; i > empty; --i)
retval[i] = retval[i - empty];
#endif
+#if RETURN_LIMB_SIZE > 1
retval[1] = 0;
+#endif
for (i = numsize; i > 0; --i)
num[i + empty] = num[i - 1];
MPN_ZERO (num, empty + 1);
or NULL if C was not found in the first N bytes of SRC. */
extern __ptr_t __memccpy __P ((__ptr_t __dest, __const __ptr_t __src,
int __c, size_t __n));
-#if defined (__USE_SVID) || defined (__USE_BSD) || defined (__USE_XOPEN)
+#if defined __USE_SVID || defined __USE_BSD || defined __USE_XOPEN
extern __ptr_t memccpy __P ((__ptr_t __dest, __const __ptr_t __src,
int __c, size_t __n));
#endif /* SVID. */
__locale_t __l));
#endif
-#if defined(__USE_SVID) || defined(__USE_BSD) || defined(__USE_XOPEN_EXTENDED)
+#if defined __USE_SVID || defined __USE_BSD || defined __USE_XOPEN_EXTENDED
/* Duplicate S, returning an identical malloc'd string. */
extern char *__strdup __P ((__const char *__s));
extern char *strdup __P ((__const char *__s));
resultant string is terminated even if no null terminator
appears before STRING[N]. */
extern char *__strndup __P ((__const char *__string, size_t __n));
-#if defined(__USE_GNU)
+#if defined __USE_GNU
extern char *strndup __P ((__const char *__string, size_t __n));
#endif
-#if defined (__USE_GNU) && defined (__GNUC__)
+#if defined __USE_GNU && defined __GNUC__
/* Duplicate S, returning an identical alloca'd string. */
#define strdupa(s) \
(__extension__ \
extern char *strerror_r __P ((int __errnum, char *__buf, size_t __buflen));
#endif
-#if defined(__USE_BSD) || defined(__USE_XOPEN_EXTENDED)
+#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED
/* Copy N bytes of SRC to DEST (like memmove, but args reversed). */
extern void bcopy __P ((__const __ptr_t __src, __ptr_t __dest, size_t __n));
$(rpcsvc:%=rpcsvc/%)
install-others = $(inst_sysconfdir)/rpc
generated = $(rpcsvc:%.x=rpcsvc/%.h) $(rpcsvc:%.x=x%.c) \
- $(rpcsvc:%.x=rpcsvc/%.stmp) $(rpcsvc:%.x=x%.stmp)
+ $(rpcsvc:%.x=rpcsvc/%.stmp) $(rpcsvc:%.x=x%.stmp) \
+ rpc-proto.c
routines := auth_none auth_unix authuxprot bindrsvprt \
clnt_gen clnt_perr clnt_raw clnt_simp clnt_tcp \
# The generated source files depend on the corresponding generated headers.
# Gratuitous dependency on generated .c file here just gets it mentioned to
# avoid being an intermediate file and getting removed.
-$(rpcsvc:%.x=$(objpfx)x%.o): $(objpfx)x%.o: $(objpfx)x%.c $(objpfx)rpcsvc/%.h
+$(rpcsvc:%.x=$(objpfx)x%.o): $(objpfx)x%.o: $(objpfx)x%.c $(objpfx)rpcsvc/%.h \
+ $(objpfx)rpc-proto.d
+
+ifndef no_deps
+-include $(objpfx)rpc-proto.d
+endif
+
+$(objpfx)rpc-proto.d: $(objpfx)%.d: $(objpfx)%.c
+ $(+make-deps)
+# Special file to generate dependencies for the RPC service objects.
+# Collect all include directives from the source files.
+$(objpfx)rpc-proto.c: $(rpcsvc:%=rpcsvc/%)
+ { echo '#include <rpc/types.h>'; \
+ echo '#include <rpc/xdr.h>'; \
+ echo '#include <rpc/rpc.h>'; \
+ sed -n '/^%#include/s/%//p' $^; } > $@T
+ mv -f $@T $@
mv $@-tmp $@
$(common-objpfx)det_endian: $(sysdep_dir)/generic/det_endian.c
- $(native-compile)
+ $(common-objdir-compile)
before-compile := $(before-compile) $(common-objpfx)bytesex.h
common-generated := $(common-generated) bytesex.h det_endian
$(dir $<)$(notdir $<) > $@-tmp
mv $@-tmp $@
+make_siglist-CFLAGS = -DSIGNUM_H=\"$(shell pwd)/$(firstword $(wildcard \
+ $(+sysdep_dirs:%=%/signum.h)))\"
$(objpfx)make_siglist: $(sysdep_dir)/generic/make_siglist.c
- $(make-target-directory)
- signum_h=`cd $(dir $(firstword $(wildcard \
- $(+sysdep_dirs:%=%/signum.h)))); pwd`/signum.h; \
- $(native-compile) \
- -DSIGNUM_H=\"$${signum_h}\"
+ $(native-compile)
generated := $(generated) make_siglist siglist.c
endif
-/* Copyright (C) 1993, 1994, 1995, 1996 Free Software Foundation, Inc.
-This file is part of the GNU C Library.
+/* Copyright (C) 1993, 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
-The GNU C Library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Library General Public License as
-published by the Free Software Foundation; either version 2 of the
-License, or (at your option) any later version.
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
-The GNU C Library 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
-Library General Public License for more details.
+ The GNU C Library 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
+ Library General Public License for more details.
-You should have received a copy of the GNU Library General Public
-License along with the GNU C Library; see the file COPYING.LIB. If
-not, write to the Free Software Foundation, Inc., 675 Mass Ave,
-Cambridge, MA 02139, USA. */
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
#include "gmp.h"
#include "gmp-impl.h"
-/* Copyright (C) 1995, 1996 Free Software Foundation, Inc.
-This file is part of the GNU C Library.
+/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
-The GNU C Library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Library General Public License as
-published by the Free Software Foundation; either version 2 of the
-License, or (at your option) any later version.
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
-The GNU C Library 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
-Library General Public License for more details.
+ The GNU C Library 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
+ Library General Public License for more details.
-You should have received a copy of the GNU Library General Public
-License along with the GNU C Library; see the file COPYING.LIB. If
-not, write to the Free Software Foundation, Inc., 675 Mass Ave,
-Cambridge, MA 02139, USA. */
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
#include "gmp.h"
#include "gmp-impl.h"
-/* Copyright (C) 1995, 1996 Free Software Foundation, Inc.
-This file is part of the GNU C Library.
-
-The GNU C Library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Library General Public License as
-published by the Free Software Foundation; either version 2 of the
-License, or (at your option) any later version.
-
-The GNU C Library 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
-Library General Public License for more details.
-
-You should have received a copy of the GNU Library General Public
-License along with the GNU C Library; see the file COPYING.LIB. If
-not, write to the Free Software Foundation, Inc., 675 Mass Ave,
-Cambridge, MA 02139, USA. */
+/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
#include "gmp.h"
#include "gmp-impl.h"
-/* Copyright (C) 1995 Free Software Foundation, Inc.
-This file is part of the GNU C Library.
+/* Copyright (C) 1995, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
-The GNU C Library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Library General Public License as
-published by the Free Software Foundation; either version 2 of the
-License, or (at your option) any later version.
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
-The GNU C Library 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
-Library General Public License for more details.
+ The GNU C Library 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
+ Library General Public License for more details.
-You should have received a copy of the GNU Library General Public
-License along with the GNU C Library; see the file COPYING.LIB. If
-not, write to the Free Software Foundation, Inc., 675 Mass Ave,
-Cambridge, MA 02139, USA. */
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
#include "gmp.h"
#include "gmp-impl.h"
/* Convert a multi-precision integer of the needed number of bits (24 for
float) and an integral power of two to a `float' in IEEE754 single-
- precision format. */
+ precision format. */
float
__mpn_construct_float (mp_srcptr frac_ptr, int expt, int sign)
{
union ieee754_float u;
-
+
u.ieee.negative = sign;
u.ieee.exponent = expt + IEEE754_FLOAT_BIAS;
#if BITS_PER_MP_LIMB > FLT_MANT_DIG
-/* Copyright (C) 1995, 1996 Free Software Foundation, Inc.
-This file is part of the GNU C Library.
-
-The GNU C Library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Library General Public License as
-published by the Free Software Foundation; either version 2 of the
-License, or (at your option) any later version.
-
-The GNU C Library 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
-Library General Public License for more details.
-
-You should have received a copy of the GNU Library General Public
-License along with the GNU C Library; see the file COPYING.LIB. If
-not, write to the Free Software Foundation, Inc., 675 Mass Ave,
-Cambridge, MA 02139, USA. */
+/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
#include "gmp.h"
#include "gmp-impl.h"
--- /dev/null
+/* Return positive difference between arguments.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include <math.h>
+
+double
+__fdim (double x, double y)
+{
+ int clsx = fpclassify (x);
+ int clsy = fpclassify (y);
+
+ if (clsx == FP_NAN || clsy == FP_NAN
+ || (y < 0 && clsx == FP_INFINITE && clsy == FP_INFINITE))
+ /* Raise invalid flag. */
+ return x - y;
+
+ return x < y ? 0 : x - y;
+}
+weak_alias (__fdim, fdim)
--- /dev/null
+/* Return positive difference between arguments.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include <math.h>
+
+float
+__fdimf (float x, float y)
+{
+ int clsx = fpclassify (x);
+ int clsy = fpclassify (y);
+
+ if (clsx == FP_NAN || clsy == FP_NAN
+ || (y < 0 && clsx == FP_INFINITE && clsy == FP_INFINITE))
+ /* Raise invalid flag. */
+ return x - y;
+
+ return x < y ? 0 : x - y;
+}
+weak_alias (__fdimf, fdimf)
--- /dev/null
+/* Return positive difference between arguments.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include <math.h>
+
+long double
+__fdiml (long double x, long double y)
+{
+ int clsx = fpclassify (x);
+ int clsy = fpclassify (y);
+
+ if (clsx == FP_NAN || clsy == FP_NAN
+ || (y < 0 && clsx == FP_INFINITE && clsy == FP_INFINITE))
+ /* Raise invalid flag. */
+ return x - y;
+
+ return x < y ? 0 : x - y;
+}
+weak_alias (__fdiml, fdiml)
--- /dev/null
+/* Return maximum numeric value of X and Y.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include <math.h>
+
+
+double
+__fmax (double x, double y)
+{
+ return (isgreaterequal (x, y) || isnan (y)) ? x : y;
+}
+weak_alias (__fmax, fmax)
--- /dev/null
+/* Return maximum numeric value of X and Y.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include <math.h>
+
+
+float
+__fmaxf (float x, float y)
+{
+ return (isgreaterequal (x, y) || isnan (y)) ? x : y;
+}
+weak_alias (__fmaxf, fmaxf)
--- /dev/null
+/* Return maximum numeric value of X and Y.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include <math.h>
+
+
+long double
+__fmaxl (long double x, long double y)
+{
+ return (isgreaterequal (x, y) || isnan (y)) ? x : y;
+}
+weak_alias (__fmaxl, fmaxl)
--- /dev/null
+/* Return minimum numeric value of X and Y.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include <math.h>
+
+
+double
+__fmin (double x, double y)
+{
+ return (islessequal (x, y) || isnan (y)) ? x : y;
+}
+weak_alias (__fmin, fmin)
--- /dev/null
+/* Return minimum numeric value of X and Y.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include <math.h>
+
+
+float
+__fminf (float x, float y)
+{
+ return (islessequal (x, y) || isnan (y)) ? x : y;
+}
+weak_alias (__fminf, fminf)
--- /dev/null
+/* Return minimum numeric value of X and Y.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include <math.h>
+
+
+long double
+__fminl (long double x, long double y)
+{
+ return (islessequal (x, y) || isnan (y)) ? x : y;
+}
+weak_alias (__fminl, fminl)
--- /dev/null
+/* Return classification value corresponding to argument.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include <math.h>
+
+#include "math_private.h"
+
+
+int
+__fpclassify (double x)
+{
+ u_int32_t hx, lx;
+ int retval = FP_NORMAL;
+
+ GET_WORDS (hx, lx, x);
+ lx |= hx & 0xfffff;
+ hx &= 0x7ff00000;
+ if ((hx | lx) == 0)
+ retval = FP_ZERO;
+ else if (hx == 0)
+ retval = FP_SUBNORMAL;
+ else if (hx == 0x7ff00000)
+ retval = lx != 0 ? FP_NAN : FP_INFINITE;
+
+ return retval;
+}
--- /dev/null
+/* Return classification value corresponding to argument.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include <math.h>
+
+#include "math_private.h"
+
+
+int
+__fpclassifyf (float x)
+{
+ u_int32_t wx;
+ int retval = FP_NORMAL;
+
+ GET_FLOAT_WORD (wx, x);
+ wx &= 0x7fffffff;
+ if (wx == 0)
+ retval = FP_ZERO;
+ else if (wx < 0x1000000)
+ retval = FP_SUBNORMAL;
+ else if (wx == 0x7f000000)
+ retval = wx > 0x7f000000 ? FP_NAN : FP_INFINITE;
+
+ return retval;
+}
--- /dev/null
+/* Return classification value corresponding to argument.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include <math.h>
+
+#include "math_private.h"
+
+
+int
+__fpclassifyl (long double x)
+{
+ u_int32_t ex, hx, lx;
+ int retval = FP_NORMAL;
+
+ GET_LDOUBLE_WORDS (ex, hx, lx, x);
+ hx |= lx;
+ ex &= 0x7fff;
+ if ((ex | hx) == 0)
+ retval = FP_ZERO;
+ else if (ex == 0)
+ retval = FP_SUBNORMAL;
+ else if (ex == 0x7fff)
+ retval = hx != 0 ? FP_NAN : FP_INFINITE;
+
+ return retval;
+}
--- /dev/null
+/* Return nonzero value if number is negative.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include <math.h>
+
+#include "math_private.h"
+
+int
+__signbit (double x)
+{
+ int32_t hx;
+
+ GET_HIGH_WORD (hx, x);
+ return hx & 0x80000000;
+}
--- /dev/null
+/* Return nonzero value if number is negative.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include <math.h>
+
+#include "math_private.h"
+
+int
+__signbitf (float x)
+{
+ int32_t hx;
+
+ GET_FLOAT_WORD (hx, x);
+ return hx & 0x80000000;
+}
--- /dev/null
+/* Return nonzero value if number is negative.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include <math.h>
+
+#include "math_private.h"
+
+int
+__signbitl (long double x)
+{
+ int32_t e;
+
+ GET_LDOUBLE_EXP (e, x);
+ return e & 0x8000;
+}
-/* Copyright (C) 1991, 92, 93, 94, 96 Free Software Foundation, Inc.
-This file is part of the GNU C Library.
+/* Definitions of inline math functions implemented by the m68881/2.
+ Copyright (C) 1991, 92, 93, 94, 96, 97 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
-The GNU C Library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Library General Public License as
-published by the Free Software Foundation; either version 2 of the
-License, or (at your option) any later version.
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
-The GNU C Library 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
-Library General Public License for more details.
+ The GNU C Library 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
+ Library General Public License for more details.
-You should have received a copy of the GNU Library General Public
-License along with the GNU C Library; see the file COPYING.LIB. If
-not, write to the Free Software Foundation, Inc., 675 Mass Ave,
-Cambridge, MA 02139, USA. */
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
#ifdef __GNUC__
#include <sys/cdefs.h>
-#ifdef __NO_M81_MATH_INLINES
+#ifdef __LIBC_M81_MATH_INLINES
/* This is used when defining the functions themselves. Define them with
__ names, and with `static inline' instead of `extern inline' so the
bodies will always be used, never an external function call. */
/* Define a const math function. */
#define __m81_defun(rettype, func, args) \
- __m81_inline rettype \
- __m81_u(func) args __attribute__((__const__)); \
- __m81_inline rettype \
+ __m81_inline rettype __attribute__((__const__)) \
__m81_u(func) args
/* Define the three variants of a math function that has a direct
implementation in the m68k fpu. FUNC is the name for C (which will be
suffixed with f and l for the float and long double version, resp). OP
is the name of the fpu operation (without leading f). */
-#define __inline_mathop(func, op) \
- __m81_defun (double, func, (double __mathop_x)) \
- { \
- double __result; \
- __asm("f" __STRING(op) "%.x %1, %0" : "=f" (__result) : "f" (__mathop_x));\
- return __result; \
- } \
- __m81_defun (float, func##f, (float __mathop_x)) \
- { \
- float __result; \
- __asm("f" __STRING(op) "%.x %1, %0" : "=f" (__result) : "f" (__mathop_x));\
- return __result; \
- } \
- __m81_defun (long double, func##l, (long double __mathop_x)) \
+
+#ifdef __USE_MISC
+#define __inline_mathop(func, op) \
+ __inline_mathop1(double, func, op) \
+ __inline_mathop1(float, __CONCAT(func,f), op) \
+ __inline_mathop1(long double, __CONCAT(func,l), op)
+#else
+#define __inline_mathop(func, op) \
+ __inline_mathop1(double, func, op)
+#endif
+
+#define __inline_mathop1(float_type,func, op) \
+ __m81_defun (float_type, func, (float_type __mathop_x)) \
{ \
- long double __result; \
+ float_type __result; \
__asm("f" __STRING(op) "%.x %1, %0" : "=f" (__result) : "f" (__mathop_x));\
return __result; \
}
+#ifdef __LIBC_M81_MATH_INLINES
/* ieee style elementary functions */
+/* These are internal to the implementation of libm. */
__inline_mathop(__ieee754_acos, acos)
__inline_mathop(__ieee754_asin, asin)
__inline_mathop(__ieee754_cosh, cosh)
__inline_mathop(__ieee754_log, logn)
__inline_mathop(__ieee754_sqrt, sqrt)
__inline_mathop(__ieee754_atanh, atanh)
+#endif
__inline_mathop(__atan, atan)
__inline_mathop(__cos, cos)
__inline_mathop(__logb, log2)
__inline_mathop(__significand, getman)
+#if !defined __NO_MATH_INLINES && defined __OPTIMIZE__
+
+__inline_mathop(atan, atan)
+__inline_mathop(cos, cos)
+__inline_mathop(sin, sin)
+__inline_mathop(tan, tan)
+__inline_mathop(tanh, tanh)
+__inline_mathop(fabs, abs)
+__inline_mathop(sqrt, sqrt)
+
+#if defined(__USE_MISC) || defined(__USE_XOPEN_EXTENDED)
+__inline_mathop(rint, int)
+__inline_mathop(expm1, etoxm1)
+__inline_mathop(log1p, lognp1)
+__inline_mathop(logb, log2)
+#endif
+
+#ifdef __USE_MISC
+__inline_mathop(significand, getman)
+#endif
+
+#endif /* !__NO_MATH_INLINES && __OPTIMIZE__ */
+
/* This macro contains the definition for the rest of the inline
functions, using __FLOAT_TYPE as the domain type and __S as the suffix
for the function names. */
-#define __inline_functions(__float_type, __s) \
-__m81_defun (__float_type, \
- __ieee754_remainder##__s, (__float_type __x, __float_type __y)) \
+#ifdef __LIBC_M81_MATH_INLINES
+/* Internally used functions. */
+#define __internal_inline_functions(float_type, s) \
+__m81_defun (float_type, __CONCAT(__ieee754_remainder,s), \
+ (float_type __x, float_type __y)) \
{ \
- __float_type __result; \
+ float_type __result; \
__asm("frem%.x %1, %0" : "=f" (__result) : "f" (__y), "0" (__x)); \
return __result; \
} \
\
-__m81_defun (__float_type, \
- __ieee754_fmod##__s, (__float_type __x, __float_type __y)) \
+__m81_defun (float_type, __CONCAT(__ieee754_fmod,s), \
+ (float_type __x, float_type __y)) \
{ \
- __float_type __result; \
+ float_type __result; \
__asm("fmod%.x %1, %0" : "=f" (__result) : "f" (__y), "0" (__x)); \
return __result; \
} \
\
-__m81_defun (__float_type, \
- __ieee754_atan2##__s, (__float_type __y, __float_type __x)) \
+__m81_defun (float_type, __CONCAT(__ieee754_atan2,s), \
+ (float_type __y, float_type __x)) \
{ \
- __float_type __pi, __pi_2; \
+ float_type __pi, __pi_2; \
\
__asm ("fmovecr%.x %#0, %0" : "=f" (__pi)); \
__asm ("fscale%.w %#-1, %0" : "=f" (__pi_2) : "0" (__pi)); \
if (__y > 0) \
{ \
if (__x > __y) \
- return __m81_u(__atan##__s) (__y / __x); \
+ return __m81_u(__CONCAT(__atan,s)) (__y / __x); \
else \
- return __pi_2 - __m81_u(__atan##__s) (__x / __y); \
+ return __pi_2 - __m81_u(__CONCAT(__atan,s)) (__x / __y); \
} \
else \
{ \
if (__x > -__y) \
- return __m81_u(__atan##__s) (__y / __x); \
+ return __m81_u(__CONCAT(__atan,s)) (__y / __x); \
else \
- return -__pi_2 - __m81_u(__atan##__s) (__x / __y); \
+ return -__pi_2 - __m81_u(__CONCAT(__atan,s)) (__x / __y); \
} \
} \
else \
if (__y > 0) \
{ \
if (-__x < __y) \
- return __pi + __m81_u(__atan##__s) (__y / __x); \
+ return __pi + __m81_u(__CONCAT(__atan,s)) (__y / __x); \
else \
- return __pi_2 - __m81_u(__atan##__s) (__x / __y); \
+ return __pi_2 - __m81_u(__CONCAT(__atan,s)) (__x / __y); \
} \
else \
{ \
if (-__x > -__y) \
- return -__pi + __m81_u(__atan##__s) (__y / __x); \
+ return -__pi + __m81_u(__CONCAT(__atan,s)) (__y / __x); \
else \
- return -__pi_2 - __m81_u(__atan##__s) (__x / __y); \
+ return -__pi_2 - __m81_u(__CONCAT(__atan,s)) (__x / __y); \
} \
} \
} \
\
-__m81_inline __float_type \
-__m81_u(__frexp##__s)(__float_type __value, int *__expptr) \
-{ \
- __float_type __mantissa, __exponent; \
- int __iexponent; \
- if (__value == 0.0) \
- { \
- *__expptr = 0; \
- return __value; \
- } \
- __asm("fgetexp%.x %1, %0" : "=f" (__exponent) : "f" (__value)); \
- __iexponent = (int) __exponent + 1; \
- *__expptr = __iexponent; \
- __asm("fscale%.l %2, %0" : "=f" (__mantissa) \
- : "0" (__value), "dmi" (-__iexponent)); \
- return __mantissa; \
-} \
- \
-__m81_defun (__float_type, __floor##__s, (__float_type __x)) \
-{ \
- __float_type __result; \
- unsigned long int __ctrl_reg; \
- __asm __volatile__ ("fmove%.l %!, %0" : "=dm" (__ctrl_reg)); \
- /* Set rounding towards negative infinity. */ \
- __asm __volatile__ ("fmove%.l %0, %!" : /* No outputs. */ \
- : "dmi" ((__ctrl_reg & ~0x10) | 0x20)); \
- /* Convert X to an integer, using -Inf rounding. */ \
- __asm __volatile__ ("fint%.x %1, %0" : "=f" (__result) : "f" (__x)); \
- /* Restore the previous rounding mode. */ \
- __asm __volatile__ ("fmove%.l %0, %!" : /* No outputs. */ \
- : "dmi" (__ctrl_reg)); \
- return __result; \
-} \
- \
-__m81_defun (__float_type, \
- __ieee754_pow##__s, (__float_type __x, __float_type __y)) \
+__m81_defun (float_type, __CONCAT(__ieee754_pow,s), \
+ (float_type __x, float_type __y)) \
{ \
- __float_type __result; \
+ float_type __result; \
if (__x == 0.0) \
{ \
if (__y <= 0.0) \
__asm("ftwotox%.x %1, %0" : "=f" (__result) : "f" (__y)); \
else if (__x < 0.0) \
{ \
- __float_type __temp = __m81_u (__rint##__s) (__y); \
+ float_type __temp = __m81_u (__CONCAT(__rint,s)) (__y); \
if (__y == __temp) \
{ \
int __i = (int) __y; \
- __result = (__m81_u(__ieee754_exp##__s) \
- (__y * __m81_u(__ieee754_log##__s) (-__x))); \
+ __result = (__m81_u(__CONCAT(__ieee754_exp,s)) \
+ (__y * __m81_u(__CONCAT(__ieee754_log,s)) (-__x))); \
if (__i & 1) \
__result = -__result; \
} \
__result = 0.0 / 0.0; \
} \
else \
- __result = (__m81_u(__ieee754_exp##__s) \
- (__y * __m81_u(__ieee754_log##__s) (__x))); \
+ __result = (__m81_u(__CONCAT(__ieee754_exp,s)) \
+ (__y * __m81_u(__CONCAT(__ieee754_log,s)) (__x))); \
return __result; \
} \
\
-__m81_defun (__float_type, __ceil##__s, (__float_type __x)) \
+__m81_defun (float_type, __CONCAT(__ieee754_scalb,s), \
+ (float_type __x, float_type __n)) \
{ \
- __float_type __result; \
+ float_type __result; \
+ __asm ("fscale%.x %1, %0" : "=f" (__result) : "f" (__n), "0" (__x)); \
+ return __result; \
+}
+
+__internal_inline_functions (double,)
+__internal_inline_functions (float,f)
+__internal_inline_functions (long double,l)
+#undef __internal_inline_functions
+
+#endif /* __LIBC_M81_MATH_INLINES */
+
+/* The rest of the functions are available to the user. */
+
+#define __inline_functions(float_type, s) \
+__m81_inline float_type \
+__m81_u(__CONCAT(__frexp,s))(float_type __value, int *__expptr) \
+{ \
+ float_type __mantissa, __exponent; \
+ int __iexponent; \
+ if (__value == 0.0) \
+ { \
+ *__expptr = 0; \
+ return __value; \
+ } \
+ __asm("fgetexp%.x %1, %0" : "=f" (__exponent) : "f" (__value)); \
+ __iexponent = (int) __exponent + 1; \
+ *__expptr = __iexponent; \
+ __asm("fscale%.l %2, %0" : "=f" (__mantissa) \
+ : "0" (__value), "dmi" (-__iexponent)); \
+ return __mantissa; \
+} \
+ \
+__m81_defun (float_type, __CONCAT(__floor,s), (float_type __x)) \
+{ \
+ float_type __result; \
+ unsigned long int __ctrl_reg; \
+ __asm __volatile__ ("fmove%.l %!, %0" : "=dm" (__ctrl_reg)); \
+ /* Set rounding towards negative infinity. */ \
+ __asm __volatile__ ("fmove%.l %0, %!" : /* No outputs. */ \
+ : "dmi" ((__ctrl_reg & ~0x10) | 0x20)); \
+ /* Convert X to an integer, using -Inf rounding. */ \
+ __asm __volatile__ ("fint%.x %1, %0" : "=f" (__result) : "f" (__x)); \
+ /* Restore the previous rounding mode. */ \
+ __asm __volatile__ ("fmove%.l %0, %!" : /* No outputs. */ \
+ : "dmi" (__ctrl_reg)); \
+ return __result; \
+} \
+ \
+__m81_defun (float_type, __CONCAT(__ceil,s), (float_type __x)) \
+{ \
+ float_type __result; \
unsigned long int __ctrl_reg; \
__asm __volatile__ ("fmove%.l %!, %0" : "=dm" (__ctrl_reg)); \
/* Set rounding towards positive infinity. */ \
return __result; \
} \
\
-__m81_inline __float_type \
-__m81_u(__modf##__s)(__float_type __value, __float_type *__iptr) \
+__m81_inline float_type \
+__m81_u(__CONCAT(__modf,s))(float_type __value, float_type *__iptr) \
{ \
- __float_type __modf_int; \
+ float_type __modf_int; \
__asm ("fintrz%.x %1, %0" : "=f" (__modf_int) : "f" (__value)); \
*__iptr = __modf_int; \
return __value - __modf_int; \
} \
\
-__m81_defun (int, __isinf##__s, (__float_type __value)) \
+__m81_defun (int, __CONCAT(__isinf,s), (float_type __value)) \
{ \
/* There is no branch-condition for infinity, \
so we must extract and examine the condition codes manually. */ \
return (__fpsr & (2 << 24)) ? (__fpsr & (8 << 24) ? -1 : 1) : 0; \
} \
\
-__m81_defun (int, __isnan##__s, (__float_type __value)) \
+__m81_defun (int, __CONCAT(__isnan,s), (float_type __value)) \
{ \
char __result; \
__asm("ftst%.x %1\n" \
return __result; \
} \
\
-__m81_defun (int, __finite##__s, (__float_type __value)) \
+__m81_defun (int, __CONCAT(__finite,s), (float_type __value)) \
{ \
/* There is no branch-condition for infinity, so we must extract and \
examine the condition codes manually. */ \
return (__fpsr & (3 << 24)) == 0; \
} \
\
-__m81_defun (int, __ilogb##__s, (__float_type __x)) \
+__m81_defun (int, __CONCAT(__ilogb,s), (float_type __x)) \
{ \
- __float_type __result; \
+ float_type __result; \
if (__x == 0.0) \
return 0x80000001; \
__asm("fgetexp%.x %1, %0" : "=f" (__result) : "f" (__x)); \
return (int) __result; \
} \
\
-__m81_defun (__float_type, \
- __ieee754_scalb##__s, (__float_type __x, __float_type __n)) \
+__m81_defun (float_type, __CONCAT(__scalbn,s), (float_type __x, int __n)) \
{ \
- __float_type __result; \
- __asm ("fscale%.x %1, %0" : "=f" (__result) : "f" (__n), "0" (__x)); \
- return __result; \
-} \
- \
-__m81_defun (__float_type, __scalbn##__s, (__float_type __x, int __n)) \
-{ \
- __float_type __result; \
+ float_type __result; \
__asm ("fscale%.l %1, %0" : "=f" (__result) : "dmi" (__n), "0" (__x)); \
return __result; \
}
/* This defines the three variants of the inline functions. */
-__inline_functions (double, )
-__inline_functions (float, f)
-__inline_functions (long double, l)
+__inline_functions (double,)
+__inline_functions (float,f)
+__inline_functions (long double,l)
#undef __inline_functions
+#if !defined __NO_MATH_INLINES && defined __OPTIMIZE__
+
+/* Define inline versions of the user visible functions. */
+
+#define __inline_forward_c(rettype, name, args1, args2) \
+extern __inline rettype __attribute__((__const__)) \
+name args1 \
+{ \
+ return __CONCAT(__,name) args2; \
+}
+
+#define __inline_forward(rettype, name, args1, args2) \
+extern __inline rettype name args1 \
+{ \
+ return __CONCAT(__,name) args2; \
+}
+
+__inline_forward(double,frexp, (double __value, int *__expptr),
+ (__value, __expptr))
+__inline_forward_c(double,floor, (double __x), (__x))
+__inline_forward_c(double,ceil, (double __x), (__x))
+__inline_forward(double,modf, (double __value, double *__iptr),
+ (__value, __iptr))
+#ifdef __USE_MISC
+__inline_forward_c(int,isinf, (double __value), (__value))
+__inline_forward_c(int,finite, (double __value), (__value))
+__inline_forward_c(double,scalbn, (double __x, int __n), (__x, __n))
+#endif
+#if defined __USE_MISC || defined __USE_XOPEN
+__inline_forward_c(int,isnan, (double __value), (__value))
+__inline_forward_c(int,ilogb, (double __value), (__value))
+#endif
+
+#ifdef __USE_MISC
+
+__inline_forward(float,frexpf, (float __value, int *__expptr),
+ (__value, __expptr))
+__inline_forward_c(float,floorf, (float __x), (__x))
+__inline_forward_c(float,ceilf, (float __x), (__x))
+__inline_forward(float,modff, (float __value, float *__iptr),
+ (__value, __iptr))
+__inline_forward_c(int,isinff, (float __value), (__value))
+__inline_forward_c(int,finitef, (float __value), (__value))
+__inline_forward_c(float,scalbnf, (float __x, int __n), (__x, __n))
+__inline_forward_c(int,isnanf, (float __value), (__value))
+__inline_forward_c(int,ilogbf, (float __value), (__value))
+
+__inline_forward(long double,frexpl, (long double __value, int *__expptr),
+ (__value, __expptr))
+__inline_forward_c(long double,floorl, (long double __x), (__x))
+__inline_forward_c(long double,ceill, (long double __x), (__x))
+__inline_forward(long double,modfl,
+ (long double __value, long double *__iptr),
+ (__value, __iptr))
+__inline_forward_c(int,isinfl, (long double __value), (__value))
+__inline_forward_c(int,finitel, (long double __value), (__value))
+__inline_forward_c(long double,scalbnl, (long double __x, int __n),
+ (__x, __n))
+__inline_forward_c(int,isnanl, (long double __value), (__value))
+__inline_forward_c(int,ilogbl, (long double __value), (__value))
+
+#endif /* __USE_MISC */
+
+#undef __inline_forward
+#undef __inline_forward_c
+
+#endif /* !__NO_MATH_INLINES && __OPTIMIZE__ */
+
#endif /* GCC. */
-/* Copyright (C) 1996 Free Software Foundation, Inc.
-This file is part of the GNU C Library.
+/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
-The GNU C Library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Library General Public License as
-published by the Free Software Foundation; either version 2 of the
-License, or (at your option) any later version.
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
-The GNU C Library 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
-Library General Public License for more details.
+ The GNU C Library 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
+ Library General Public License for more details.
-You should have received a copy of the GNU Library General Public
-License along with the GNU C Library; see the file COPYING.LIB. If
-not, write to the Free Software Foundation, Inc., 675 Mass Ave,
-Cambridge, MA 02139, USA. */
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
-#define __NO_M81_MATH_INLINES
+#define __LIBC_M81_MATH_INLINES
#include <math.h>
#include "math_private.h"
-/* Copyright (C) 1996 Free Software Foundation, Inc.
-This file is part of the GNU C Library.
+/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
-The GNU C Library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Library General Public License as
-published by the Free Software Foundation; either version 2 of the
-License, or (at your option) any later version.
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
-The GNU C Library 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
-Library General Public License for more details.
+ The GNU C Library 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
+ Library General Public License for more details.
-You should have received a copy of the GNU Library General Public
-License along with the GNU C Library; see the file COPYING.LIB. If
-not, write to the Free Software Foundation, Inc., 675 Mass Ave,
-Cambridge, MA 02139, USA. */
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
-#define __NO_M81_MATH_INLINES
+#define __LIBC_M81_MATH_INLINES
#include <math.h>
#include "math_private.h"
-/* Copyright (C) 1996 Free Software Foundation, Inc.
-This file is part of the GNU C Library.
+/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
-The GNU C Library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Library General Public License as
-published by the Free Software Foundation; either version 2 of the
-License, or (at your option) any later version.
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
-The GNU C Library 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
-Library General Public License for more details.
+ The GNU C Library 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
+ Library General Public License for more details.
-You should have received a copy of the GNU Library General Public
-License along with the GNU C Library; see the file COPYING.LIB. If
-not, write to the Free Software Foundation, Inc., 675 Mass Ave,
-Cambridge, MA 02139, USA. */
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
-#define __NO_M81_MATH_INLINES
+#define __LIBC_M81_MATH_INLINES
#include <math.h>
#include "math_private.h"
-/* Copyright (C) 1996 Free Software Foundation, Inc.
-This file is part of the GNU C Library.
+/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
-The GNU C Library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Library General Public License as
-published by the Free Software Foundation; either version 2 of the
-License, or (at your option) any later version.
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
-The GNU C Library 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
-Library General Public License for more details.
+ The GNU C Library 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
+ Library General Public License for more details.
-You should have received a copy of the GNU Library General Public
-License along with the GNU C Library; see the file COPYING.LIB. If
-not, write to the Free Software Foundation, Inc., 675 Mass Ave,
-Cambridge, MA 02139, USA. */
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
-#define __NO_M81_MATH_INLINES
+#define __LIBC_M81_MATH_INLINES
#include <math.h>
#include "math_private.h"
-/* Copyright (C) 1996 Free Software Foundation, Inc.
-This file is part of the GNU C Library.
+/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
-The GNU C Library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Library General Public License as
-published by the Free Software Foundation; either version 2 of the
-License, or (at your option) any later version.
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
-The GNU C Library 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
-Library General Public License for more details.
+ The GNU C Library 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
+ Library General Public License for more details.
-You should have received a copy of the GNU Library General Public
-License along with the GNU C Library; see the file COPYING.LIB. If
-not, write to the Free Software Foundation, Inc., 675 Mass Ave,
-Cambridge, MA 02139, USA. */
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
-#define __NO_M81_MATH_INLINES
+#define __LIBC_M81_MATH_INLINES
#include <math.h>
#include "math_private.h"
-/* Copyright (C) 1996 Free Software Foundation, Inc.
-This file is part of the GNU C Library.
-
-The GNU C Library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Library General Public License as
-published by the Free Software Foundation; either version 2 of the
-License, or (at your option) any later version.
-
-The GNU C Library 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
-Library General Public License for more details.
-
-You should have received a copy of the GNU Library General Public
-License along with the GNU C Library; see the file COPYING.LIB. If
-not, write to the Free Software Foundation, Inc., 675 Mass Ave,
-Cambridge, MA 02139, USA. */
-
-#include <ansidecl.h>
-#define __NO_M81_MATH_INLINES
+/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#define __LIBC_M81_MATH_INLINES
#include <math.h>
#ifndef FUNC
#define __CONCATX(a,b) __CONCAT(a,b)
float_type
-DEFUN(__CONCATX(__,FUNC), (x), float_type x)
+__CONCATX(__,FUNC) (x)
+ float_type x;
{
return __m81_u(__CONCATX(__,FUNC))(x);
}
-/* Copyright (C) 1996 Free Software Foundation, Inc.
-This file is part of the GNU C Library.
-
-The GNU C Library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Library General Public License as
-published by the Free Software Foundation; either version 2 of the
-License, or (at your option) any later version.
-
-The GNU C Library 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
-Library General Public License for more details.
-
-You should have received a copy of the GNU Library General Public
-License along with the GNU C Library; see the file COPYING.LIB. If
-not, write to the Free Software Foundation, Inc., 675 Mass Ave,
-Cambridge, MA 02139, USA. */
-
-#include <ansidecl.h>
-#define __NO_M81_MATH_INLINES
+/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#define __LIBC_M81_MATH_INLINES
#include <math.h>
#ifndef FUNC
#define __CONCATX(a,b) __CONCAT(a,b)
float_type
-DEFUN(__CONCATX(__,FUNC), (value, expptr), float_type value AND int *expptr)
+__CONCATX(__,FUNC) (value, expptr)
+ float_type value;
+ int *expptr;
{
return __m81_u(__CONCATX(__,FUNC))(value, expptr);
}
+
#define weak_aliasx(a,b) weak_alias(a,b)
weak_aliasx (__CONCATX(__,FUNC), FUNC)
-/* Copyright (C) 1996 Free Software Foundation, Inc.
-This file is part of the GNU C Library.
-
-The GNU C Library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Library General Public License as
-published by the Free Software Foundation; either version 2 of the
-License, or (at your option) any later version.
-
-The GNU C Library 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
-Library General Public License for more details.
-
-You should have received a copy of the GNU Library General Public
-License along with the GNU C Library; see the file COPYING.LIB. If
-not, write to the Free Software Foundation, Inc., 675 Mass Ave,
-Cambridge, MA 02139, USA. */
-
-#include <ansidecl.h>
-#define __NO_M81_MATH_INLINES
+/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#define __LIBC_M81_MATH_INLINES
#include <math.h>
#ifndef FUNC
#define __CONCATX(a,b) __CONCAT(a,b)
int
-DEFUN(__CONCATX(__,FUNC), (x), float_type x)
+__CONCATX(__,FUNC) (x)
+ float_type x;
{
return __m81_u(__CONCATX(__,FUNC))(x);
}
-/* Copyright (C) 1996 Free Software Foundation, Inc.
-This file is part of the GNU C Library.
-
-The GNU C Library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Library General Public License as
-published by the Free Software Foundation; either version 2 of the
-License, or (at your option) any later version.
-
-The GNU C Library 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
-Library General Public License for more details.
-
-You should have received a copy of the GNU Library General Public
-License along with the GNU C Library; see the file COPYING.LIB. If
-not, write to the Free Software Foundation, Inc., 675 Mass Ave,
-Cambridge, MA 02139, USA. */
-
-#include <ansidecl.h>
-#define __NO_M81_MATH_INLINES
+/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#define __LIBC_M81_MATH_INLINES
#include <math.h>
#ifndef FUNC
#define __CONCATX(a,b) __CONCAT(a,b)
int
-DEFUN(__CONCATX(__,FUNC), (x), float_type x)
+__CONCATX(__,FUNC) (x)
+ float_type x;
{
return __m81_u(__CONCATX(__,FUNC))(x);
}
-/* Copyright (C) 1996 Free Software Foundation, Inc.
-This file is part of the GNU C Library.
-
-The GNU C Library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Library General Public License as
-published by the Free Software Foundation; either version 2 of the
-License, or (at your option) any later version.
-
-The GNU C Library 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
-Library General Public License for more details.
-
-You should have received a copy of the GNU Library General Public
-License along with the GNU C Library; see the file COPYING.LIB. If
-not, write to the Free Software Foundation, Inc., 675 Mass Ave,
-Cambridge, MA 02139, USA. */
-
-#include <ansidecl.h>
-#define __NO_M81_MATH_INLINES
+/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#define __LIBC_M81_MATH_INLINES
#include <math.h>
#ifndef FUNC
#define __CONCATX(a,b) __CONCAT(a,b)
float_type
-DEFUN(__CONCATX(__,FUNC), (x, iptr), float_type x AND float_type *iptr)
+__CONCATX(__,FUNC) (x, iptr)
+ float_type x;
+ float_type *iptr;
{
return __m81_u(__CONCATX(__,FUNC))(x, iptr);
}
+
#define weak_aliasx(a,b) weak_alias(a,b)
weak_aliasx(__CONCATX(__,FUNC), FUNC)
-/* Copyright (C) 1996 Free Software Foundation, Inc.
-This file is part of the GNU C Library.
-
-The GNU C Library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Library General Public License as
-published by the Free Software Foundation; either version 2 of the
-License, or (at your option) any later version.
-
-The GNU C Library 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
-Library General Public License for more details.
-
-You should have received a copy of the GNU Library General Public
-License along with the GNU C Library; see the file COPYING.LIB. If
-not, write to the Free Software Foundation, Inc., 675 Mass Ave,
-Cambridge, MA 02139, USA. */
-
-#include <ansidecl.h>
-#define __NO_M81_MATH_INLINES
+/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#define __LIBC_M81_MATH_INLINES
#include <math.h>
#ifndef FUNC
#define __CONCATX(a,b) __CONCAT(a,b)
float_type
-DEFUN(__CONCATX(__,FUNC), (x, exp), float_type x AND int exp)
+__CONCATX(__,FUNC) (x, exp)
+ float_type x;
+ int exp;
{
return __m81_u(__CONCATX(__,FUNC))(x, exp);
}
mv $@-t $@
# Turn into a version that works when cd'd into $(objdir).
-cded-objdir-includes = $(patsubst -I$$cwd//%,-I/%,\
- $(patsubst -I%,-I$$cwd/%,$(+includes)))
-# $(BUILD_CFLAGS) needs to come last because it contains unwanted -Is.
+mk-stdiolim-CFLAGS = $(patsubst -I$(shell pwd)//%,-I/%,\
+ $(patsubst -I%,-I$(shell pwd)/%,$(+includes)))
+# $(ALL_BUILD_CFLAGS) needs to come last because it contains unwanted -Is.
$(common-objpfx)mk-stdiolim: $(sysdep_dir)/posix/mk-stdiolim.c \
$(..)posix/posix1_lim.h local_lim.h
- cwd=`pwd`; cd $(objpfx).; \
- $(BUILD_CC) $(cded-objdir-includes) $(BUILD_CFLAGS) \
- $$cwd/$< -o $(patsubst $(common-objpfx)%,$(..)%,$@)
-
+ $(common-objdir-compile)
common-generated := $(common-generated) stdio_lim.h mk-stdiolim
before-compile := $(before-compile) $(common-objpfx)stdio_lim.h
$(dir $(firstword $(wildcard $(+sysdep_dirs:%=%/local_lim.h))))))
ifneq (,$(wildcard $(sysincludedir)/sys/param.h))
-local_lim-CFLAGS := $(local_lim-CFLAGS) -DHAVE_SYS_PARAM_H
+mk-local_lim-CFLAGS += -DHAVE_SYS_PARAM_H
endif
ifneq (,$(wildcard $(sysincludedir)/sys/limits.h))
-local_lim-CFLAGS := $(local_lim-CFLAGS) -DHAVE_SYS_LIMITS_H
+mk-local_lim-CFLAGS += -DHAVE_SYS_LIMITS_H
endif
ifneq (,$(wildcard $(sysincludedir)/limits.h))
-local_lim-CFLAGS := $(local_lim-CFLAGS) -DHAVE_LIMITS_H
+mk-local_lim-CFLAGS += -DHAVE_LIMITS_H
endif
$(common-objpfx)local_lim.h: $(common-objpfx)mk-local_lim
- if $(dir $<)$(notdir $<) > $@-t; then mv $@-t $@; else XXX; fi
+ $(dir $<)$(notdir $<) > $@-t
+ mv -f $@-t $@
$(common-objpfx)mk-local_lim: $(sysdep_dir)/unix/mk-local_lim.c
- cwd=`pwd`; cd $(@D); \
- $(BUILD_CC) $(BUILD_CFLAGS) $(local_lim-CFLAGS) $$cwd/$< -o $(@F)
+ $(common-objdir-compile)
before-compile := $(before-compile) $(common-objpfx)local_lim.h
common-generated := $(common-generated) local_lim.h mk-local_lim
before-compile := $(before-compile) $(common-objpfx)sys/param.h
$(common-objpfx)sys/param.h: $(sysincludedir)/sys/param.h
- -mkdir $(@D:%/=%)
+ $(make-target-directory)
(echo '#ifndef _GNU_SYS_PARAM_H'; \
echo '#define _GNU_SYS_PARAM_H 1'; \
echo '#include <endian.h>'; \
$(common-objpfx)param.h.dep: $(common-objpfx)param.h.c \
$(sysdep_dir)/unix/Makefile
$(+mkdep) -I$(sysincludedir) $< \
- | sed > $@ \
+ | sed > $@-t \
-e 's@^.*:@@' \
-e 's@$<@@g' \
-e 's@$(sysincludedir)/*@@g' \
-e 's@\\$$@@' \
-e 's@^@sys/param.h-includes := $$(sys/param.h-includes) @'
+ mv $@-t $@
# Get the generated definition of sys/param.h-includes.
ifndef no_deps
-include $(common-objpfx)param.h.dep
+-include $(common-objpfx)param.h.dep
endif
# Don't preempt our own headers.
# Copy the system files to $(common-objdir).
$(addprefix $(common-objpfx),$(sys/param.h-includes)): $(common-objpfx)%: \
$(sysincludedir)/%
- -mkdir $(@D:%/=%)
+ $(make-target-directory)
# Some of these files sometimes contain conflicting declarations for htons,
# ntohs, etc. They also often contain definitions of *_ENDIAN and
# BYTE_ORDER, which we define ourselves in <endian.h>.
$(common-objpfx)errnos: $(wildcard $(sysincludedir)/errno.h \
$(sysincludedir)/sys/errno.h)
- cat $^ | sed -n 's/^#define[ ]*\(E[A-Z0-9][A-Z0-9]*\)[ ].*$$/\1/p' > $@-tmp
+ sed -n 's/^#define[ ]*\(E[A-Z0-9][A-Z0-9]*\)[ ].*$$/\1/p' \
+ $^ > $@-tmp
mv $@-tmp $@
common-generated := $(common-generated) \
$(ioctl-includes))))
$(common-objpfx)make-ioctls: $(common-objpfx)make-ioctls.c
- cd $(@D); $(BUILD_CC) $(BUILD_CFLAGS) $(make-ioctls-CFLAGS) \
- $(<:$(common-objpfx)%=%) -o $(@F)
+ $(common-objdir-compile)
$(common-objpfx)make-ioctls.c: $(sysdep_dir)/unix/ioctls-tmpl.c \
$(sysdep_dir)/unix/ioctls.awk \
# Transmogrify any of several formats of the file into the one we want.
$(common-objpfx)sys/syscall.h: $(syscall.h)
- -mkdir $(common-objpfx)sys
+ $(make-target-directory)
tr '[A-Z]' '[a-z]' < $< | \
sed -e 's/[ ]sys_/ /' \
-e 's/^#define[ ]*\([a-z0-9_]*\)[ ]*/#define SYS_\1 /' \
-/* Copyright (C) 1993, 1995, 1996 Free Software Foundation, Inc.
+/* Copyright (C) 1993, 1995, 1996, 1997 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Brendan Kehoe <brendan@zen.org>, 1993.
ldiq v0, __NR_brk
call_pal PAL_callsys
+ /* Be prepared for an OSF-style brk. */
+ bne a3, $err1
+ beq v0, $ok
+
/* Correctly handle the brk(0) query case. */
cmoveq a0, v0, a0
-
- subq a0, v0, t0
- bne t0, error
+ xor a0, v0, t0
+ bne t0, $err0
/* Update __curbrk and return cleanly. */
- stq a0, __curbrk
mov zero, v0
+$ok: stq a0, __curbrk
ret
/* What a horrible way to die. */
-error: ldi v0, ENOMEM
- jmp zero, __syscall_error
+$err0: ldi v0, ENOMEM
+$err1: jmp zero, __syscall_error
END(__brk)
-#include <linux/in_systm.h>
+/* System specific type definitions for networking code.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#ifndef _NETINET_IN_SYSTM_H
+#define _NETINET_IN_SYSTM_H 1
+
+#include <sys/cdefs.h>
+#include <sys/types.h>
+
+__BEGIN_DECLS
+
+/*
+ * Network order versions of various data types. Unfortunately, BSD
+ * assumes specific sizes for shorts (16 bit) and longs (32 bit) which
+ * don't hold in general. As a consequence, the network order versions
+ * may not reflect the actual size of the native data types.
+ */
+
+typedef u_int16_t n_short; /* short as received from the net */
+typedef u_int32_t n_long; /* long as received from the net */
+typedef u_int32_t n_time; /* ms since 00:00 GMT, byte rev */
+
+__END_DECLS
+
+#endif /* netinet/in_systm.h */
+/* Poll system call, with emulation if it is not available.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include <errno.h>
+#include <sys/poll.h>
+
+extern int __syscall_poll __P ((struct pollfd *fds, unsigned int nfds,
+ int timeout));
+extern int __emulate_poll __P ((struct pollfd *fds, unsigned long int nfds,
+ int timeout));
+
+/* The real implementation. */
+int
+poll (fds, nfds, timeout)
+ struct pollfd *fds;
+ unsigned long int nfds;
+ int timeout;
+{
+ static int must_emulate = 0;
+
+ if (!must_emulate)
+ {
+ int retval = __syscall_poll (fds, nfds, timeout);
+
+ if (retval >= 0 || errno != ENOSYS)
+ return retval;
+
+ must_emulate = 1;
+ }
+
+ return __emulate_poll (fds, nfds, timeout);
+}
+
+
+/* Get the emulation code. */
+#define poll(fds, nfds, timeout) __emulate_poll (fds, nfds, timeout)
#include <sysdeps/unix/bsd/poll.c>
pause - pause 0 __libc_pause pause
personality init-first personality 1 __personality personality
pipe - pipe 1 __pipe pipe
+s_poll EXTRA poll 3 __syscall_poll
query_module EXTRA query_module 5 query_module
s_getdents EXTRA getdents 3 __getdents
s_getpriority getpriority getpriority 2 __syscall_getpriority
# along the way (e.g., glue-ctype) will fail because it'll try to link
# with the libc.a being *constructed* in $(objdir). As a work-around,
# we add this to each native-compile.
-BUILD_CFLAGS := $(BUILD_CFLAGS) -L/lib
+ALL_BUILD_CFLAGS += -L/lib
-/* Copyright (C) 1995, 1996 Free Software Foundation, Inc.
+/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
/* Get system dependent definition of `struct ipc_perm' and more. */
#include <sys/ipc_buf.h>
+#if !defined __USE_SVID && !defined __USE_XOPEN && __GNUC__ >= 2
+# warning "Files using this header must be compiled with _SVID_SOURCE or _XOPEN_SOURCE"
+#endif
+
__BEGIN_DECLS
/* Generates key for System V style IPC. */
echo '$*-zones := $$(subst $$(nl), ,$$($*-zones))' ;\
echo 'ifdef $*-zones' ;\
if test x$(findstring $*, $(tzlinks)) != x; then \
- echo '$$(addprefix $$(inst_zonedir)/right/,$$($*-zones)) \';\
- echo '$$(addprefix $$(inst_zonedir)/posix/,$$($*-zones)) \';\
+ echo '$$(addprefix $$(inst_zonedir)/right/,$$($*-zones)): \';\
+ echo '$$(foreach t,$$(tzbases),$$(addprefix $$(inst_zonedir)/right/,$$($$t-zones)))' ;\
+ echo '$$(addprefix $$(inst_zonedir)/posix/,$$($*-zones)): \';\
+ echo '$$(foreach t,$$(tzbases),$$(addprefix $$(inst_zonedir)/posix/,$$($$t-zones)))' ;\
echo '$$(addprefix $$(inst_zonedir)/,$$($*-zones)): \' ;\
- echo '$$(foreach t,$$(tzbases),$$(addprefix $$(inst_zonedir)/right/,$$($$t-zones))) \' ;\
- echo '$$(foreach t,$$(tzbases),$$(addprefix $$(inst_zonedir)/posix/,$$($$t-zones))) \' ;\
echo '$$(foreach t,$$(tzbases),$$(addprefix $$(inst_zonedir)/,$$($$t-zones)))' ;\
fi ;\
echo '$$(addprefix $$(inst_datadir)/zone%/right/,$$($*-zones)): \' ;\
-# @(#)leapseconds 7.8
+# @(#)leapseconds 7.9
# Allowance for leapseconds added to each timezone file.
Leap 1993 Jun 30 23:59:60 + S
Leap 1994 Jun 30 23:59:60 + S
Leap 1995 Dec 31 23:59:60 + S
+Leap 1997 Jun 30 23:59:60 + S
#ifndef lint
#ifndef NOID
-static char elsieid[] = "@(#)zic.c 7.81";
+static char elsieid[] = "@(#)zic.c 7.82";
#endif /* !defined NOID */
#endif /* !defined lint */
if (!itsdir(name)) {
/*
** It doesn't seem to exist, so we try to create it.
- ** Double check the return. Someone may be one
- ** step ahead of us.
+ ** Creation may fail because of the directory being
+ ** created by some other multiprocessor, so we get
+ ** to do extra checking.
*/
if (mkdir(name, 0755) != 0) {
- int save_error = errno;
- if (errno == EEXIST && !itsdir(name)) {
- const char *e = strerror(save_error);
+ const char *e = strerror(errno);
+ if (errno != EEXIST || !itsdir(name)) {
(void) fprintf(stderr,
- _("%s: Can't create directory %s: %s\n"),
- progname, name, e);
+_("%s: Can't create directory %s: %s\n"),
+ progname, name, e);
ifree(name);
return -1;
}