diff options
author | Roland McGrath <roland@gnu.org> | 1996-05-30 16:12:42 +0000 |
---|---|---|
committer | Roland McGrath <roland@gnu.org> | 1996-05-30 16:12:42 +0000 |
commit | 76060ec0b8b5d6f0a860a94f100dc6e48041bac3 (patch) | |
tree | b4ff1b5370a30a16705239598cb8e98f4b80b9ca | |
parent | c3352e623384fe221743a6d2212c17d9619041ef (diff) | |
download | glibc-76060ec0b8b5d6f0a860a94f100dc6e48041bac3.tar.gz glibc-76060ec0b8b5d6f0a860a94f100dc6e48041bac3.tar.xz glibc-76060ec0b8b5d6f0a860a94f100dc6e48041bac3.zip |
Thu May 30 11:24:05 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu> cvs/libc-960602 cvs/libc-960601 cvs/libc-960531
* po/header.pot: Replace with exact boilerplate pinard dictates. * sysdeps/i386/strtok.S (Lillegal_argument): Remove this code to set errno and the check that jumped to it. * sysdeps/mach/hurd/Makefile (errnos.d): Use $(sed-remove-objpfx). Thu May 30 03:21:57 1996 Ulrich Drepper <drepper@cygnus.com> * FAQ: Document need of gperf program for developers. * elf/elf.h: Fix typos in comments. * libio/stdio.h [!__STRICT_ANSI__ || _POSIX_SOURCE]: Add prototypes for `ctermid' and `cuserid'. * locale/programs/locale.c: Switch to user selected locale before printing variables. * math/Makefile [$(long-double-fcts)==yes]: Define long-m-routines and long-c-routines. Only if the `long double' data type is available we need to compile the functions. (libm-routines): Add $(long-m-routines). (routines): Remove isinfl, isnanl. Use new file s_isinfl and s_isnanl instead if `long double' is available. * math/math.h: Include <mathcalls.h> again to define `long double' functions. * math/math_private.h: Define data types, prototypes and access macros for `long double'. * stdlib/stdlib.h: Add prototypes for `strtoll' and `strtoull'. [GCC2 && OPTIMIZE]: Define strto{,u}ll as inline function which calls __strto{,u}q_internal. * stdlib/strfmon.c: Replace PTR by `void *'. * stdlib/strtoq.c: Define strtoll as weak alias. * stdlib/strtouq.c: Define strtoull as weak alias. * string/tester.c: Correct `strsep' test. * sysdeps/generic/strsep.c: Make compatible with BSD version. Trailing characters of skip set are not skipped. In this case empty tokens are returned. * sysdeps/i386/isinfl.c, sysdeps/i386/isnanl.c, sysdeps/ieee754/isinf.c, sysdeps/ieee754/isinfl.c, sysdeps/ieee754/isnan.c, sysdeps/ieee754/isnanl.c: Removed. We now use the versions part of libm. * sysdeps/i386/strsep.S: Removed. Generic C version is of similar speed. * sysdeps/i386/strtok.S: Remove support for `strsep'. * sysdeps/libm-i387/e_acosl.S, sysdeps/libm-i387/s_ceill.S, sysdeps/libm-i387/s_copysignl.S, sysdeps/libm-i387/s_finitel.S, sysdeps/libm-i387/s_floorl.S, sysdeps/libm-i387/s_isinfl.c, sysdeps/libm-i387/s_isnanl.c, sysdeps/libm-i387/s_nextafterl.c, sysdeps/libm-i387/s_rintl.S, sysdeps/libm-i387/s_significandl.S: New i387 specific math functions implementing `long double' versions. * sysdeps/libm-ieee754/s_ceill.c, sysdeps/libm-ieee754/s_copysignl.c, sysdeps/libm-ieee754/s_fabsl.c, sysdeps/libm-ieee754/s_finitel.c, sysdeps/libm-ieee754/s_floorl.c, sysdeps/libm-ieee754/s_isinfl.c, sysdeps/libm-ieee754/s_isnanl.c, sysdeps/libm-ieee754/s_nextafterl.c, sysdeps/libm-ieee754/s_rintl.c, sysdeps/libm-ieee754/s_scalbnl.c, sysdeps/libm-ieee754/s_significandl.c: New generic `long double' versions of libm functions. * sysdeps/libm-i387/e_exp.S: Add a few comments to explain the Intel FPU nonsense. * sysdeps/libm-i387/s_ceil.S, sysdeps/libm-i387/s_ceilf.S, sysdeps/libm-i387/s_floor.S, sysdeps/libm-i387/s_floorf.S: Correct handling of local variables. The old version created a stack frame but stored the values outside. * sysdeps/libm-ieee754/s_isinf.c, sysdeps/libm-ieee754/s_isnan.c [!NO_LONG_DOUBLE]: Define alias with `long double' versions name. * login/pututline_r.c: Include sys/stat.h. Fix typos. according to currently used locale for category LC_CTYPE by inet_nsap_ntoa. Now in <arpa/inet.h>. _IO_dup2 to contain complete parameter list.
54 files changed, 1502 insertions, 517 deletions
diff --git a/ChangeLog b/ChangeLog index 8de5a686b3..25eb068779 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,94 @@ +Thu May 30 11:24:05 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu> + + * po/header.pot: Replace with exact boilerplate pinard dictates. + + * sysdeps/i386/strtok.S (Lillegal_argument): Remove this code to set + errno and the check that jumped to it. + + * sysdeps/mach/hurd/Makefile (errnos.d): Use $(sed-remove-objpfx). + +Thu May 30 03:21:57 1996 Ulrich Drepper <drepper@cygnus.com> + + * FAQ: Document need of gperf program for developers. + + * elf/elf.h: Fix typos in comments. + + * libio/stdio.h [!__STRICT_ANSI__ || _POSIX_SOURCE]: Add + prototypes for `ctermid' and `cuserid'. + + * locale/programs/locale.c: Switch to user selected locale + before printing variables. + + * math/Makefile [$(long-double-fcts)==yes]: Define long-m-routines + and long-c-routines. Only if the `long double' data type is + available we need to compile the functions. + (libm-routines): Add $(long-m-routines). + (routines): Remove isinfl, isnanl. Use new file s_isinfl and + s_isnanl instead if `long double' is available. + + * math/math.h: Include <mathcalls.h> again to define `long double' + functions. + + * math/math_private.h: Define data types, prototypes and access + macros for `long double'. + + * stdlib/stdlib.h: Add prototypes for `strtoll' and `strtoull'. + [GCC2 && OPTIMIZE]: Define strto{,u}ll as inline function which + calls __strto{,u}q_internal. + + * stdlib/strfmon.c: Replace PTR by `void *'. + + * stdlib/strtoq.c: Define strtoll as weak alias. + * stdlib/strtouq.c: Define strtoull as weak alias. + + * string/tester.c: Correct `strsep' test. + + * sysdeps/generic/strsep.c: Make compatible with BSD version. + Trailing characters of skip set are not skipped. In this case + empty tokens are returned. + + * sysdeps/i386/isinfl.c, sysdeps/i386/isnanl.c, + sysdeps/ieee754/isinf.c, sysdeps/ieee754/isinfl.c, + sysdeps/ieee754/isnan.c, sysdeps/ieee754/isnanl.c: Removed. We + now use the versions part of libm. + + * sysdeps/i386/strsep.S: Removed. Generic C version is of + similar speed. + * sysdeps/i386/strtok.S: Remove support for `strsep'. + + * sysdeps/libm-i387/e_acosl.S, sysdeps/libm-i387/s_ceill.S, + sysdeps/libm-i387/s_copysignl.S, sysdeps/libm-i387/s_finitel.S, + sysdeps/libm-i387/s_floorl.S, sysdeps/libm-i387/s_isinfl.c, + sysdeps/libm-i387/s_isnanl.c, sysdeps/libm-i387/s_nextafterl.c, + sysdeps/libm-i387/s_rintl.S, sysdeps/libm-i387/s_significandl.S: + New i387 specific math functions implementing `long double' + versions. + + * sysdeps/libm-ieee754/s_ceill.c, + sysdeps/libm-ieee754/s_copysignl.c, + sysdeps/libm-ieee754/s_fabsl.c, sysdeps/libm-ieee754/s_finitel.c, + sysdeps/libm-ieee754/s_floorl.c, sysdeps/libm-ieee754/s_isinfl.c, + sysdeps/libm-ieee754/s_isnanl.c, + sysdeps/libm-ieee754/s_nextafterl.c, + sysdeps/libm-ieee754/s_rintl.c, sysdeps/libm-ieee754/s_scalbnl.c, + sysdeps/libm-ieee754/s_significandl.c: New generic `long double' + versions of libm functions. + + * sysdeps/libm-i387/e_exp.S: Add a few comments to explain the + Intel FPU nonsense. + + * sysdeps/libm-i387/s_ceil.S, sysdeps/libm-i387/s_ceilf.S, + sysdeps/libm-i387/s_floor.S, sysdeps/libm-i387/s_floorf.S: Correct + handling of local variables. The old version created a stack + frame but stored the values outside. + + * sysdeps/libm-ieee754/s_isinf.c, sysdeps/libm-ieee754/s_isnan.c + [!NO_LONG_DOUBLE]: Define alias with `long double' versions name. + Wed May 29 12:53:10 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu> + * login/pututline_r.c: Include sys/stat.h. Fix typos. + * version.h (VERSION): Set to 1.90. * Makerules (distinfo-vars): Write extra-libs and *-routines for each @@ -43,7 +132,7 @@ Tue May 28 04:38:10 1996 Ulrich Drepper <drepper@cygnus.com> * locale/programs/ld-ctype.c: Determine value of mb_cur_max according to current character set and write it out with the rest. * stdlib/stdlib.h (MB_CUR_MAX): Not constant anymore. Get value - according to currently used locale for catefory LC_CTYPE by + according to currently used locale for category LC_CTYPE by calling the function __ctype_get_mb_cur_max. Tue May 28 03:27:46 1996 Ulrich Drepper <drepper@cygnus.com> @@ -288,7 +377,7 @@ Thu May 23 23:09:33 1996 Ulrich Drepper <drepper@cygnus.com> * resolv/inet_ntop.c: Correct compatibility problems (sprintf). * resolv/inet_pton.c: Remove fourth argument. * resolv/resolv.h: Remove prototypes for inet_nsap_addr and - inet_nsap_ntoa. Now on <arpa/inet.h>. + inet_nsap_ntoa. Now in <arpa/inet.h>. * stdlib/gmp-impl.h: Add prototypes for internal functions. @@ -405,7 +494,7 @@ Thu May 23 00:01:10 1996 Ulrich Drepper <drepper@cygnus.com> Add prototypes for local functions to prevent warnings. * libio/iopopen.c: Change prototypes for _IO_fork, _IO_pipe, and - _IO_DUP2 to contain complete parameter list. + _IO_dup2 to contain complete parameter list. * libio/libio.h: Add definition of struct _IO_cookie_file. diff --git a/FAQ b/FAQ index f85b255bbc..cc26946b24 100644 --- a/FAQ +++ b/FAQ @@ -129,6 +129,9 @@ Older releases are known to have bugs that affect building the GNU C library. If you are interested in some more measurements let me know. +* Some files depend on special tools. E.g., files ending in .gperf + need a `gperf' program. The GNU version (part of libg++) is known + to work while some vendor versions do not. * When compiling for Linux: diff --git a/elf/elf.h b/elf/elf.h index 2b41ff0cbc..ec81f0b820 100644 --- a/elf/elf.h +++ b/elf/elf.h @@ -546,8 +546,8 @@ typedef struct /* Special section indices. */ #define SHN_MIPS_ACOMMON 0xff00 /* Allocated common symbols */ -#define SHN_MIPS_TEXT 0xff01 /* Allocated test symbol. */ -#define SHN_MIPS_DATA 0xff02 /* Allocated data symbol. */ +#define SHN_MIPS_TEXT 0xff01 /* Allocated test symbols. */ +#define SHN_MIPS_DATA 0xff02 /* Allocated data symbols. */ #define SHN_MIPS_SCOMMON 0xff03 /* Small common symbols */ #define SHN_MIPS_SUNDEFINED 0xff04 /* Small undefined symbols */ diff --git a/libio/stdio.h b/libio/stdio.h index 70728ed8d9..a1766cea33 100644 --- a/libio/stdio.h +++ b/libio/stdio.h @@ -75,8 +75,6 @@ typedef _IO_fpos_t fpos_t; #define FILENAME_MAX _G_FILENAME_MAX #define TMP_MAX 999 /* Only limited by filename length */ -#define L_ctermid 9 -#define L_cuserid 9 #define P_tmpdir "/tmp" #define L_tmpnam 20 @@ -108,7 +106,7 @@ extern int fgetc __P ((FILE *)); extern int fgetpos __P ((FILE* fp, fpos_t *pos)); extern char* fgets __P ((char*, int, FILE*)); extern FILE* fopen __P ((__const char*, __const char*)); -extern FILE* fopencookie __P ((void *cookie, __const char *mode, +extern FILE* fopencookie __P ((void *cookie, __const char *mode, _IO_cookie_io_functions_t io_functions)); extern int fprintf __P ((FILE*, __const char* format, ...)); extern int fputc __P ((int, FILE*)); @@ -163,6 +161,15 @@ extern FILE *fdopen __P ((int, __const char *)); extern int fileno __P ((FILE*)); extern FILE* popen __P ((__const char*, __const char*)); extern int pclose __P ((FILE*)); + +#define L_ctermid 9 +#define L_cuserid 9 + +/* Return the name of the controlling terminal. */ +extern char *ctermid __P ((char *__buf)); + +/* Get character login name of the user. */ +extern char *cuserid __P ((char * __buf)); #endif #ifdef __USE_GNU diff --git a/locale/programs/locale.c b/locale/programs/locale.c index 8254289598..41c7b1d46e 100644 --- a/locale/programs/locale.c +++ b/locale/programs/locale.c @@ -196,6 +196,10 @@ main (int argc, char *argv[]) exit (EXIT_SUCCESS); } + /* Specific information about the current locale are requested. + Change to this locale now. */ + setlocale (LC_ALL, ""); + /* If no real argument is given we have to print the contents of the current locale definition variables. These are LANG and the LC_*. */ if (optind == argc && show_keyword_name == 0 && show_category_name == 0) diff --git a/login/pututline_r.c b/login/pututline_r.c index 07322e5740..824cf3a391 100644 --- a/login/pututline_r.c +++ b/login/pututline_r.c @@ -24,13 +24,14 @@ Boston, MA 02111-1307, USA. */ #include <unistd.h> #include <utmp.h> #include <sys/file.h> +#include <sys/stat.h> /* XXX An alternative solution would be to call a SUID root program which write the new value. */ int -pututline_r (const struct utmp *utmp_ptr, struct utmp_data *utmp_data) +pututline_r (const struct utmp *id, struct utmp_data *utmp_data) { struct stat st; int result = 0; @@ -59,17 +60,16 @@ pututline_r (const struct utmp *utmp_ptr, struct utmp_data *utmp_data) #if _HAVE_UT_TYPE - 0 /* Seek position to write. */ - if (utmp_data->ubuf.ut_type != utmp_ptr->ut_type) + if (utmp_data->ubuf.ut_type != id->ut_type) { /* We must not overwrite the data in UTMP_DATA. */ struct utmp_data *data_tmp = alloca (sizeof (utmp_data)); struct utmp *dummy; - off_t new_pos; *data_tmp = *utmp_data; utmp_data = data_tmp; - if (getutid_r (utmp_ptr, &dummy, utmp_data) < 0) + if (getutid_r (id, &dummy, utmp_data) < 0) { if (errno != ESRCH) /* Some error occured. If no entry was found, the position @@ -78,6 +78,7 @@ pututline_r (const struct utmp *utmp_ptr, struct utmp_data *utmp_data) /* Set position pointer to position after adding of the record. */ utmp_data->loc_utmp += sizeof (struct utmp); + } } #endif @@ -102,7 +103,7 @@ pututline_r (const struct utmp *utmp_ptr, struct utmp_data *utmp_data) } /* Write the new data. */ - if (write (utmp_data->ut_fd, utmp_ptr, sizeof (struct utmp)) + if (write (utmp_data->ut_fd, id, sizeof (struct utmp)) != sizeof (struct utmp)) { /* If we appended a new record this is only partially written. diff --git a/math/Makefile b/math/Makefile index e1caa2908f..730b5610e0 100644 --- a/math/Makefile +++ b/math/Makefile @@ -30,7 +30,7 @@ distribute := math_private.h machine/asm.h machine/endian.h # Build the -lm library. extra-libs := libm -libm-routines := e_acos e_acosf e_acosh e_acoshf e_asin e_asinf \ +libm-routines = e_acos e_acosf e_acosh e_acoshf e_asin e_asinf \ e_atan2 e_atan2f e_atanh e_atanhf e_cosh e_coshf \ e_exp e_expf e_fmod e_fmodf e_hypot e_hypotf e_j0 \ e_j0f e_j1 e_j1f e_jn e_jnf e_lgamma_r e_lgammaf_r \ @@ -55,12 +55,22 @@ libm-routines := e_acos e_acosf e_acosh e_acoshf e_asin e_asinf \ w_j0f w_j1 w_j1f w_jn w_jnf w_lgamma w_lgamma_r \ w_lgammaf w_lgammaf_r w_log w_log10 w_log10f w_logf \ w_pow w_powf w_remainder w_remainderf w_scalb \ - w_scalbf w_sinh w_sinhf w_sqrt w_sqrtf + w_scalbf w_sinh w_sinhf w_sqrt w_sqrtf \ + $(long-m-routines) + +ifeq ($(long-double-fcts),yes) +long-m-routines := s_ceill s_copysignl s_fabsl s_finitel s_floorl \ + s_nextafterl s_rintl s_significandl +endif # These functions are in libc instead of libm because __printf_fp # calls them, so any program using printf will need them linked in, # and we don't want to have to link every program with -lm. -routines := s_isinf s_isinff s_isnan s_isnanf isinfl isnanl +routines = s_isinf s_isinff s_isnan s_isnanf $(long-c-routines) + +ifeq ($(long-double-fcts),yes) +long-c-routines := s_isinfl s_isnanl +endif include ../Rules diff --git a/math/math.h b/math/math.h index 7bec1300c2..7a6134a6f0 100644 --- a/math/math.h +++ b/math/math.h @@ -61,6 +61,7 @@ __BEGIN_DECLS #undef __MATH_PRECNAME #ifdef __USE_MISC + /* Include the file of declarations again, this type using `float' instead of `double' and appending f to each function name. */ @@ -69,7 +70,17 @@ __BEGIN_DECLS #include <mathcalls.h> #undef _Mdouble_ #undef __MATH_PRECNAME -#endif + +/* Include the file of declarations again, this type using `long double' + instead of `double' and appending l to each function name. */ + +#define _Mdouble_ long double +#define __MATH_PRECNAME(name,r) name##l##r +#include <mathcalls.h> +#undef _Mdouble_ +#undef __MATH_PRECNAME + +#endif /* Use misc. */ #ifdef __USE_MISC diff --git a/math/math_private.h b/math/math_private.h index 95f65a293b..c4ac857607 100644 --- a/math/math_private.h +++ b/math/math_private.h @@ -147,6 +147,93 @@ do { \ (d) = sf_u.value; \ } while (0) +/* A union which permits us to convert between a long double and + three 32 bit ints. */ + +#if BYTE_ORDER == BIG_ENDIAN + +typedef union +{ + long double value; + struct + { + unsigned int sign_exponent:16; + unsigned int empty:16; + u_int32_t msw; + u_int32_t lsw; + } parts; +} ieee_long_double_shape_type; + +#endif + +#if BYTE_ORDER == LITTLE_ENDIAN + +typedef union +{ + long double value; + struct + { + u_int32_t lsw; + u_int32_t msw; + unsigned int sign_exponent:16; + unsigned int empty:16; + } parts; +} ieee_long_double_shape_type; + +#endif + +/* Get three 32 bit ints from a double. */ + +#define GET_LDOUBLE_WORDS(exp,ix0,ix1,d) \ +do { \ + ieee_long_double_shape_type ew_u; \ + ew_u.value = (d); \ + (exp) = ew_u.parts.sign_exponent; \ + (ix0) = ew_u.parts.msw; \ + (ix1) = ew_u.parts.lsw; \ +} while (0) + +/* Set a double from two 32 bit ints. */ + +#define SET_LDOUBLE_WORDS(d,exp,ix0,ix1) \ +do { \ + ieee_long_double_shape_type iw_u; \ + iw_u.parts.sign_exponent = (exp); \ + iw_u.parts.msw = (ix0); \ + iw_u.parts.lsw = (ix1); \ + (d) = iw_u.value; \ +} while (0) + +/* Set the more significant 32 bits of a long double mantissa from an int. */ + +#define SET_LDOUBLE_MSW(d,v) \ +do { \ + ieee_long_double_shape_type sh_u; \ + sh_u.value = (d); \ + sh_u.parts.msw = (v); \ + (d) = sh_u.value; \ +} while (0) + +/* Get int from the exponent of a long double. */ + +#define GET_LDOUBLE_EXP(exp,d) \ +do { \ + ieee_long_double_shape_type ge_u; \ + ge_u.value = (d); + (exp) = ge_u.parts.sign_exponent; \ +} while (0) + +/* Set exponent of a long double from an int. */ + +#define SET_LDOUBLE_EXP(d,exp) \ +do { \ + ieee_long_double_shape_type se_u; \ + se_u.value = (d); \ + se_u.parts.sign_exponent = (exp); \ + (d) = se_u.value; \ +} while (0) + + /* ieee style elementary functions */ extern double __ieee754_sqrt __P((double)); extern double __ieee754_acos __P((double)); @@ -219,4 +306,41 @@ extern float __kernel_cosf __P((float,float)); extern float __kernel_tanf __P((float,float,int)); extern int __kernel_rem_pio2f __P((float*,float*,int,int,int,const int*)); + +/* ieee style elementary long double functions */ +extern long double __ieee754_sqrtl __P((long double)); +extern long double __ieee754_acosl __P((long double)); +extern long double __ieee754_acoshl __P((long double)); +extern long double __ieee754_logl __P((long double)); +extern long double __ieee754_atanhl __P((long double)); +extern long double __ieee754_asinl __P((long double)); +extern long double __ieee754_atan2l __P((long double,long double)); +extern long double __ieee754_expl __P((long double)); +extern long double __ieee754_coshl __P((long double)); +extern long double __ieee754_fmodl __P((long double,long double)); +extern long double __ieee754_powl __P((long double,long double)); +extern long double __ieee754_lgammal_r __P((long double,int *)); +extern long double __ieee754_gammal_r __P((long double,int *)); +extern long double __ieee754_lgammal __P((long double)); +extern long double __ieee754_gammal __P((long double)); +extern long double __ieee754_log10l __P((long double)); +extern long double __ieee754_sinhl __P((long double)); +extern long double __ieee754_hypotl __P((long double,long double)); +extern long double __ieee754_j0l __P((long double)); +extern long double __ieee754_j1l __P((long double)); +extern long double __ieee754_y0l __P((long double)); +extern long double __ieee754_y1l __P((long double)); +extern long double __ieee754_jnl __P((int,long double)); +extern long double __ieee754_ynl __P((int,long double)); +extern long double __ieee754_remainderl __P((long double,long double)); +extern int __ieee754_rem_pio2l __P((long double,long double*)); +extern long double __ieee754_scalbl __P((long double,long double)); + +/* long double versions of fdlibm kernel functions */ +extern long double __kernel_sinl __P((long double,long double,int)); +extern long double __kernel_cosl __P((long double,long double)); +extern long double __kernel_tanl __P((long double,long double,int)); +extern int __kernel_rem_pio2l __P((long double*,long double*,int,int, + int,const int*)); + #endif /* _MATH_PRIVATE_H_ */ diff --git a/po/SYS_libc.pot b/po/SYS_libc.pot index d2fcf7da91..b30691f9d3 100644 --- a/po/SYS_libc.pot +++ b/po/SYS_libc.pot @@ -5,8 +5,8 @@ #, fuzzy msgid "" msgstr "" -"Project-Id-Version: libc 1.09.7\n" -"PO-Revision-Date: 1996-05-29 13:04\n" +"Project-Id-Version: libc 1.90\n" +"PO-Revision-Date: 1996-05-29 14:03\n" "Last-Translator: GNU libc maintainers <bug-glibc@prep.ai.mit.edu>\n" "Language-Team: LANGUAGE <LL@li.org>\n" "MIME-Version: 1.0\n" @@ -259,6 +259,10 @@ msgstr "" msgid "(unknown)" msgstr "" +#: catgets/gencat.c:242 +msgid "*standard input*" +msgstr "" + #: inet/rcmd.c:325 msgid ".rhosts fstat failed" msgstr "" @@ -284,22 +288,18 @@ msgstr "" msgid "; why = " msgstr "" -#: sysdeps/mach/hurd/errlist.c:112 msgid "?" msgstr "" -#: sysdeps/mach/hurd/errlist.c:58 msgid "Address already in use" msgstr "" -#: sysdeps/mach/hurd/errlist.c:57 msgid "Address family not supported by protocol family" msgstr "" msgid "Alarm clock" msgstr "" -#: sysdeps/mach/hurd/errlist.c:17 msgid "Argument list too long" msgstr "" @@ -307,19 +307,15 @@ msgstr "" msgid "Authentication OK" msgstr "" -#: sysdeps/mach/hurd/errlist.c:90 msgid "Authentication error" msgstr "" -#: sysdeps/mach/hurd/errlist.c:24 msgid "Bad address" msgstr "" -#: sysdeps/mach/hurd/errlist.c:19 msgid "Bad file descriptor" msgstr "" -#: sysdeps/mach/hurd/errlist.c:25 msgid "Block device required" msgstr "" @@ -327,7 +323,6 @@ msgstr "" msgid "Broadcast select problem" msgstr "" -#: sysdeps/mach/hurd/errlist.c:42 msgid "Broken pipe" msgstr "" @@ -337,15 +332,12 @@ msgstr "" msgid "CPU time limit exceeded" msgstr "" -#: sysdeps/mach/hurd/errlist.c:59 msgid "Can't assign requested address" msgstr "" -#: sysdeps/mach/hurd/errlist.c:68 msgid "Can't send after socket shutdown" msgstr "" -#: sysdeps/mach/hurd/errlist.c:22 msgid "Cannot allocate memory" msgstr "" @@ -376,42 +368,33 @@ msgstr "" msgid "Client credential too weak" msgstr "" -#: sysdeps/mach/hurd/errlist.c:114 msgid "Computer bought the farm" msgstr "" -#: sysdeps/mach/hurd/errlist.c:71 msgid "Connection refused" msgstr "" -#: sysdeps/mach/hurd/errlist.c:64 msgid "Connection reset by peer" msgstr "" -#: sysdeps/mach/hurd/errlist.c:70 msgid "Connection timed out" msgstr "" msgid "Continued" msgstr "" -#: sysdeps/mach/hurd/errlist.c:49 msgid "Destination address required" msgstr "" -#: sysdeps/mach/hurd/errlist.c:26 msgid "Device busy" msgstr "" -#: sysdeps/mach/hurd/errlist.c:16 msgid "Device not configured" msgstr "" -#: sysdeps/mach/hurd/errlist.c:76 msgid "Directory not empty" msgstr "" -#: sysdeps/mach/hurd/errlist.c:79 msgid "Disc quota exceeded" msgstr "" @@ -424,7 +407,6 @@ msgstr "" msgid "Error in unknown error system: " msgstr "" -#: sysdeps/mach/hurd/errlist.c:18 msgid "Exec format error" msgstr "" @@ -432,36 +414,30 @@ msgstr "" msgid "Failed (unspecified error)" msgstr "" -#: sysdeps/mach/hurd/errlist.c:27 msgid "File exists" msgstr "" -#: sysdeps/mach/hurd/errlist.c:73 msgid "File name too long" msgstr "" msgid "File size limit exceeded" msgstr "" -#: sysdeps/mach/hurd/errlist.c:37 msgid "File too large" msgstr "" msgid "Floating point exception" msgstr "" -#: sysdeps/mach/hurd/errlist.c:88 msgid "Function not implemented" msgstr "" -#: sysdeps/mach/hurd/errlist.c:115 msgid "Gratuitous error" msgstr "" msgid "Hangup" msgstr "" -#: sysdeps/mach/hurd/errlist.c:74 msgid "Host is down" msgstr "" @@ -478,34 +454,27 @@ msgstr "" msgid "Illegal Instruction" msgstr "" -#: sysdeps/mach/hurd/errlist.c:39 msgid "Illegal seek" msgstr "" -#: sysdeps/mach/hurd/errlist.c:89 msgid "Inappropriate file type or format" msgstr "" -#: sysdeps/mach/hurd/errlist.c:35 msgid "Inappropriate ioctl for device" msgstr "" -#: sysdeps/mach/hurd/errlist.c:110 msgid "Inappropriate operation for background process" msgstr "" -#: sysdeps/mach/hurd/errlist.c:15 msgid "Input/output error" msgstr "" msgid "Interrupt" msgstr "" -#: sysdeps/mach/hurd/errlist.c:14 msgid "Interrupted system call" msgstr "" -#: sysdeps/mach/hurd/errlist.c:32 msgid "Invalid argument" msgstr "" @@ -533,7 +502,6 @@ msgstr "" msgid "Invalid content of \\{\\}" msgstr "" -#: sysdeps/mach/hurd/errlist.c:28 msgid "Invalid cross-device link" msgstr "" @@ -553,7 +521,6 @@ msgstr "" msgid "Invalid server verifier" msgstr "" -#: sysdeps/mach/hurd/errlist.c:31 msgid "Is a directory" msgstr "" @@ -564,23 +531,18 @@ msgstr "" msgid "Memory exhausted" msgstr "" -#: sysdeps/mach/hurd/errlist.c:50 msgid "Message too long" msgstr "" -#: sysdeps/mach/hurd/errlist.c:91 msgid "Need authenticator" msgstr "" -#: sysdeps/mach/hurd/errlist.c:62 msgid "Network dropped connection on reset" msgstr "" -#: sysdeps/mach/hurd/errlist.c:60 msgid "Network is down" msgstr "" -#: sysdeps/mach/hurd/errlist.c:61 msgid "Network is unreachable" msgstr "" @@ -588,15 +550,12 @@ msgstr "" msgid "No address associated with name" msgstr "" -#: sysdeps/mach/hurd/errlist.c:65 msgid "No buffer space available" msgstr "" -#: sysdeps/mach/hurd/errlist.c:20 msgid "No child processes" msgstr "" -#: sysdeps/mach/hurd/errlist.c:87 msgid "No locks available" msgstr "" @@ -612,31 +571,24 @@ msgstr "" msgid "No remote programs registered.\n" msgstr "" -#: sysdeps/mach/hurd/errlist.c:75 msgid "No route to host" msgstr "" -#: sysdeps/mach/hurd/errlist.c:38 msgid "No space left on device" msgstr "" -#: sysdeps/mach/hurd/errlist.c:12 msgid "No such file or directory" msgstr "" -#: sysdeps/mach/hurd/errlist.c:13 msgid "No such process" msgstr "" -#: sysdeps/mach/hurd/errlist.c:30 msgid "Not a directory" msgstr "" -#: sysdeps/mach/hurd/errlist.c:43 msgid "Numerical argument out of domain" msgstr "" -#: sysdeps/mach/hurd/errlist.c:44 msgid "Numerical result out of range" msgstr "" @@ -644,27 +596,21 @@ msgstr "" msgid "Odd number of quotation marks" msgstr "" -#: sysdeps/mach/hurd/errlist.c:47 msgid "Operation already in progress" msgstr "" -#: sysdeps/mach/hurd/errlist.c:11 msgid "Operation not permitted" msgstr "" -#: sysdeps/mach/hurd/errlist.c:55 msgid "Operation not supported" msgstr "" -#: sysdeps/mach/hurd/errlist.c:29 msgid "Operation not supported by device" msgstr "" -#: sysdeps/mach/hurd/errlist.c:46 msgid "Operation now in progress" msgstr "" -#: sysdeps/mach/hurd/errlist.c:23 msgid "Permission denied" msgstr "" @@ -678,42 +624,33 @@ msgstr "" msgid "Profiling timer expired" msgstr "" -#: sysdeps/mach/hurd/errlist.c:56 msgid "Protocol family not supported" msgstr "" -#: sysdeps/mach/hurd/errlist.c:52 msgid "Protocol not available" msgstr "" -#: sysdeps/mach/hurd/errlist.c:53 msgid "Protocol not supported" msgstr "" -#: sysdeps/mach/hurd/errlist.c:51 msgid "Protocol wrong type for socket" msgstr "" msgid "Quit" msgstr "" -#: sysdeps/mach/hurd/errlist.c:86 msgid "RPC bad procedure for program" msgstr "" -#: sysdeps/mach/hurd/errlist.c:84 msgid "RPC program not available" msgstr "" -#: sysdeps/mach/hurd/errlist.c:85 msgid "RPC program version wrong" msgstr "" -#: sysdeps/mach/hurd/errlist.c:82 msgid "RPC struct is bad" msgstr "" -#: sysdeps/mach/hurd/errlist.c:83 msgid "RPC version wrong" msgstr "" @@ -793,7 +730,6 @@ msgstr "" msgid "RPC: Unknown protocol" msgstr "" -#: sysdeps/mach/hurd/errlist.c:40 msgid "Read-only file system" msgstr "" @@ -801,75 +737,57 @@ msgstr "" msgid "Regular expression too big" msgstr "" -#: sysdeps/mach/hurd/errlist.c:92 msgid "Reserved error 82" msgstr "" -#: sysdeps/mach/hurd/errlist.c:93 msgid "Reserved error 83" msgstr "" -#: sysdeps/mach/hurd/errlist.c:94 msgid "Reserved error 84" msgstr "" -#: sysdeps/mach/hurd/errlist.c:95 msgid "Reserved error 85" msgstr "" -#: sysdeps/mach/hurd/errlist.c:96 msgid "Reserved error 86" msgstr "" -#: sysdeps/mach/hurd/errlist.c:97 msgid "Reserved error 87" msgstr "" -#: sysdeps/mach/hurd/errlist.c:98 msgid "Reserved error 88" msgstr "" -#: sysdeps/mach/hurd/errlist.c:99 msgid "Reserved error 89" msgstr "" -#: sysdeps/mach/hurd/errlist.c:100 msgid "Reserved error 90" msgstr "" -#: sysdeps/mach/hurd/errlist.c:101 msgid "Reserved error 91" msgstr "" -#: sysdeps/mach/hurd/errlist.c:102 msgid "Reserved error 92" msgstr "" -#: sysdeps/mach/hurd/errlist.c:103 msgid "Reserved error 93" msgstr "" -#: sysdeps/mach/hurd/errlist.c:104 msgid "Reserved error 94" msgstr "" -#: sysdeps/mach/hurd/errlist.c:105 msgid "Reserved error 95" msgstr "" -#: sysdeps/mach/hurd/errlist.c:106 msgid "Reserved error 96" msgstr "" -#: sysdeps/mach/hurd/errlist.c:107 msgid "Reserved error 97" msgstr "" -#: sysdeps/mach/hurd/errlist.c:108 msgid "Reserved error 98" msgstr "" -#: sysdeps/mach/hurd/errlist.c:109 msgid "Reserved error 99" msgstr "" @@ -881,11 +799,9 @@ msgstr "" msgid "Resolver internal error" msgstr "" -#: sysdeps/mach/hurd/errlist.c:21 msgid "Resource deadlock avoided" msgstr "" -#: sysdeps/mach/hurd/errlist.c:45 msgid "Resource temporarily unavailable" msgstr "" @@ -900,27 +816,21 @@ msgstr "" msgid "Server rejected verifier" msgstr "" -#: sysdeps/mach/hurd/errlist.c:66 msgid "Socket is already connected" msgstr "" -#: sysdeps/mach/hurd/errlist.c:67 msgid "Socket is not connected" msgstr "" -#: sysdeps/mach/hurd/errlist.c:48 msgid "Socket operation on non-socket" msgstr "" -#: sysdeps/mach/hurd/errlist.c:54 msgid "Socket type not supported" msgstr "" -#: sysdeps/mach/hurd/errlist.c:63 msgid "Software caused connection abort" msgstr "" -#: sysdeps/mach/hurd/errlist.c:80 msgid "Stale NFS file handle" msgstr "" @@ -936,46 +846,37 @@ msgstr "" msgid "Stopped (tty output)" msgstr "" -#: posix/regex.c:940 sysdeps/mach/hurd/errlist.c:10 +#: posix/regex.c:940 msgid "Success" msgstr "" msgid "Terminated" msgstr "" -#: sysdeps/mach/hurd/errlist.c:36 msgid "Text file busy" msgstr "" -#: sysdeps/mach/hurd/errlist.c:81 msgid "Too many levels of remote in path" msgstr "" -#: sysdeps/mach/hurd/errlist.c:72 msgid "Too many levels of symbolic links" msgstr "" -#: sysdeps/mach/hurd/errlist.c:41 msgid "Too many links" msgstr "" -#: sysdeps/mach/hurd/errlist.c:34 msgid "Too many open files" msgstr "" -#: sysdeps/mach/hurd/errlist.c:33 msgid "Too many open files in system" msgstr "" -#: sysdeps/mach/hurd/errlist.c:77 msgid "Too many processes" msgstr "" -#: sysdeps/mach/hurd/errlist.c:69 msgid "Too many references: can't splice" msgstr "" -#: sysdeps/mach/hurd/errlist.c:78 msgid "Too many users" msgstr "" @@ -986,10 +887,14 @@ msgstr "" msgid "Trailing backslash" msgstr "" -#: sysdeps/mach/hurd/errlist.c:111 msgid "Translator died" msgstr "" +#: catgets/gencat.c:201 +#, c-format +msgid "Try `%s --help' for more information.\n" +msgstr "" + #: inet/rcmd.c:118 #, c-format msgid "Trying %s...\n" @@ -1039,6 +944,21 @@ msgstr "" msgid "Urgent I/O condition" msgstr "" +#: catgets/gencat.c:204 +#, c-format +msgid "" +"Usage: %s [OPTION]... -o OUTPUT-FILE [INPUT-FILE]...\n" +" %s [OPTION]... [OUTPUT-FILE [INPUT-FILE]...]\n" +"Mandatory arguments to long options are mandatory for short options too.\n" +" -H, --header create C header file containing symbol definitions\n" +" -h, --help display this help and exit\n" +" --new do not use existing catalog, force new output file\n" +" -o, --output=NAME write output to file NAME\n" +" -V, --version output version information and exit\n" +"If INPUT-FILE is -, input is read from standard input. If OUTPUT-FILE\n" +"is -, output is written to standard output.\n" +msgstr "" + #: posix/getconf.c:81 #, c-format msgid "Usage: %s variable_name [pathname]\n" @@ -1064,7 +984,6 @@ msgstr "" msgid "Window changed" msgstr "" -#: sysdeps/mach/hurd/errlist.c:113 msgid "You really blew it this time" msgstr "" @@ -1117,6 +1036,16 @@ msgstr "" msgid "can't reassign procedure number %d\n" msgstr "" +#: catgets/gencat.c:248 +#, c-format +msgid "cannot open input file `%s'" +msgstr "" + +#: catgets/gencat.c:753 gencat.c:794 +#, c-format +msgid "cannot open output file `%s'" +msgstr "" + #: sunrpc/clnt_raw.c:106 msgid "clnt_raw.c - Fatal header serialization error." msgstr "" @@ -1151,11 +1080,23 @@ msgstr "" msgid "definition keyword expected" msgstr "" +#: catgets/gencat.c:367 +msgid "duplicate set definition" +msgstr "" + #: time/zic.c:928 #, c-format msgid "duplicate zone name %s (file \"%s\", line %d)" msgstr "" +#: catgets/gencat.c:530 +msgid "duplicated message identifier" +msgstr "" + +#: catgets/gencat.c:503 +msgid "duplicated message number" +msgstr "" + #: sunrpc/svc_udp.c:344 msgid "enablecache: cache already enabled" msgstr "" @@ -1215,6 +1156,10 @@ msgstr "" msgid "illegal result type" msgstr "" +#: catgets/gencat.c:340 gencat.c:417 +msgid "illegal set number" +msgstr "" + #: time/zic.c:777 msgid "input line of unknown type" msgstr "" @@ -1263,6 +1208,10 @@ msgstr "" msgid "line too long" msgstr "" +#: catgets/gencat.c:598 +msgid "malformed line ignored" +msgstr "" + #: malloc/mcheck.c:168 msgid "memory clobbered before allocated block" msgstr "" @@ -1422,6 +1371,10 @@ msgstr "" msgid "svcudp_create: socket creation problem" msgstr "" +#: catgets/gencat.c:369 gencat.c:505 gencat.c:532 +msgid "this is the first definition" +msgstr "" + #: time/zic.c:1083 msgid "time before zero" msgstr "" @@ -1459,6 +1412,16 @@ msgstr "" msgid "typed single year" msgstr "" +#: catgets/gencat.c:466 +#, c-format +msgid "unknown directive `%s': line ignored" +msgstr "" + +#: catgets/gencat.c:445 +#, c-format +msgid "unknown set `%s'" +msgstr "" + msgid "unknown signal" msgstr "" @@ -1466,6 +1429,10 @@ msgstr "" msgid "unruly zone" msgstr "" +#: catgets/gencat.c:950 +msgid "unterminated message" +msgstr "" + #: sunrpc/rpc_scan.c:319 msgid "unterminated string constant" msgstr "" @@ -1491,6 +1458,10 @@ msgstr "" msgid "while opening UTMP file" msgstr "" +#: catgets/gencat.c:977 +msgid "while opening old catalog file" +msgstr "" + #: time/zic.c:1041 msgid "wrong number of fields on Leap line" msgstr "" diff --git a/po/header.pot b/po/header.pot index e3cdf591c8..c74bd351ec 100644 --- a/po/header.pot +++ b/po/header.pot @@ -1,15 +1,15 @@ -# GNU libc message catalog of translations -# Copyright (C) 1996 Free Software Foundation, Inc. -# Automatically generated; contact <bug-glibc@prep.ai.mit.edu> +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR Free Software Foundation, Inc. +# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. # #, fuzzy msgid "" msgstr "" "Project-Id-Version: libc VERSION\n" -"PO-Revision-Date: DATE\n" -"Last-Translator: GNU libc maintainers <bug-glibc@prep.ai.mit.edu>\n" +"POT-Creation-Date: DATE\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+DIST\n" +"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" "MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=ISO-8859-1\n" -"Content-Transfer-Encoding: 8-bit\n" - +"Content-Type: text/plain; charset=CHARSET\n" +"Content-Transfer-Encoding: ENCODING\n" diff --git a/stdlib/stdlib.h b/stdlib/stdlib.h index d34f56256a..876fcc2bb8 100644 --- a/stdlib/stdlib.h +++ b/stdlib/stdlib.h @@ -107,6 +107,16 @@ extern unsigned long long int strtouq __P ((__const char *__nptr, char **__endptr, int __base)); #endif /* GCC and use BSD. */ +#if defined (__GNUC__) && defined (__USE_MISC) +/* Convert a string to a quadword integer. */ +extern long long int strtoll __P ((__const char *__nptr, char **__endptr, + int __base)); +/* Convert a string to an unsigned quadword integer. */ +extern unsigned long long int strtoull __P ((__const char *__nptr, + char **__endptr, int __base)); +#endif /* GCC and use MISC. */ + + /* The internal entry points for `strtoX' take an extra flag argument saying whether or not to parse locale-dependent number grouping. */ @@ -160,6 +170,15 @@ extern __inline unsigned long long int strtouq (__const char *__nptr, { return __strtouq_internal (__nptr, __endptr, __base, 0); } #endif +#ifdef __USE_MISC +extern __inline long long int strtoll (__const char *__nptr, char **__endptr, + int __base) +{ return __strtoq_internal (__nptr, __endptr, __base, 0); } +extern __inline unsigned long long int strtoull (__const char *__nptr, + char **__endptr, int __base) +{ return __strtouq_internal (__nptr, __endptr, __base, 0); } +#endif + extern __inline double atof (__const char *__nptr) { return strtod (__nptr, (char **) NULL); } extern __inline int atoi (__const char *__nptr) diff --git a/stdlib/strfmon.c b/stdlib/strfmon.c index 2074f29e46..3b8c7d602a 100644 --- a/stdlib/strfmon.c +++ b/stdlib/strfmon.c @@ -255,7 +255,7 @@ strfmon (char *s, size_t maxsize, const char *format, ...) ++fmt; is_long_double = 1; } - + /* Handle format specifier. */ switch (*fmt++) { @@ -288,7 +288,7 @@ strfmon (char *s, size_t maxsize, const char *format, ...) _NL_CURRENT (LC_MONETARY, MON_GROUPING), *_NL_CURRENT (LC_MONETARY, MON_THOUSANDS_SEP)); - + /* Now it's time to get the value. */ if (is_long_double == 1) { @@ -348,7 +348,7 @@ strfmon (char *s, size_t maxsize, const char *format, ...) sep_by_space = 0; if (left_prec == -1) left_prec = 0; - + /* Perhaps we'll someday make these things configurable so better start using symbolic names now. */ @@ -356,7 +356,7 @@ strfmon (char *s, size_t maxsize, const char *format, ...) #define right_paren ')' startp = dest; /* Remember start so we can compute lenght. */ - + if (sign_posn == 0) out_char (left_paren); if (sign_posn == 5) /* This is for positive number and ( flag. */ @@ -371,7 +371,7 @@ strfmon (char *s, size_t maxsize, const char *format, ...) if (sep_by_space == 2) out_char (' '); } - + if (print_curr_symbol) { out_string (currency_symbol); @@ -398,7 +398,7 @@ strfmon (char *s, size_t maxsize, const char *format, ...) _IO_JUMPS ((_IO_FILE *) &f) = &_IO_str_jumps; _IO_str_init_static ((_IO_FILE *) &f, dest, (s + maxsize) - dest, dest); #else - memset((PTR) &f, 0, sizeof(f)); + memset((void *) &f, 0, sizeof(f)); f.__magic = _IOMAGIC; f.__mode.__write = 1; /* The buffer size is one less than MAXLEN @@ -443,7 +443,7 @@ strfmon (char *s, size_t maxsize, const char *format, ...) return -1; dest += done; - + if (!cs_precedes) { if (sign_posn == 3) @@ -467,7 +467,7 @@ strfmon (char *s, size_t maxsize, const char *format, ...) out_char (' '); out_char (sign_char); } - + if (sign_posn == 0) out_char (right_paren); if (sign_posn == 5) @@ -497,7 +497,7 @@ strfmon (char *s, size_t maxsize, const char *format, ...) /* Terminate the string. */ out_char ('\0'); - + va_end (ap); return dest - s - 1; diff --git a/stdlib/strtoq.c b/stdlib/strtoq.c index be1f723b13..5a9510bf52 100644 --- a/stdlib/strtoq.c +++ b/stdlib/strtoq.c @@ -1,5 +1,5 @@ /* strtoq -- Function to parse a `long long int' from text. -Copyright (C) 1995 Free Software Foundation, Inc. +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 @@ -20,3 +20,5 @@ Cambridge, MA 02139, USA. */ #define QUAD 1 #include <strtol.c> + +weak_alias (strtoq, strtoll) diff --git a/stdlib/strtouq.c b/stdlib/strtouq.c index 4eea0b22ee..e4d817f7f7 100644 --- a/stdlib/strtouq.c +++ b/stdlib/strtouq.c @@ -1,5 +1,5 @@ /* strtouq -- Function to parse an `unsigned long long int' from text. -Copyright (C) 1995 Free Software Foundation, Inc. +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 @@ -20,3 +20,5 @@ Cambridge, MA 02139, USA. */ #define QUAD 1 #include <strtoul.c> + +weak_alias (strtouq, strotull) diff --git a/string/tester.c b/string/tester.c index 64ccce1e11..6be3d2dade 100644 --- a/string/tester.c +++ b/string/tester.c @@ -413,51 +413,64 @@ DEFUN(main, (argc, argv), int argc AND char **argv) cp = strcpy(one, "first, second, third"); equal(strsep(&cp, ", "), "first", 1); /* Basic test. */ equal(one, "first", 2); - equal(strsep(&cp, ", "), "second", 3); - equal(strsep(&cp, ", "), "third", 4); - check(strsep(&cp, ", ") == NULL, 5); + equal(strsep(&cp, ", "), "", 3); + equal(strsep(&cp, ", "), "second", 4); + equal(strsep(&cp, ", "), "", 5); + equal(strsep(&cp, ", "), "third", 6); + check(strsep(&cp, ", ") == NULL, 7); cp = strcpy(one, ", first, "); - equal(strsep(&cp, ", "), "", 6); /* null token. */ - equal(strsep(&cp, ", "), "", 7); + equal(strsep(&cp, ", "), "", 8); + equal(strsep(&cp, ", "), "", 9); + equal(strsep(&cp, ", "), "first", 10); /* Extra delims, 1 tok. */ + equal(strsep(&cp, ", "), "", 11); + check(strsep(&cp, ", ") == NULL, 12); cp = strcpy(one, "1a, 1b; 2a, 2b"); - equal(strsep(&cp, ", "), "1a", 8); /* Changing delim lists. */ - equal(strsep(&cp, "; "), "1b", 9); - equal(strsep(&cp, ", "), "2a", 10); + equal(strsep(&cp, ", "), "1a", 13); /* Changing delim lists. */ + equal(strsep(&cp, ", "), "", 14); + equal(strsep(&cp, "; "), "1b", 15); + equal(strsep(&cp, ", "), "", 16); + equal(strsep(&cp, ", "), "2a", 17); cp = strcpy(two, "x-y"); - equal(strsep(&cp, "-"), "x", 11); /* New string before done. */ - equal(strsep(&cp, "-"), "y", 12); - check(strsep(&cp, "-") == NULL, 13); + equal(strsep(&cp, "-"), "x", 18); /* New string before done. */ + equal(strsep(&cp, "-"), "y", 19); + check(strsep(&cp, "-") == NULL, 20); cp = strcpy(one, "a,b, c,, ,d"); - equal(strsep(&cp, ", "), "a", 14); /* Different separators. */ - equal(strsep(&cp, ", "), "b", 15); - equal(strsep(&cp, " ,"), "c", 16); /* Permute list too. */ - equal(strsep(&cp, " ,"), "d", 17); - check(strsep(&cp, ", ") == NULL, 18); - check(strsep(&cp, ", ") == NULL, 19); /* Persistence. */ + equal(strsep(&cp, ", "), "a", 21); /* Different separators. */ + equal(strsep(&cp, ", "), "b", 22); + equal(strsep(&cp, " ,"), "", 23); + equal(strsep(&cp, " ,"), "c", 24); /* Permute list too. */ + equal(strsep(&cp, " ,"), "", 25); + equal(strsep(&cp, " ,"), "", 26); + equal(strsep(&cp, " ,"), "", 27); + equal(strsep(&cp, " ,"), "d", 28); + check(strsep(&cp, ", ") == NULL, 29); + check(strsep(&cp, ", ") == NULL, 30); /* Persistence. */ cp = strcpy(one, ", "); - check(strsep(&cp, ", ") == one, 20); /* Null token. */ + equal(strsep(&cp, ", "), "", 31); + equal(strsep(&cp, ", "), "", 32); + check(strsep(&cp, ", ") == NULL, 33); /* No tokens. */ cp = strcpy(one, ""); - check(strsep(&cp, ", ") == NULL, 21); /* Empty string. */ + check(strsep(&cp, ", ") == NULL, 34); /* Empty string. */ cp = strcpy(one, "abc"); - equal(strsep(&cp, ", "), "abc", 22); /* No delimiters. */ - check(strsep(&cp, ", ") == NULL, 23); + equal(strsep(&cp, ", "), "abc", 35); /* No delimiters. */ + check(strsep(&cp, ", ") == NULL, 36); cp = strcpy(one, "abc"); - equal(strsep(&cp, ""), "abc", 24); /* Empty delimiter list. */ - check(strsep(&cp, "") == NULL, 25); + equal(strsep(&cp, ""), "abc", 37); /* Empty delimiter list. */ + check(strsep(&cp, "") == NULL, 38); (void) strcpy(one, "abcdefgh"); cp = strcpy(one, "a,b,c"); - equal(strsep(&cp, ","), "a", 26); /* Basics again... */ - equal(strsep(&cp, ","), "b", 27); - equal(strsep(&cp, ","), "c", 28); - check(strsep(&cp, ",") == NULL, 29); - equal(one+6, "gh", 30); /* Stomped past end? */ - equal(one, "a", 31); /* Stomped old tokens? */ - equal(one+2, "b", 32); - equal(one+4, "c", 33); + equal(strsep(&cp, ","), "a", 39); /* Basics again... */ + equal(strsep(&cp, ","), "b", 40); + equal(strsep(&cp, ","), "c", 41); + check(strsep(&cp, ",") == NULL, 42); + equal(one+6, "gh", 43); /* Stomped past end? */ + equal(one, "a", 44); /* Stomped old tokens? */ + equal(one+2, "b", 45); + equal(one+4, "c", 46); /* memcmp. */ it = "memcmp"; - check(memcmp("a", "a", 1) == 0, 1); /* Identity. */ + check(memcmp("a", "a", 1) == 0, 1); /* Identity. */ check(memcmp("abc", "abc", 3) == 0, 2); /* Multicharacter. */ check(memcmp("abcd", "abce", 4) < 0, 3); /* Honestly unequal. */ check(memcmp("abce", "abcd", 4) > 0, 4); diff --git a/sysdeps/generic/strsep.c b/sysdeps/generic/strsep.c index b57a22f649..6fbcb084a6 100644 --- a/sysdeps/generic/strsep.c +++ b/sysdeps/generic/strsep.c @@ -13,8 +13,8 @@ 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. */ +not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +Boston, MA 02111-1307, USA. */ #include <string.h> @@ -31,9 +31,9 @@ strsep (char **stringp, const char *delim) end = strpbrk (begin, delim); if (end) { - /* Terminate the token and advance *STRINGP past the delimiters. */ + /* Terminate the token and set *STRINGP past NUL character. */ *end++ = '\0'; - *stringp = end + strspn (end, delim); + *stringp = end; } else /* No more delimiters; this is the last token. */ diff --git a/sysdeps/i386/isinfl.c b/sysdeps/i386/isinfl.c deleted file mode 100644 index 056d756d58..0000000000 --- a/sysdeps/i386/isinfl.c +++ /dev/null @@ -1,46 +0,0 @@ -/* Check `long double' for Infinity. i386 FPU version. -Copyright (C) 1991, 1992, 1995 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 <math.h> -#include "ieee754.h" - -#undef __isinfl -#undef isinfl - - -/* Return 0 if VALUE is finite or NaN, +1 if it - is +Infinity, -1 if it is -Infinity. */ -int -__isinfl (long double value) -{ - union ieee854_long_double u; - - u.d = value; - - /* Intel's interpretation of the IEEE 854 standard defines Inf to - have the maximum possible exponent and the MSB of the mantissa - set. No further bit of the mantissa must be set. */ - if ((u.ieee.exponent & 0x7fff) == 0x7fff && - u.ieee.mantissa0 == 0x80000000 && u.ieee.mantissa1 == 0) - return u.ieee.negative ? -1 : 1; - - return 0; -} - -weak_alias (__isinfl, isinfl); diff --git a/sysdeps/i386/isnanl.c b/sysdeps/i386/isnanl.c deleted file mode 100644 index de10c07532..0000000000 --- a/sysdeps/i386/isnanl.c +++ /dev/null @@ -1,43 +0,0 @@ -/* Check `long double' for Not A Number. i386 FPU version. -Copyright (C) 1991, 1992, 1995 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 <math.h> -#include "ieee754.h" - -#undef __isnanl -#undef isnanl - - -/* Return nonzero if VALUE is not a number. */ -int -__isnanl (long double value) -{ - union ieee854_long_double u; - - u.d = value; - - /* Intel's interpretation of the IEEE 854 standard defines NaN to - have the maximum possible exponent and the MSB and at least one - more bit of the mantissa set. */ - return ((u.ieee.exponent & 0x7fff) == 0x7fff - && ((u.ieee.mantissa0 & 0x80000000) != 0) - && ((u.ieee.mantissa0 & 0x7fffffff) != 0 || u.ieee.mantissa1 != 0)); -} - -weak_alias (__isnanl, isnanl); diff --git a/sysdeps/i386/strsep.S b/sysdeps/i386/strsep.S deleted file mode 100644 index 8c425dd505..0000000000 --- a/sysdeps/i386/strsep.S +++ /dev/null @@ -1,3 +0,0 @@ -#define FUNCTION strsep -#define USE_AS_STRSEP 1 -#include <sysdeps/i386/strtok.S> diff --git a/sysdeps/i386/strtok.S b/sysdeps/i386/strtok.S index 28845e08cf..2ef8803ef6 100644 --- a/sysdeps/i386/strtok.S +++ b/sysdeps/i386/strtok.S @@ -19,7 +19,6 @@ 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 <errnos.h> #include <sysdep.h> /* This file can be used for three variants of the strtok function: @@ -35,14 +34,9 @@ Boston, MA 02111-1307, USA. */ delim (sp + 8) save_ptr (sp + 12) - strsep: - INPUT PARAMETERS - str_ptr (sp + 4) - delim (sp + 8) - We do a common implementation here. */ -#if !defined (USE_AS_STRTOK_R) && !defined (USE_AS_STRSEP) +#ifndef USE_AS_STRTOK_R .bss .local save_ptr ASM_TYPE_DIRECTIVE (save_ptr, @object) @@ -53,73 +47,40 @@ save_ptr: #define FUNCTION strtok #endif - /* We use the possibility to do some more initialization - for the strtok implementation. */ .text -Lillegal_argument: -#ifndef PIC - movl $EINVAL, C_SYMBOL_NAME(errno) - xorl %eax, %eax -#else -# if defined (USE_AS_STRTOK_R) || defined (USE_AS_STRSEP) - pushl %ebx /* Save PIC register. */ - call Lhere2 -Lhere2: popl %ebx - addl $_GLOBAL_OFFSET_TABLE_+[.-Lhere2], %ebx -# endif - movl errno@GOT(%ebx), %ebx - movl $EINVAL, (%ebx) - xorl %eax, %eax - popl %ebx -#endif - ret - ENTRY (FUNCTION) movl 4(%esp), %edx /* Get start of string. */ movl 8(%esp), %eax /* Get start of delimiter set. */ -#ifdef USE_AS_STRSEP - /* %EDX does not yet contain the string starting point. Only - a pointer to the location where it is stored. */ - movl (%edx), %edx -#else -# if !defined (USE_AS_STRTOK_R) && defined (PIC) +#if !defined (USE_AS_STRTOK_R) && defined (PIC) pushl %ebx /* Save PIC register. */ call Lhere Lhere: popl %ebx addl $_GLOBAL_OFFSET_TABLE_+[.-Lhere], %ebx -# endif +#endif /* If the pointer is NULL we have to use the stored value of the last run. */ cmpl $0, %edx jne L0 -# ifdef USE_AS_STRTOK_R +#ifdef USE_AS_STRTOK_R /* The value is stored in the third argument. */ movl 12(%esp), %edx movl (%edx), %edx -# else +#else /* The value is in the local variable defined above. But we have to take care for PIC code. */ -# ifndef PIC +# ifndef PIC movl save_ptr, %edx -# else +# else movl save_ptr@GOTOFF(%ebx), %edx -# endif # endif #endif - /* Compare whether pointer is NULL. We are tolerant here - because the C function do the same. */ - cmpl $0, %edx - je Lillegal_argument - -#ifndef USE_AS_STRSEP L0: -#endif /* First we create a table with flags for all possible characters. For the ASCII (7bit/8bit) or ISO-8859-X character sets which are supported by the C string functions we have 256 characters. @@ -224,8 +185,8 @@ L1: leal -4(%edx), %eax /* prepare loop */ 1. a character in the stopset was found and 2. the end of the string was found - But as a sign that the chracter is in the stopset we store its - value in the table. But the value of NUL is NUL so the loop + As a sign that the character is in the stopset we store its + value in the table. The value of NUL is NUL so the loop terminates for NUL in every case. */ L3: addl $4, %eax /* adjust pointer for full loop round */ @@ -295,9 +256,6 @@ L11: #ifdef USE_AS_STRTOK_R movl 12(%esp), %ecx movl %edx, (%ecx) -#elif USE_AS_STRSEP - movl 4(%esp), %ecx - movl %edx, (%ecx) #else # ifndef PIC movl %edx, save_ptr @@ -315,9 +273,6 @@ LreturnNULL: #ifdef USE_AS_STRTOK_R movl 12(%esp), %ecx movl %eax, (%ecx) -#elif USE_AS_STRSEP - movl 4(%esp), %ecx - movl %eax, (%ecx) #else # ifndef PIC movl %eax, save_ptr diff --git a/sysdeps/ieee754/isinf.c b/sysdeps/ieee754/isinf.c deleted file mode 100644 index 79be916432..0000000000 --- a/sysdeps/ieee754/isinf.c +++ /dev/null @@ -1,40 +0,0 @@ -/* Copyright (C) 1991, 1992, 1995 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> -#include <math.h> -#include "ieee754.h" - -/* Return 0 if VALUE is finite or NaN, +1 if it - is +Infinity, -1 if it is -Infinity. */ -int -DEFUN(__isinf, (value), double value) -{ - union ieee754_double u; - - u.d = value; - /* An IEEE 754 infinity has an exponent with the - maximum possible value and a zero mantissa. */ - if ((u.ieee.exponent & 0x7ff) == 0x7ff && - u.ieee.mantissa0 == 0 && u.ieee.mantissa1 == 0) - return u.ieee.negative ? -1 : 1; - - return 0; -} - -weak_alias (__isinf, isinf) diff --git a/sysdeps/ieee754/isinfl.c b/sysdeps/ieee754/isinfl.c deleted file mode 100644 index ad03728ad8..0000000000 --- a/sysdeps/ieee754/isinfl.c +++ /dev/null @@ -1,44 +0,0 @@ -/* Copyright (C) 1991, 1992, 1995 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 <math.h> -#include "ieee754.h" - -#undef __isinfl -#undef isinfl - - -/* Return 0 if VALUE is finite or NaN, +1 if it - is +Infinity, -1 if it is -Infinity. */ -int -__isinfl (long double value) -{ - union ieee854_long_double u; - - u.d = value; - - /* An IEEE 854 infinity has an exponent with the - maximum possible value and a zero mantissa. */ - if ((u.ieee.exponent & 0x7fff) == 0x7fff && - u.ieee.mantissa0 == 0 && u.ieee.mantissa1 == 0) - return u.ieee.negative ? -1 : 1; - - return 0; -} - -weak_alias (__isinfl, isinfl); diff --git a/sysdeps/ieee754/isnan.c b/sysdeps/ieee754/isnan.c deleted file mode 100644 index 8a537cc0dd..0000000000 --- a/sysdeps/ieee754/isnan.c +++ /dev/null @@ -1,37 +0,0 @@ -/* Copyright (C) 1991, 1992, 1995 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> -#include <math.h> -#include "ieee754.h" - -/* Return nonzero if VALUE is not a number. */ -int -DEFUN(__isnan, (value), double value) -{ - union ieee754_double u; - - u.d = value; - - /* IEEE 754 NaN's have the maximum possible - exponent and a nonzero mantissa. */ - return ((u.ieee.exponent & 0x7ff) == 0x7ff && - (u.ieee.mantissa0 != 0 || u.ieee.mantissa1 != 0)); -} - -weak_alias (__isnan, isnan) diff --git a/sysdeps/ieee754/isnanl.c b/sysdeps/ieee754/isnanl.c deleted file mode 100644 index b06b31a3d2..0000000000 --- a/sysdeps/ieee754/isnanl.c +++ /dev/null @@ -1,40 +0,0 @@ -/* Copyright (C) 1991, 1992, 1995 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 <math.h> -#include "ieee754.h" - -#undef __isnanl -#undef isnanl - - -/* Return nonzero if VALUE is not a number. */ -int -__isnanl (long double value) -{ - union ieee854_long_double u; - - u.d = value; - - /* IEEE 854 NaN's have the maximum possible - exponent and a nonzero mantissa. */ - return ((u.ieee.exponent & 0x7fff) == 0x7fff && - (u.ieee.mantissa0 != 0 || u.ieee.mantissa1 != 0)); -} - -weak_alias (__isnanl, isnanl); diff --git a/sysdeps/libm-i387/e_acosl.S b/sysdeps/libm-i387/e_acosl.S new file mode 100644 index 0000000000..3779fa7861 --- /dev/null +++ b/sysdeps/libm-i387/e_acosl.S @@ -0,0 +1,21 @@ +/* + * Written by J.T. Conklin <jtc@netbsd.org>. + * Public domain. + * + * Adapted for `long double' by Ulrich Drepper <drepper@cygnus.com>. + */ + +#include <machine/asm.h> + + +/* acosl = atanl (sqrtl(1 - x^2) / x) */ +ENTRY(__ieee754_acos) + fldt 4(%esp) /* x */ + fst %st(1) + fmul %st(0) /* x^2 */ + fld1 + fsubp /* 1 - x^2 */ + fsqrt /* sqrtl (1 - x^2) */ + fxch %st(1) + fpatan + ret diff --git a/sysdeps/libm-i387/e_exp.S b/sysdeps/libm-i387/e_exp.S index 3ed039bc87..144748e820 100644 --- a/sysdeps/libm-i387/e_exp.S +++ b/sysdeps/libm-i387/e_exp.S @@ -10,12 +10,15 @@ RCSID("$NetBSD: e_exp.S,v 1.4 1995/05/08 23:47:04 jtc Exp $") /* e^x = 2^(x * log2(e)) */ ENTRY(__ieee754_exp) fldl 4(%esp) - fxam +/* I added the following ugly construct because exp(+-Inf) resulted + in NaN. The ugliness results from the bright minds at Intel. + -- drepper@cygnus.com. */ + fxam /* Is NaN or +-Inf? */ fstsw %ax sahf - jnc .LnoInf - jp .LisInf -.LnoInf: + jnc .LnoInfNaN /* No, jump. */ + jp .LisInf /* Is +-Inf, jump. */ +.LnoInfNaN: fldl2e fmulp /* x * log2(e) */ fstl %st(1) @@ -29,7 +32,7 @@ ENTRY(__ieee754_exp) ret .LisInf: - andb $2, %ah - jz .LpInf - fldz + andb $2, %ah /* Test sign. */ + jz .LpInf /* If positive, jump. */ + fldz /* Set result to 0. */ .LpInf: ret diff --git a/sysdeps/libm-i387/s_ceil.S b/sysdeps/libm-i387/s_ceil.S index 2fd813dcd7..eabe662a6c 100644 --- a/sysdeps/libm-i387/s_ceil.S +++ b/sysdeps/libm-i387/s_ceil.S @@ -12,17 +12,17 @@ ENTRY(__ceil) movl %esp,%ebp subl $8,%esp - fstcw -12(%ebp) /* store fpu control word */ - movw -12(%ebp),%dx + fstcw -4(%ebp) /* store fpu control word */ + movw -4(%ebp),%dx orw $0x0800,%dx /* round towards +oo */ andw $0xfbff,%dx - movw %dx,-16(%ebp) - fldcw -16(%ebp) /* load modfied control word */ + movw %dx,-8(%ebp) + fldcw -8(%ebp) /* load modfied control word */ fldl 8(%ebp); /* round */ frndint - fldcw -12(%ebp) /* restore original control word */ + fldcw -4(%ebp) /* restore original control word */ leave ret diff --git a/sysdeps/libm-i387/s_ceilf.S b/sysdeps/libm-i387/s_ceilf.S index 6458b45e8f..c2163abef1 100644 --- a/sysdeps/libm-i387/s_ceilf.S +++ b/sysdeps/libm-i387/s_ceilf.S @@ -12,17 +12,17 @@ ENTRY(__ceilf) movl %esp,%ebp subl $8,%esp - fstcw -12(%ebp) /* store fpu control word */ - movw -12(%ebp),%dx + fstcw -4(%ebp) /* store fpu control word */ + movw -4(%ebp),%dx orw $0x0800,%dx /* round towards +oo */ andw $0xfbff,%dx - movw %dx,-16(%ebp) - fldcw -16(%ebp) /* load modfied control word */ + movw %dx,-8(%ebp) + fldcw -8(%ebp) /* load modfied control word */ flds 8(%ebp); /* round */ frndint - fldcw -12(%ebp) /* restore original control word */ + fldcw -4(%ebp) /* restore original control word */ leave ret diff --git a/sysdeps/libm-i387/s_ceill.S b/sysdeps/libm-i387/s_ceill.S new file mode 100644 index 0000000000..fd7bd38752 --- /dev/null +++ b/sysdeps/libm-i387/s_ceill.S @@ -0,0 +1,30 @@ +/* + * Written by J.T. Conklin <jtc@netbsd.org>. + * Changes for long double by Ulrich Drepper <drepper@cygnus.com> + * Public domain. + */ + +#include <machine/asm.h> + +RCSID("$NetBSD: $") + +ENTRY(__ceill) + pushl %ebp + movl %esp,%ebp + subl $8,%esp + + fstcw -4(%ebp) /* store fpu control word */ + movw -4(%ebp),%dx + orw $0x0800,%dx /* round towards +oo */ + andw $0xfbff,%dx + movw %dx,-8(%ebp) + fldcw -8(%ebp) /* load modfied control word */ + + fldt 8(%ebp); /* round */ + frndint + + fldcw -4(%ebp) /* restore original control word */ + + leave + ret +weak_alias (__ceill, ceill) diff --git a/sysdeps/libm-i387/s_copysignl.S b/sysdeps/libm-i387/s_copysignl.S new file mode 100644 index 0000000000..f65f6842ea --- /dev/null +++ b/sysdeps/libm-i387/s_copysignl.S @@ -0,0 +1,20 @@ +/* + * Written by J.T. Conklin <jtc@netbsd.org>. + * Changes for long double by Ulrich Drepper <drepper@cygnus.com> + * Public domain. + */ + +#include <machine/asm.h> + +RCSID("$NetBSD: $") + +ENTRY(__copysignl) + movl 24(%esp),%edx + movl 12(%esp),%eax + andl $0x8000,%edx + andl $0x7fff,%eax + orl %edx,%eax + movl %eax,12(%esp) + fldl 4(%esp) + ret +weak_alias (__copysignl, copysignl) diff --git a/sysdeps/libm-i387/s_finitel.S b/sysdeps/libm-i387/s_finitel.S new file mode 100644 index 0000000000..d163965c0d --- /dev/null +++ b/sysdeps/libm-i387/s_finitel.S @@ -0,0 +1,19 @@ +/* + * Written by J.T. Conklin <jtc@netbsd.org>. + * Public domain. + * + * Adapted for `long double' by Ulrich Drepper <drepper@cygnus.com>. + */ + +#include <machine/asm.h> + +RCSID("$NetBSD: $") + +ENTRY(__finitel) + movl 12(%esp),%eax + andl $0x7fff, %eax + cmpl $0x7fff, %eax + setne %al + andl $0x000000ff, %eax + ret +weak_alias (__finitel, finitel) diff --git a/sysdeps/libm-i387/s_floor.S b/sysdeps/libm-i387/s_floor.S index 33d5dbcc70..66e688f7f7 100644 --- a/sysdeps/libm-i387/s_floor.S +++ b/sysdeps/libm-i387/s_floor.S @@ -12,17 +12,17 @@ ENTRY(__floor) movl %esp,%ebp subl $8,%esp - fstcw -12(%ebp) /* store fpu control word */ - movw -12(%ebp),%dx + fstcw -4(%ebp) /* store fpu control word */ + movw -4(%ebp),%dx orw $0x0400,%dx /* round towards -oo */ andw $0xf7ff,%dx - movw %dx,-16(%ebp) - fldcw -16(%ebp) /* load modfied control word */ + movw %dx,-8(%ebp) + fldcw -8(%ebp) /* load modfied control word */ fldl 8(%ebp); /* round */ frndint - fldcw -12(%ebp) /* restore original control word */ + fldcw -4(%ebp) /* restore original control word */ leave ret diff --git a/sysdeps/libm-i387/s_floorf.S b/sysdeps/libm-i387/s_floorf.S index dd290fa818..4b10f74e4f 100644 --- a/sysdeps/libm-i387/s_floorf.S +++ b/sysdeps/libm-i387/s_floorf.S @@ -12,17 +12,17 @@ ENTRY(__floorf) movl %esp,%ebp subl $8,%esp - fstcw -12(%ebp) /* store fpu control word */ - movw -12(%ebp),%dx + fstcw -4(%ebp) /* store fpu control word */ + movw -4(%ebp),%dx orw $0x0400,%dx /* round towards -oo */ andw $0xf7ff,%dx - movw %dx,-16(%ebp) - fldcw -16(%ebp) /* load modfied control word */ + movw %dx,-8(%ebp) + fldcw -8(%ebp) /* load modfied control word */ flds 8(%ebp); /* round */ frndint - fldcw -12(%ebp) /* restore original control word */ + fldcw -4(%ebp) /* restore original control word */ leave ret diff --git a/sysdeps/libm-i387/s_floorl.S b/sysdeps/libm-i387/s_floorl.S new file mode 100644 index 0000000000..af52ffcacf --- /dev/null +++ b/sysdeps/libm-i387/s_floorl.S @@ -0,0 +1,30 @@ +/* + * Written by J.T. Conklin <jtc@netbsd.org>. + * Changes for long double by Ulrich Drepper <drepper@cygnus.com> + * Public domain. + */ + +#include <machine/asm.h> + +RCSID("$NetBSD: $") + +ENTRY(__floorl) + pushl %ebp + movl %esp,%ebp + subl $8,%esp + + fstcw -4(%ebp) /* store fpu control word */ + movw -4(%ebp),%dx + orw $0x0400,%dx /* round towards -oo */ + andw $0xf7ff,%dx + movw %dx,-8(%ebp) + fldcw -8(%ebp) /* load modfied control word */ + + fldt 8(%ebp) /* round */ + frndint + + fldcw -4(%ebp) /* restore original control word */ + + leave + ret +weak_alias (__floorl, floorl) diff --git a/sysdeps/libm-i387/s_isinfl.c b/sysdeps/libm-i387/s_isinfl.c new file mode 100644 index 0000000000..3ee53d5ecc --- /dev/null +++ b/sysdeps/libm-i387/s_isinfl.c @@ -0,0 +1,36 @@ +/* + * Written by J.T. Conklin <jtc@netbsd.org>. + * Change for long double by Ulrich Drepper <drepper@cygnus.com>. + * Intel i387 specific version. + * Public domain. + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: $"; +#endif + +/* + * isinfl(x) returns 1 is x is inf, else 0; + * no branching! + */ + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ + int __isinfl(long double x) +#else + int __isinfl(x) + long double x; +#endif +{ + int32_t se,hx,lx; + GET_LDOUBLE_WORDS(se,hx,lx,x); + se &= 0x7fff; + se ^= 0x7fff; + /* This additional ^ 0x80000000 is necessary because in Intel's + internal representation the implicit one is explicit. */ + se |= (hx ^ 0x80000000) | lx; + return (se == 0); +} +weak_alias (__isinfl, isinfl) diff --git a/sysdeps/libm-i387/s_isnanl.c b/sysdeps/libm-i387/s_isnanl.c new file mode 100644 index 0000000000..768ea2164b --- /dev/null +++ b/sysdeps/libm-i387/s_isnanl.c @@ -0,0 +1,46 @@ +/* s_isnanl.c -- long double version for i387 of s_isnan.c. + * Conversion to long double by Ulrich Drepper, + * Cygnus Support, drepper@cygnus.com. + */ + +/* + * ==================================================== + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. + * + * Developed at SunPro, a Sun Microsystems, Inc. business. + * Permission to use, copy, modify, and distribute this + * software is freely granted, provided that this notice + * is preserved. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: $"; +#endif + +/* + * isnanl(x) returns 1 is x is nan, else 0; + * no branching! + */ + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ + int __isnanl(long double x) +#else + int __isnanl(x) + long double x; +#endif +{ + int32_t se,hx,lx; + GET_LDOUBLE_WORDS(se,hx,lx,x); + se = (se & 0x7fff) << 1; + lx |= hx; + /* The additional &hx is required because Intel's extended format + has the normally implicit 1 explicit present. Sigh! */ + se |= (u_int32_t)((lx|(-lx))&hx)>>31; + se = 0xfffe - se; + return (int)((u_int32_t)(se))>>16; +} +weak_alias (__isnanl, isnanl) diff --git a/sysdeps/libm-i387/s_nextafterl.c b/sysdeps/libm-i387/s_nextafterl.c new file mode 100644 index 0000000000..b574430832 --- /dev/null +++ b/sysdeps/libm-i387/s_nextafterl.c @@ -0,0 +1,102 @@ +/* s_nextafterl.c -- long double version of s_nextafter.c. + * Special version for i387. + * Conversion to long double by Ulrich Drepper, + * Cygnus Support, drepper@cygnus.com. + */ + +/* + * ==================================================== + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. + * + * Developed at SunPro, a Sun Microsystems, Inc. business. + * Permission to use, copy, modify, and distribute this + * software is freely granted, provided that this notice + * is preserved. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: $"; +#endif + +/* IEEE functions + * nextafterl(x,y) + * return the next machine floating-point number of x in the + * direction toward y. + * Special cases: + */ + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ + long double __nextafterl(long double x, long double y) +#else + long double __nextafterl(x,y) + long double x,y; +#endif +{ + int32_t hx,hy,ix,iy; + u_int32_t lx,ly,esx,esy; + + GET_LDOUBLE_WORDS(esx,hx,lx,x); + GET_LDOUBLE_WORDS(esy,hy,ly,y); + ix = esx&0x7fff; /* |x| */ + iy = esy&0x7fff; /* |y| */ + + /* The additional &hx/&hy is required because Intel's extended format + has the normally implicit 1 explicit present. Sigh! */ + if(((ix==0x7fff)&&(((hx|lx)|-(hx|lx))&hx)>>31!=0) || /* x is nan */ + ((iy==0x7fff)&&(((hy|ly)|-(hy|ly))&hy)>>31!=0)) /* y is nan */ + return x+y; + if(x==y) return x; /* x=y, return x */ + if((ix|hx|lx)==0) { /* x == 0 */ + SET_LDOUBLE_WORDS(x,esx&0x8000,0,1);/* return +-minsubnormal */ + y = x*x; + if(y==x) return y; else return x; /* raise underflow flag */ + } + if(esx<0x8000) { /* x > 0 */ + if(ix>iy||((ix==iy) && (hx>hy||((hx==hy)&&(lx>ly))))) { + /* x > y, x -= ulp */ + if(lx==0) { + if (hx==0) esx -= 1; + hx -= 1; + } + lx -= 1; + } else { /* x < y, x += ulp */ + lx += 1; + if(lx==0) { + hx += 1; + if (hx==0) + esx += 1; + } + } + } else { /* x < 0 */ + if(esy>=0||(ix>iy||((ix==iy)&&(hx>hy||((hx==hy)&&(lx>ly)))))){ + /* x < y, x -= ulp */ + if(lx==0) { + if (hx==0) esx -= 1; + hx -= 1; + } + lx -= 1; + } else { /* x > y, x += ulp */ + lx += 1; + if(lx==0) { + hx += 1; + if (hx==0) esx += 1; + } + } + } + esy = esx&0x7fff; + if(esy==0x7fff) return x+x; /* overflow */ + if(esy==0) { /* underflow */ + y = x*x; + if(y!=x) { /* raise underflow flag */ + SET_LDOUBLE_WORDS(y,esx,hx,lx); + return y; + } + } + SET_LDOUBLE_WORDS(x,esx,hx,lx); + return x; +} +weak_alias (__nextafterl, nextafterl) diff --git a/sysdeps/libm-i387/s_rintl.S b/sysdeps/libm-i387/s_rintl.S new file mode 100644 index 0000000000..aec09a6ec4 --- /dev/null +++ b/sysdeps/libm-i387/s_rintl.S @@ -0,0 +1,15 @@ +/* + * Written by J.T. Conklin <jtc@netbsd.org>. + * Changes for long double by Ulrich Drepper <drepper@cygnus.com> + * Public domain. + */ + +#include <machine/asm.h> + +RCSID("$NetBSD: $") + +ENTRY(__rintl) + fldt 4(%esp) + frndint + ret +weak_alias (__rintl, rintl) diff --git a/sysdeps/libm-i387/s_significandl.S b/sysdeps/libm-i387/s_significandl.S new file mode 100644 index 0000000000..e512f54fb2 --- /dev/null +++ b/sysdeps/libm-i387/s_significandl.S @@ -0,0 +1,16 @@ +/* + * Written by J.T. Conklin <jtc@netbsd.org>. + * Changes for long double by Ulrich Drepper <drepper@cygnus.com> + * Public domain. + */ + +#include <machine/asm.h> + +RCSID("$NetBSD: $") + +ENTRY(__significandl) + fldt 4(%esp) + fxtract + fstpt %st(1) + ret +weak_alias (__significandl, significandl) diff --git a/sysdeps/libm-ieee754/s_ceill.c b/sysdeps/libm-ieee754/s_ceill.c new file mode 100644 index 0000000000..c5c86487ea --- /dev/null +++ b/sysdeps/libm-ieee754/s_ceill.c @@ -0,0 +1,89 @@ +/* s_ceill.c -- long double version of s_ceil.c. + * Conversion to long double by Ulrich Drepper, + * Cygnus Support, drepper@cygnus.com. + */ + +/* + * ==================================================== + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. + * + * Developed at SunPro, a Sun Microsystems, Inc. business. + * Permission to use, copy, modify, and distribute this + * software is freely granted, provided that this notice + * is preserved. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: $"; +#endif + +/* + * ceill(x) + * Return x rounded toward -inf to integral value + * Method: + * Bit twiddling. + * Exception: + * Inexact flag raised if x not equal to ceil(x). + */ + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ +static const long double huge = 1.0e4930; +#else +static long double huge = 1.0e4930; +#endif + +#ifdef __STDC__ + long double __ceill(long double x) +#else + long double __ceill(x) + long double x; +#endif +{ + int32_t i1,j0; + u_int32_t i,j,se,i0,sx; + GET_LDOUBLE_WORDS(se,i0,i1,x); + sx = (se>>15)&1; + j0 = (se&0x7fff)-0x3fff; + if(j0<32) { + if(j0<0) { /* raise inexact if x != 0 */ + if(huge+x>0.0) {/* return 0*sign(x) if |x|<1 */ + if(sx) {es=0x8000;i0=0;i1=0;} + else if((i0|i1)!=0) { es=0x3fff;i0=0;i1=0;} + } + } else { + i = (0xffffffff)>>j0; + if(((i0&i)|i1)==0) return x; /* x is integral */ + if(huge+x>0.0) { /* raise inexact flag */ + if(sx==0) { + if (j0>0) i0 += (0x80000000)>>(j0-1); + else ++se; + } + i0 &= (~i); i1=0; + } + } + } else if (j0>63) { + if(j0==0x4000) return x+x; /* inf or NaN */ + else return x; /* x is integral */ + } else { + i = ((u_int32_t)(0xffffffff))>>(j0-32); + if((i1&i)==0) return x; /* x is integral */ + if(huge+x>0.0) { /* raise inexact flag */ + if(sx==0) { + if(j0==32) i0+=1; + else { + j = i1 + (1<<(64-j0)); + if(j<i1) i0+=1; /* got a carry */ + i1 = j; + } + } + i1 &= (~i); + } + } + SET_LDOUBLE_WORDS(x,se,i0,i1); + return x; +} +weak_alias (__ceill, ceill) diff --git a/sysdeps/libm-ieee754/s_copysignl.c b/sysdeps/libm-ieee754/s_copysignl.c new file mode 100644 index 0000000000..9976575b3b --- /dev/null +++ b/sysdeps/libm-ieee754/s_copysignl.c @@ -0,0 +1,43 @@ +/* s_copysignl.c -- long double version of s_copysign.c. + * Conversion to long double by Ulrich Drepper, + * Cygnus Support, drepper@cygnus.com. + */ + +/* + * ==================================================== + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. + * + * Developed at SunPro, a Sun Microsystems, Inc. business. + * Permission to use, copy, modify, and distribute this + * software is freely granted, provided that this notice + * is preserved. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: $"; +#endif + +/* + * copysignl(long double x, long double y) + * copysignl(x,y) returns a value with the magnitude of x and + * with the sign bit of y. + */ + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ + long double __copysignl(long double x, long double y) +#else + long double __copysignl(x,y) + long double x,y; +#endif +{ + u_int32_t es1,es2; + GET_LDOUBLE_EXP(es1,x); + GET_LDOUBLE_EXP(es2,y); + SET_LDOUBLE_EXP(x,(es1&0x7fff)|(es2&0x8000)); + return x; +} +weak_alias (__copysignl, copysignl) diff --git a/sysdeps/libm-ieee754/s_fabsl.c b/sysdeps/libm-ieee754/s_fabsl.c new file mode 100644 index 0000000000..f7170503fb --- /dev/null +++ b/sysdeps/libm-ieee754/s_fabsl.c @@ -0,0 +1,40 @@ +/* s_fabsl.c -- long double version of s_fabs.c. + * Conversion to long double by Ulrich Drepper, + * Cygnus Support, drepper@cygnus.com. + */ + +/* + * ==================================================== + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. + * + * Developed at SunPro, a Sun Microsystems, Inc. business. + * Permission to use, copy, modify, and distribute this + * software is freely granted, provided that this notice + * is preserved. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: $"; +#endif + +/* + * fabsl(x) returns the absolute value of x. + */ + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ + long double __fabsl(long double x) +#else + long double __fabsl(x) + long double x; +#endif +{ + u_int32_t exp; + GET_LDOUBLE_EXP(exp,x); + SET_LDOUBLE_EXP(x,exp&0x7fff); + return x; +} +weak_alias (__fabsl, fabsl) diff --git a/sysdeps/libm-ieee754/s_finitel.c b/sysdeps/libm-ieee754/s_finitel.c new file mode 100644 index 0000000000..02487c610d --- /dev/null +++ b/sysdeps/libm-ieee754/s_finitel.c @@ -0,0 +1,40 @@ +/* s_finitel.c -- long double version of s_finite.c. + * Conversion to long double by Ulrich Drepper, + * Cygnus Support, drepper@cygnus.com. + */ + +/* + * ==================================================== + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. + * + * Developed at SunPro, a Sun Microsystems, Inc. business. + * Permission to use, copy, modify, and distribute this + * software is freely granted, provided that this notice + * is preserved. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: $"; +#endif + +/* + * finitel(x) returns 1 is x is finite, else 0; + * no branching! + */ + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ + int __finite(long double x) +#else + int __finite(x) + long double x; +#endif +{ + int32_t exp; + GET_LDOUBLE_EXP(exp,x); + return (int)((u_int32_t)((exp&0x7fff)-0x7fff)>>15); +} +weak_alias (__finitel, finitel) diff --git a/sysdeps/libm-ieee754/s_floorl.c b/sysdeps/libm-ieee754/s_floorl.c new file mode 100644 index 0000000000..8cd81c6302 --- /dev/null +++ b/sysdeps/libm-ieee754/s_floorl.c @@ -0,0 +1,89 @@ +/* s_floorl.c -- long double version of s_floor.c. + * Conversion to long double by Ulrich Drepper, + * Cygnus Support, drepper@cygnus.com. + */ + +/* + * ==================================================== + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. + * + * Developed at SunPro, a Sun Microsystems, Inc. business. + * Permission to use, copy, modify, and distribute this + * software is freely granted, provided that this notice + * is preserved. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: $"; +#endif + +/* + * floorl(x) + * Return x rounded toward -inf to integral value + * Method: + * Bit twiddling. + * Exception: + * Inexact flag raised if x not equal to floor(x). + */ + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ +static const long double huge = 1.0e4930; +#else +static long double huge = 1.0e4930; +#endif + +#ifdef __STDC__ + long double __floorl(long double x) +#else + long double __floorl(x) + long double x; +#endif +{ + int32_t i1,j0; + u_int32_t i,j,se,i0,sx; + GET_LDOUBLE_WORDS(se,i0,i1,x); + sx = (se>>15)&1; + j0 = (se&0x7fff)-0x3fff; + if(j0<32) { + if(j0<0) { /* raise inexact if x != 0 */ + if(huge+x>0.0) {/* return 0*sign(x) if |x|<1 */ + if(sx==0) {se=0;i0=i1=0;} + else if(((se&0x7fff)|i0|i1)!=0) + { se=0xbfff;i0;i1=0;} + } + } else { + i = (0xffffffff)>>j0; + if(((i0&i)|i1)==0) return x; /* x is integral */ + if(huge+x>0.0) { /* raise inexact flag */ + if(sx) { + if (j0>0) i0 += (0x80000000)>>(j0-1); + else ++se; + i0 &= (~i); i1=0; + } + } + } else if (j0>63) { + if(j0==0x4000) return x+x; /* inf or NaN */ + else return x; /* x is integral */ + } else { + i = ((u_int32_t)(0xffffffff))>>(j0-32); + if((i1&i)==0) return x; /* x is integral */ + if(huge+x>0.0) { /* raise inexact flag */ + if(sx) { + if(j0==32) i0+=1; + else { + j = i1+(1<<(64-j0)); + if(j<i1) i0 +=1 ; /* got a carry */ + i1=j; + } + } + i1 &= (~i); + } + } + SET_LDOUBLE_WORDS(x,se,i0,i1); + return x; +} +weak_alias (__floorl, floorl) diff --git a/sysdeps/libm-ieee754/s_isinf.c b/sysdeps/libm-ieee754/s_isinf.c index a54d97cba6..6d435f00b2 100644 --- a/sysdeps/libm-ieee754/s_isinf.c +++ b/sysdeps/libm-ieee754/s_isinf.c @@ -30,3 +30,6 @@ static char rcsid[] = "$NetBSD: s_isinf.c,v 1.3 1995/05/11 23:20:14 jtc Exp $"; return (hx == 0); } weak_alias (__isinf, isinf) +#ifdef NO_LONG_DOUBLE +weak_alias (__isinf, isinfl) +#endif diff --git a/sysdeps/libm-ieee754/s_isinfl.c b/sysdeps/libm-ieee754/s_isinfl.c new file mode 100644 index 0000000000..22dff75444 --- /dev/null +++ b/sysdeps/libm-ieee754/s_isinfl.c @@ -0,0 +1,33 @@ +/* + * Written by J.T. Conklin <jtc@netbsd.org>. + * Change for long double by Ulrich Drepper <drepper@cygnus.com>. + * Public domain. + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: $"; +#endif + +/* + * isinfl(x) returns 1 is x is inf, else 0; + * no branching! + */ + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ + int __isinfl(long double x) +#else + int __isinfl(x) + long double x; +#endif +{ + int32_t se,hx,lx; + GET_LDOUBLE_WORDS(se,hx,lx,x); + se &= 0x7fff; + se ^= 0x7fff; + se |= hx | lx; + return (se == 0); +} +weak_alias (__isinfl, isinfl) diff --git a/sysdeps/libm-ieee754/s_isnan.c b/sysdeps/libm-ieee754/s_isnan.c index 2609a51968..4d8983c9b3 100644 --- a/sysdeps/libm-ieee754/s_isnan.c +++ b/sysdeps/libm-ieee754/s_isnan.c @@ -5,7 +5,7 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ @@ -32,8 +32,11 @@ static char rcsid[] = "$NetBSD: s_isnan.c,v 1.8 1995/05/10 20:47:36 jtc Exp $"; int32_t hx,lx; EXTRACT_WORDS(hx,lx,x); hx &= 0x7fffffff; - hx |= (u_int32_t)(lx|(-lx))>>31; + hx |= (u_int32_t)(lx|(-lx))>>31; hx = 0x7ff00000 - hx; return (int)((u_int32_t)(hx))>>31; } weak_alias (__isnan, isnan) +#ifdef NO_LONG_DOUBLE +weak_alias (__isnan, isnanl) +#endif diff --git a/sysdeps/libm-ieee754/s_isnanl.c b/sysdeps/libm-ieee754/s_isnanl.c new file mode 100644 index 0000000000..0da97090bd --- /dev/null +++ b/sysdeps/libm-ieee754/s_isnanl.c @@ -0,0 +1,44 @@ +/* s_isnanl.c -- long double version of s_isnan.c. + * Conversion to long double by Ulrich Drepper, + * Cygnus Support, drepper@cygnus.com. + */ + +/* + * ==================================================== + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. + * + * Developed at SunPro, a Sun Microsystems, Inc. business. + * Permission to use, copy, modify, and distribute this + * software is freely granted, provided that this notice + * is preserved. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: $"; +#endif + +/* + * isnanl(x) returns 1 is x is nan, else 0; + * no branching! + */ + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ + int __isnanl(long double x) +#else + int __isnanl(x) + long double x; +#endif +{ + int32_t se,hx,lx; + GET_LDOUBLE_WORDS(se,hx,lx,x); + se = (se & 0x7fff) << 1; + hx |= lx; + se |= (u_int32_t)(hx|(-hx))>>31; + se = 0xfffe - se; + return (int)((u_int32_t)(se))>>16; +} +weak_alias (__isnanl, isnanl) diff --git a/sysdeps/libm-ieee754/s_nextafterl.c b/sysdeps/libm-ieee754/s_nextafterl.c new file mode 100644 index 0000000000..0327261f33 --- /dev/null +++ b/sysdeps/libm-ieee754/s_nextafterl.c @@ -0,0 +1,99 @@ +/* s_nextafterl.c -- long double version of s_nextafter.c. + * Conversion to long double by Ulrich Drepper, + * Cygnus Support, drepper@cygnus.com. + */ + +/* + * ==================================================== + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. + * + * Developed at SunPro, a Sun Microsystems, Inc. business. + * Permission to use, copy, modify, and distribute this + * software is freely granted, provided that this notice + * is preserved. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: $"; +#endif + +/* IEEE functions + * nextafterl(x,y) + * return the next machine floating-point number of x in the + * direction toward y. + * Special cases: + */ + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ + long double __nextafterl(long double x, long double y) +#else + long double __nextafterl(x,y) + long double x,y; +#endif +{ + int32_t hx,hy,ix,iy; + u_int32_t lx,ly,esx,esy; + + GET_LDOUBLE_WORDS(esx,hx,lx,x); + GET_LDOUBLE_WORDS(esy,hy,ly,y); + ix = esx&0x7fff; /* |x| */ + iy = esy&0x7fff; /* |y| */ + + if(((ix==0x7fff)&&((hx|lx)|-(hx|lx))!=0) || /* x is nan */ + ((iy==0x7fff)&&((hy|ly)|-(hy|ly))!=0)) /* y is nan */ + return x+y; + if(x==y) return x; /* x=y, return x */ + if((ix|hx|lx)==0) { /* x == 0 */ + SET_LDOUBLE_WORDS(x,esx&0x8000,0,1);/* return +-minsubnormal */ + y = x*x; + if(y==x) return y; else return x; /* raise underflow flag */ + } + if(esx<0x8000) { /* x > 0 */ + if(ix>iy||((ix==iy) && (hx>hy||((hx==hy)&&(lx>ly))))) { + /* x > y, x -= ulp */ + if(lx==0) { + if (hx==0) esx -= 1; + hx -= 1; + } + lx -= 1; + } else { /* x < y, x += ulp */ + lx += 1; + if(lx==0) { + hx += 1; + if (hx==0) + esx += 1; + } + } + } else { /* x < 0 */ + if(esy>=0||(ix>iy||((ix==iy)&&(hx>hy||((hx==hy)&&(lx>ly)))))){ + /* x < y, x -= ulp */ + if(lx==0) { + if (hx==0) esx -= 1; + hx -= 1; + } + lx -= 1; + } else { /* x > y, x += ulp */ + lx += 1; + if(lx==0) { + hx += 1; + if (hx==0) esx += 1; + } + } + } + esy = esx&0x7fff; + if(esy==0x7fff) return x+x; /* overflow */ + if(esy==0) { /* underflow */ + y = x*x; + if(y!=x) { /* raise underflow flag */ + SET_LDOUBLE_WORDS(y,esx,hx,lx); + return y; + } + } + SET_LDOUBLE_WORDS(x,esx,hx,lx); + return x; +} +weak_alias (__nextafterl, nextafterl) diff --git a/sysdeps/libm-ieee754/s_rintl.c b/sysdeps/libm-ieee754/s_rintl.c new file mode 100644 index 0000000000..c9f12b162a --- /dev/null +++ b/sysdeps/libm-ieee754/s_rintl.c @@ -0,0 +1,96 @@ +/* s_rintl.c -- long double version of s_rint.c. + * Conversion to long double by Ulrich Drepper, + * Cygnus Support, drepper@cygnus.com. + */ + +/* + * ==================================================== + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. + * + * Developed at SunPro, a Sun Microsystems, Inc. business. + * Permission to use, copy, modify, and distribute this + * software is freely granted, provided that this notice + * is preserved. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: $"; +#endif + +/* + * rintl(x) + * Return x rounded to integral value according to the prevailing + * rounding mode. + * Method: + * Using floating addition. + * Exception: + * Inexact flag raised if x not equal to rintl(x). + */ + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ +static const long double +#else +static long double +#endif +TWO64[2]={ + 1.844674407370955161600000e+19, /* 0x403F, 0x00000000, 0x00000000 */ + -1.844674407370955161600000e+19, /* 0xC03F, 0x00000000, 0x00000000 */ +}; + +#ifdef __STDC__ + long double __rintl(long double x) +#else + long double __rintl(x) + long double x; +#endif +{ + int32_t se,j0,sx; + u_int32_t i,i0,i1; + long double w,t; + GET_LDOUBLE_WORDS(se,i0,i1,x); + sx = (se>>15)&1; + j0 = (se&0x7fff)-0x3fff; + if(j0<32) { + if(j0<0) { + if(((se&0x7fff)|i0|i1)==0) return x; + i1 |= i0; + i0 &= 0xe0000000; + i0 |= (i1|-i1)&0x80000000; + SET_LDOUBLE_MSW(x,i0); + w = TWO64[sx]+x; + t = w-TWO64[sx]; + GET_LDOUBLE_EXP(i0,t); + SET_LDOUBLE_EXP(t,(i0&0x7fff)|(sx<<15)); + return t; + } else { + i = (0xffffffff)>>j0; + if(((i0&i)|i1)==0) return x; /* x is integral */ + i>>=1; + if(((i0&i)|i1)!=0) { + if(j0==31) i1 = 0x40000000; else + i0 = (i0&(~i))|((0x20000000)>>j0); + /* Shouldn't this be + if (j0 >= 30) i1 = 0x80000000 >> (j0 - 30); + i0 = (i0&(~i))|((0x20000000)>>j0); + If yes, this should be correct in s_rint and + s_rintf, too. -- drepper@cygnus.com */ + } + } + } else if (j0>63) { + if(j0==0x4000) return x+x; /* inf or NaN */ + else return x; /* x is integral */ + } else { + i = ((u_int32_t)(0xffffffff))>>(j0-32); + if((i1&i)==0) return x; /* x is integral */ + i>>=1; + if((i1&i)!=0) i1 = (i1&(~i))|((0x40000000)>>(j0-32)); + } + SET_LDOUBLE_WORDS(x,se,i0,i1); + w = TWO64[sx]+x; + return w-TWO64[sx]; +} +weak_alias (__rintl, rintl) diff --git a/sysdeps/libm-ieee754/s_scalbnl.c b/sysdeps/libm-ieee754/s_scalbnl.c new file mode 100644 index 0000000000..d00eb88167 --- /dev/null +++ b/sysdeps/libm-ieee754/s_scalbnl.c @@ -0,0 +1,71 @@ +/* s_scalbnl.c -- long double version of s_scalbn.c. + * Conversion to long double by Ulrich Drepper, + * Cygnus Support, drepper@cygnus.com. + */ + +/* + * ==================================================== + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. + * + * Developed at SunPro, a Sun Microsystems, Inc. business. + * Permission to use, copy, modify, and distribute this + * software is freely granted, provided that this notice + * is preserved. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: $"; +#endif + +/* + * scalbnl (long double x, int n) + * scalbnl(x,n) returns x* 2**n computed by exponent + * manipulation rather than by actually performing an + * exponentiation or a multiplication. + */ + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ +static const long double +#else +static long double +#endif +two54 = 1.80143985094819840000e+16, /* 0x43500000, 0x00000000 */ +twom54 = 5.55111512312578270212e-17, /* 0x3C900000, 0x00000000 */ +huge = 1.0e+300, +tiny = 1.0e-300; + +#ifdef __STDC__ + long double __scalbnl (long double x, int n) +#else + long double __scalbnl (x,n) + long double x; int n; +#endif +{ + int32_t k,es,hx,lx; + GET_LDOUBLE_WORDS(es,hx,lx,x); + k = es&0x7fff; /* extract exponent */ + if (k==0) { /* 0 or subnormal x */ + if ((lx|(hx&0x7fffffff))==0) return x; /* +-0 */ + x *= two54; + GET_HIGH_WORD(hx,x); + k = ((hx&0x7ff00000)>>20) - 54; + if (n< -50000) return tiny*x; /*underflow*/ + } + if (k==0x7ff) return x+x; /* NaN or Inf */ + k = k+n; + if (k > 0x7fe) return huge*__copysign(huge,x); /* overflow */ + if (k > 0) /* normal result */ + {SET_HIGH_WORD(x,(hx&0x800fffff)|(k<<20)); return x;} + if (k <= -54) + if (n > 50000) /* in case integer overflow in n+k */ + return huge*__copysign(huge,x); /*overflow*/ + else return tiny*__copysign(tiny,x); /*underflow*/ + k += 54; /* subnormal result */ + SET_HIGH_WORD(x,(hx&0x800fffff)|(k<<20)); + return x*twom54; +} +weak_alias (__scalbnl, scalbnl) diff --git a/sysdeps/libm-ieee754/s_significandl.c b/sysdeps/libm-ieee754/s_significandl.c new file mode 100644 index 0000000000..6339274b5a --- /dev/null +++ b/sysdeps/libm-ieee754/s_significandl.c @@ -0,0 +1,39 @@ +/* s_significandl.c -- long double version of s_significand.c. + * Conversion to long double by Ulrich Drepper, + * Cygnus Support, drepper@cygnus.com. + */ + +/* + * ==================================================== + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. + * + * Developed at SunPro, a Sun Microsystems, Inc. business. + * Permission to use, copy, modify, and distribute this + * software is freely granted, provided that this notice + * is preserved. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: $"; +#endif + +/* + * significandl(x) computes just + * scalbl(x, (double) -ilogbl(x)), + * for exercising the fraction-part(F) IEEE 754-1985 test vector. + */ + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ + long double __significandl(long double x) +#else + long double __significandl(x) + long double x; +#endif +{ + return __ieee754_scalbl(x,(double) -ilogbl(x)); +} +weak_alias (__significandl, significandl) diff --git a/sysdeps/mach/hurd/Makefile b/sysdeps/mach/hurd/Makefile index 14dc1ebc83..298cd5f71a 100644 --- a/sysdeps/mach/hurd/Makefile +++ b/sysdeps/mach/hurd/Makefile @@ -76,7 +76,7 @@ endef $(common-objpfx)errnos.d: $(mach-errnos-deps) $(mach-errno-h) | \ $(CC) $(CPPFLAGS) -M -x c - | \ - sed -e 's,- *:,mach-errnos-deps :=,' > $@t + sed $(sed-remove-objpfx) -e 's,- *:,mach-errnos-deps :=,' > $@t mv -f $@t $@ $(hurd)/errnos.h: $(common-objpfx)stamp-errnos ; |