Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

start to include system headers (tests broken)

  • Loading branch information...
commit 2f11f2e15392069a3c4a72fef2358fbf722b4e0e 1 parent ec318d9
Alon Zakai authored
Showing with 6,311 additions and 3 deletions.
  1. +1 −1  emscripten.py
  2. +133 −0 system/include/_ansi.h
  3. +40 −0 system/include/_syslist.h
  4. +21 −0 system/include/alloca.h
  5. +69 −0 system/include/ar.h
  6. +33 −0 system/include/argz.h
  7. +46 −0 system/include/assert.h
  8. +124 −0 system/include/complex.h
  9. +113 −0 system/include/ctype.h
  10. +15 −0 system/include/dirent.h
  11. +15 −0 system/include/envlock.h
  12. +16 −0 system/include/envz.h
  13. +11 −0 system/include/errno.h
  14. +13 −0 system/include/fastmath.h
  15. +1 −0  system/include/fcntl.h
  16. +55 −0 system/include/fnmatch.h
  17. +190 −0 system/include/getopt.h
  18. +89 −0 system/include/glob.h
  19. +94 −0 system/include/grp.h
  20. +62 −0 system/include/iconv.h
  21. +256 −0 system/include/ieeefp.h
  22. +290 −0 system/include/inttypes.h
  23. +316 −0 system/include/langinfo.h
  24. +23 −0 system/include/libgen.h
  25. +146 −0 system/include/limits.h
  26. +65 −0 system/include/locale.h
  27. +169 −0 system/include/malloc.h
  28. +580 −0 system/include/math.h
  29. +2 −0  system/include/newlib.h
  30. +7 −0 system/include/paths.h
  31. +44 −0 system/include/process.h
  32. +359 −0 system/include/pthread.h
  33. +78 −0 system/include/pwd.h
  34. +3 −0  system/include/readme.txt
  35. +183 −0 system/include/reent.h
  36. +7 −0 system/include/regdef.h
  37. +102 −0 system/include/regex.h
  38. +97 −0 system/include/sched.h
  39. +59 −0 system/include/search.h
  40. +20 −0 system/include/setjmp.h
  41. +30 −0 system/include/signal.h
  42. +50 −0 system/include/stdarg.h
  43. +64 −0 system/include/stddef.h
  44. +493 −0 system/include/stdint.h
  45. +685 −0 system/include/stdio.h
  46. +226 −0 system/include/stdlib.h
  47. +104 −0 system/include/string.h
  48. +35 −0 system/include/strings.h
  49. +39 −0 system/include/tar.h
  50. +7 −0 system/include/termios.h
  51. +261 −0 system/include/time.h
  52. +46 −0 system/include/unctrl.h
  53. +6 −0 system/include/unistd.h
  54. +12 −0 system/include/utime.h
  55. +8 −0 system/include/utmp.h
  56. +192 −0 system/include/wchar.h
  57. +47 −0 system/include/wctype.h
  58. +53 −0 system/include/wordexp.h
  59. +1 −1  tests/runner.py
  60. +1 −1  tools/emmaken.py
  61. +4 −0 tools/shared.py
2  emscripten.py
View
@@ -101,7 +101,7 @@ def compile_malloc():
"""
src = path_from_root('src', 'dlmalloc.c')
includes = '-I' + path_from_root('src', 'include')
- command = [shared.CLANG, '-c', '-g', '-emit-llvm', '-m32'] + shared.COMPILER_OPTS + ['-o-', includes, src]
+ command = [shared.CLANG, '-c', '-g', '-emit-llvm'] + shared.COMPILER_OPTS + ['-o-', includes, src]
with get_temp_file('.bc') as out: ret = subprocess.call(command, stdout=out)
if ret != 0: raise RuntimeError('Could not compile dlmalloc.')
return out.name
133 system/include/_ansi.h
View
@@ -0,0 +1,133 @@
+/* Provide support for both ANSI and non-ANSI environments. */
+
+/* Some ANSI environments are "broken" in the sense that __STDC__ cannot be
+ relied upon to have it's intended meaning. Therefore we must use our own
+ concoction: _HAVE_STDC. Always use _HAVE_STDC instead of __STDC__ in newlib
+ sources!
+
+ To get a strict ANSI C environment, define macro __STRICT_ANSI__. This will
+ "comment out" the non-ANSI parts of the ANSI header files (non-ANSI header
+ files aren't affected). */
+
+#ifndef _ANSIDECL_H_
+#define _ANSIDECL_H_
+
+#include <newlib.h>
+#include <sys/config.h>
+
+/* First try to figure out whether we really are in an ANSI C environment. */
+/* FIXME: This probably needs some work. Perhaps sys/config.h can be
+ prevailed upon to give us a clue. */
+
+#ifdef __STDC__
+#define _HAVE_STDC
+#endif
+
+/* ISO C++. */
+
+#ifdef __cplusplus
+#if !(defined(_BEGIN_STD_C) && defined(_END_STD_C))
+#ifdef _HAVE_STD_CXX
+#define _BEGIN_STD_C namespace std { extern "C" {
+#define _END_STD_C } }
+#else
+#define _BEGIN_STD_C extern "C" {
+#define _END_STD_C }
+#endif
+#if defined(__GNUC__) && \
+ ( (__GNUC__ >= 4) || \
+ ( (__GNUC__ >= 3) && defined(__GNUC_MINOR__) && (__GNUC_MINOR__ >= 3) ) )
+#define _NOTHROW __attribute__ ((nothrow))
+#else
+#define _NOTHROW throw()
+#endif
+#endif
+#else
+#define _BEGIN_STD_C
+#define _END_STD_C
+#define _NOTHROW
+#endif
+
+#ifdef _HAVE_STDC
+#define _PTR void *
+#define _AND ,
+#define _NOARGS void
+#define _CONST const
+#define _VOLATILE volatile
+#define _SIGNED signed
+#define _DOTS , ...
+#define _VOID void
+#ifdef __CYGWIN__
+#define _EXFUN_NOTHROW(name, proto) __cdecl name proto _NOTHROW
+#define _EXFUN(name, proto) __cdecl name proto
+#define _EXPARM(name, proto) (* __cdecl name) proto
+#define _EXFNPTR(name, proto) (__cdecl * name) proto
+#else
+#define _EXFUN_NOTHROW(name, proto) name proto _NOTHROW
+#define _EXFUN(name, proto) name proto
+#define _EXPARM(name, proto) (* name) proto
+#define _EXFNPTR(name, proto) (* name) proto
+#endif
+#define _DEFUN(name, arglist, args) name(args)
+#define _DEFUN_VOID(name) name(_NOARGS)
+#define _CAST_VOID (void)
+#ifndef _LONG_DOUBLE
+#define _LONG_DOUBLE long double
+#endif
+#ifndef _LONG_LONG_TYPE
+#define _LONG_LONG_TYPE long long
+#endif
+#ifndef _PARAMS
+#define _PARAMS(paramlist) paramlist
+#endif
+#else
+#define _PTR char *
+#define _AND ;
+#define _NOARGS
+#define _CONST
+#define _VOLATILE
+#define _SIGNED
+#define _DOTS
+#define _VOID void
+#define _EXFUN(name, proto) name()
+#define _EXFUN_NOTHROW(name, proto) name()
+#define _DEFUN(name, arglist, args) name arglist args;
+#define _DEFUN_VOID(name) name()
+#define _CAST_VOID
+#define _LONG_DOUBLE double
+#define _LONG_LONG_TYPE long
+#ifndef _PARAMS
+#define _PARAMS(paramlist) ()
+#endif
+#endif
+
+/* Support gcc's __attribute__ facility. */
+
+#ifdef __GNUC__
+#define _ATTRIBUTE(attrs) __attribute__ (attrs)
+#else
+#define _ATTRIBUTE(attrs)
+#endif
+
+/* The traditional meaning of 'extern inline' for GCC is not
+ to emit the function body unless the address is explicitly
+ taken. However this behaviour is changing to match the C99
+ standard, which uses 'extern inline' to indicate that the
+ function body *must* be emitted. If we are using GCC, but do
+ not have the new behaviour, we need to use extern inline; if
+ we are using a new GCC with the C99-compatible behaviour, or
+ a non-GCC compiler (which we will have to hope is C99, since
+ there is no other way to achieve the effect of omitting the
+ function if it isn't referenced) we just use plain 'inline',
+ which c99 defines to mean more-or-less the same as the Gnu C
+ 'extern inline'. */
+#if defined(__GNUC__) && !defined(__GNUC_STDC_INLINE__)
+/* We're using GCC, but without the new C99-compatible behaviour. */
+#define _ELIDABLE_INLINE extern __inline__ _ATTRIBUTE ((__always_inline__))
+#else
+/* We're using GCC in C99 mode, or an unknown compiler which
+ we just have to hope obeys the C99 semantics of inline. */
+#define _ELIDABLE_INLINE __inline__
+#endif
+
+#endif /* _ANSIDECL_H_ */
40 system/include/_syslist.h
View
@@ -0,0 +1,40 @@
+/* internal use only -- mapping of "system calls" for libraries that lose
+ and only provide C names, so that we end up in violation of ANSI */
+#ifndef __SYSLIST_H
+#define __SYSLIST_H
+
+#ifdef MISSING_SYSCALL_NAMES
+#define _close close
+#define _execve execve
+#define _fcntl fcntl
+#define _fork fork
+#define _fstat fstat
+#define _getpid getpid
+#define _gettimeofday gettimeofday
+#define _isatty isatty
+#define _kill kill
+#define _link link
+#define _lseek lseek
+#define _mkdir mkdir
+#define _open open
+#define _read read
+#define _sbrk sbrk
+#define _stat stat
+#define _times times
+#define _unlink unlink
+#define _wait wait
+#define _write write
+#endif /* MISSING_SYSCALL_NAMES */
+
+#if defined MISSING_SYSCALL_NAMES || !defined HAVE_OPENDIR
+/* If the system call interface is missing opendir, readdir, and
+ closedir, there is an implementation of these functions in
+ libc/posix that is implemented using open, getdents, and close.
+ Note, these functions are currently not in the libc/syscalls
+ directory. */
+#define _opendir opendir
+#define _readdir readdir
+#define _closedir closedir
+#endif /* MISSING_SYSCALL_NAMES || !HAVE_OPENDIR */
+
+#endif /* !__SYSLIST_H_ */
21 system/include/alloca.h
View
@@ -0,0 +1,21 @@
+/* libc/include/alloca.h - Allocate memory on stack */
+
+/* Written 2000 by Werner Almesberger */
+/* Rearranged for general inclusion by stdlib.h.
+ 2001, Corinna Vinschen <vinschen@redhat.com> */
+
+#ifndef _NEWLIB_ALLOCA_H
+#define _NEWLIB_ALLOCA_H
+
+#include "_ansi.h"
+#include <sys/reent.h>
+
+#undef alloca
+
+#ifdef __GNUC__
+#define alloca(size) __builtin_alloca(size)
+#else
+void * _EXFUN(alloca,(size_t));
+#endif
+
+#endif
69 system/include/ar.h
View
@@ -0,0 +1,69 @@
+/* $NetBSD: ar.h,v 1.4 1994/10/26 00:55:43 cgd Exp $ */
+
+/*-
+ * Copyright (c) 1991, 1993
+ * The Regents of the University of California. All rights reserved.
+ * (c) UNIX System Laboratories, Inc.
+ * All or some portions of this file are derived from material licensed
+ * to the University of California by American Telephone and Telegraph
+ * Co. or Unix System Laboratories, Inc. and are reproduced herein with
+ * the permission of UNIX System Laboratories, Inc.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Hugh Smith at The University of Guelph.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * @(#)ar.h 8.2 (Berkeley) 1/21/94
+ */
+
+#ifndef _AR_H_
+#define _AR_H_
+
+/* Pre-4BSD archives had these magic numbers in them. */
+#define OARMAG1 0177555
+#define OARMAG2 0177545
+
+#define ARMAG "!<arch>\n" /* ar "magic number" */
+#define SARMAG 8 /* strlen(ARMAG); */
+
+#define AR_EFMT1 "#1/" /* extended format #1 */
+
+struct ar_hdr {
+ char ar_name[16]; /* name */
+ char ar_date[12]; /* modification time */
+ char ar_uid[6]; /* user id */
+ char ar_gid[6]; /* group id */
+ char ar_mode[8]; /* octal file permissions */
+ char ar_size[10]; /* size in bytes */
+#define ARFMAG "`\n"
+ char ar_fmag[2]; /* consistency check */
+};
+
+#endif /* !_AR_H_ */
33 system/include/argz.h
View
@@ -0,0 +1,33 @@
+/* Copyright (C) 2002 by Red Hat, Incorporated. All rights reserved.
+ *
+ * Permission to use, copy, modify, and distribute this software
+ * is freely granted, provided that this notice is preserved.
+ */
+
+#ifndef _ARGZ_H_
+#define _ARGZ_H_
+
+#include <errno.h>
+#include <sys/types.h>
+
+#include "_ansi.h"
+
+_BEGIN_STD_C
+
+/* The newlib implementation of these functions assumes that sizeof(char) == 1. */
+error_t argz_create (char *const argv[], char **argz, size_t *argz_len);
+error_t argz_create_sep (const char *string, int sep, char **argz, size_t *argz_len);
+size_t argz_count (const char *argz, size_t argz_len);
+void argz_extract (char *argz, size_t argz_len, char **argv);
+void argz_stringify (char *argz, size_t argz_len, int sep);
+error_t argz_add (char **argz, size_t *argz_len, const char *str);
+error_t argz_add_sep (char **argz, size_t *argz_len, const char *str, int sep);
+error_t argz_append (char **argz, size_t *argz_len, const char *buf, size_t buf_len);
+error_t argz_delete (char **argz, size_t *argz_len, char *entry);
+error_t argz_insert (char **argz, size_t *argz_len, char *before, const char *entry);
+char * argz_next (char *argz, size_t argz_len, const char *entry);
+error_t argz_replace (char **argz, size_t *argz_len, const char *str, const char *with, unsigned *replace_count);
+
+_END_STD_C
+
+#endif /* _ARGZ_H_ */
46 system/include/assert.h
View
@@ -0,0 +1,46 @@
+/*
+ assert.h
+*/
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "_ansi.h"
+
+#undef assert
+
+#ifdef NDEBUG /* required by ANSI standard */
+# define assert(__e) ((void)0)
+#else
+# define assert(__e) ((__e) ? (void)0 : __assert_func (__FILE__, __LINE__, \
+ __ASSERT_FUNC, #__e))
+
+# ifndef __ASSERT_FUNC
+ /* Use g++'s demangled names in C++. */
+# if defined __cplusplus && defined __GNUC__
+# define __ASSERT_FUNC __PRETTY_FUNCTION__
+
+ /* C99 requires the use of __func__. */
+# elif __STDC_VERSION__ >= 199901L
+# define __ASSERT_FUNC __func__
+
+ /* Older versions of gcc don't have __func__ but can use __FUNCTION__. */
+# elif __GNUC__ >= 2
+# define __ASSERT_FUNC __FUNCTION__
+
+ /* failed to detect __func__ support. */
+# else
+# define __ASSERT_FUNC ((char *) 0)
+# endif
+# endif /* !__ASSERT_FUNC */
+#endif /* !NDEBUG */
+
+void _EXFUN(__assert, (const char *, int, const char *)
+ _ATTRIBUTE ((__noreturn__)));
+void _EXFUN(__assert_func, (const char *, int, const char *, const char *)
+ _ATTRIBUTE ((__noreturn__)));
+
+#ifdef __cplusplus
+}
+#endif
124 system/include/complex.h
View
@@ -0,0 +1,124 @@
+/* $NetBSD: complex.h,v 1.3 2010/09/15 16:11:30 christos Exp $ */
+
+/*
+ * Written by Matthias Drochner.
+ * Public domain.
+ */
+
+#ifndef _COMPLEX_H
+#define _COMPLEX_H
+
+#define complex _Complex
+#define _Complex_I 1.0fi
+#define I _Complex_I
+
+#include <sys/cdefs.h>
+
+__BEGIN_DECLS
+
+/* 7.3.5 Trigonometric functions */
+/* 7.3.5.1 The cacos functions */
+double complex cacos(double complex);
+float complex cacosf(float complex);
+
+/* 7.3.5.2 The casin functions */
+double complex casin(double complex);
+float complex casinf(float complex);
+
+/* 7.3.5.1 The catan functions */
+double complex catan(double complex);
+float complex catanf(float complex);
+
+/* 7.3.5.1 The ccos functions */
+double complex ccos(double complex);
+float complex ccosf(float complex);
+
+/* 7.3.5.1 The csin functions */
+double complex csin(double complex);
+float complex csinf(float complex);
+
+/* 7.3.5.1 The ctan functions */
+double complex ctan(double complex);
+float complex ctanf(float complex);
+
+/* 7.3.6 Hyperbolic functions */
+/* 7.3.6.1 The cacosh functions */
+double complex cacosh(double complex);
+float complex cacoshf(float complex);
+
+/* 7.3.6.2 The casinh functions */
+double complex casinh(double complex);
+float complex casinhf(float complex);
+
+/* 7.3.6.3 The catanh functions */
+double complex catanh(double complex);
+float complex catanhf(float complex);
+
+/* 7.3.6.4 The ccosh functions */
+double complex ccosh(double complex);
+float complex ccoshf(float complex);
+
+/* 7.3.6.5 The csinh functions */
+double complex csinh(double complex);
+float complex csinhf(float complex);
+
+/* 7.3.6.6 The ctanh functions */
+double complex ctanh(double complex);
+float complex ctanhf(float complex);
+
+/* 7.3.7 Exponential and logarithmic functions */
+/* 7.3.7.1 The cexp functions */
+double complex cexp(double complex);
+float complex cexpf(float complex);
+
+/* 7.3.7.2 The clog functions */
+double complex clog(double complex);
+float complex clogf(float complex);
+
+/* 7.3.8 Power and absolute-value functions */
+/* 7.3.8.1 The cabs functions */
+/*#ifndef __LIBM0_SOURCE__
+/* avoid conflict with historical cabs(struct complex) */
+/* double cabs(double complex) __RENAME(__c99_cabs);
+ float cabsf(float complex) __RENAME(__c99_cabsf);
+ #endif
+*/
+double cabs(double complex) ;
+float cabsf(float complex) ;
+
+/* 7.3.8.2 The cpow functions */
+double complex cpow(double complex, double complex);
+float complex cpowf(float complex, float complex);
+
+/* 7.3.8.3 The csqrt functions */
+double complex csqrt(double complex);
+float complex csqrtf(float complex);
+
+/* 7.3.9 Manipulation functions */
+/* 7.3.9.1 The carg functions */
+double carg(double complex);
+float cargf(float complex);
+
+/* 7.3.9.2 The cimag functions */
+double cimag(double complex);
+float cimagf(float complex);
+/*long double cimagl(long double complex); */
+
+/* 7.3.9.3 The conj functions */
+double complex conj(double complex);
+float complex conjf(float complex);
+/*long double complex conjl(long double complex); */
+
+/* 7.3.9.4 The cproj functions */
+double complex cproj(double complex);
+float complex cprojf(float complex);
+/*long double complex cprojl(long double complex); */
+
+/* 7.3.9.5 The creal functions */
+double creal(double complex);
+float crealf(float complex);
+/*long double creall(long double complex); */
+
+__END_DECLS
+
+#endif /* ! _COMPLEX_H */
113 system/include/ctype.h
View
@@ -0,0 +1,113 @@
+#ifndef _CTYPE_H_
+#define _CTYPE_H_
+
+#include "_ansi.h"
+
+_BEGIN_STD_C
+
+int _EXFUN(isalnum, (int __c));
+int _EXFUN(isalpha, (int __c));
+int _EXFUN(iscntrl, (int __c));
+int _EXFUN(isdigit, (int __c));
+int _EXFUN(isgraph, (int __c));
+int _EXFUN(islower, (int __c));
+int _EXFUN(isprint, (int __c));
+int _EXFUN(ispunct, (int __c));
+int _EXFUN(isspace, (int __c));
+int _EXFUN(isupper, (int __c));
+int _EXFUN(isxdigit,(int __c));
+int _EXFUN(tolower, (int __c));
+int _EXFUN(toupper, (int __c));
+
+#if !defined(__STRICT_ANSI__) || defined(__cplusplus) || __STDC_VERSION__ >= 199901L
+int _EXFUN(isblank, (int __c));
+#endif
+
+#ifndef __STRICT_ANSI__
+int _EXFUN(isascii, (int __c));
+int _EXFUN(toascii, (int __c));
+#define _tolower(__c) ((unsigned char)(__c) - 'A' + 'a')
+#define _toupper(__c) ((unsigned char)(__c) - 'a' + 'A')
+#endif
+
+#define _U 01
+#define _L 02
+#define _N 04
+#define _S 010
+#define _P 020
+#define _C 040
+#define _X 0100
+#define _B 0200
+
+#ifndef _MB_CAPABLE
+_CONST
+#endif
+extern __IMPORT char *__ctype_ptr__;
+
+#ifndef __cplusplus
+/* These macros are intentionally written in a manner that will trigger
+ a gcc -Wall warning if the user mistakenly passes a 'char' instead
+ of an int containing an 'unsigned char'. Note that the sizeof will
+ always be 1, which is what we want for mapping EOF to __ctype_ptr__[0];
+ the use of a raw index inside the sizeof triggers the gcc warning if
+ __c was of type char, and sizeof masks side effects of the extra __c.
+ Meanwhile, the real index to __ctype_ptr__+1 must be cast to int,
+ since isalpha(0x100000001LL) must equal isalpha(1), rather than being
+ an out-of-bounds reference on a 64-bit machine. */
+#define __ctype_lookup(__c) ((__ctype_ptr__+sizeof(""[__c]))[(int)(__c)])
+
+#define isalpha(__c) (__ctype_lookup(__c)&(_U|_L))
+#define isupper(__c) ((__ctype_lookup(__c)&(_U|_L))==_U)
+#define islower(__c) ((__ctype_lookup(__c)&(_U|_L))==_L)
+#define isdigit(__c) (__ctype_lookup(__c)&_N)
+#define isxdigit(__c) (__ctype_lookup(__c)&(_X|_N))
+#define isspace(__c) (__ctype_lookup(__c)&_S)
+#define ispunct(__c) (__ctype_lookup(__c)&_P)
+#define isalnum(__c) (__ctype_lookup(__c)&(_U|_L|_N))
+#define isprint(__c) (__ctype_lookup(__c)&(_P|_U|_L|_N|_B))
+#define isgraph(__c) (__ctype_lookup(__c)&(_P|_U|_L|_N))
+#define iscntrl(__c) (__ctype_lookup(__c)&_C)
+
+#if defined(__GNUC__) && \
+ (!defined(__STRICT_ANSI__) || __STDC_VERSION__ >= 199901L)
+#define isblank(__c) \
+ __extension__ ({ __typeof__ (__c) __x = (__c); \
+ (__ctype_lookup(__x)&_B) || (int) (__x) == '\t';})
+#endif
+
+
+/* Non-gcc versions will get the library versions, and will be
+ slightly slower. These macros are not NLS-aware so they are
+ disabled if the system supports the extended character sets. */
+# if defined(__GNUC__)
+# if !defined (_MB_EXTENDED_CHARSETS_ISO) && !defined (_MB_EXTENDED_CHARSETS_WINDOWS)
+# define toupper(__c) \
+ __extension__ ({ __typeof__ (__c) __x = (__c); \
+ islower (__x) ? (int) __x - 'a' + 'A' : (int) __x;})
+# define tolower(__c) \
+ __extension__ ({ __typeof__ (__c) __x = (__c); \
+ isupper (__x) ? (int) __x - 'A' + 'a' : (int) __x;})
+# else /* _MB_EXTENDED_CHARSETS* */
+/* Allow a gcc warning if the user passed 'char', but defer to the
+ function. */
+# define toupper(__c) \
+ __extension__ ({ __typeof__ (__c) __x = (__c); \
+ (void) __ctype_ptr__[__x]; (toupper) (__x);})
+# define tolower(__c) \
+ __extension__ ({ __typeof__ (__c) __x = (__c); \
+ (void) __ctype_ptr__[__x]; (tolower) (__x);})
+# endif /* _MB_EXTENDED_CHARSETS* */
+# endif /* __GNUC__ */
+#endif /* !__cplusplus */
+
+#ifndef __STRICT_ANSI__
+#define isascii(__c) ((unsigned)(__c)<=0177)
+#define toascii(__c) ((__c)&0177)
+#endif
+
+/* For C++ backward-compatibility only. */
+extern __IMPORT _CONST char _ctype_[];
+
+_END_STD_C
+
+#endif /* _CTYPE_H_ */
15 system/include/dirent.h
View
@@ -0,0 +1,15 @@
+#ifndef _DIRENT_H_
+#define _DIRENT_H_
+#ifdef __cplusplus
+extern "C" {
+#endif
+#include <sys/dirent.h>
+
+#if !defined(MAXNAMLEN) && !defined(_POSIX_SOURCE)
+#define MAXNAMLEN 1024
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+#endif /*_DIRENT_H_*/
15 system/include/envlock.h
View
@@ -0,0 +1,15 @@
+/* envlock.h -- header file for env routines. */
+
+#ifndef _INCLUDE_ENVLOCK_H_
+#define _INCLUDE_ENVLOCK_H_
+
+#include <_ansi.h>
+#include <sys/reent.h>
+
+#define ENV_LOCK __env_lock(reent_ptr)
+#define ENV_UNLOCK __env_unlock(reent_ptr)
+
+void _EXFUN(__env_lock,(struct _reent *reent));
+void _EXFUN(__env_unlock,(struct _reent *reent));
+
+#endif /* _INCLUDE_ENVLOCK_H_ */
16 system/include/envz.h
View
@@ -0,0 +1,16 @@
+/* Copyright (C) 2002 by Red Hat, Incorporated. All rights reserved.
+ *
+ * Permission to use, copy, modify, and distribute this software
+ * is freely granted, provided that this notice is preserved.
+ */
+
+#include <errno.h>
+#include <sys/types.h>
+
+/* The newlib implementation of these functions assumes that sizeof(char) == 1. */
+char * envz_entry (const char *envz, size_t envz_len, const char *name);
+char * envz_get (const char *envz, size_t envz_len, const char *name);
+error_t envz_add (char **envz, size_t *envz_len, const char *name, const char *value);
+error_t envz_merge (char **envz, size_t *envz_len, const char *envz2, size_t envz2_len, int override);
+void envz_remove(char **envz, size_t *envz_len, const char *name);
+void envz_strip (char **envz, size_t *envz_len);
11 system/include/errno.h
View
@@ -0,0 +1,11 @@
+#ifndef __ERRNO_H__
+#define __ERRNO_H__
+
+#ifndef __error_t_defined
+typedef int error_t;
+#define __error_t_defined 1
+#endif
+
+#include <sys/errno.h>
+
+#endif /* !__ERRNO_H__ */
13 system/include/fastmath.h
View
@@ -0,0 +1,13 @@
+#ifndef _FASTMATH_H_
+#ifdef __cplusplus
+extern "C" {
+#endif
+#define _FASTMATH_H_
+
+#include <math.h>
+#include <machine/fastmath.h>
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* _FASTMATH_H_ */
1  system/include/fcntl.h
View
@@ -0,0 +1 @@
+#include <sys/fcntl.h>
55 system/include/fnmatch.h
View
@@ -0,0 +1,55 @@
+/*-
+ * Copyright (c) 1992, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD: src/include/fnmatch.h,v 1.10 2002/03/23 17:24:53 imp Exp $
+ * @(#)fnmatch.h 8.1 (Berkeley) 6/2/93
+ */
+
+#ifndef _FNMATCH_H_
+#define _FNMATCH_H_
+
+#define FNM_NOMATCH 1 /* Match failed. */
+
+#define FNM_NOESCAPE 0x01 /* Disable backslash escaping. */
+#define FNM_PATHNAME 0x02 /* Slash must be matched by slash. */
+#define FNM_PERIOD 0x04 /* Period must be matched by period. */
+
+#if defined(_GNU_SOURCE) || !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE)
+#define FNM_LEADING_DIR 0x08 /* Ignore /<tail> after Imatch. */
+#define FNM_CASEFOLD 0x10 /* Case insensitive search. */
+#define FNM_IGNORECASE FNM_CASEFOLD
+#define FNM_FILE_NAME FNM_PATHNAME
+#endif
+
+#include <sys/cdefs.h>
+
+__BEGIN_DECLS
+int fnmatch(const char *, const char *, int);
+__END_DECLS
+
+#endif /* !_FNMATCH_H_ */
190 system/include/getopt.h
View
@@ -0,0 +1,190 @@
+/****************************************************************************
+
+getopt.h - Read command line options
+
+AUTHOR: Gregory Pietsch
+CREATED Thu Jan 09 22:37:00 1997
+
+DESCRIPTION:
+
+The getopt() function parses the command line arguments. Its arguments argc
+and argv are the argument count and array as passed to the main() function
+on program invocation. The argument optstring is a list of available option
+characters. If such a character is followed by a colon (`:'), the option
+takes an argument, which is placed in optarg. If such a character is
+followed by two colons, the option takes an optional argument, which is
+placed in optarg. If the option does not take an argument, optarg is NULL.
+
+The external variable optind is the index of the next array element of argv
+to be processed; it communicates from one call to the next which element to
+process.
+
+The getopt_long() function works like getopt() except that it also accepts
+long options started by two dashes `--'. If these take values, it is either
+in the form
+
+--arg=value
+
+ or
+
+--arg value
+
+It takes the additional arguments longopts which is a pointer to the first
+element of an array of type GETOPT_LONG_OPTION_T, defined below. The last
+element of the array has to be filled with NULL for the name field.
+
+The longind pointer points to the index of the current long option relative
+to longopts if it is non-NULL.
+
+The getopt() function returns the option character if the option was found
+successfully, `:' if there was a missing parameter for one of the options,
+`?' for an unknown option character, and EOF for the end of the option list.
+
+The getopt_long() function's return value is described below.
+
+The function getopt_long_only() is identical to getopt_long(), except that a
+plus sign `+' can introduce long options as well as `--'.
+
+Describe how to deal with options that follow non-option ARGV-elements.
+
+If the caller did not specify anything, the default is REQUIRE_ORDER if the
+environment variable POSIXLY_CORRECT is defined, PERMUTE otherwise.
+
+REQUIRE_ORDER means don't recognize them as options; stop option processing
+when the first non-option is seen. This is what Unix does. This mode of
+operation is selected by either setting the environment variable
+POSIXLY_CORRECT, or using `+' as the first character of the optstring
+parameter.
+
+PERMUTE is the default. We permute the contents of ARGV as we scan, so that
+eventually all the non-options are at the end. This allows options to be
+given in any order, even with programs that were not written to expect this.
+
+RETURN_IN_ORDER is an option available to programs that were written to
+expect options and other ARGV-elements in any order and that care about the
+ordering of the two. We describe each non-option ARGV-element as if it were
+the argument of an option with character code 1. Using `-' as the first
+character of the optstring parameter selects this mode of operation.
+
+The special argument `--' forces an end of option-scanning regardless of the
+value of `ordering'. In the case of RETURN_IN_ORDER, only `--' can cause
+getopt() and friends to return EOF with optind != argc.
+
+COPYRIGHT NOTICE AND DISCLAIMER:
+
+Copyright (C) 1997 Gregory Pietsch
+
+This file and the accompanying getopt.c implementation file are hereby
+placed in the public domain without restrictions. Just give the author
+credit, don't claim you wrote it or prevent anyone else from using it.
+
+Gregory Pietsch's current e-mail address:
+gpietsch@comcast.net
+****************************************************************************/
+
+/* This is a glibc-extension header file. */
+
+#ifndef GETOPT_H
+#define GETOPT_H
+
+#include <_ansi.h>
+
+/* include files needed by this include file */
+
+#define no_argument 0
+#define required_argument 1
+#define optional_argument 2
+
+#ifdef __cplusplus
+extern "C"
+{
+
+#endif /* __cplusplus */
+
+/* types defined by this include file */
+ struct option
+ {
+ char *name; /* the name of the long option */
+ int has_arg; /* one of the above macros */
+ int *flag; /* determines if getopt_long() returns a
+ * value for a long option; if it is
+ * non-NULL, 0 is returned as a function
+ * value and the value of val is stored in
+ * the area pointed to by flag. Otherwise,
+ * val is returned. */
+ int val; /* determines the value to return if flag is
+ * NULL. */
+
+ };
+
+/* While getopt.h is a glibc extension, the following are newlib extensions.
+ * They are optionally included via the __need_getopt_newlib flag. */
+
+#ifdef __need_getopt_newlib
+
+ /* macros defined by this include file */
+ #define NO_ARG no_argument
+ #define REQUIRED_ARG required_argument
+ #define OPTIONAL_ARG optional_argument
+
+ /* The GETOPT_DATA_INITIALIZER macro is used to initialize a statically-
+ allocated variable of type struct getopt_data. */
+ #define GETOPT_DATA_INITIALIZER {0,0,0,0,0}
+
+ /* These #defines are to make accessing the reentrant functions easier. */
+ #define getopt_r __getopt_r
+ #define getopt_long_r __getopt_long_r
+ #define getopt_long_only_r __getopt_long_only_r
+
+ /* The getopt_data structure is for reentrancy. Its members are similar to
+ the externally-defined variables. */
+ typedef struct getopt_data
+ {
+ char *optarg;
+ int optind, opterr, optopt, optwhere;
+ } getopt_data;
+
+#endif /* __need_getopt_newlib */
+
+ /* externally-defined variables */
+ extern char *optarg;
+ extern int optind;
+ extern int opterr;
+ extern int optopt;
+
+ /* function prototypes */
+ int _EXFUN (getopt,
+ (int __argc, char *const __argv[], const char *__optstring));
+
+ int _EXFUN (getopt_long,
+ (int __argc, char *const __argv[], const char *__shortopts,
+ const struct option * __longopts, int *__longind));
+
+ int _EXFUN (getopt_long_only,
+ (int __argc, char *const __argv[], const char *__shortopts,
+ const struct option * __longopts, int *__longind));
+
+#ifdef __need_getopt_newlib
+ int _EXFUN (__getopt_r,
+ (int __argc, char *const __argv[], const char *__optstring,
+ struct getopt_data * __data));
+
+ int _EXFUN (__getopt_long_r,
+ (int __argc, char *const __argv[], const char *__shortopts,
+ const struct option * __longopts, int *__longind,
+ struct getopt_data * __data));
+
+ int _EXFUN (__getopt_long_only_r,
+ (int __argc, char *const __argv[], const char *__shortopts,
+ const struct option * __longopts, int *__longind,
+ struct getopt_data * __data));
+#endif /* __need_getopt_newlib */
+
+#ifdef __cplusplus
+};
+
+#endif /* __cplusplus */
+
+#endif /* GETOPT_H */
+
+/* END OF FILE getopt.h */
89 system/include/glob.h
View
@@ -0,0 +1,89 @@
+/*
+ * Copyright (c) 1989, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Guido van Rossum.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * @(#)glob.h 8.1 (Berkeley) 6/2/93
+ * $FreeBSD: src/include/glob.h,v 1.6 2002/03/23 17:24:53 imp Exp $
+ */
+
+#ifndef _GLOB_H_
+#define _GLOB_H_
+
+#include <sys/cdefs.h>
+
+struct stat;
+typedef struct {
+ int gl_pathc; /* Count of total paths so far. */
+ int gl_matchc; /* Count of paths matching pattern. */
+ int gl_offs; /* Reserved at beginning of gl_pathv. */
+ int gl_flags; /* Copy of flags parameter to glob. */
+ char **gl_pathv; /* List of paths matching pattern. */
+ /* Copy of errfunc parameter to glob. */
+ int (*gl_errfunc)(const char *, int);
+
+ /*
+ * Alternate filesystem access methods for glob; replacement
+ * versions of closedir(3), readdir(3), opendir(3), stat(2)
+ * and lstat(2).
+ */
+ void (*gl_closedir)(void *);
+ struct dirent *(*gl_readdir)(void *);
+ void *(*gl_opendir)(const char *);
+ int (*gl_lstat)(const char *, struct stat *);
+ int (*gl_stat)(const char *, struct stat *);
+} glob_t;
+
+#define GLOB_APPEND 0x0001 /* Append to output from previous call. */
+#define GLOB_DOOFFS 0x0002 /* Use gl_offs. */
+#define GLOB_ERR 0x0004 /* Return on error. */
+#define GLOB_MARK 0x0008 /* Append / to matching directories. */
+#define GLOB_NOCHECK 0x0010 /* Return pattern itself if nothing matches. */
+#define GLOB_NOSORT 0x0020 /* Don't sort. */
+
+#define GLOB_ALTDIRFUNC 0x0040 /* Use alternately specified directory funcs. */
+#define GLOB_BRACE 0x0080 /* Expand braces ala csh. */
+#define GLOB_MAGCHAR 0x0100 /* Pattern had globbing characters. */
+#define GLOB_NOMAGIC 0x0200 /* GLOB_NOCHECK without magic chars (csh). */
+#define GLOB_QUOTE 0x0400 /* Quote special chars with \. */
+#define GLOB_TILDE 0x0800 /* Expand tilde names from the passwd file. */
+#define GLOB_LIMIT 0x1000 /* limit number of returned paths */
+
+/* backwards compatibility, this is the old name for this option */
+#define GLOB_MAXPATH GLOB_LIMIT
+
+#define GLOB_NOSPACE (-1) /* Malloc call failed. */
+#define GLOB_ABEND (-2) /* Unignored error. */
+
+__BEGIN_DECLS
+int glob(const char *, int, int (*)(const char *, int), glob_t *);
+void globfree(glob_t *);
+__END_DECLS
+
+#endif /* !_GLOB_H_ */
94 system/include/grp.h
View
@@ -0,0 +1,94 @@
+/* $NetBSD: grp.h,v 1.7 1995/04/29 05:30:40 cgd Exp $ */
+
+/*-
+ * Copyright (c) 1989, 1993
+ * The Regents of the University of California. All rights reserved.
+ * (c) UNIX System Laboratories, Inc.
+ * All or some portions of this file are derived from material licensed
+ * to the University of California by American Telephone and Telegraph
+ * Co. or Unix System Laboratories, Inc. and are reproduced herein with
+ * the permission of UNIX System Laboratories, Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * @(#)grp.h 8.2 (Berkeley) 1/21/94
+ */
+
+#ifndef _GRP_H_
+#define _GRP_H_
+
+#include <sys/types.h>
+#ifdef __CYGWIN__
+#include <cygwin/grp.h>
+#endif
+
+#if !defined(_POSIX_SOURCE) && !defined(_XOPEN_SOURCE)
+#define _PATH_GROUP "/etc/group"
+#endif
+
+struct group {
+ char *gr_name; /* group name */
+ char *gr_passwd; /* group password */
+ gid_t gr_gid; /* group id */
+ char **gr_mem; /* group members */
+};
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef __INSIDE_CYGWIN__
+struct group *getgrgid (gid_t);
+struct group *getgrnam (const char *);
+int getgrnam_r (const char *, struct group *,
+ char *, size_t, struct group **);
+int getgrgid_r (gid_t, struct group *,
+ char *, size_t, struct group **);
+#ifndef _POSIX_SOURCE
+struct group *getgrent (void);
+void setgrent (void);
+void endgrent (void);
+#ifndef __CYGWIN__
+void setgrfile (const char *);
+#endif /* !__CYGWIN__ */
+#ifndef _XOPEN_SOURCE
+#ifndef __CYGWIN__
+char *group_from_gid (gid_t, int);
+int setgroupent (int);
+#endif /* !__CYGWIN__ */
+int initgroups (const char *, gid_t);
+#endif /* !_XOPEN_SOURCE */
+#endif /* !_POSIX_SOURCE */
+#endif /* !__INSIDE_CYGWIN__ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* !_GRP_H_ */
62 system/include/iconv.h
View
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2003-2004, Artem B. Bityuckiy, SoftMine Corporation.
+ * Rights transferred to Franklin Electronic Publishers.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+#ifndef _ICONV_H_
+#define _ICONV_H_
+
+#include <_ansi.h>
+#include <reent.h>
+#include <sys/types.h>
+#include <sys/_types.h>
+
+/* iconv_t: charset conversion descriptor type */
+typedef _iconv_t iconv_t;
+
+_BEGIN_STD_C
+
+#ifndef _REENT_ONLY
+iconv_t
+_EXFUN(iconv_open, (_CONST char *, _CONST char *));
+
+size_t
+_EXFUN(iconv, (iconv_t, char **, size_t *, char **, size_t *));
+
+int
+_EXFUN(iconv_close, (iconv_t));
+#endif
+
+iconv_t
+_EXFUN(_iconv_open_r, (struct _reent *, _CONST char *, _CONST char *));
+
+size_t
+_EXFUN(_iconv_r, (struct _reent *, iconv_t, _CONST char **,
+ size_t *, char **, size_t *));
+
+int
+_EXFUN(_iconv_close_r, (struct _reent *, iconv_t));
+
+_END_STD_C
+
+#endif /* #ifndef _ICONV_H_ */
256 system/include/ieeefp.h
View
@@ -0,0 +1,256 @@
+#ifndef _IEEE_FP_H_
+#define _IEEE_FP_H_
+
+#include "_ansi.h"
+
+#include <machine/ieeefp.h>
+
+_BEGIN_STD_C
+
+/* FIXME FIXME FIXME:
+ Neither of __ieee_{float,double}_shape_tape seem to be used anywhere
+ except in libm/test. If that is the case, please delete these from here.
+ If that is not the case, please insert documentation here describing why
+ they're needed. */
+
+#ifdef __IEEE_BIG_ENDIAN
+
+typedef union
+{
+ double value;
+ struct
+ {
+ unsigned int sign : 1;
+ unsigned int exponent: 11;
+ unsigned int fraction0:4;
+ unsigned int fraction1:16;
+ unsigned int fraction2:16;
+ unsigned int fraction3:16;
+
+ } number;
+ struct
+ {
+ unsigned int sign : 1;
+ unsigned int exponent: 11;
+ unsigned int quiet:1;
+ unsigned int function0:3;
+ unsigned int function1:16;
+ unsigned int function2:16;
+ unsigned int function3:16;
+ } nan;
+ struct
+ {
+ unsigned long msw;
+ unsigned long lsw;
+ } parts;
+ long aslong[2];
+} __ieee_double_shape_type;
+
+#endif
+
+#ifdef __IEEE_LITTLE_ENDIAN
+
+typedef union
+{
+ double value;
+ struct
+ {
+#ifdef __SMALL_BITFIELDS
+ unsigned int fraction3:16;
+ unsigned int fraction2:16;
+ unsigned int fraction1:16;
+ unsigned int fraction0: 4;
+#else
+ unsigned int fraction1:32;
+ unsigned int fraction0:20;
+#endif
+ unsigned int exponent :11;
+ unsigned int sign : 1;
+ } number;
+ struct
+ {
+#ifdef __SMALL_BITFIELDS
+ unsigned int function3:16;
+ unsigned int function2:16;
+ unsigned int function1:16;
+ unsigned int function0:3;
+#else
+ unsigned int function1:32;
+ unsigned int function0:19;
+#endif
+ unsigned int quiet:1;
+ unsigned int exponent: 11;
+ unsigned int sign : 1;
+ } nan;
+ struct
+ {
+ unsigned long lsw;
+ unsigned long msw;
+ } parts;
+
+ long aslong[2];
+
+} __ieee_double_shape_type;
+
+#endif
+
+#ifdef __IEEE_BIG_ENDIAN
+
+typedef union
+{
+ float value;
+ struct
+ {
+ unsigned int sign : 1;
+ unsigned int exponent: 8;
+ unsigned int fraction0: 7;
+ unsigned int fraction1: 16;
+ } number;
+ struct
+ {
+ unsigned int sign:1;
+ unsigned int exponent:8;
+ unsigned int quiet:1;
+ unsigned int function0:6;
+ unsigned int function1:16;
+ } nan;
+ long p1;
+
+} __ieee_float_shape_type;
+
+#endif
+
+#ifdef __IEEE_LITTLE_ENDIAN
+
+typedef union
+{
+ float value;
+ struct
+ {
+ unsigned int fraction0: 7;
+ unsigned int fraction1: 16;
+ unsigned int exponent: 8;
+ unsigned int sign : 1;
+ } number;
+ struct
+ {
+ unsigned int function1:16;
+ unsigned int function0:6;
+ unsigned int quiet:1;
+ unsigned int exponent:8;
+ unsigned int sign:1;
+ } nan;
+ long p1;
+
+} __ieee_float_shape_type;
+
+#endif
+
+
+
+
+
+/* FLOATING ROUNDING */
+
+typedef int fp_rnd;
+#define FP_RN 0 /* Round to nearest */
+#define FP_RM 1 /* Round down */
+#define FP_RP 2 /* Round up */
+#define FP_RZ 3 /* Round to zero (trunate) */
+
+fp_rnd _EXFUN(fpgetround,(void));
+fp_rnd _EXFUN(fpsetround, (fp_rnd));
+
+/* EXCEPTIONS */
+
+typedef int fp_except;
+#define FP_X_INV 0x10 /* Invalid operation */
+#define FP_X_DX 0x80 /* Divide by zero */
+#define FP_X_OFL 0x04 /* Overflow exception */
+#define FP_X_UFL 0x02 /* Underflow exception */
+#define FP_X_IMP 0x01 /* imprecise exception */
+
+fp_except _EXFUN(fpgetmask,(void));
+fp_except _EXFUN(fpsetmask,(fp_except));
+fp_except _EXFUN(fpgetsticky,(void));
+fp_except _EXFUN(fpsetsticky, (fp_except));
+
+/* INTEGER ROUNDING */
+
+typedef int fp_rdi;
+#define FP_RDI_TOZ 0 /* Round to Zero */
+#define FP_RDI_RD 1 /* Follow float mode */
+
+fp_rdi _EXFUN(fpgetroundtoi,(void));
+fp_rdi _EXFUN(fpsetroundtoi,(fp_rdi));
+
+#undef isnan
+#undef isinf
+
+int _EXFUN(isnan, (double));
+int _EXFUN(isinf, (double));
+int _EXFUN(finite, (double));
+
+
+
+int _EXFUN(isnanf, (float));
+int _EXFUN(isinff, (float));
+int _EXFUN(finitef, (float));
+
+#define __IEEE_DBL_EXPBIAS 1023
+#define __IEEE_FLT_EXPBIAS 127
+
+#define __IEEE_DBL_EXPLEN 11
+#define __IEEE_FLT_EXPLEN 8
+
+
+#define __IEEE_DBL_FRACLEN (64 - (__IEEE_DBL_EXPLEN + 1))
+#define __IEEE_FLT_FRACLEN (32 - (__IEEE_FLT_EXPLEN + 1))
+
+#define __IEEE_DBL_MAXPOWTWO ((double)(1L << 32 - 2) * (1L << (32-11) - 32 + 1))
+#define __IEEE_FLT_MAXPOWTWO ((float)(1L << (32-8) - 1))
+
+#define __IEEE_DBL_NAN_EXP 0x7ff
+#define __IEEE_FLT_NAN_EXP 0xff
+
+#ifndef __ieeefp_isnanf
+#define __ieeefp_isnanf(x) (((*(long *)&(x) & 0x7f800000L)==0x7f800000L) && \
+ ((*(long *)&(x) & 0x007fffffL)!=0000000000L))
+#endif
+#define isnanf(x) __ieeefp_isnanf(x)
+
+#ifndef __ieeefp_isinff
+#define __ieeefp_isinff(x) (((*(long *)&(x) & 0x7f800000L)==0x7f800000L) && \
+ ((*(long *)&(x) & 0x007fffffL)==0000000000L))
+#endif
+#define isinff(x) __ieeefp_isinff(x)
+
+#ifndef __ieeefp_finitef
+#define __ieeefp_finitef(x) (((*(long *)&(x) & 0x7f800000L)!=0x7f800000L))
+#endif
+#define finitef(x) __ieeefp_finitef(x)
+
+#ifdef _DOUBLE_IS_32BITS
+#undef __IEEE_DBL_EXPBIAS
+#define __IEEE_DBL_EXPBIAS __IEEE_FLT_EXPBIAS
+
+#undef __IEEE_DBL_EXPLEN
+#define __IEEE_DBL_EXPLEN __IEEE_FLT_EXPLEN
+
+#undef __IEEE_DBL_FRACLEN
+#define __IEEE_DBL_FRACLEN __IEEE_FLT_FRACLEN
+
+#undef __IEEE_DBL_MAXPOWTWO
+#define __IEEE_DBL_MAXPOWTWO __IEEE_FLT_MAXPOWTWO
+
+#undef __IEEE_DBL_NAN_EXP
+#define __IEEE_DBL_NAN_EXP __IEEE_FLT_NAN_EXP
+
+#undef __ieee_double_shape_type
+#define __ieee_double_shape_type __ieee_float_shape_type
+
+#endif /* _DOUBLE_IS_32BITS */
+
+_END_STD_C
+
+#endif /* _IEEE_FP_H_ */
290 system/include/inttypes.h
View
@@ -0,0 +1,290 @@
+/*
+ * Copyright (c) 2004, 2005 by
+ * Ralf Corsepius, Ulm/Germany. All rights reserved.
+ *
+ * Permission to use, copy, modify, and distribute this software
+ * is freely granted, provided that this notice is preserved.
+ */
+
+/**
+ * @file inttypes.h
+ */
+
+#ifndef _INTTYPES_H
+#define _INTTYPES_H
+
+#include <stdint.h>
+#define __need_wchar_t
+#include <stddef.h>
+
+#define __STRINGIFY(a) #a
+
+/* 8-bit types */
+#define __PRI8(x) __STRINGIFY(x)
+#define __SCN8(x) __STRINGIFY(hh##x)
+
+
+#define PRId8 __PRI8(d)
+#define PRIi8 __PRI8(i)
+#define PRIo8 __PRI8(o)
+#define PRIu8 __PRI8(u)
+#define PRIx8 __PRI8(x)
+#define PRIX8 __PRI8(X)
+
+#define SCNd8 __SCN8(d)
+#define SCNi8 __SCN8(i)
+#define SCNo8 __SCN8(o)
+#define SCNu8 __SCN8(u)
+#define SCNx8 __SCN8(x)
+
+
+#define PRIdLEAST8 __PRI8(d)
+#define PRIiLEAST8 __PRI8(i)
+#define PRIoLEAST8 __PRI8(o)
+#define PRIuLEAST8 __PRI8(u)
+#define PRIxLEAST8 __PRI8(x)
+#define PRIXLEAST8 __PRI8(X)
+
+#define SCNdLEAST8 __SCN8(d)
+#define SCNiLEAST8 __SCN8(i)
+#define SCNoLEAST8 __SCN8(o)
+#define SCNuLEAST8 __SCN8(u)
+#define SCNxLEAST8 __SCN8(x)
+
+
+#define PRIdFAST8 __PRI8(d)
+#define PRIiFAST8 __PRI8(i)
+#define PRIoFAST8 __PRI8(o)
+#define PRIuFAST8 __PRI8(u)
+#define PRIxFAST8 __PRI8(x)
+#define PRIXFAST8 __PRI8(X)
+
+#define SCNdFAST8 __SCN8(d)
+#define SCNiFAST8 __SCN8(i)
+#define SCNoFAST8 __SCN8(o)
+#define SCNuFAST8 __SCN8(u)
+#define SCNxFAST8 __SCN8(x)
+
+/* 16-bit types */
+#define __PRI16(x) __STRINGIFY(x)
+#define __SCN16(x) __STRINGIFY(h##x)
+
+
+#define PRId16 __PRI16(d)
+#define PRIi16 __PRI16(i)
+#define PRIo16 __PRI16(o)
+#define PRIu16 __PRI16(u)
+#define PRIx16 __PRI16(x)
+#define PRIX16 __PRI16(X)
+
+#define SCNd16 __SCN16(d)
+#define SCNi16 __SCN16(i)
+#define SCNo16 __SCN16(o)
+#define SCNu16 __SCN16(u)
+#define SCNx16 __SCN16(x)
+
+
+#define PRIdLEAST16 __PRI16(d)
+#define PRIiLEAST16 __PRI16(i)
+#define PRIoLEAST16 __PRI16(o)
+#define PRIuLEAST16 __PRI16(u)
+#define PRIxLEAST16 __PRI16(x)
+#define PRIXLEAST16 __PRI16(X)
+
+#define SCNdLEAST16 __SCN16(d)
+#define SCNiLEAST16 __SCN16(i)
+#define SCNoLEAST16 __SCN16(o)
+#define SCNuLEAST16 __SCN16(u)
+#define SCNxLEAST16 __SCN16(x)
+
+
+#define PRIdFAST16 __PRI16(d)
+#define PRIiFAST16 __PRI16(i)
+#define PRIoFAST16 __PRI16(o)
+#define PRIuFAST16 __PRI16(u)
+#define PRIxFAST16 __PRI16(x)
+#define PRIXFAST16 __PRI16(X)
+
+#define SCNdFAST16 __SCN16(d)
+#define SCNiFAST16 __SCN16(i)
+#define SCNoFAST16 __SCN16(o)
+#define SCNuFAST16 __SCN16(u)
+#define SCNxFAST16 __SCN16(x)
+
+/* 32-bit types */
+#if __have_long32
+#define __PRI32(x) __STRINGIFY(l##x)
+#define __SCN32(x) __STRINGIFY(l##x)
+#else
+#define __PRI32(x) __STRINGIFY(x)
+#define __SCN32(x) __STRINGIFY(x)
+#endif
+
+#define PRId32 __PRI32(d)
+#define PRIi32 __PRI32(i)
+#define PRIo32 __PRI32(o)
+#define PRIu32 __PRI32(u)
+#define PRIx32 __PRI32(x)
+#define PRIX32 __PRI32(X)
+
+#define SCNd32 __SCN32(d)
+#define SCNi32 __SCN32(i)
+#define SCNo32 __SCN32(o)
+#define SCNu32 __SCN32(u)
+#define SCNx32 __SCN32(x)
+
+
+#define PRIdLEAST32 __PRI32(d)
+#define PRIiLEAST32 __PRI32(i)
+#define PRIoLEAST32 __PRI32(o)
+#define PRIuLEAST32 __PRI32(u)
+#define PRIxLEAST32 __PRI32(x)
+#define PRIXLEAST32 __PRI32(X)
+
+#define SCNdLEAST32 __SCN32(d)
+#define SCNiLEAST32 __SCN32(i)
+#define SCNoLEAST32 __SCN32(o)
+#define SCNuLEAST32 __SCN32(u)
+#define SCNxLEAST32 __SCN32(x)
+
+
+#define PRIdFAST32 __PRI32(d)
+#define PRIiFAST32 __PRI32(i)
+#define PRIoFAST32 __PRI32(o)
+#define PRIuFAST32 __PRI32(u)
+#define PRIxFAST32 __PRI32(x)
+#define PRIXFAST32 __PRI32(X)
+
+#define SCNdFAST32 __SCN32(d)
+#define SCNiFAST32 __SCN32(i)
+#define SCNoFAST32 __SCN32(o)
+#define SCNuFAST32 __SCN32(u)
+#define SCNxFAST32 __SCN32(x)
+
+
+/* 64-bit types */
+#if __have_long64
+#define __PRI64(x) __STRINGIFY(l##x)
+#define __SCN64(x) __STRINGIFY(l##x)
+#elif __have_longlong64
+#define __PRI64(x) __STRINGIFY(ll##x)
+#define __SCN64(x) __STRINGIFY(ll##x)
+#else
+#define __PRI64(x) __STRINGIFY(x)
+#define __SCN64(x) __STRINGIFY(x)
+#endif
+
+#define PRId64 __PRI64(d)
+#define PRIi64 __PRI64(i)
+#define PRIo64 __PRI64(o)
+#define PRIu64 __PRI64(u)
+#define PRIx64 __PRI64(x)
+#define PRIX64 __PRI64(X)
+
+#define SCNd64 __SCN64(d)
+#define SCNi64 __SCN64(i)
+#define SCNo64 __SCN64(o)
+#define SCNu64 __SCN64(u)
+#define SCNx64 __SCN64(x)
+
+#if __int64_t_defined
+#define PRIdLEAST64 __PRI64(d)
+#define PRIiLEAST64 __PRI64(i)
+#define PRIoLEAST64 __PRI64(o)
+#define PRIuLEAST64 __PRI64(u)
+#define PRIxLEAST64 __PRI64(x)
+#define PRIXLEAST64 __PRI64(X)
+
+#define SCNdLEAST64 __SCN64(d)
+#define SCNiLEAST64 __SCN64(i)
+#define SCNoLEAST64 __SCN64(o)
+#define SCNuLEAST64 __SCN64(u)
+#define SCNxLEAST64 __SCN64(x)
+
+
+#define PRIdFAST64 __PRI64(d)
+#define PRIiFAST64 __PRI64(i)
+#define PRIoFAST64 __PRI64(o)
+#define PRIuFAST64 __PRI64(u)
+#define PRIxFAST64 __PRI64(x)
+#define PRIXFAST64 __PRI64(X)
+
+#define SCNdFAST64 __SCN64(d)
+#define SCNiFAST64 __SCN64(i)
+#define SCNoFAST64 __SCN64(o)
+#define SCNuFAST64 __SCN64(u)
+#define SCNxFAST64 __SCN64(x)
+#endif
+
+/* max-bit types */
+#if __have_long64
+#define __PRIMAX(x) __STRINGIFY(l##x)
+#define __SCNMAX(x) __STRINGIFY(l##x)
+#elif __have_longlong64
+#define __PRIMAX(x) __STRINGIFY(ll##x)
+#define __SCNMAX(x) __STRINGIFY(ll##x)
+#else
+#define __PRIMAX(x) __STRINGIFY(x)
+#define __SCNMAX(x) __STRINGIFY(x)
+#endif
+
+#define PRIdMAX __PRIMAX(d)
+#define PRIiMAX __PRIMAX(i)
+#define PRIoMAX __PRIMAX(o)
+#define PRIuMAX __PRIMAX(u)
+#define PRIxMAX __PRIMAX(x)
+#define PRIXMAX __PRIMAX(X)
+
+#define SCNdMAX __SCNMAX(d)
+#define SCNiMAX __SCNMAX(i)
+#define SCNoMAX __SCNMAX(o)
+#define SCNuMAX __SCNMAX(u)
+#define SCNxMAX __SCNMAX(x)
+
+/* ptr types */
+#if __have_long64
+#define __PRIPTR(x) __STRINGIFY(l##x)
+#define __SCNPTR(x) __STRINGIFY(l##x)
+#elif __have_longlong64
+#define __PRIPTR(x) __STRINGIFY(ll##x)
+#define __SCNPTR(x) __STRINGIFY(ll##x)
+#else
+#define __PRIPTR(x) __STRINGIFY(x)
+#define __SCNPTR(x) __STRINGIFY(x)
+#endif
+
+#define PRIdPTR __PRIPTR(d)
+#define PRIiPTR __PRIPTR(i)
+#define PRIoPTR __PRIPTR(o)
+#define PRIuPTR __PRIPTR(u)
+#define PRIxPTR __PRIPTR(x)
+#define PRIXPTR __PRIPTR(X)
+
+#define SCNdPTR __SCNPTR(d)
+#define SCNiPTR __SCNPTR(i)
+#define SCNoPTR __SCNPTR(o)
+#define SCNuPTR __SCNPTR(u)
+#define SCNxPTR __SCNPTR(x)
+
+
+typedef struct {
+ intmax_t quot;
+ intmax_t rem;
+} imaxdiv_t;
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern intmax_t imaxabs(intmax_t j);
+extern imaxdiv_t imaxdiv(intmax_t numer, intmax_t denomer);
+extern intmax_t strtoimax(const char *__restrict, char **__restrict, int);
+extern uintmax_t strtoumax(const char *__restrict, char **__restrict, int);
+extern intmax_t wcstoimax(const wchar_t *__restrict, wchar_t **__restrict, int);
+extern uintmax_t wcstoumax(const wchar_t *__restrict, wchar_t **__restrict, int);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
316 system/include/langinfo.h
View
@@ -0,0 +1,316 @@
+/*-
+ * Copyright (c) 2001 Alexey Zelkin <phantom@FreeBSD.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD: src/include/langinfo.h,v 1.5 2002/03/23 17:24:53 imp Exp $
+ */
+
+#ifndef _LANGINFO_H_
+#define _LANGINFO_H_
+
+#include <newlib.h>
+#include <sys/config.h>
+#include <sys/cdefs.h>
+
+typedef int nl_item;
+
+enum __nl_item
+{
+ /* POSIX and BSD defined items have to stick to the original values
+ to maintain backward compatibility. */
+ _NL_CTYPE_CODESET_NAME = 0, /* codeset name */
+#define CODESET _NL_CTYPE_CODESET_NAME
+ D_T_FMT, /* string for formatting date and time */
+#define D_T_FMT D_T_FMT
+ D_FMT, /* date format string */
+#define D_FMT D_FMT
+ T_FMT, /* time format string */
+#define T_FMT T_FMT
+ T_FMT_AMPM, /* a.m. or p.m. time formatting string */
+#define T_FMT_AMPM T_FMT_AMPM
+ AM_STR, /* Ante Meridian affix */
+#define AM_STR AM_STR
+ PM_STR, /* Post Meridian affix */
+#define PM_STR PM_STR
+
+/* week day names */
+ DAY_1,
+#define DAY_1 DAY_1
+ DAY_2,
+#define DAY_2 DAY_2
+ DAY_3,
+#define DAY_3 DAY_3
+ DAY_4,
+#define DAY_4 DAY_4
+ DAY_5,
+#define DAY_5 DAY_5
+ DAY_6,
+#define DAY_6 DAY_6
+ DAY_7,
+#define DAY_7 DAY_7
+
+/* abbreviated week day names */
+ ABDAY_1,
+#define ABDAY_1 ABDAY_1
+ ABDAY_2,
+#define ABDAY_2 ABDAY_2
+ ABDAY_3,
+#define ABDAY_3 ABDAY_3
+ ABDAY_4,
+#define ABDAY_4 ABDAY_4
+ ABDAY_5,
+#define ABDAY_5 ABDAY_5
+ ABDAY_6,
+#define ABDAY_6 ABDAY_6
+ ABDAY_7,
+#define ABDAY_7 ABDAY_7
+
+/* month names */
+ MON_1,
+#define MON_1 MON_1
+ MON_2,
+#define MON_2 MON_2
+ MON_3,
+#define MON_3 MON_3
+ MON_4,
+#define MON_4 MON_4
+ MON_5,
+#define MON_5 MON_5
+ MON_6,
+#define MON_6 MON_6
+ MON_7,
+#define MON_7 MON_7
+ MON_8,
+#define MON_8 MON_8
+ MON_9,
+#define MON_9 MON_9
+ MON_10,
+#define MON_10 MON_10
+ MON_11,
+#define MON_11 MON_11
+ MON_12,
+#define MON_12 MON_12
+
+/* abbreviated month names */
+ ABMON_1,
+#define ABMON_1 ABMON_1
+ ABMON_2,
+#define ABMON_2 ABMON_2
+ ABMON_3,
+#define ABMON_3 ABMON_3
+ ABMON_4,
+#define ABMON_4 ABMON_4
+ ABMON_5,
+#define ABMON_5 ABMON_5
+ ABMON_6,
+#define ABMON_6 ABMON_6
+ ABMON_7,
+#define ABMON_7 ABMON_7
+ ABMON_8,
+#define ABMON_8 ABMON_8
+ ABMON_9,
+#define ABMON_9 ABMON_9
+ ABMON_10,
+#define ABMON_10 ABMON_10
+ ABMON_11,
+#define ABMON_11 ABMON_11
+ ABMON_12,
+#define ABMON_12 ABMON_12
+
+ ERA, /* era description segments */
+#define ERA ERA
+ ERA_D_FMT, /* era date format string */
+#define ERA_D_FMT ERA_D_FMT
+ ERA_D_T_FMT, /* era date and time format string */
+#define ERA_D_T_FMT ERA_D_T_FMT
+ ERA_T_FMT, /* era time format string */
+#define ERA_T_FMT ERA_T_FMT
+ ALT_DIGITS, /* alternative symbols for digits */
+#define ALT_DIGITS ALT_DIGITS
+
+ RADIXCHAR, /* radix char */
+#define RADIXCHAR RADIXCHAR
+ THOUSEP, /* separator for thousands */
+#define THOUSEP THOUSEP
+
+ YESEXPR, /* affirmative response expression */
+#define YESEXPR YESEXPR
+ NOEXPR, /* negative response expression */
+#define NOEXPR NOEXPR
+ YESSTR, /* affirmative response for yes/no queries */
+#define YESSTR YESSTR
+ NOSTR, /* negative response for yes/no queries */
+#define NOSTR NOSTR
+
+ CRNCYSTR, /* currency symbol */
+#define CRNCYSTR CRNCYSTR
+
+ D_MD_ORDER, /* month/day order (BSD extension) */
+#define D_MD_ORDER D_MD_ORDER
+
+ _NL_TIME_DATE_FMT = 84, /* date fmt used by date(1) (GNU extension) */
+#define _DATE_FMT _NL_TIME_DATE_FMT
+
+#ifdef __HAVE_LOCALE_INFO__
+ _NL_CTYPE_MB_CUR_MAX,
+ _NL_MESSAGES_CODESET,
+
+#ifdef __HAVE_LOCALE_INFO_EXTENDED__
+
+ /* NOTE:
+
+ Always maintain the order and position of existing entries!
+ Always append new entry to the list, prior to the definition
+ of _NL_LOCALE_EXTENDED_LAST_ENTRY. */
+
+ _NL_LOCALE_EXTENDED_FIRST_ENTRY,
+
+ _NL_CTYPE_OUTDIGITS0_MB,
+ _NL_CTYPE_OUTDIGITS1_MB,
+ _NL_CTYPE_OUTDIGITS2_MB,
+ _NL_CTYPE_OUTDIGITS3_MB,
+ _NL_CTYPE_OUTDIGITS4_MB,
+ _NL_CTYPE_OUTDIGITS5_MB,
+ _NL_CTYPE_OUTDIGITS6_MB,
+ _NL_CTYPE_OUTDIGITS7_MB,
+ _NL_CTYPE_OUTDIGITS8_MB,
+ _NL_CTYPE_OUTDIGITS9_MB,
+ _NL_CTYPE_OUTDIGITS0_WC,
+ _NL_CTYPE_OUTDIGITS1_WC,
+ _NL_CTYPE_OUTDIGITS2_WC,
+ _NL_CTYPE_OUTDIGITS3_WC,
+ _NL_CTYPE_OUTDIGITS4_WC,
+ _NL_CTYPE_OUTDIGITS5_WC,
+ _NL_CTYPE_OUTDIGITS6_WC,
+ _NL_CTYPE_OUTDIGITS7_WC,
+ _NL_CTYPE_OUTDIGITS8_WC,
+ _NL_CTYPE_OUTDIGITS9_WC,
+
+ _NL_TIME_CODESET,
+ _NL_TIME_WMON_1,
+ _NL_TIME_WMON_2,
+ _NL_TIME_WMON_3,
+ _NL_TIME_WMON_4,
+ _NL_TIME_WMON_5,
+ _NL_TIME_WMON_6,
+ _NL_TIME_WMON_7,
+ _NL_TIME_WMON_8,
+ _NL_TIME_WMON_9,
+ _NL_TIME_WMON_10,
+ _NL_TIME_WMON_11,
+ _NL_TIME_WMON_12,
+ _NL_TIME_WMONTH_1,
+ _NL_TIME_WMONTH_2,
+ _NL_TIME_WMONTH_3,
+ _NL_TIME_WMONTH_4,
+ _NL_TIME_WMONTH_5,
+ _NL_TIME_WMONTH_6,
+ _NL_TIME_WMONTH_7,
+ _NL_TIME_WMONTH_8,
+ _NL_TIME_WMONTH_9,
+ _NL_TIME_WMONTH_10,
+ _NL_TIME_WMONTH_11,
+ _NL_TIME_WMONTH_12,
+ _NL_TIME_WWDAY_1,
+ _NL_TIME_WWDAY_2,
+ _NL_TIME_WWDAY_3,
+ _NL_TIME_WWDAY_4,
+ _NL_TIME_WWDAY_5,
+ _NL_TIME_WWDAY_6,
+ _NL_TIME_WWDAY_7,
+ _NL_TIME_WWEEKDAY_1,
+ _NL_TIME_WWEEKDAY_2,
+ _NL_TIME_WWEEKDAY_3,
+ _NL_TIME_WWEEKDAY_4,
+ _NL_TIME_WWEEKDAY_5,
+ _NL_TIME_WWEEKDAY_6,
+ _NL_TIME_WWEEKDAY_7,
+ _NL_TIME_WT_FMT,
+ _NL_TIME_WD_FMT,
+ _NL_TIME_WD_T_FMT,
+ _NL_TIME_WAM_STR,
+ _NL_TIME_WPM_STR,
+ _NL_TIME_WDATE_FMT,
+ _NL_TIME_WT_FMT_AMPM,
+ _NL_TIME_WERA,
+ _NL_TIME_WERA_D_FMT,
+ _NL_TIME_WERA_D_T_FMT,
+ _NL_TIME_WERA_T_FMT,
+ _NL_TIME_WALT_DIGITS,
+
+ _NL_NUMERIC_CODESET,
+ _NL_NUMERIC_GROUPING,
+ _NL_NUMERIC_DECIMAL_POINT_WC,
+ _NL_NUMERIC_THOUSANDS_SEP_WC,
+
+ _NL_MONETARY_INT_CURR_SYMBOL,
+ _NL_MONETARY_CURRENCY_SYMBOL,
+ _NL_MONETARY_MON_DECIMAL_POINT,
+ _NL_MONETARY_MON_THOUSANDS_SEP,
+ _NL_MONETARY_MON_GROUPING,
+ _NL_MONETARY_POSITIVE_SIGN,
+ _NL_MONETARY_NEGATIVE_SIGN,
+ _NL_MONETARY_INT_FRAC_DIGITS,
+ _NL_MONETARY_FRAC_DIGITS,
+ _NL_MONETARY_P_CS_PRECEDES,
+ _NL_MONETARY_P_SEP_BY_SPACE,
+ _NL_MONETARY_N_CS_PRECEDES,
+ _NL_MONETARY_N_SEP_BY_SPACE,
+ _NL_MONETARY_P_SIGN_POSN,
+ _NL_MONETARY_N_SIGN_POSN,
+ _NL_MONETARY_INT_P_CS_PRECEDES,
+ _NL_MONETARY_INT_P_SEP_BY_SPACE,
+ _NL_MONETARY_INT_N_CS_PRECEDES,
+ _NL_MONETARY_INT_N_SEP_BY_SPACE,
+ _NL_MONETARY_INT_P_SIGN_POSN,
+ _NL_MONETARY_INT_N_SIGN_POSN,
+ _NL_MONETARY_CODESET,
+ _NL_MONETARY_WINT_CURR_SYMBOL,
+ _NL_MONETARY_WCURRENCY_SYMBOL,
+ _NL_MONETARY_WMON_DECIMAL_POINT,
+ _NL_MONETARY_WMON_THOUSANDS_SEP,
+ _NL_MONETARY_WPOSITIVE_SIGN,
+ _NL_MONETARY_WNEGATIVE_SIGN,
+
+ _NL_MESSAGES_WYESEXPR,
+ _NL_MESSAGES_WNOEXPR,
+ _NL_MESSAGES_WYESSTR,
+ _NL_MESSAGES_WNOSTR,
+
+ _NL_COLLATE_CODESET,
+
+ /* This MUST be the last entry since it's used to check for an array
+ index in nl_langinfo(). */
+ _NL_LOCALE_EXTENDED_LAST_ENTRY
+
+#endif /* __HAVE_LOCALE_INFO_EXTENDED__ */
+#endif /* __HAVE_LOCALE_INFO__ */
+
+};
+
+__BEGIN_DECLS
+char *nl_langinfo(nl_item);
+__END_DECLS
+
+#endif /* !_LANGINFO_H_ */
23 system/include/libgen.h
View
@@ -0,0 +1,23 @@
+/*
+ * libgen.h - defined by XPG4
+ */
+
+#ifndef _LIBGEN_H_
+#define _LIBGEN_H_
+
+#include "_ansi.h"
+#include <sys/reent.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+char *_EXFUN(basename, (char *));
+char *_EXFUN(dirname, (char *));
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _LIBGEN_H_ */
+
146 system/include/limits.h
View
@@ -0,0 +1,146 @@
+#ifndef _LIBC_LIMITS_H_
+# define _LIBC_LIMITS_H_ 1
+
+#include <newlib.h>
+
+# ifdef _MB_LEN_MAX
+# define MB_LEN_MAX _MB_LEN_MAX
+# else
+# define MB_LEN_MAX 1
+# endif
+
+/* Maximum number of positional arguments, if _WANT_IO_POS_ARGS. */
+# ifndef NL_ARGMAX
+# define NL_ARGMAX 32
+# endif
+
+/* if do not have #include_next support, then we
+ have to define the limits here. */
+# if !defined __GNUC__ || __GNUC__ < 2
+
+# ifndef _LIMITS_H
+# define _LIMITS_H 1
+
+# include <sys/config.h>
+
+/* Number of bits in a `char'. */
+# undef CHAR_BIT
+# define CHAR_BIT 8
+
+/* Minimum and maximum values a `signed char' can hold. */
+# undef SCHAR_MIN
+# define SCHAR_MIN (-128)
+# undef SCHAR_MAX
+# define SCHAR_MAX 127
+
+/* Maximum value an `unsigned char' can hold. (Minimum is 0). */
+# undef UCHAR_MAX
+# define UCHAR_MAX 255
+
+/* Minimum and maximum values a `char' can hold. */
+# ifdef __CHAR_UNSIGNED__
+# undef CHAR_MIN
+# define CHAR_MIN 0
+# undef CHAR_MAX
+# define CHAR_MAX 255
+# else
+# undef CHAR_MIN
+# define CHAR_MIN (-128)
+# undef CHAR_MAX
+# define CHAR_MAX 127
+# endif
+
+/* Minimum and maximum values a `signed short int' can hold. */
+# undef SHRT_MIN
+/* For the sake of 16 bit hosts, we may not use -32768 */
+# define SHRT_MIN (-32767-1)
+# undef SHRT_MAX
+# define SHRT_MAX 32767
+
+/* Maximum value an `unsigned short int' can hold. (Minimum is 0). */
+# undef USHRT_MAX
+# define USHRT_MAX 65535
+
+/* Minimum and maximum values a `signed int' can hold. */
+# ifndef __INT_MAX__
+# define __INT_MAX__ 2147483647
+# endif
+# undef INT_MIN
+# define INT_MIN (-INT_MAX-1)
+# undef INT_MAX
+# define INT_MAX __INT_MAX__
+
+/* Maximum value an `unsigned int' can hold. (Minimum is 0). */
+# undef UINT_MAX
+# define UINT_MAX (INT_MAX * 2U + 1)
+
+/* Minimum and maximum values a `signed long int' can hold.
+ (Same as `int'). */
+# ifndef __LONG_MAX__
+# if defined (__alpha__) || (defined (__sparc__) && defined(__arch64__)) || defined (__sparcv9)
+# define __LONG_MAX__ 9223372036854775807L
+# else
+# define __LONG_MAX__ 2147483647L
+# endif /* __alpha__ || sparc64 */
+# endif
+# undef LONG_MIN
+# define LONG_MIN (-LONG_MAX-1)
+# undef LONG_MAX
+# define LONG_MAX __LONG_MAX__
+
+/* Maximum value an `unsigned long int' can hold. (Minimum is 0). */
+# undef ULONG_MAX
+# define ULONG_MAX (LONG_MAX * 2UL + 1)
+
+# ifndef __LONG_LONG_MAX__
+# define __LONG_LONG_MAX__ 9223372036854775807LL
+# endif
+
+# if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
+/* Minimum and maximum values a `signed long long int' can hold. */
+# undef LLONG_MIN
+# define LLONG_MIN (-LLONG_MAX-1)
+# undef LLONG_MAX
+# define LLONG_MAX __LONG_LONG_MAX__
+
+/* Maximum value an `unsigned long long int' can hold. (Minimum is 0). */
+# undef ULLONG_MAX
+# define ULLONG_MAX (LLONG_MAX * 2ULL + 1)
+# endif
+
+# if defined (__GNU_LIBRARY__) ? defined (__USE_GNU) : !defined (__STRICT_ANSI__)
+/* Minimum and maximum values a `signed long long int' can hold. */
+# undef LONG_LONG_MIN
+# define LONG_LONG_MIN (-LONG_LONG_MAX-1)
+# undef LONG_LONG_MAX
+# define LONG_LONG_MAX __LONG_LONG_MAX__
+
+/* Maximum value an `unsigned long long int' can hold. (Minimum is 0). */
+# undef ULONG_LONG_MAX
+# define ULONG_LONG_MAX (LONG_LONG_MAX * 2ULL + 1)
+# endif
+
+# endif /* _LIMITS_H */
+# endif /* GCC 2. */
+
+#endif /* !_LIBC_LIMITS_H_ */
+
+#if defined __GNUC__ && !defined _GCC_LIMITS_H_
+/* `_GCC_LIMITS_H_' is what GCC's file defines. */
+# include_next <limits.h>
+#endif /* __GNUC__ && !_GCC_LIMITS_H_ */
+
+#ifndef _POSIX2_RE_DUP_MAX
+/* The maximum number of repeated occurrences of a regular expression
+ * permitted when using the interval notation `\{M,N\}'. */
+#define _POSIX2_RE_DUP_MAX 255
+#endif /* _POSIX2_RE_DUP_MAX */
+
+#ifndef ARG_MAX
+#define ARG_MAX 4096
+#endif
+
+#ifndef PATH_MAX
+#define PATH_MAX 4096
+#endif
+
65 system/include/locale.h
View
@@ -0,0 +1,65 @@
+/*
+ locale.h
+ Values appropriate for the formatting of monetary and other
+ numberic quantities.
+*/
+
+#ifndef _LOCALE_H_
+#define _LOCALE_H_
+
+#include "_ansi.h"
+
+#ifndef NULL
+#define NULL 0
+#endif
+
+#define LC_ALL 0
+#define LC_COLLATE 1
+#define LC_CTYPE 2
+#define LC_MONETARY 3
+#define LC_NUMERIC 4
+#define LC_TIME 5
+#define LC_MESSAGES 6
+
+_BEGIN_STD_C
+
+struct lconv
+{
+ char *decimal_point;
+ char *thousands_sep;
+ char *grouping;
+ char *int_curr_symbol;
+ char *currency_symbol;
+ char *mon_decimal_point;
+ char *mon_thousands_sep;
+ char *mon_grouping;
+ char *positive_sign;
+ char *negative_sign;
+ char int_frac_digits;
+ char frac_digits;
+ char p_cs_precedes;
+ char p_sep_by_space;
+ char n_cs_precedes;
+ char n_sep_by_space;
+ char p_sign_posn;
+ char n_sign_posn;
+ char int_n_cs_precedes;
+ char int_n_sep_by_space;
+ char int_n_sign_posn;
+ char int_p_cs_precedes;
+ char int_p_sep_by_space;
+ char int_p_sign_posn;
+};
+
+#ifndef _REENT_ONLY
+char *_EXFUN(setlocale,(int category, const char *locale));
+struct lconv *_EXFUN(localeconv,(void));
+#endif
+
+struct _reent;
+char *_EXFUN(_setlocale_r,(struct _reent *, int category, const char *locale));
+struct lconv *_EXFUN(_localeconv_r,(struct _reent *));
+
+_END_STD_C
+
+#endif /* _LOCALE_H_ */
169 system/include/malloc.h
View
@@ -0,0 +1,169 @@
+/* malloc.h -- header file for memory routines. */
+
+#ifndef _INCLUDE_MALLOC_H_
+#define _INCLUDE_MALLOC_H_
+
+#include <_ansi.h>
+#include <sys/reent.h>
+
+#define __need_size_t
+#include <stddef.h>
+
+/* include any machine-specific extensions */
+#include <machine/malloc.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* This version of struct mallinfo must match the one in
+ libc/stdlib/mallocr.c. */
+
+struct mallinfo {
+ int arena; /* total space allocated from system */
+ int ordblks; /* number of non-inuse chunks */
+ int smblks; /* unused -- always zero */
+ int hblks; /* number of mmapped regions */
+ int hblkhd; /* total space in mmapped regions */
+ int usmblks; /* unused -- always zero */
+ int fsmblks; /* unused -- always zero */
+ int uordblks; /* total allocated space */
+ int fordblks; /* total non-inuse space */
+ int keepcost; /* top-most, releasable (via malloc_trim) space */
+};
+
+/* The routines. */
+
+extern _PTR malloc _PARAMS ((size_t));
+#ifdef __CYGWIN__
+#undef _malloc_r
+#define _malloc_r(r, s) malloc (s)
+#else
+extern _PTR _malloc_r _PARAMS ((struct _reent *, size_t));
+#endif
+
+extern _VOID free _PARAMS ((_PTR));
+#ifdef __CYGWIN__
+#undef _free_r
+#define _free_r(r, p) free (p)
+#else
+extern _VOID _free_r _PARAMS ((struct _reent *, _PTR));
+#endif
+
+extern _PTR realloc _PARAMS ((_PTR, size_t));
+#ifdef __CYGWIN__
+#undef _realloc_r
+#define _realloc_r(r, p, s) realloc (p, s)
+#else
+extern _PTR _realloc_r _PARAMS ((struct _reent *, _PTR, size_t));
+#endif
+
+extern _PTR calloc _PARAMS ((size_t, size_t));
+#ifdef __CYGWIN__
+#undef _calloc_r
+#define _calloc_r(r, s1, s2) calloc (s1, s2);
+#else
+extern _PTR _calloc_r _PARAMS ((struct _reent *, size_t, size_t));
+#endif
+
+extern _PTR memalign _PARAMS ((size_t, size_t));
+#ifdef __CYGWIN__
+#undef _memalign_r
+#define _memalign_r(r, s1, s2) memalign (s1, s2);
+#else
+extern _PTR _memalign_r _PARAMS ((struct _reent *, size_t, size_t));
+#endif
+
+extern struct mallinfo mallinfo _PARAMS ((void));
+#ifdef __CYGWIN__
+#undef _mallinfo_r
+#define _mallinfo_r(r) mallinfo ()
+#else
+extern struct mallinfo _mallinfo_r _PARAMS ((struct _reent *));
+#endif
+
+extern void malloc_stats _PARAMS ((void));
+#ifdef __CYGWIN__
+#undef _malloc_stats_r
+#define _malloc_stats_r(r) malloc_stats ()
+#else
+extern void _malloc_stats_r _PARAMS ((struct _reent *));
+#endif
+
+extern int mallopt _PARAMS ((int, int));
+#ifdef __CYGWIN__
+#undef _mallopt_r
+#define _mallopt_r(i1, i2) mallopt (i1, i2)
+#else
+extern int _mallopt_r _PARAMS ((struct _reent *, int, int));
+#endif
+
+extern size_t malloc_usable_size _PARAMS ((_PTR));
+#ifdef __CYGWIN__
+#undef _malloc_usable_size_r
+#define _malloc_usable_size_r(r, p) malloc_usable_size (p)
+#else
+extern size_t _malloc_usable_size_r _PARAMS ((struct _reent *, _PTR));
+#endif
+
+/* These aren't too useful on an embedded system, but we define them
+ anyhow. */
+
+extern _PTR valloc _PARAMS ((size_t));
+#ifdef __CYGWIN__
+#undef _valloc_r
+#define _valloc_r(r, s) valloc (s)
+#else
+extern _PTR _valloc_r _PARAMS ((struct _reent *, size_t));
+#endif
+
+extern _PTR pvalloc _PARAMS ((size_t));
+#ifdef __CYGWIN__
+#undef _pvalloc_r
+#define _pvalloc_r(r, s) pvalloc (s)
+#else
+extern _PTR _pvalloc_r _PARAMS ((struct _reent *, size_t));
+#endif
+
+extern int malloc_trim _PARAMS ((size_t));
+#ifdef __CYGWIN__
+#undef _malloc_trim_r
+#define _malloc_trim_r(r, s) malloc_trim (s)
+#else
+extern int _malloc_trim_r _PARAMS ((struct _reent *, size_t));
+#endif
+
+/* A compatibility routine for an earlier version of the allocator. */
+
+extern _VOID mstats _PARAMS ((char *));
+#ifdef __CYGWIN__
+#undef _mstats_r
+#define _mstats_r(r, p) mstats (p)
+#else
+extern _VOID _mstats_r _PARAMS ((struct _reent *, char *));
+#endif
+
+/* SVID2/XPG mallopt options */
+
+#define M_MXFAST 1 /* UNUSED in this malloc */
+#define M_NLBLKS 2 /* UNUSED in this malloc */
+#define M_GRAIN 3 /* UNUSED in this malloc */
+#define M_KEEP 4 /* UNUSED in this malloc */
+
+/* mallopt options that actually do something */
+
+#define M_TRIM_THRESHOLD -1
+#define M_TOP_PAD -2
+#define M_MMAP_THRESHOLD -3
+#define M_MMAP_MAX -4
+
+#ifndef __CYGWIN__
+/* Some systems provide this, so do too for compatibility. */
+extern void cfree _PARAMS ((_PTR));
+#endif /* __CYGWIN__ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _INCLUDE_MALLOC_H_ */
580 system/include/math.h
View
@@ -0,0 +1,580 @@
+#ifndef _MATH_H_
+
+#define _MATH_H_
+
+#include <sys/reent.h>
+#include <machine/ieeefp.h>
+#include "_ansi.h"
+
+_BEGIN_STD_C
+
+/* __dmath, __fmath, and __ldmath are only here for backwards compatibility
+ * in case any code used them. They are no longer used by Newlib, itself,
+ * other than legacy. */
+union __dmath
+{
+ double d;
+ __ULong i[2];
+};
+
+union __fmath
+{
+ float f;
+ __ULong i[1];
+};
+
+#if defined(_HAVE_LONG_DOUBLE)
+union __ldmath
+{
+ long double ld;
+ __ULong i[4];
+};
+#endif
+
+/* Natural log of 2 */
+#define _M_LN2 0.693147180559945309417
+
+#if defined(__GNUC__) && \
+ ( (__GNUC__ >= 4) || \
+ ( (__GNUC__ >= 3) && defined(__GNUC_MINOR__) && (__GNUC_MINOR__ >= 3) ) )
+
+ /* gcc >= 3.3 implicitly defines builtins for HUGE_VALx values. */
+
+# ifndef HUGE_VAL
+# define HUGE_VAL (__builtin_huge_val())
+# endif
+
+# ifndef HUGE_VALF
+# define HUGE_VALF (__builtin_huge_valf())
+# endif
+
+# ifndef HUGE_VALL
+# define HUGE_VALL (__builtin_huge_vall())
+# endif
+
+# ifndef INFINITY
+# define INFINITY (__builtin_inff())
+# endif
+
+# ifndef NAN
+# define NAN (__builtin_nanf(""))
+# endif
+
+#else /* !gcc >= 3.3 */
+
+ /* No builtins. Use fixed defines instead. (All 3 HUGE plus the INFINITY
+ * and NAN macros are required to be constant expressions. Using a variable--
+ * even a static const--does not meet this requirement, as it cannot be
+ * evaluated at translation time.)
+ * The infinities are done using numbers that are far in excess of
+ * something that would be expected to be encountered in a floating-point
+ * implementation. (A more certain way uses values from float.h, but that is
+ * avoided because system includes are not supposed to include each other.)
+ * This method might produce warnings from some compilers. (It does in
+ * newer GCCs, but not for ones that would hit this #else.) If this happens,
+ * please report details to the Newlib mailing list. */
+
+ #ifndef HUGE_VAL
+ #define HUGE_VAL (1.0e999999999)
+ #endif
+
+ #ifndef HUGE_VALF
+ #define HUGE_VALF (1.0e999999999F)
+ #endif
+
+ #if !defined(HUGE_VALL) && defined(_HAVE_LONG_DOUBLE)
+ #define HUGE_VALL (1.0e999999999L)
+ #endif
+
+ #if !defined(INFINITY)
+ #define INFINITY (HUGE_VALF)
+ #endif
+
+ #if !defined(NAN)
+ #if defined(__GNUC__) && defined(__cplusplus)
+ /* Exception: older g++ versions warn about the divide by 0 used in the
+ * normal case (even though older gccs do not). This trick suppresses the
+ * warning, but causes errors for plain gcc, so is only used in the one
+ * special case. */
+ static const union { __ULong __i[1]; float __d; } __Nanf = {0x7FC00000};
+ #define NAN (__Nanf.__d)
+ #else
+ #define NAN (0.0F/0.0F)
+ #endif
+ #endif
+
+#endif /* !gcc >= 3.3 */
+
+/* Reentrant ANSI C functions. */
+
+#ifndef __math_68881