/* Copyright (C) 1996, 1997, 1998 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 Lesser General Public License as published by the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ #if !defined _SIGNAL_H && !defined _SYS_UCONTEXT_H # error "Never use directly; include instead." #endif #ifndef sigcontext_struct /* Kernel headers before 2.1.1 define a struct sigcontext_struct, but we need sigcontext. */ # define sigcontext_struct sigcontext # ifndef __user # define __user # endif # include #endif /* This file specifies the native word size of the machine, which indicates the ELF file class used for executables and shared objects on this machine. */ #ifndef _LINK_H # error "Never use directly; include instead." #endif #include #define __ELF_NATIVE_CLASS __WORDSIZE /* The entries in the .hash table always have a size of 32 bits. */ typedef uint32_t Elf_Symndx; /* * Copyright (C) 2003-2006 Manuel Novoa III * * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. */ /* Define a maximal floating point type, and the associated constants * that are defined for the floating point types in float.h. * * This is to support archs that are missing long double, or even double. */ #ifndef _UCLIBC_FPMAX_H #define _UCLIBC_FPMAX_H #ifndef _ISOC99_SOURCE #define _ISOC99_SOURCE 1 #endif #include #include #ifdef __UCLIBC_HAS_FLOATS__ #if defined(LDBL_MANT_DIG) typedef long double __fpmax_t; #define FPMAX_TYPE 3 #define FPMAX_MANT_DIG LDBL_MANT_DIG #define FPMAX_DIG LDBL_DIG #define FPMAX_EPSILON LDBL_EPSILON #define FPMAX_MIN_EXP LDBL_MIN_EXP #define FPMAX_MIN LDBL_MIN #define FPMAX_MIN_10_EXP LDBL_MIN_10_EXP #define FPMAX_MAX_EXP LDBL_MAX_EXP #define FPMAX_MAX LDBL_MAX #define FPMAX_MAX_10_EXP LDBL_MAX_10_EXP #elif defined(DBL_MANT_DIG) typedef double __fpmax_t; #define FPMAX_TYPE 2 #define FPMAX_MANT_DIG DBL_MANT_DIG #define FPMAX_DIG DBL_DIG #define FPMAX_EPSILON DBL_EPSILON #define FPMAX_MIN_EXP DBL_MIN_EXP #define FPMAX_MIN DBL_MIN #define FPMAX_MIN_10_EXP DBL_MIN_10_EXP #define FPMAX_MAX_EXP DBL_MAX_EXP #define FPMAX_MAX DBL_MAX #define FPMAX_MAX_10_EXP DBL_MAX_10_EXP #elif defined(FLT_MANT_DIG) typedef float __fpmax_t; #define FPMAX_TYPE 1 #define FPMAX_MANT_DIG FLT_MANT_DIG #define FPMAX_DIG FLT_DIG #define FPMAX_EPSILON FLT_EPSILON #define FPMAX_MIN_EXP FLT_MIN_EXP #define FPMAX_MIN FLT_MIN #define FPMAX_MIN_10_EXP FLT_MIN_10_EXP #define FPMAX_MAX_EXP FLT_MAX_EXP #define FPMAX_MAX FLT_MAX #define FPMAX_MAX_10_EXP FLT_MAX_10_EXP #else #error unable to determine appropriate type for __fpmax_t! #endif #ifndef DECIMAL_DIG #ifdef L___strtofpmax /* Emit warning only once. */ #warning DECIMAL_DIG is not defined! If you are using gcc, it may not be defining __STDC_VERSION__ as it should. #endif #if !defined(FLT_RADIX) || (FLT_RADIX != 2) #error unable to compensate for missing DECIMAL_DIG! #endif /* ceil (1 + #mantissa * log10 (FLT_RADIX)) */ #define DECIMAL_DIG (1 + (((FPMAX_MANT_DIG * 100) + 331) / 332)) #endif /* DECIMAL_DIG */ /* The following checks in an __fpmax_t is either 0 or +/- infinity. * * WARNING!!! WARNING!!! WARNING!!! WARNING!!! WARNING!!! WARNING!!! * * This only works if __fpmax_t is the actual maximal floating point type used * in intermediate calculations. Otherwise, excess precision in the * intermediate values can cause the test to fail. * * WARNING!!! WARNING!!! WARNING!!! WARNING!!! WARNING!!! WARNING!!! */ #define __FPMAX_ZERO_OR_INF_CHECK(x) ((x) == ((x)/4) ) #endif /* __UCLIBC_HAS_FLOATS__ */ #endif /* _UCLIBC_FPMAX_H */ /* Use a default of 100 for CLK_TCK to implement sysconf() and clock(). * Override this by supplying an arch-specific version of this header file. * * WARNING: It is assumed that this is a constant integer value usable in * preprocessor conditionals!!! */ #define __UCLIBC_CLK_TCK_CONST 100 /* __sig_atomic_t, __sigset_t, and related definitions. Linux version. Copyright (C) 1991, 1992, 1994, 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 Lesser General Public License as published by the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ #ifndef _SIGSET_H_types # define _SIGSET_H_types 1 typedef int __sig_atomic_t; /* A 'sigset_t' has a bit for each signal. * glibc has space for 1024 signals (!), but most arches supported * by Linux have 64 signals, and only MIPS has 128. * There seems to be some historical baggage in sparc[64] * where they might have (or had in the past) 32 signals only, * I hope it's irrelevant now. * Signal 0 does not exist, so we have signals 1..64, not 0..63. * In uclibc, kernel and userspace sigset_t is always the same. * BTW, struct sigaction is also the same on kernel and userspace side. */ #if defined(__mips__) # define _SIGSET_NWORDS (128 / (8 * sizeof (unsigned long))) #else # define _SIGSET_NWORDS (64 / (8 * sizeof (unsigned long))) #endif typedef struct { unsigned long __val[_SIGSET_NWORDS]; } __sigset_t; #endif /* We only want to define these functions if was actually included; otherwise we were included just to define the types. Since we are namespace-clean, it wouldn't hurt to define extra macros. But trouble can be caused by functions being defined (e.g., any global register vars declared later will cause compilation errors). */ #if !defined _SIGSET_H_fns && defined _SIGNAL_H # define _SIGSET_H_fns 1 # ifndef _EXTERN_INLINE # define _EXTERN_INLINE extern __inline # endif /* Return a mask that includes the bit for SIG only. */ /* Unsigned cast ensures shift/mask insns are used. */ # define __sigmask(sig) \ (((unsigned long) 1) << ((unsigned)((sig) - 1) % (8 * sizeof (unsigned long)))) /* Return the word index for SIG. */ # define __sigword(sig) ((unsigned)((sig) - 1) / (8 * sizeof (unsigned long))) /* gcc 4.3.1 is not clever enough to optimize for _SIGSET_NWORDS == 1 and 2, * which are about the only values which can be there */ # if defined __GNUC__ && __GNUC__ >= 2 # define __sigemptyset(set) \ (__extension__ ({ \ sigset_t *__set = (set); \ if (_SIGSET_NWORDS <= 2) { \ __set->__val[0] = 0; \ if (_SIGSET_NWORDS == 2) \ __set->__val[1] = 0; \ } else { \ int __cnt = _SIGSET_NWORDS; \ while (--__cnt >= 0) __set->__val[__cnt] = 0; \ } \ 0; \ })) # define __sigfillset(set) \ (__extension__ ({ \ sigset_t *__set = (set); \ if (_SIGSET_NWORDS <= 2) { \ __set->__val[0] = ~0UL; \ if (_SIGSET_NWORDS == 2) \ __set->__val[1] = ~0UL; \ } else { \ int __cnt = _SIGSET_NWORDS; \ while (--__cnt >= 0) __set->__val[__cnt] = ~0UL; \ } \ 0; \ })) # ifdef __USE_GNU /* The POSIX does not specify for handling the whole signal set in one command. This is often wanted and so we define three more functions here. */ # define __sigisemptyset(set) \ (__extension__ ({ \ long __ret; \ const sigset_t *__set = (set); \ if (_SIGSET_NWORDS == 1) { \ __ret = __set->__val[0]; \ } else if (_SIGSET_NWORDS == 2) { \ __ret = __set->__val[0] | __set->__val[1]; \ } else { \ int __cnt = _SIGSET_NWORDS; \ __ret = __set->__val[--__cnt]; \ while (!__ret && --__cnt >= 0) \ __ret = __set->__val[__cnt]; \ } \ __ret == 0; \ })) # define __sigandset(dest, left, right) \ (__extension__ ({ \ sigset_t *__dest = (dest); \ const sigset_t *__left = (left); \ const sigset_t *__right = (right); \ if (_SIGSET_NWORDS <= 2) { \ __dest->__val[0] = __left->__val[0] & __right->__val[0];\ if (_SIGSET_NWORDS == 2) \ __dest->__val[1] = __left->__val[1] & __right->__val[1];\ } else { \ int __cnt = _SIGSET_NWORDS; \ while (--__cnt >= 0) \ __dest->__val[__cnt] = (__left->__val[__cnt] \ & __right->__val[__cnt]); \ } \ 0; \ })) # define __sigorset(dest, left, right) \ (__extension__ ({ \ sigset_t *__dest = (dest); \ const sigset_t *__left = (left); \ const sigset_t *__right = (right); \ if (_SIGSET_NWORDS <= 2) { \ __dest->__val[0] = __left->__val[0] | __right->__val[0];\ if (_SIGSET_NWORDS == 2) \ __dest->__val[1] = __left->__val[1] | __right->__val[1];\ } else { \ int __cnt = _SIGSET_NWORDS; \ while (--__cnt >= 0) \ __dest->__val[__cnt] = (__left->__val[__cnt] \ | __right->__val[__cnt]); \ } \ 0; \ })) # endif # endif /* These functions needn't check for a bogus signal number -- error checking is done in the non __ versions. */ extern int __sigismember (__const __sigset_t *, int); extern int __sigaddset (__sigset_t *, int); extern int __sigdelset (__sigset_t *, int); # ifdef __USE_EXTERN_INLINES # define __SIGSETFN(NAME, BODY, CONST) \ _EXTERN_INLINE int \ NAME (CONST __sigset_t *__set, int __sig) \ { \ unsigned long __mask = __sigmask (__sig); \ unsigned long __word = __sigword (__sig); \ return BODY; \ } __SIGSETFN (__sigismember, (__set->__val[__word] & __mask) ? 1 : 0, __const) __SIGSETFN (__sigaddset, ((__set->__val[__word] |= __mask), 0), ) __SIGSETFN (__sigdelset, ((__set->__val[__word] &= ~__mask), 0), ) # undef __SIGSETFN # endif #endif /* ! _SIGSET_H_fns. */ /* 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 Lesser General Public License as published by the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ #ifndef _DIRENT_H # error "Never use directly; include instead." #endif struct dirent { #ifndef __USE_FILE_OFFSET64 __ino_t d_ino; __off_t d_off; #else __ino64_t d_ino; __off64_t d_off; #endif unsigned short int d_reclen; unsigned char d_type; char d_name[256]; /* We must not include limits.h! */ }; #ifdef __USE_LARGEFILE64 struct dirent64 { __ino64_t d_ino; __off64_t d_off; unsigned short int d_reclen; unsigned char d_type; char d_name[256]; /* We must not include limits.h! */ }; #endif #define d_fileno d_ino /* Backwards compatibility. */ #undef _DIRENT_HAVE_D_NAMLEN #define _DIRENT_HAVE_D_RECLEN #define _DIRENT_HAVE_D_OFF #define _DIRENT_HAVE_D_TYPE /* siginfo_t, sigevent and constants. Linux version. Copyright (C) 1997-2002, 2003 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 Lesser General Public License as published by the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ #if !defined _SIGNAL_H && !defined __need_siginfo_t \ && !defined __need_sigevent_t # error "Never include this file directly. Use instead" #endif #include #if (!defined __have_sigval_t \ && (defined _SIGNAL_H || defined __need_siginfo_t \ || defined __need_sigevent_t)) # define __have_sigval_t 1 /* Type for data associated with a signal. */ typedef union sigval { int sival_int; void *sival_ptr; } sigval_t; #endif #if (!defined __have_siginfo_t \ && (defined _SIGNAL_H || defined __need_siginfo_t)) # define __have_siginfo_t 1 # define __SI_MAX_SIZE 128 # if __WORDSIZE == 64 # define __SI_PAD_SIZE ((__SI_MAX_SIZE / sizeof (int)) - 4) # else # define __SI_PAD_SIZE ((__SI_MAX_SIZE / sizeof (int)) - 3) # endif typedef struct siginfo { int si_signo; /* Signal number. */ int si_errno; /* If non-zero, an errno value associated with this signal, as defined in . */ int si_code; /* Signal code. */ union { int _pad[__SI_PAD_SIZE]; /* kill(). */ struct { __pid_t si_pid; /* Sending process ID. */ __uid_t si_uid; /* Real user ID of sending process. */ } _kill; /* POSIX.1b timers. */ struct { int si_tid; /* Timer ID. */ int si_overrun; /* Overrun count. */ sigval_t si_sigval; /* Signal value. */ } _timer; /* POSIX.1b signals. */ struct { __pid_t si_pid; /* Sending process ID. */ __uid_t si_uid; /* Real user ID of sending process. */ sigval_t si_sigval; /* Signal value. */ } _rt; /* SIGCHLD. */ struct { __pid_t si_pid; /* Which child. */ __uid_t si_uid; /* Real user ID of sending process. */ int si_status; /* Exit value or signal. */ __clock_t si_utime; __clock_t si_stime; } _sigchld; /* SIGILL, SIGFPE, SIGSEGV, SIGBUS. */ struct { void *si_addr; /* Faulting insn/memory ref. */ } _sigfault; /* SIGPOLL. */ struct { long int si_band; /* Band event for SIGPOLL. */ int si_fd; } _sigpoll; } _sifields; } siginfo_t; /* X/Open requires some more fields with fixed names. */ # define si_pid _sifields._kill.si_pid # define si_uid _sifields._kill.si_uid # define si_timerid _sifields._timer.si_tid # define si_overrun _sifields._timer.si_overrun # define si_status _sifields._sigchld.si_status # define si_utime _sifields._sigchld.si_utime # define si_stime _sifields._sigchld.si_stime # define si_value _sifields._rt.si_sigval # define si_int _sifields._rt.si_sigval.sival_int # define si_ptr _sifields._rt.si_sigval.sival_ptr # define si_addr _sifields._sigfault.si_addr # define si_band _sifields._sigpoll.si_band # define si_fd _sifields._sigpoll.si_fd /* Values for `si_code'. Positive values are reserved for kernel-generated signals. */ enum { SI_ASYNCNL = -60, /* Sent by asynch name lookup completion. */ # define SI_ASYNCNL SI_ASYNCNL SI_TKILL = -6, /* Sent by tkill. */ # define SI_TKILL SI_TKILL SI_SIGIO, /* Sent by queued SIGIO. */ # define SI_SIGIO SI_SIGIO SI_ASYNCIO, /* Sent by AIO completion. */ # define SI_ASYNCIO SI_ASYNCIO SI_MESGQ, /* Sent by real time mesq state change. */ # define SI_MESGQ SI_MESGQ SI_TIMER, /* Sent by timer expiration. */ # define SI_TIMER SI_TIMER SI_QUEUE, /* Sent by sigqueue. */ # define SI_QUEUE SI_QUEUE SI_USER, /* Sent by kill, sigsend, raise. */ # define SI_USER SI_USER SI_KERNEL = 0x80 /* Send by kernel. */ #define SI_KERNEL SI_KERNEL }; /* `si_code' values for SIGILL signal. */ enum { ILL_ILLOPC = 1, /* Illegal opcode. */ # define ILL_ILLOPC ILL_ILLOPC ILL_ILLOPN, /* Illegal operand. */ # define ILL_ILLOPN ILL_ILLOPN ILL_ILLADR, /* Illegal addressing mode. */ # define ILL_ILLADR ILL_ILLADR ILL_ILLTRP, /* Illegal trap. */ # define ILL_ILLTRP ILL_ILLTRP ILL_PRVOPC, /* Privileged opcode. */ # define ILL_PRVOPC ILL_PRVOPC ILL_PRVREG, /* Privileged register. */ # define ILL_PRVREG ILL_PRVREG ILL_COPROC, /* Coprocessor error. */ # define ILL_COPROC ILL_COPROC ILL_BADSTK /* Internal stack error. */ # define ILL_BADSTK ILL_BADSTK }; /* `si_code' values for SIGFPE signal. */ enum { FPE_INTDIV = 1, /* Integer divide by zero. */ # define FPE_INTDIV FPE_INTDIV FPE_INTOVF, /* Integer overflow. */ # define FPE_INTOVF FPE_INTOVF FPE_FLTDIV, /* Floating point divide by zero. */ # define FPE_FLTDIV FPE_FLTDIV FPE_FLTOVF, /* Floating point overflow. */ # define FPE_FLTOVF FPE_FLTOVF FPE_FLTUND, /* Floating point underflow. */ # define FPE_FLTUND FPE_FLTUND FPE_FLTRES, /* Floating point inexact result. */ # define FPE_FLTRES FPE_FLTRES FPE_FLTINV, /* Floating point invalid operation. */ # define FPE_FLTINV FPE_FLTINV FPE_FLTSUB /* Subscript out of range. */ # define FPE_FLTSUB FPE_FLTSUB }; /* `si_code' values for SIGSEGV signal. */ enum { SEGV_MAPERR = 1, /* Address not mapped to object. */ # define SEGV_MAPERR SEGV_MAPERR SEGV_ACCERR /* Invalid permissions for mapped object. */ # define SEGV_ACCERR SEGV_ACCERR }; /* `si_code' values for SIGBUS signal. */ enum { BUS_ADRALN = 1, /* Invalid address alignment. */ # define BUS_ADRALN BUS_ADRALN BUS_ADRERR, /* Non-existant physical address. */ # define BUS_ADRERR BUS_ADRERR BUS_OBJERR /* Object specific hardware error. */ # define BUS_OBJERR BUS_OBJERR }; /* `si_code' values for SIGTRAP signal. */ enum { TRAP_BRKPT = 1, /* Process breakpoint. */ # define TRAP_BRKPT TRAP_BRKPT TRAP_TRACE /* Process trace trap. */ # define TRAP_TRACE TRAP_TRACE }; /* `si_code' values for SIGCHLD signal. */ enum { CLD_EXITED = 1, /* Child has exited. */ # define CLD_EXITED CLD_EXITED CLD_KILLED, /* Child was killed. */ # define CLD_KILLED CLD_KILLED CLD_DUMPED, /* Child terminated abnormally. */ # define CLD_DUMPED CLD_DUMPED CLD_TRAPPED, /* Traced child has trapped. */ # define CLD_TRAPPED CLD_TRAPPED CLD_STOPPED, /* Child has stopped. */ # define CLD_STOPPED CLD_STOPPED CLD_CONTINUED /* Stopped child has continued. */ # define CLD_CONTINUED CLD_CONTINUED }; /* `si_code' values for SIGPOLL signal. */ enum { POLL_IN = 1, /* Data input available. */ # define POLL_IN POLL_IN POLL_OUT, /* Output buffers available. */ # define POLL_OUT POLL_OUT POLL_MSG, /* Input message available. */ # define POLL_MSG POLL_MSG POLL_ERR, /* I/O error. */ # define POLL_ERR POLL_ERR POLL_PRI, /* High priority input available. */ # define POLL_PRI POLL_PRI POLL_HUP /* Device disconnected. */ # define POLL_HUP POLL_HUP }; # undef __need_siginfo_t #endif /* !have siginfo_t && (have _SIGNAL_H || need siginfo_t). */ #if (defined _SIGNAL_H || defined __need_sigevent_t) \ && !defined __have_sigevent_t # define __have_sigevent_t 1 /* Structure to transport application-defined values with signals. */ # define __SIGEV_MAX_SIZE 64 # if __WORDSIZE == 64 # define __SIGEV_PAD_SIZE ((__SIGEV_MAX_SIZE / sizeof (int)) - 4) # else # define __SIGEV_PAD_SIZE ((__SIGEV_MAX_SIZE / sizeof (int)) - 3) # endif typedef struct sigevent { sigval_t sigev_value; int sigev_signo; int sigev_notify; union { int _pad[__SIGEV_PAD_SIZE]; /* When SIGEV_SIGNAL and SIGEV_THREAD_ID set, LWP ID of the thread to receive the signal. */ __pid_t _tid; struct { void (*_function) (sigval_t); /* Function to start. */ void *_attribute; /* Really pthread_attr_t. */ } _sigev_thread; } _sigev_un; } sigevent_t; /* POSIX names to access some of the members. */ # define sigev_notify_function _sigev_un._sigev_thread._function # define sigev_notify_attributes _sigev_un._sigev_thread._attribute /* `sigev_notify' values. */ enum { SIGEV_SIGNAL = 0, /* Notify via signal. */ # define SIGEV_SIGNAL SIGEV_SIGNAL SIGEV_NONE, /* Other notification: meaningless. */ # define SIGEV_NONE SIGEV_NONE SIGEV_THREAD, /* Deliver via thread creation. */ # define SIGEV_THREAD SIGEV_THREAD SIGEV_THREAD_ID = 4 /* Send signal to specific thread. */ #define SIGEV_THREAD_ID SIGEV_THREAD_ID }; #endif /* have _SIGNAL_H. */ /* Copyright (C) 1994, 1997, 1998, 1999 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 Lesser General Public License as published by the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ #if !defined _STDIO_H && !defined __need_FOPEN_MAX && !defined __need_IOV_MAX # error "Never include directly; use instead." #endif #ifdef _STDIO_H # define L_tmpnam 20 # define TMP_MAX 238328 # define FILENAME_MAX 4095 # ifdef __USE_POSIX # define L_ctermid 9 # define L_cuserid 9 # endif #endif #if defined __need_FOPEN_MAX || defined _STDIO_H # undef FOPEN_MAX # define FOPEN_MAX 16 #endif #if defined __need_IOV_MAX && !defined IOV_MAX # define IOV_MAX 1024 #endif /* Copyright (C) 1996, 1997, 1998, 1999, 2000 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 Lesser General Public License as published by the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ #ifndef _NETDB_H # error "Never include directly; use instead." #endif /* Description of data base entry for a single network. NOTE: here a poor assumption is made. The network number is expected to fit into an unsigned long int variable. */ struct netent { char *n_name; /* Official name of network. */ char **n_aliases; /* Alias list. */ int n_addrtype; /* Net address type. */ uint32_t n_net; /* Network number. */ }; /* Inline math functions for i387. Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by John C. Bowman , 1995. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ #ifndef _MATH_H # error "Never use directly; include instead." #endif #ifdef __cplusplus # define __MATH_INLINE __inline #else # define __MATH_INLINE extern __inline #endif #if defined __USE_ISOC99 && defined __GNUC__ && __GNUC__ >= 2 /* GCC 2.97 and up have builtins that actually can be used. */ # if !__GNUC_PREREQ (2,97) /* ISO C99 defines some macros to perform unordered comparisons. The ix87 FPU supports this with special opcodes and we should use them. These must not be inline functions since we have to be able to handle all floating-point types. */ # undef isgreater # undef isgreaterequal # undef isless # undef islessequal # undef islessgreater # undef isunordered # ifdef __i686__ /* For the PentiumPro and more recent processors we can provide better code. */ # define isgreater(x, y) \ ({ register char __result; \ __asm__ ("fucomip %%st(1), %%st; seta %%al" \ : "=a" (__result) : "u" (y), "t" (x) : "cc", "st"); \ __result; }) # define isgreaterequal(x, y) \ ({ register char __result; \ __asm__ ("fucomip %%st(1), %%st; setae %%al" \ : "=a" (__result) : "u" (y), "t" (x) : "cc", "st"); \ __result; }) # define isless(x, y) \ ({ register char __result; \ __asm__ ("fucomip %%st(1), %%st; seta %%al" \ : "=a" (__result) : "u" (x), "t" (y) : "cc", "st"); \ __result; }) # define islessequal(x, y) \ ({ register char __result; \ __asm__ ("fucomip %%st(1), %%st; setae %%al" \ : "=a" (__result) : "u" (x), "t" (y) : "cc", "st"); \ __result; }) # define islessgreater(x, y) \ ({ register char __result; \ __asm__ ("fucomip %%st(1), %%st; setne %%al" \ : "=a" (__result) : "u" (y), "t" (x) : "cc", "st"); \ __result; }) # define isunordered(x, y) \ ({ register char __result; \ __asm__ ("fucomip %%st(1), %%st; setp %%al" \ : "=a" (__result) : "u" (y), "t" (x) : "cc", "st"); \ __result; }) # else /* This is the dumb, portable code for i386 and above. */ # define isgreater(x, y) \ ({ register char __result; \ __asm__ ("fucompp; fnstsw; testb $0x45, %%ah; setz %%al" \ : "=a" (__result) : "u" (y), "t" (x) : "cc", "st", "st(1)"); \ __result; }) # define isgreaterequal(x, y) \ ({ register char __result; \ __asm__ ("fucompp; fnstsw; testb $0x05, %%ah; setz %%al" \ : "=a" (__result) : "u" (y), "t" (x) : "cc", "st", "st(1)"); \ __result; }) # define isless(x, y) \ ({ register char __result; \ __asm__ ("fucompp; fnstsw; testb $0x45, %%ah; setz %%al" \ : "=a" (__result) : "u" (x), "t" (y) : "cc", "st", "st(1)"); \ __result; }) # define islessequal(x, y) \ ({ register char __result; \ __asm__ ("fucompp; fnstsw; testb $0x05, %%ah; setz %%al" \ : "=a" (__result) : "u" (x), "t" (y) : "cc", "st", "st(1)"); \ __result; }) # define islessgreater(x, y) \ ({ register char __result; \ __asm__ ("fucompp; fnstsw; testb $0x44, %%ah; setz %%al" \ : "=a" (__result) : "u" (y), "t" (x) : "cc", "st", "st(1)"); \ __result; }) # define isunordered(x, y) \ ({ register char __result; \ __asm__ ("fucompp; fnstsw; sahf; setp %%al" \ : "=a" (__result) : "u" (y), "t" (x) : "cc", "st", "st(1)"); \ __result; }) # endif /* __i686__ */ # endif /* GCC 2.97 */ /* The gcc, version 2.7 or below, has problems with all this inlining code. So disable it for this version of the compiler. */ # if __GNUC_PREREQ (2, 8) /* Test for negative number. Used in the signbit() macro. */ __MATH_INLINE int __NTH (__signbitf (float __x)) { __extension__ union { float __f; int __i; } __u = { __f: __x }; return __u.__i < 0; } __MATH_INLINE int __NTH (__signbit (double __x)) { __extension__ union { double __d; int __i[2]; } __u = { __d: __x }; return __u.__i[1] < 0; } __MATH_INLINE int __NTH (__signbitl (long double __x)) { __extension__ union { long double __l; int __i[3]; } __u = { __l: __x }; return (__u.__i[2] & 0x8000) != 0; } # endif #endif /* The gcc, version 2.7 or below, has problems with all this inlining code. So disable it for this version of the compiler. */ #if __GNUC_PREREQ (2, 8) #if ((!defined __NO_MATH_INLINES || defined __LIBC_INTERNAL_MATH_INLINES) \ && defined __OPTIMIZE__) /* A macro to define float, double, and long double versions of various math functions for the ix87 FPU. FUNC is the function name (which will be suffixed with f and l for the float and long double version, respectively). OP is the name of the FPU operation. We define two sets of macros. The set with the additional NP doesn't add a prototype declaration. */ #if defined __USE_MISC || defined __USE_ISOC99 # define __inline_mathop(func, op) \ __inline_mathop_ (double, func, op) \ __inline_mathop_ (float, __CONCAT(func,f), op) \ __inline_mathop_ (long double, __CONCAT(func,l), op) # define __inline_mathopNP(func, op) \ __inline_mathopNP_ (double, func, op) \ __inline_mathopNP_ (float, __CONCAT(func,f), op) \ __inline_mathopNP_ (long double, __CONCAT(func,l), op) #else # define __inline_mathop(func, op) \ __inline_mathop_ (double, func, op) # define __inline_mathopNP(func, op) \ __inline_mathopNP_ (double, func, op) #endif #define __inline_mathop_(float_type, func, op) \ __inline_mathop_decl_ (float_type, func, op, "0" (__x)) #define __inline_mathopNP_(float_type, func, op) \ __inline_mathop_declNP_ (float_type, func, op, "0" (__x)) #if defined __USE_MISC || defined __USE_ISOC99 # define __inline_mathop_decl(func, op, params...) \ __inline_mathop_decl_ (double, func, op, params) \ __inline_mathop_decl_ (float, __CONCAT(func,f), op, params) \ __inline_mathop_decl_ (long double, __CONCAT(func,l), op, params) # define __inline_mathop_declNP(func, op, params...) \ __inline_mathop_declNP_ (double, func, op, params) \ __inline_mathop_declNP_ (float, __CONCAT(func,f), op, params) \ __inline_mathop_declNP_ (long double, __CONCAT(func,l), op, params) #else # define __inline_mathop_decl(func, op, params...) \ __inline_mathop_decl_ (double, func, op, params) # define __inline_mathop_declNP(func, op, params...) \ __inline_mathop_declNP_ (double, func, op, params) #endif #define __inline_mathop_decl_(float_type, func, op, params...) \ __MATH_INLINE float_type func (float_type) __THROW; \ __inline_mathop_declNP_ (float_type, func, op, params) #define __inline_mathop_declNP_(float_type, func, op, params...) \ __MATH_INLINE float_type __NTH (func (float_type __x)) \ { \ register float_type __result; \ __asm__ __volatile__ (op : "=t" (__result) : params); \ return __result; \ } #if defined __USE_MISC || defined __USE_ISOC99 # define __inline_mathcode(func, arg, code) \ __inline_mathcode_ (double, func, arg, code) \ __inline_mathcode_ (float, __CONCAT(func,f), arg, code) \ __inline_mathcode_ (long double, __CONCAT(func,l), arg, code) # define __inline_mathcodeNP(func, arg, code) \ __inline_mathcodeNP_ (double, func, arg, code) \ __inline_mathcodeNP_ (float, __CONCAT(func,f), arg, code) \ __inline_mathcodeNP_ (long double, __CONCAT(func,l), arg, code) # define __inline_mathcode2(func, arg1, arg2, code) \ __inline_mathcode2_ (double, func, arg1, arg2, code) \ __inline_mathcode2_ (float, __CONCAT(func,f), arg1, arg2, code) \ __inline_mathcode2_ (long double, __CONCAT(func,l), arg1, arg2, code) # define __inline_mathcodeNP2(func, arg1, arg2, code) \ __inline_mathcodeNP2_ (double, func, arg1, arg2, code) \ __inline_mathcodeNP2_ (float, __CONCAT(func,f), arg1, arg2, code) \ __inline_mathcodeNP2_ (long double, __CONCAT(func,l), arg1, arg2, code) # define __inline_mathcode3(func, arg1, arg2, arg3, code) \ __inline_mathcode3_ (double, func, arg1, arg2, arg3, code) \ __inline_mathcode3_ (float, __CONCAT(func,f), arg1, arg2, arg3, code) \ __inline_mathcode3_ (long double, __CONCAT(func,l), arg1, arg2, arg3, code) # define __inline_mathcodeNP3(func, arg1, arg2, arg3, code) \ __inline_mathcodeNP3_ (double, func, arg1, arg2, arg3, code) \ __inline_mathcodeNP3_ (float, __CONCAT(func,f), arg1, arg2, arg3, code) \ __inline_mathcodeNP3_ (long double, __CONCAT(func,l), arg1, arg2, arg3, code) #else # define __inline_mathcode(func, arg, code) \ __inline_mathcode_ (double, func, (arg), code) # define __inline_mathcodeNP(func, arg, code) \ __inline_mathcodeNP_ (double, func, (arg), code) # define __inline_mathcode2(func, arg1, arg2, code) \ __inline_mathcode2_ (double, func, arg1, arg2, code) # define __inline_mathcodeNP2(func, arg1, arg2, code) \ __inline_mathcodeNP2_ (double, func, arg1, arg2, code) # define __inline_mathcode3(func, arg1, arg2, arg3, code) \ __inline_mathcode3_ (double, func, arg1, arg2, arg3, code) # define __inline_mathcodeNP3(func, arg1, arg2, arg3, code) \ __inline_mathcodeNP3_ (double, func, arg1, arg2, arg3, code) #endif #define __inline_mathcode_(float_type, func, arg, code) \ __MATH_INLINE float_type func (float_type) __THROW; \ __inline_mathcodeNP_(float_type, func, arg, code) #define __inline_mathcodeNP_(float_type, func, arg, code) \ __MATH_INLINE float_type __NTH (func (float_type arg)) \ { \ code; \ } #define __inline_mathcode2_(float_type, func, arg1, arg2, code) \ __MATH_INLINE float_type func (float_type, float_type) __THROW; \ __inline_mathcodeNP2_ (float_type, func, arg1, arg2, code) #define __inline_mathcodeNP2_(float_type, func, arg1, arg2, code) \ __MATH_INLINE float_type __NTH (func (float_type arg1, float_type arg2)) \ { \ code; \ } #define __inline_mathcode3_(float_type, func, arg1, arg2, arg3, code) \ __MATH_INLINE float_type func (float_type, float_type, float_type) __THROW; \ __inline_mathcodeNP3_(float_type, func, arg1, arg2, arg3, code) #define __inline_mathcodeNP3_(float_type, func, arg1, arg2, arg3, code) \ __MATH_INLINE float_type __NTH (func (float_type arg1, float_type arg2, \ float_type arg3)) \ { \ code; \ } #endif #if !defined __NO_MATH_INLINES && defined __OPTIMIZE__ /* Miscellaneous functions */ __inline_mathcode (__sgn, __x, \ return __x == 0.0 ? 0.0 : (__x > 0.0 ? 1.0 : -1.0)) /* __FAST_MATH__ is defined by gcc -ffast-math. */ #ifdef __FAST_MATH__ __inline_mathcode (__pow2, __x, \ register long double __value; \ register long double __exponent; \ __extension__ long long int __p = (long long int) __x; \ if (__x == (long double) __p) \ { \ __asm__ __volatile__ \ ("fscale" \ : "=t" (__value) : "0" (1.0), "u" (__x)); \ return __value; \ } \ __asm__ __volatile__ \ ("fld %%st(0)\n\t" \ ijklmnopqrstuv "frndint # int(x)\n\t" \ "fxch\n\t" \ "fsub %%st(1) # fract(x)\n\t" \ "f2xm1 # 2^(fract(x)) - 1\n\t" \ : "=t" (__value), "=u" (__exponent) : "0" (__x)); \ __value += 1.0; \ __asm__ __volatile__ \ ("fscale" \ : "=t" (__value) : "0" (__value), "u" (__exponent)); \ return __value) # ifdef __USE_GNU # define __sincos_code \ register long double __cosr; \ register long double __sinr; \ __asm__ __volatile__ \ ("fsincos\n\t" \ "fnstsw %%ax\n\t" \ "testl $0x400, %%eax\n\t" \ "jz 1f\n\t" \ "fldpi\n\t" \ "fadd %%st(0)\n\t" \ "fxch %%st(1)\n\t" \ "2: fprem1\n\t" \ "fnstsw %%ax\n\t" \ "testl $0x400, %%eax\n\t" \ "jnz 2b\n\t" \ "fstp %%st(1)\n\t" \ "fsincos\n\t" \ "1:" \ : "=t" (__cosr), "=u" (__sinr) : "0" (__x)); \ *__sinx = __sinr; \ *__cosx = __cosr __MATH_INLINE void __NTH (__sincos (double __x, double *__sinx, double *__cosx)) { __sincos_code; } __MATH_INLINE void __NTH (__sincosf (float __x, float *__sinx, float *__cosx)) { __sincos_code; } __MATH_INLINE void __NTH (__sincosl (long double __x, long double *__sinx, long double *__cosx)) { __sincos_code; } # endif /* Optimized inline implementation, sometimes with reduced precision and/or argument range. */ # if __GNUC_PREREQ (3, 5) # define __expm1_code \ register long double __temp; \ __temp = __builtin_expm1l (__x); \ return __temp ? __temp : __x # else # define __expm1_code \ register long double __value; \ register long double __exponent; \ register long double __temp; \ __asm__ __volatile__ \ ("fldl2e # e^x - 1 = 2^(x * log2(e)) - 1\n\t" \ "fmul %%st(1) # x * log2(e)\n\t" \ "fst %%st(1)\n\t" \ "frndint # int(x * log2(e))\n\t" \ "fxch\n\t" \ "fsub %%st(1) # fract(x * log2(e))\n\t" \ "f2xm1 # 2^(fract(x * log2(e))) - 1\n\t" \ "fscale # 2^(x * log2(e)) - 2^(int(x * log2(e)))\n\t" \ : "=t" (__value), "=u" (__exponent) : "0" (__x)); \ __asm__ __volatile__ \ ("fscale # 2^int(x * log2(e))\n\t" \ : "=t" (__temp) : "0" (1.0), "u" (__exponent)); \ __temp -= 1.0; \ __temp += __value; \ return __temp ? __temp : __x # endif __inline_mathcodeNP_ (long double, __expm1l, __x, __expm1_code) # if __GNUC_PREREQ (3, 4) __inline_mathcodeNP_ (long double, __expl, __x, return __builtin_expl (__x)) # else # define __exp_code \ register long double __value; \ register long double __exponent; \ __asm__ __volatile__ \ ("fldl2e # e^x = 2^(x * log2(e))\n\t" \ "fmul %%st(1) # x * log2(e)\n\t" \ "fst %%st(1)\n\t" \ "frndint # int(x * log2(e))\n\t" \ "fxch\n\t" \ "fsub %%st(1) # fract(x * log2(e))\n\t" \ "f2xm1 # 2^(fract(x * log2(e))) - 1\n\t" \ : "=t" (__value), "=u" (__exponent) : "0" (__x)); \ __value += 1.0; \ __asm__ __volatile__ \ ("fscale" \ : "=t" (__value) : "0" (__value), "u" (__exponent)); \ return __value __inline_mathcodeNP (exp, __x, __exp_code) __inline_mathcodeNP_ (long double, __expl, __x, __exp_code) # endif # if !__GNUC_PREREQ (3, 5) __inline_mathcodeNP (tan, __x, \ register long double __value; \ register long double __value2 __attribute__ ((__unused__)); \ __asm__ __volatile__ \ ("fptan" \ : "=t" (__value2), "=u" (__value) : "0" (__x)); \ return __value) # endif #endif /* __FAST_MATH__ */ #if __GNUC_PREREQ (3, 4) __inline_mathcodeNP2_ (long double, __atan2l, __y, __x, return __builtin_atan2l (__y, __x)) #else # define __atan2_code \ register long double __value; \ __asm__ __volatile__ \ ("fpatan" \ : "=t" (__value) : "0" (__x), "u" (__y) : "st(1)"); \ return __value # ifdef __FAST_MATH__ __inline_mathcodeNP2 (atan2, __y, __x, __atan2_code) # endif __inline_mathcodeNP2_ (long double, __atan2l, __y, __x, __atan2_code) #endif #if defined __FAST_MATH__ && !__GNUC_PREREQ (3, 5) __inline_mathcodeNP2 (fmod, __x, __y, \ register long double __value; \ __asm__ __volatile__ \ ("1: fprem\n\t" \ "fnstsw %%ax\n\t" \ "sahf\n\t" \ "jp 1b" \ : "=t" (__value) : "0" (__x), "u" (__y) : "ax", "cc"); \ return __value) #endif #ifdef __FAST_MATH__ # if !__GNUC_PREREQ (3,3) __inline_mathopNP (sqrt, "fsqrt") __inline_mathopNP_ (long double, __sqrtl, "fsqrt") # define __libc_sqrtl(n) __sqrtl (n) # else # define __libc_sqrtl(n) __builtin_sqrtl (n) # endif #endif #if __GNUC_PREREQ (2, 8) __inline_mathcodeNP_ (double, fabs, __x, return __builtin_fabs (__x)) # if defined __USE_MISC || defined __USE_ISOC99 __inline_mathcodeNP_ (float, fabsf, __x, return __builtin_fabsf (__x)) __inline_mathcodeNP_ (long double, fabsl, __x, return __builtin_fabsl (__x)) # endif __inline_mathcodeNP_ (long double, __fabsl, __x, return __builtin_fabsl (__x)) #else __inline_mathop (fabs, "fabs") __inline_mathop_ (long double, __fabsl, "fabs") #endif #ifdef __FAST_MATH__ # if !__GNUC_PREREQ (3, 4) /* The argument range of this inline version is reduced. */ __inline_mathopNP (sin, "fsin") /* The argument range of this inline version is reduced. */ __inline_mathopNP (cos, "fcos") __inline_mathop_declNP (log, "fldln2; fxch; fyl2x", "0" (__x) : "st(1)") # endif # if !__GNUC_PREREQ (3, 5) __inline_mathop_declNP (log10, "fldlg2; fxch; fyl2x", "0" (__x) : "st(1)") __inline_mathcodeNP (asin, __x, return __atan2l (__x, __libc_sqrtl (1.0 - __x * __x))) __inline_mathcodeNP (acos, __x, return __atan2l (__libc_sqrtl (1.0 - __x * __x), __x)) # endif # if !__GNUC_PREREQ (3, 4) __inline_mathop_declNP (atan, "fld1; fpatan", "0" (__x) : "st(1)") # endif #endif /* __FAST_MATH__ */ __inline_mathcode_ (long double, __sgn1l, __x, \ __extension__ union { long double __xld; unsigned int __xi[3]; } __n = \ { __xld: __x }; \ __n.__xi[2] = (__n.__xi[2] & 0x8000) | 0x3fff; \ __n.__xi[1] = 0x80000000; \ __n.__xi[0] = 0; \ return __n.__xld) #ifdef __FAST_MATH__ /* The argument range of the inline version of sinhl is slightly reduced. */ __inline_mathcodeNP (sinh, __x, \ register long double __exm1 = __expm1l (__fabsl (__x)); \ return 0.5 * (__exm1 / (__exm1 + 1.0) + __exm1) * __sgn1l (__x)) __inline_mathcodeNP (cosh, __x, \ register long double __ex = __expl (__x); \ return 0.5 * (__ex + 1.0 / __ex)) __inline_mathcodeNP (tanh, __x, \ register long double __exm1 = __expm1l (-__fabsl (__x + __x)); \ return __exm1 / (__exm1 + 2.0) * __sgn1l (-__x)) #endif __inline_mathcodeNP (floor, __x, \ register long double __value; \ __volatile unsigned short int __cw; \ __volatile unsigned short int __cwtmp; \ __asm__ __volatile__ ("fnstcw %0" : "=m" (__cw)); \ __cwtmp = (__cw & 0xf3ff) | 0x0400; /* rounding down */ \ __asm__ __volatile__ ("fldcw %0" : : "m" (__cwtmp)); \ __asm__ __volatile__ ("frndint" : "=t" (__value) : "0" (__x)); \ __asm__ __volatile__ ("fldcw %0" : : "m" (__cw)); \ return __value) __inline_mathcodeNP (ceil, __x, \ register long double __value; \ __volatile unsigned short int __cw; \ __volatile unsigned short int __cwtmp; \ __asm__ __volatile__ ("fnstcw %0" : "=m" (__cw)); \ __cwtmp = (__cw & 0xf3ff) | 0x0800; /* rounding up */ \ __asm__ __volatile__ ("fldcw %0" : : "m" (__cwtmp)); \ __asm__ __volatile__ ("frndint" : "=t" (__value) : "0" (__x)); \ __asm__ __volatile__ ("fldcw %0" : : "m" (__cw)); \ return __value) #ifdef __FAST_MATH__ # define __ldexp_code \ register long double __value; \ __asm__ __volatile__ \ ("fscale" \ : "=t" (__value) : "0" (__x), "u" ((long double) __y)); \ return __value __MATH_INLINE double __NTH (ldexp (double __x, int __y)) { __ldexp_code; } #endif /* Optimized versions for some non-standardized functions. */ #if defined __USE_ISOC99 || defined __USE_MISC # ifdef __FAST_MATH__ __inline_mathcodeNP (expm1, __x, __expm1_code) /* We cannot rely on M_SQRT being defined. So we do it for ourself here. */ # define __M_SQRT2 1.41421356237309504880L /* sqrt(2) */ # if !__GNUC_PREREQ (3, 5) __inline_mathcodeNP (log1p, __x, \ register long double __value; \ if (__fabsl (__x) >= 1.0 - 0.5 * __M_SQRT2) \ __value = logl (1.0 + __x); \ else \ __asm__ __volatile__ \ ("fldln2\n\t" \ "fxch\n\t" \ "fyl2xp1" \ : "=t" (__value) : "0" (__x) : "st(1)"); \ return __value) # endif /* The argument range of the inline version of asinhl is slightly reduced. */ __inline_mathcodeNP (asinh, __x, \ register long double __y = __fabsl (__x); \ return (log1pl (__y * __y / (__libc_sqrtl (__y * __y + 1.0) + 1.0) + __y) \ * __sgn1l (__x))) __inline_mathcodeNP (acosh, __x, \ return logl (__x + __libc_sqrtl (__x - 1.0) * __libc_sqrtl (__x + 1.0))) __inline_mathcodeNP (atanh, __x, \ register long double __y = __fabsl (__x); \ return -0.5 * log1pl (-(__y + __y) / (1.0 + __y)) * __sgn1l (__x)) /* The argument range of the inline version of hypotl is slightly reduced. */ __inline_mathcodeNP2 (hypot, __x, __y, return __libc_sqrtl (__x * __x + __y * __y)) # if !__GNUC_PREREQ (3, 5) __inline_mathcodeNP(logb, __x, \ register long double __value; \ register long double __junk; \ __asm__ __volatile__ \ ("fxtract\n\t" \ : "=t" (__junk), "=u" (__value) : "0" (__x)); \ return __value) # endif # endif #endif #ifdef __USE_ISOC99 # ifdef __FAST_MATH__ # if !__GNUC_PREREQ (3, 5) __inline_mathop_declNP (log2, "fld1; fxch; fyl2x", "0" (__x) : "st(1)") # endif __MATH_INLINE float __NTH (ldexpf (float __x, int __y)) { __ldexp_code; } __MATH_INLINE long double __NTH (ldexpl (long double __x, int __y)) { __ldexp_code; } __inline_mathcodeNP3 (fma, __x, __y, __z, return (__x * __y) + __z) __inline_mathopNP (rint, "frndint") # endif /* __FAST_MATH__ */ # define __lrint_code \ long int __lrintres; \ __asm__ __volatile__ \ ("fistpl %0" \ : "=m" (__lrintres) : "t" (__x) : "st"); \ return __lrintres __MATH_INLINE long int __NTH (lrintf (float __x)) { __lrint_code; } __MATH_INLINE long int __NTH (lrint (double __x)) { __lrint_code; } __MATH_INLINE long int __NTH (lrintl (long double __x)) { __lrint_code; } # undef __lrint_code # define __llrint_code \ long long int __llrintres; \ __asm__ __volatile__ \ ("fistpll %0" \ : "=m" (__llrintres) : "t" (__x) : "st"); \ return __llrintres __MATH_INLINE long long int __NTH (llrintf (float __x)) { __llrint_code; } __MATH_INLINE long long int __NTH (llrint (double __x)) { __llrint_code; } __MATH_INLINE long long int __NTH (llrintl (long double __x)) { __llrint_code; } # undef __llrint_code #endif #ifdef __USE_MISC # if defined __FAST_MATH__ && !__GNUC_PREREQ (3, 5) __inline_mathcodeNP2 (drem, __x, __y, \ register double __value; \ register int __clobbered; \ __asm__ __volatile__ \ ("1: fprem1\n\t" \ "fstsw %%ax\n\t" \ "sahf\n\t" \ "jp 1b" \ : "=t" (__value), "=&a" (__clobbered) : "0" (__x), "u" (__y) : "cc"); \ return __value) # endif /* This function is used in the `isfinite' macro. */ __MATH_INLINE int __NTH (__finite (double __x)) { union { double __d; int __i[2]; } u; u.__d = __x; /* Finite numbers have at least one zero bit in exponent. */ /* All other numbers will result in 0xffffffff after OR: */ return (u.__i[1] | 0x800fffff) != 0xffffffff; } __MATH_INLINE int __NTH (__finitef (float __x)) { union { float __d; int __i; } u; u.__d = __x; return (u.__i | 0x807fffff) != 0xffffffff; } /* Miscellaneous functions */ # ifdef __FAST_MATH__ __inline_mathcode (__coshm1, __x, \ register long double __exm1 = __expm1l (__fabsl (__x)); \ return 0.5 * (__exm1 / (__exm1 + 1.0)) * __exm1) __inline_mathcode (__acosh1p, __x, \ return log1pl (__x + __libc_sqrtl (__x) * __libc_sqrtl (__x + 2.0))) # endif /* __FAST_MATH__ */ #endif /* __USE_MISC */ /* Undefine some of the large macros which are not used anymore. */ #undef __atan2_code #ifdef __FAST_MATH__ # undef __expm1_code # undef __exp_code # undef __sincos_code #endif /* __FAST_MATH__ */ #endif /* __NO_MATH_INLINES */ /* This code is used internally in the GNU libc. */ #ifdef __LIBC_INTERNAL_MATH_INLINES __inline_mathop (__ieee754_sqrt, "fsqrt") __inline_mathcode2 (__ieee754_atan2, __y, __x, register long double __value; __asm__ __volatile__ ("fpatan\n\t" : "=t" (__value) : "0" (__x), "u" (__y) : "st(1)"); return __value;) #endif #endif /* __GNUC__ */ /* Copyright (C) 1991, 1996, 1999, 2000, 2001 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 Lesser General Public License as published by the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ /* * Never include this file directly; include instead. */ #ifndef _BITS_POSIX2_LIM_H #define _BITS_POSIX2_LIM_H 1 /* The maximum `ibase' and `obase' values allowed by the `bc' utility. */ #define _POSIX2_BC_BASE_MAX 99 /* The maximum number of elements allowed in an array by the `bc' utility. */ #define _POSIX2_BC_DIM_MAX 2048 /* The maximum `scale' value allowed by the `bc' utility. */ #define _POSIX2_BC_SCALE_MAX 99 /* The maximum length of a string constant accepted by the `bc' utility. */ #define _POSIX2_BC_STRING_MAX 1000 /* The maximum number of weights that can be assigned to an entry of the LC_COLLATE `order' keyword in the locale definition file. */ #define _POSIX2_COLL_WEIGHTS_MAX 2 /* The maximum number of expressions that can be nested within parentheses by the `expr' utility. */ #define _POSIX2_EXPR_NEST_MAX 32 /* The maximum length, in bytes, of an input line. */ #define _POSIX2_LINE_MAX 2048 /* The maximum number of repeated occurrences of a regular expression permitted when using the interval notation `\{M,N\}'. */ #define _POSIX2_RE_DUP_MAX 255 /* The maximum number of bytes in a character class name. We have no fixed limit, 2048 is a high number. */ #define _POSIX2_CHARCLASS_NAME_MAX 14 /* These values are implementation-specific, and may vary within the implementation. Their precise values can be obtained from sysconf. */ #ifndef BC_BASE_MAX #define BC_BASE_MAX _POSIX2_BC_BASE_MAX #endif #ifndef BC_DIM_MAX #define BC_DIM_MAX _POSIX2_BC_DIM_MAX #endif #ifndef BC_SCALE_MAX #define BC_SCALE_MAX _POSIX2_BC_SCALE_MAX #endif #ifndef BC_STRING_MAX #define BC_STRING_MAX _POSIX2_BC_STRING_MAX #endif #ifndef COLL_WEIGHTS_MAX #define COLL_WEIGHTS_MAX 255 #endif #ifndef EXPR_NEST_MAX #define EXPR_NEST_MAX _POSIX2_EXPR_NEST_MAX #endif #ifndef LINE_MAX #define LINE_MAX _POSIX2_LINE_MAX #endif #ifndef CHARCLASS_NAME_MAX #define CHARCLASS_NAME_MAX 2048 #endif /* This value is defined like this in regex.h. */ #define RE_DUP_MAX (0x7fff) #endif /* bits/posix2_lim.h */ /* Prototype declarations for complex math functions; helper file for . Copyright (C) 1997, 1998, 2001 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 Lesser General Public License as published by the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ /* NOTE: Because of the special way this file is used by , this file must NOT be protected from multiple inclusion as header files usually are. This file provides prototype declarations for the math functions. Most functions are declared using the macro: __MATHCALL (NAME, (ARGS...)); This means there is a function `NAME' returning `double' and a function `NAMEf' returning `float'. Each place `_Mdouble_' appears in the prototype, that is actually `double' in the prototype for `NAME' and `float' in the prototype for `NAMEf'. Reentrant variant functions are called `NAME_r' and `NAMEf_r'. Functions returning other types like `int' are declared using the macro: __MATHDECL (TYPE, NAME, (ARGS...)); This is just like __MATHCALL but for a function returning `TYPE' instead of `_Mdouble_'. In all of these cases, there is still both a `NAME' and a `NAMEf' that takes `float' arguments. */ #ifndef _COMPLEX_H #error "Never use directly; include instead." #endif #define _Mdouble_complex_ _Mdouble_ _Complex /* Trigonometric functions. */ /* Arc cosine of Z. */ __MATHCALL (cacos, (_Mdouble_complex_ __z)); /* Arc sine of Z. */ __MATHCALL (casin, (_Mdouble_complex_ __z)); /* Arc tangent of Z. */ __MATHCALL (catan, (_Mdouble_complex_ __z)); /* Cosine of Z. */ __MATHCALL (ccos, (_Mdouble_complex_ __z)); /* Sine of Z. */ __MATHCALL (csin, (_Mdouble_complex_ __z)); /* Tangent of Z. */ __MATHCALL (ctan, (_Mdouble_complex_ __z)); /* Hyperbolic functions. */ /* Hyperbolic arc cosine of Z. */ __MATHCALL (cacosh, (_Mdouble_complex_ __z)); /* Hyperbolic arc sine of Z. */ __MATHCALL (casinh, (_Mdouble_complex_ __z)); /* Hyperbolic arc tangent of Z. */ __MATHCALL (catanh, (_Mdouble_complex_ __z)); /* Hyperbolic cosine of Z. */ __MATHCALL (ccosh, (_Mdouble_complex_ __z)); /* Hyperbolic sine of Z. */ __MATHCALL (csinh, (_Mdouble_complex_ __z)); /* Hyperbolic tangent of Z. */ __MATHCALL (ctanh, (_Mdouble_complex_ __z)); /* Exponential and logarithmic functions. */ /* Exponential function of Z. */ __MATHCALL (cexp, (_Mdouble_complex_ __z)); /* Natural logarithm of Z. */ __MATHCALL (clog, (_Mdouble_complex_ __z)); #ifdef __USE_GNU /* The base 10 logarithm is not defined by the standard but to implement the standard C++ library it is handy. */ __MATHCALL (clog10, (_Mdouble_complex_ __z)); #endif /* Power functions. */ /* Return X to the Y power. */ __MATHCALL (cpow, (_Mdouble_complex_ __x, _Mdouble_complex_ __y)); /* Return the square root of Z. */ __MATHCALL (csqrt, (_Mdouble_complex_ __z)); /* Absolute value, conjugates, and projection. */ /* Absolute value of Z. */ __MATHDECL (_Mdouble_,cabs, (_Mdouble_complex_ __z)); /* Argument value of Z. */ __MATHDECL (_Mdouble_,carg, (_Mdouble_complex_ __z)); /* Complex conjugate of Z. */ __MATHCALL (conj, (_Mdouble_complex_ __z)); /* Projection of Z onto the Riemann sphere. */ __MATHCALL (cproj, (_Mdouble_complex_ __z)); /* Decomposing complex values. */ /* Imaginary part of Z. */ __MATHDECL (_Mdouble_,cimag, (_Mdouble_complex_ __z)); /* Real part of Z. */ __MATHDECL (_Mdouble_,creal, (_Mdouble_complex_ __z)); /* Now some optimized versions. GCC has handy notations for these functions. Recent GCC handles these as builtin functions so does not need inlines. */ #if defined __GNUC__ && !__GNUC_PREREQ (2, 97) && defined __OPTIMIZE__ /* Imaginary part of Z. */ __extern_inline _Mdouble_ __MATH_PRECNAME(cimag) (_Mdouble_complex_ __z) __THROW { return __imag__ __z; } /* Real part of Z. */ __extern_inline _Mdouble_ __MATH_PRECNAME(creal) (_Mdouble_complex_ __z) __THROW { return __real__ __z; } /* Complex conjugate of Z. */ __extern_inline _Mdouble_complex_ __MATH_PRECNAME(conj) (_Mdouble_complex_ __z) __THROW { return __extension__ ~__z; } #endif /* Default `HUGE_VALL' constant. Used by and functions for overflow. Copyright (C) 1992, 1996, 1997, 2004 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 Lesser General Public License as published by the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ #ifndef _MATH_H # error "Never use directly;