summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDanny Smith <dannysmith@users.sourceforge.net>2002-03-22 22:35:38 +0000
committerDanny Smith <dannysmith@users.sourceforge.net>2002-03-22 22:35:38 +0000
commitbaa82e431ee64b46445d75e05e5d8c0043ec07d0 (patch)
tree3729c9d233c39e5c9870bd5b33a985876d1895e9
parent69a7b5f79888513741e65a54216d7756474b76c2 (diff)
downloadgdb-baa82e431ee64b46445d75e05e5d8c0043ec07d0.tar.gz
Added fenv.h inttypes.h
-rw-r--r--winsup/mingw/include/fenv.h85
-rw-r--r--winsup/mingw/include/inttypes.h275
-rw-r--r--winsup/mingw/include/math.h457
-rw-r--r--winsup/mingw/include/stdlib.h480
-rw-r--r--winsup/mingw/include/wchar.h309
5 files changed, 1606 insertions, 0 deletions
diff --git a/winsup/mingw/include/fenv.h b/winsup/mingw/include/fenv.h
new file mode 100644
index 00000000000..ddc43dfc836
--- /dev/null
+++ b/winsup/mingw/include/fenv.h
@@ -0,0 +1,85 @@
+#ifndef _FENV_H
+#define _FENV_H
+
+/*
+ For now, support only for the basic abstraction of flags that are
+ either set or clear. fexcept_t could be structure that holds more info
+ about the fp environment.
+*/
+typedef unsigned short fexcept_t;
+
+/* This 28-byte struct represents the entire floating point
+ environment as stored by fnstenv or fstenv */
+typedef struct
+{
+ unsigned short __control_word;
+ unsigned short __unused0;
+ unsigned short __status_word;
+ unsigned short __unused1;
+ unsigned short __tag_word;
+ unsigned short __unused2;
+ unsigned int __ip_offset; /* instruction pointer offset */
+ unsigned short __ip_selector;
+ unsigned short __opcode;
+ unsigned int __data_offset;
+ unsigned short __data_selector;
+ unsigned short __unused3;
+} fenv_t;
+
+
+/* FPU status word exception flags */
+#define FE_INVALID 0x01
+#define FE_DENORMAL 0x02
+#define FE_DIVBYZERO 0x04
+#define FE_OVERFLOW 0x08
+#define FE_UNDERFLOW 0x10
+#define FE_INEXACT 0x20
+#define FE_ALL_EXCEPT (FE_INVALID | FE_DENORMAL | FE_DIVBYZERO \
+ | FE_OVERFLOW | FE_UNDERFLOW | FE_INEXACT)
+
+/* FPU control word rounding flags */
+#define FE_TONEAREST 0x0000
+#define FE_DOWNWARD 0x0400
+#define FE_UPWARD 0x0800
+#define FE_TOWARDZERO 0x0c00
+
+
+/* The default floating point environment */
+#define FE_DFL_ENV ((const fenv_t *)-1)
+
+
+#ifndef RC_INVOKED
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/*TODO: Some of these could be inlined */
+/* 7.6.2 Exception */
+
+extern int feclearexcept (int);
+extern int fegetexceptflag (fexcept_t * flagp, int excepts);
+extern int feraiseexcept (int excepts );
+extern int fesetexceptflag (const fexcept_t *, int);
+extern int fetestexcept (int excepts);
+
+
+/* 7.6.3 Rounding */
+
+extern int fegetround (void);
+extern int fesetround (int mode);
+
+
+/* 7.6.4 Environment */
+
+extern int fegetenv (fenv_t * envp);
+extern int fesetenv (const fenv_t * );
+extern int feupdateenv (const fenv_t *);
+extern int feholdexcept (fenv_t *);
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* Not RC_INVOKED */
+
+#endif /* ndef _FENV_H */
diff --git a/winsup/mingw/include/inttypes.h b/winsup/mingw/include/inttypes.h
new file mode 100644
index 00000000000..74944f14bdb
--- /dev/null
+++ b/winsup/mingw/include/inttypes.h
@@ -0,0 +1,275 @@
+/* 7.8 Format conversion of integer types <inttypes.h> */
+
+#ifndef _INTTYPES_H
+#define _INTTYPES_H
+
+#include <stdint.h>
+#define __need_wchar_t
+#include <stddef.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef struct {
+ intmax_t quot;
+ intmax_t rem;
+ } imaxdiv_t;
+
+#if !defined(__cplusplus) || defined(__STDC_FORMAT_MACROS)
+
+/* 7.8.1 Macros for format specifiers
+ *
+ * MS runtime does not yet understand C9x standard "ll"
+ * length specifier. It appears to treat "ll" as "l".
+ * The non-standard I64 length specifier causes warning in GCC,
+ * but understood by MS runtime functions.
+ */
+
+/* fprintf macros for signed types */
+#define PRId8 "d"
+#define PRId16 "d"
+#define PRId32 "d"
+#define PRId64 "I64d"
+
+#define PRIdLEAST8 "d"
+#define PRIdLEAST16 "d"
+#define PRIdLEAST32 "d"
+#define PRIdLEAST64 "I64d"
+
+#define PRIdFAST8 "d"
+#define PRIdFAST16 "d"
+#define PRIdFAST32 "d"
+#define PRIdFAST64 "I64d"
+
+#define PRIdMAX "I64d"
+#define PRIdPTR "d"
+
+#define PRIi8 "i"
+#define PRIi16 "i"
+#define PRIi32 "i"
+#define PRIi64 "I64i"
+
+#define PRIiLEAST8 "i"
+#define PRIiLEAST16 "i"
+#define PRIiLEAST32 "i"
+#define PRIiLEAST64 "I64i"
+
+#define PRIiFAST8 "i"
+#define PRIiFAST16 "i"
+#define PRIiFAST32 "i"
+#define PRIiFAST64 "I64i"
+
+#define PRIiMAX "I64i"
+#define PRIiPTR "i"
+
+#define PRIo8 "o"
+#define PRIo16 "o"
+#define PRIo32 "o"
+#define PRIo64 "I64o"
+
+#define PRIoLEAST8 "o"
+#define PRIoLEAST16 "o"
+#define PRIoLEAST32 "o"
+#define PRIoLEAST64 "I64o"
+
+#define PRIoFAST8 "o"
+#define PRIoFAST16 "o"
+#define PRIoFAST32 "o"
+#define PRIoFAST64 "I64o"
+
+#define PRIoMAX "I64o"
+
+#define PRIoPTR "o"
+
+/* fprintf macros for unsigned types */
+#define PRIu8 "u"
+#define PRIu16 "u"
+#define PRIu32 "u"
+#define PRIu64 "I64u"
+
+
+#define PRIuLEAST8 "u"
+#define PRIuLEAST16 "u"
+#define PRIuLEAST32 "u"
+#define PRIuLEAST64 "I64u"
+
+#define PRIuFAST8 "u"
+#define PRIuFAST16 "u"
+#define PRIuFAST32 "u"
+#define PRIuFAST64 "I64u"
+
+#define PRIuMAX "I64u"
+#define PRIuPTR "u"
+
+#define PRIx8 "x"
+#define PRIx16 "x"
+#define PRIx32 "x"
+#define PRIx64 "I64x"
+
+#define PRIxLEAST8 "x"
+#define PRIxLEAST16 "x"
+#define PRIxLEAST32 "x"
+#define PRIxLEAST64 "I64x"
+
+#define PRIxFAST8 "x"
+#define PRIxFAST16 "x"
+#define PRIxFAST32 "x"
+#define PRIxFAST64 "I64x"
+
+#define PRIxMAX "I64x"
+#define PRIxPTR "x"
+
+#define PRIX8 "X"
+#define PRIX16 "X"
+#define PRIX32 "X"
+#define PRIX64 "I64X"
+
+#define PRIXLEAST8 "X"
+#define PRIXLEAST16 "X"
+#define PRIXLEAST32 "X"
+#define PRIXLEAST64 "I64X"
+
+#define PRIXFAST8 "X"
+#define PRIXFAST16 "X"
+#define PRIXFAST32 "X"
+#define PRIXFAST64 "I64X"
+
+#define PRIXMAX "I64X"
+#define PRIXPTR "X"
+
+/*
+ * fscanf macros for signed int types
+ * NOTE: if 32-bit int is used for int_fast8_t and int_fast16_t
+ * (see stdint.h, 7.18.1.3), FAST8 and FAST16 should have
+ * no length identifiers
+ */
+
+#define SCNd16 "hd"
+#define SCNd32 "d"
+#define SCNd64 "I64d"
+
+#define SCNdLEAST16 "hd"
+#define SCNdLEAST32 "d"
+#define SCNdLEAST64 "I64d"
+
+#define SCNdFAST16 "hd"
+#define SCNdFAST32 "d"
+#define SCNdFAST64 "I64d"
+
+#define SCNdMAX "I64d"
+#define SCNdPTR "d"
+
+#define SCNi16 "hi"
+#define SCNi32 "i"
+#define SCNi64 "I64i"
+
+#define SCNiLEAST16 "hi"
+#define SCNiLEAST32 "i"
+#define SCNiLEAST64 "I64i"
+
+#define SCNiFAST16 "hi"
+#define SCNiFAST32 "i"
+#define SCNiFAST64 "I64i"
+
+#define SCNiMAX "I64i"
+#define SCNiPTR "i"
+
+#define SCNo16 "ho"
+#define SCNo32 "o"
+#define SCNo64 "I64o"
+
+#define SCNoLEAST16 "ho"
+#define SCNoLEAST32 "o"
+#define SCNoLEAST64 "I64o"
+
+#define SCNoFAST16 "ho"
+#define SCNoFAST32 "o"
+#define SCNoFAST64 "I64o"
+
+#define SCNoMAX "I64o"
+#define SCNoPTR "o"
+
+#define SCNx16 "hx"
+#define SCNx32 "x"
+#define SCNx64 "I64x"
+
+#define SCNxLEAST16 "hx"
+#define SCNxLEAST32 "x"
+#define SCNxLEAST64 "I64x"
+
+#define SCNxFAST16 "hx"
+#define SCNxFAST32 "x"
+#define SCNxFAST64 "I64x"
+
+#define SCNxMAX "I64x"
+#define SCNxPTR "x"
+
+
+/* fscanf macros for unsigned int types */
+
+#define SCNu16 "hu"
+#define SCNu32 "u"
+#define SCNu64 "I64u"
+
+#define SCNuLEAST16 "hu"
+#define SCNuLEAST32 "u"
+#define SCNuLEAST64 "I64u"
+
+#define SCNuFAST16 "hu"
+#define SCNuFAST32 "u"
+#define SCNuFAST64 "I64u"
+
+#define SCNuMAX "I64u"
+#define SCNuPTR "u"
+
+#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
+/*
+ * no length modifier for char types prior to C9x
+ * MS runtime scanf appears to treat "hh" as "h"
+ */
+
+/* signed char */
+#define SCNd8 "hhd"
+#define SCNdLEAST8 "hhd"
+#define SCNdFAST8 "hhd"
+
+#define SCNi8 "hhi"
+#define SCNiLEAST8 "hhi"
+#define SCNiFAST8 "hhi"
+
+#define SCNo8 "hho"
+#define SCNoLEAST8 "hho"
+#define SCNoFAST8 "hho"
+
+#define SCNx8 "hhx"
+#define SCNxLEAST8 "hhx"
+#define SCNxFAST8 "hhx"
+
+/* unsigned char */
+#define SCNu8 "hhu"
+#define SCNuLEAST8 "hhu"
+#define SCNuFAST8 "hhu"
+#endif /* __STDC_VERSION__ >= 199901 */
+
+#endif /* !defined(__cplusplus) || defined(__STDC_FORMAT_MACROS) */
+
+extern inline intmax_t imaxabs (intmax_t j)
+ {return (j >= 0 ? j : -j);}
+imaxdiv_t imaxdiv (intmax_t numer, intmax_t denom);
+
+/* 7.8.2 Conversion functions for greatest-width integer types */
+
+intmax_t strtoimax (const char* __restrict__ nptr, char** __restrict__ endptr, int base);
+uintmax_t strtoumax (const char* __restrict__ nptr, char** __restrict__ endptr, int base);
+
+intmax_t wcstoimax (const wchar_t* __restrict__ nptr, wchar_t** __restrict__ endptr,
+ int base);
+uintmax_t wcstoumax (const wchar_t* __restrict__ nptr, wchar_t** __restrict__ endptr,
+ int base);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* ndef _INTTYPES_H */
diff --git a/winsup/mingw/include/math.h b/winsup/mingw/include/math.h
new file mode 100644
index 00000000000..82f9173ee9c
--- /dev/null
+++ b/winsup/mingw/include/math.h
@@ -0,0 +1,457 @@
+/*
+ * math.h
+ *
+ * Mathematical functions.
+ *
+ * This file is part of the Mingw32 package.
+ *
+ * Contributors:
+ * Created by Colin Peters <colin@bird.fu.is.saga-u.ac.jp>
+ *
+ * THIS SOFTWARE IS NOT COPYRIGHTED
+ *
+ * This source code is offered for use in the public domain. You may
+ * use, modify or distribute it freely.
+ *
+ * This code is distributed in the hope that it will be useful but
+ * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
+ * DISCLAIMED. This includes but is not limited to warranties of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * $Revision$
+ * $Author$
+ * $Date$
+ *
+ */
+
+#ifndef _MATH_H_
+#define _MATH_H_
+
+/* All the headers include this file. */
+#include <_mingw.h>
+
+/*
+ * Types for the _exception structure.
+ */
+
+#define _DOMAIN 1 /* domain error in argument */
+#define _SING 2 /* singularity */
+#define _OVERFLOW 3 /* range overflow */
+#define _UNDERFLOW 4 /* range underflow */
+#define _TLOSS 5 /* total loss of precision */
+#define _PLOSS 6 /* partial loss of precision */
+
+/*
+ * Exception types with non-ANSI names for compatibility.
+ */
+
+#ifndef __STRICT_ANSI__
+
+/* These are also defined in Mingw float.h; needed here as well to work
+ around GCC build issues. */
+#ifndef __MINGW_FPCLASS_DEFINED
+#define __MINGW_FPCLASS_DEFINED 1
+/* IEEE 754 classication */
+#define _FPCLASS_SNAN 0x0001 /* Signaling "Not a Number" */
+#define _FPCLASS_QNAN 0x0002 /* Quiet "Not a Number" */
+#define _FPCLASS_NINF 0x0004 /* Negative Infinity */
+#define _FPCLASS_NN 0x0008 /* Negative Normal */
+#define _FPCLASS_ND 0x0010 /* Negative Denormal */
+#define _FPCLASS_NZ 0x0020 /* Negative Zero */
+#define _FPCLASS_PZ 0x0040 /* Positive Zero */
+#define _FPCLASS_PD 0x0080 /* Positive Denormal */
+#define _FPCLASS_PN 0x0100 /* Positive Normal */
+#define _FPCLASS_PINF 0x0200 /* Positive Infinity */
+#endif /* __MINGW_FPCLASS_DEFINED */
+
+#ifndef _NO_OLDNAMES
+
+#define DOMAIN _DOMAIN
+#define SING _SING
+#define OVERFLOW _OVERFLOW
+#define UNDERFLOW _UNDERFLOW
+#define TLOSS _TLOSS
+#define PLOSS _PLOSS
+
+#endif /* Not _NO_OLDNAMES */
+#endif /* Not __STRICT_ANSI__ */
+
+
+#ifndef RC_INVOKED
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * HUGE_VAL is returned by strtod when the value would overflow the
+ * representation of 'double'. There are other uses as well.
+ *
+ * __imp__HUGE is a pointer to the actual variable _HUGE in
+ * MSVCRT.DLL. If we used _HUGE directly we would get a pointer
+ * to a thunk function.
+ *
+ * NOTE: The CRTDLL version uses _HUGE_dll instead.
+ */
+
+#ifndef __DECLSPEC_SUPPORTED
+
+#ifdef __MSVCRT__
+extern double* __imp__HUGE;
+#define HUGE_VAL (*__imp__HUGE)
+#else
+/* CRTDLL */
+extern double* __imp__HUGE_dll;
+#define HUGE_VAL (*__imp__HUGE_dll)
+#endif
+
+#else /* __DECLSPEC_SUPPORTED */
+
+#ifdef __MSVCRT__
+__MINGW_IMPORT double _HUGE;
+#define HUGE_VAL _HUGE
+#else
+/* CRTDLL */
+__MINGW_IMPORT double _HUGE_dll;
+#define HUGE_VAL _HUGE_dll
+#endif
+
+#endif /* __DECLSPEC_SUPPORTED */
+
+struct _exception
+{
+ int type;
+ char *name;
+ double arg1;
+ double arg2;
+ double retval;
+};
+
+
+double sin (double);
+double cos (double);
+double tan (double);
+double sinh (double);
+double cosh (double);
+double tanh (double);
+double asin (double);
+double acos (double);
+double atan (double);
+double atan2 (double, double);
+double exp (double);
+double log (double);
+double log10 (double);
+double pow (double, double);
+double sqrt (double);
+double ceil (double);
+double floor (double);
+double fabs (double);
+double ldexp (double, int);
+double frexp (double, int*);
+double modf (double, double*);
+double fmod (double, double);
+
+
+#ifndef __STRICT_ANSI__
+
+/* Complex number (for cabs) */
+struct _complex
+{
+ double x; /* Real part */
+ double y; /* Imaginary part */
+};
+
+double _cabs (struct _complex);
+double _hypot (double, double);
+double _j0 (double);
+double _j1 (double);
+double _jn (int, double);
+double _y0 (double);
+double _y1 (double);
+double _yn (int, double);
+int _matherr (struct _exception *);
+
+/* These are also declared in Mingw float.h; needed here as well to work
+ around GCC build issues. */
+/* BEGIN FLOAT.H COPY */
+
+/* Set the FPU control word as cw = (cw & ~unMask) | (unNew & unMask),
+ * i.e. change the bits in unMask to have the values they have in unNew,
+ * leaving other bits unchanged. */
+unsigned int _controlfp (unsigned int unNew, unsigned int unMask);
+unsigned int _control87 (unsigned int unNew, unsigned int unMask);
+
+
+unsigned int _clearfp (); /* Clear the FPU status word */
+unsigned int _statusfp (); /* Report the FPU status word */
+#define _clear87 _clearfp
+#define _status87 _statusfp
+
+void _fpreset (); /* Reset the FPU */
+void fpreset ();
+
+/* Global 'variable' for the current floating point error code. */
+int * __fpecode();
+#define _fpecode (*(__fpecode()))
+
+/*
+ * IEEE recommended functions
+ */
+
+double _chgsign (double);
+double _copysign (double, double);
+double _logb (double);
+double _nextafter (double, double);
+double _scalb (double, long);
+
+int _finite (double);
+int _fpclass (double);
+int _isnan (double);
+
+/* END FLOAT.H COPY */
+
+#if !defined (_NO_OLDNAMES) \
+ || (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L )
+
+/*
+ * Non-underscored versions of non-ANSI functions. These reside in
+ * liboldnames.a. They are now also ISO C99 standand names.
+ * Provided for extra portability.
+ */
+
+double cabs (struct _complex);
+double hypot (double, double);
+double j0 (double);
+double j1 (double);
+double jn (int, double);
+double y0 (double);
+double y1 (double);
+double yn (int, double);
+
+#endif /* Not _NO_OLDNAMES */
+
+#endif /* Not __STRICT_ANSI__ */
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* Not RC_INVOKED */
+
+
+#ifndef __NO_ISOCEXT
+
+#define INFINITY HUGE_VAL
+
+double nan(const char *tagp);
+float nanf(const char *tagp);
+
+#ifndef __STRICT_ANSI__
+#define nan() nan("")
+#define nanf() nanf("")
+#endif
+
+#define NAN (0.0F/0.0F)
+
+/*
+ Return values for fpclassify.
+ These are based on Intel x87 fpu condition codes
+ in the high byte of status word and differ from
+ the return values for MS IEEE 754 extension _fpclass()
+*/
+#define FP_NAN 0x0100
+#define FP_NORMAL 0x0400
+#define FP_INFINITE (FP_NAN | FP_NORMAL)
+#define FP_ZERO 0x4000
+#define FP_SUBNORMAL (FP_NORMAL | FP_ZERO)
+/* 0x0200 is signbit mask */
+
+#ifndef RC_INVOKED
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ We can't inline float, because we want to ensure truncation
+ to semantic type before classification. If we extend to long
+ double, we will also need to make double extern only.
+ (A normal long double value might become subnormal when
+ converted to double, and zero when converted to float.)
+*/
+extern __inline__ int __fpclassify (double x){
+ unsigned short sw;
+ __asm__ ("fxam; fstsw %%ax;" : "=a" (sw): "t" (x));
+ return sw & (FP_NAN | FP_NORMAL | FP_ZERO );
+}
+
+extern int __fpclassifyf (float);
+
+#define fpclassify(x) ((sizeof(x) == sizeof(float)) ? __fpclassifyf(x) \
+ : __fpclassify(x))
+
+/* We don't need to worry about trucation here:
+ A NaN stays a NaN. */
+
+extern __inline__ int __isnan (double _x)
+{
+ unsigned short sw;
+ __asm__ ("fxam;"
+ "fstsw %%ax": "=a" (sw) : "t" (_x));
+ return (sw & (FP_NAN | FP_NORMAL | FP_INFINITE | FP_ZERO | FP_SUBNORMAL))
+ == FP_NAN;
+}
+
+extern __inline__ int __isnanf (float _x)
+{
+ unsigned short sw;
+ __asm__ ("fxam;"
+ "fstsw %%ax": "=a" (sw) : "t" (_x));
+ return (sw & (FP_NAN | FP_NORMAL | FP_INFINITE | FP_ZERO | FP_SUBNORMAL))
+ == FP_NAN;
+}
+
+#define isnan(x) ((sizeof(x) == sizeof(float)) ? __isnanf(x) \
+ : __isnan(x))
+
+
+#define isfinite(x) ((fpclassify(x) & FP_NAN) == 0)
+#define isinf(x) (fpclassify(x) == FP_INFINITE)
+#define isnormal(x) (fpclassify(x) == FP_NORMAL)
+
+
+extern __inline__ int __signbit (double x) {
+ unsigned short stw;
+ __asm__ ( "fxam; fstsw %%ax;": "=a" (stw) : "t" (x));
+ return stw & 0x0200;
+}
+
+extern __inline__ int __signbitf (float x) {
+ unsigned short stw;
+ __asm__ ("fxam; fstsw %%ax;": "=a" (stw) : "t" (x));
+ return stw & 0x0200;
+}
+
+#define signbit(x) ((sizeof(x) == sizeof(float)) ? __signbitf(x) \
+ : __signbit(x))
+/*
+ * With these functions, comparisons involving quiet NaNs set the FP
+ * condition code to "unordered". The IEEE floating-point spec
+ * dictates that the result of floating-point comparisons should be
+ * false whenever a NaN is involved, with the exception of the !=,
+ * which always returns true.
+ */
+
+#if __GNUC__ >= 3
+
+#define isgreater(x, y) __builtin_isgreater(x, y)
+#define isgreaterequal(x, y) __builtin_isgreaterequal(x, y)
+#define isless(x, y) __builtin_isless(x, y)
+#define islessequal(x, y) __builtin_islessequal(x, y)
+#define islessgreater(x, y) __builtin_islessgreater(x, y)
+#define isunordered(x, y) __builtin_isunordered(x, y)
+
+#else
+/* helper */
+extern __inline__ int __fp_unordered_compare (double x, double y){
+ unsigned short retval;
+ __asm__ ("fucom %%st(1);"
+ "fnstsw;": "=a" (retval) : "t" (x), "u" (y));
+ return retval;
+}
+
+#define isgreater(x, y) ((__fp_unordered_compare(x, y) \
+ & 0x4500) == 0)
+#define isless(x, y) ((__fp_unordered_compare (y, x) \
+ & 0x4500) == 0)
+#define isgreaterequal(x, y) ((__fp_unordered_compare (x, y) \
+ & FP_INFINITE) == 0)
+#define islessequal(x, y) ((__fp_unordered_compare(y, x) \
+ & FP_INFINITE) == 0)
+#define islessgreater(x, y) ((__fp_unordered_compare(x, y) \
+ & FP_SUBNORMAL) == 0)
+#define isunordered(x, y) ((__fp_unordered_compare(x, y) \
+ & 0x4500) == 0x4500)
+
+#endif
+
+/* round, using fpu control word settings */
+extern __inline__ double rint (double x)
+{
+ double retval;
+ __asm__ ("frndint;": "=t" (retval) : "0" (x));
+ return retval;
+}
+
+extern __inline__ float rintf (float x)
+{
+ float retval;
+ __asm__ ("frndint;" : "=t" (retval) : "0" (x) );
+ return retval;
+}
+
+/* round away from zero, regardless of fpu control word settings */
+extern double round (double);
+extern float roundf (float);
+
+/* round towards zero, regardless of fpu control word settings */
+extern double trunc (double);
+extern float truncf (float);
+
+
+/* fmax and fmin.
+ NaN arguments are treated as missing data: if one argument is a NaN and the other numeric, then the
+ these functions choose the numeric value.
+*/
+
+extern double fmax (double, double);
+extern double fmin (double, double);
+extern float fmaxf (float, float);
+float fminf (float, float);
+
+/* return x * y + z as a ternary op */
+extern double fma (double, double, double);
+extern float fmaf (float, float, float);
+
+/* one lonely transcendental */
+extern double log2 (double _x);
+extern float log2f (float _x);
+
+/* The underscored versions are in MSVCRT.dll.
+ The stubs for these are in libmingwex.a */
+
+double copysign (double, double);
+float copysignf (float, float);
+double logb (double);
+float logbf (float);
+double nextafter (double, double);
+float nextafterf (float, float);
+double scalb (double, long);
+float scalbf (float, long);
+
+#if !defined (__STRICT_ANSI__) /* inline using non-ANSI functions */
+extern __inline__ double copysign (double x, double y)
+ { return _copysign(x, y); }
+extern __inline__ float copysignf (float x, float y)
+ { return _copysign(x, y); }
+extern __inline__ double logb (double x)
+ { return _logb(x); }
+extern __inline__ float logbf (float x)
+ { return _logb(x); }
+extern __inline__ double nextafter(double x, double y)
+ { return _nextafter(x, y); }
+extern __inline__ float nextafterf(float x, float y)
+ { return _nextafter(x, y); }
+extern __inline__ double scalb (double x, long i)
+ { return _scalb (x, i); }
+extern __inline__ float scalbf (float x, long i)
+ { return _scalb(x, i); }
+#endif /* (__STRICT_ANSI__) */
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* Not RC_INVOKED */
+
+#endif /* __NO_ISOCEXT */
+
+#endif /* Not _MATH_H_ */
+
diff --git a/winsup/mingw/include/stdlib.h b/winsup/mingw/include/stdlib.h
new file mode 100644
index 00000000000..8774e40955b
--- /dev/null
+++ b/winsup/mingw/include/stdlib.h
@@ -0,0 +1,480 @@
+/*
+ * stdlib.h
+ *
+ * Definitions for common types, variables, and functions.
+ *
+ * This file is part of the Mingw32 package.
+ *
+ * Contributors:
+ * Created by Colin Peters <colin@bird.fu.is.saga-u.ac.jp>
+ *
+ * THIS SOFTWARE IS NOT COPYRIGHTED
+ *
+ * This source code is offered for use in the public domain. You may
+ * use, modify or distribute it freely.
+ *
+ * This code is distributed in the hope that it will be useful but
+ * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
+ * DISCLAIMED. This includes but is not limited to warranties of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * $Revision$
+ * $Author$
+ * $Date$
+ *
+ */
+
+#ifndef _STDLIB_H_
+#define _STDLIB_H_
+
+/* All the headers include this file. */
+#include <_mingw.h>
+
+
+#define __need_size_t
+#define __need_wchar_t
+#define __need_NULL
+#ifndef RC_INVOKED
+#include <stddef.h>
+#endif /* RC_INVOKED */
+
+/*
+ * RAND_MAX is the maximum value that may be returned by rand.
+ * The minimum is zero.
+ */
+#define RAND_MAX 0x7FFF
+
+/*
+ * These values may be used as exit status codes.
+ */
+#define EXIT_SUCCESS 0
+#define EXIT_FAILURE 1
+
+/*
+ * Definitions for path name functions.
+ * NOTE: All of these values have simply been chosen to be conservatively high.
+ * Remember that with long file names we can no longer depend on
+ * extensions being short.
+ */
+#ifndef __STRICT_ANSI__
+
+#ifndef MAX_PATH
+#define MAX_PATH (260)
+#endif
+
+#define _MAX_PATH MAX_PATH
+#define _MAX_DRIVE (3)
+#define _MAX_DIR 256
+#define _MAX_FNAME 256
+#define _MAX_EXT 256
+
+#endif /* Not __STRICT_ANSI__ */
+
+
+#ifndef RC_INVOKED
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * This seems like a convenient place to declare these variables, which
+ * give programs using WinMain (or main for that matter) access to main-ish
+ * argc and argv. environ is a pointer to a table of environment variables.
+ * NOTE: Strings in _argv and environ are ANSI strings.
+ */
+extern int _argc;
+extern char** _argv;
+
+/* imports from runtime dll of the above variables */
+#ifdef __MSVCRT__
+
+extern int* __p___argc(void);
+extern char*** __p___argv(void);
+extern wchar_t*** __p___wargv(void);
+
+#define __argc (*__p___argc())
+#define __argv (*__p___argv())
+#define __wargv (*__p___wargv())
+
+#else /* !MSVCRT */
+
+#ifndef __DECLSPEC_SUPPORTED
+
+extern int* __imp___argc_dll;
+extern char*** __imp___argv_dll;
+#define __argc (*__imp___argc_dll)
+#define __argv (*__imp___argv_dll)
+
+#else /* __DECLSPEC_SUPPORTED */
+
+__MINGW_IMPORT int __argc_dll;
+__MINGW_IMPORT char** __argv_dll;
+#define __argc __argc_dll
+#define __argv __argv_dll
+
+#endif /* __DECLSPEC_SUPPORTED */
+
+#endif /* __MSVCRT */
+
+/*
+ * Also defined in ctype.h.
+ */
+
+#ifndef MB_CUR_MAX
+# ifdef __MSVCRT__
+# define MB_CUR_MAX __mb_cur_max
+ __MINGW_IMPORT int __mb_cur_max;
+# else /* not __MSVCRT */
+# define MB_CUR_MAX __mb_cur_max_dll
+ __MINGW_IMPORT int __mb_cur_max_dll;
+# endif /* not __MSVCRT */
+#endif /* MB_CUR_MAX */
+
+/*
+ * MS likes to declare errno in stdlib.h as well.
+ */
+
+#ifdef _UWIN
+#undef errno
+extern int errno;
+#else
+int* _errno(void);
+#define errno (*_errno())
+#endif
+int* __doserrno(void);
+#define _doserrno (*__doserrno())
+
+/*
+ * Use environ from the DLL, not as a global.
+ */
+
+#ifdef __MSVCRT__
+ extern char *** __p__environ(void);
+ extern wchar_t *** __p__wenviron(void);
+# define _environ (*__p__environ())
+# define _wenviron (*__p__wenviron())
+#else /* ! __MSVCRT__ */
+# ifndef __DECLSPEC_SUPPORTED
+ extern char *** __imp__environ_dll;
+# define _environ (*__imp__environ_dll)
+# else /* __DECLSPEC_SUPPORTED */
+ __MINGW_IMPORT char ** _environ_dll;
+# define _environ _environ_dll
+# endif /* __DECLSPEC_SUPPORTED */
+#endif /* ! __MSVCRT__ */
+
+#define environ _environ
+
+#ifdef __MSVCRT__
+/* One of the MSVCRTxx libraries */
+
+#ifndef __DECLSPEC_SUPPORTED
+ extern int* __imp__sys_nerr;
+# define sys_nerr (*__imp__sys_nerr)
+#else /* __DECLSPEC_SUPPORTED */
+ __MINGW_IMPORT int _sys_nerr;
+# ifndef _UWIN
+# define sys_nerr _sys_nerr
+# endif /* _UWIN */
+#endif /* __DECLSPEC_SUPPORTED */
+
+#else /* ! __MSVCRT__ */
+
+/* CRTDLL run time library */
+
+#ifndef __DECLSPEC_SUPPORTED
+ extern int* __imp__sys_nerr_dll;
+# define sys_nerr (*__imp__sys_nerr_dll)
+#else /* __DECLSPEC_SUPPORTED */
+ __MINGW_IMPORT int _sys_nerr_dll;
+# define sys_nerr _sys_nerr_dll
+#endif /* __DECLSPEC_SUPPORTED */
+
+#endif /* ! __MSVCRT__ */
+
+#ifndef __DECLSPEC_SUPPORTED
+extern char*** __imp__sys_errlist;
+#define sys_errlist (*__imp__sys_errlist)
+#else /* __DECLSPEC_SUPPORTED */
+__MINGW_IMPORT char* _sys_errlist[];
+#ifndef _UWIN
+#define sys_errlist _sys_errlist
+#endif /* _UWIN */
+#endif /* __DECLSPEC_SUPPORTED */
+
+/*
+ * OS version and such constants.
+ */
+#ifndef __STRICT_ANSI__
+
+#ifdef __MSVCRT__
+/* msvcrtxx.dll */
+
+extern unsigned int* __p__osver(void);
+extern unsigned int* __p__winver(void);
+extern unsigned int* __p__winmajor(void);
+extern unsigned int* __p__winminor(void);
+
+#define _osver (*__p__osver())
+#define _winver (*__p__winver())
+#define _winmajor (*__p__winmajor())
+#define _winminor (*__p__winminor())
+
+#else
+/* Not msvcrtxx.dll, thus crtdll.dll */
+
+#ifndef __DECLSPEC_SUPPORTED
+
+extern unsigned int* _imp___osver_dll;
+extern unsigned int* _imp___winver_dll;
+extern unsigned int* _imp___winmajor_dll;
+extern unsigned int* _imp___winminor_dll;
+
+#define _osver (*_imp___osver_dll)
+#define _winver (*_imp___winver_dll)
+#define _winmajor (*_imp___winmajor_dll)
+#define _winminor (*_imp___winminor_dll)
+
+#else /* __DECLSPEC_SUPPORTED */
+
+__MINGW_IMPORT unsigned int _osver_dll;
+__MINGW_IMPORT unsigned int _winver_dll;
+__MINGW_IMPORT unsigned int _winmajor_dll;
+__MINGW_IMPORT unsigned int _winminor_dll;
+
+#define _osver _osver_dll
+#define _winver _winver_dll
+#define _winmajor _winmajor_dll
+#define _winminor _winminor_dll
+
+#endif /* __DECLSPEC_SUPPORTED */
+
+#endif
+
+#if defined __MSVCRT__
+/* although the _pgmptr is exported as DATA,
+ * be safe and use the access function __p__pgmptr() to get it. */
+char** __p__pgmptr(void);
+#define _pgmptr (*__p__pgmptr())
+wchar_t** __p__wpgmptr(void);
+#define _wpgmptr (*__p__wpgmptr())
+#else /* ! __MSVCRT__ */
+# ifndef __DECLSPEC_SUPPORTED
+ extern char** __imp__pgmptr_dll;
+# define _pgmptr (*__imp__pgmptr_dll)
+# else /* __DECLSPEC_SUPPORTED */
+ __MINGW_IMPORT char* _pgmptr_dll;
+# define _pgmptr _pgmptr_dll
+# endif /* __DECLSPEC_SUPPORTED */
+/* no wide version in CRTDLL */
+#endif /* __MSVCRT__ */
+
+#endif /* Not __STRICT_ANSI__ */
+
+#ifdef __GNUC__
+#define _ATTRIB_NORETURN __attribute__ ((noreturn))
+#else /* Not __GNUC__ */
+#define _ATTRIB_NORETURN
+#endif /* __GNUC__ */
+
+double atof (const char*);
+int atoi (const char*);
+long atol (const char*);
+int _wtoi (const wchar_t *);
+long _wtol (const wchar_t *);
+
+double strtod (const char*, char**);
+#if !defined __NO_ISOCEXT /* extern stubs in static libmingwex.a */
+extern __inline__ float strtof (const char *nptr, char **endptr)
+ { return (strtod (nptr, endptr));}
+#endif /* __NO_ISOCEXT */
+
+long strtol (const char*, char**, int);
+unsigned long strtoul (const char*, char**, int);
+
+#ifndef _WSTDLIB_DEFINED
+/* also declared in wchar.h */
+double wcstod (const wchar_t*, wchar_t**);
+#if !defined __NO_ISOCEXT /* extern stub in static libmingwex.a */
+extern __inline__ float wcstof( const wchar_t *nptr, wchar_t **endptr)
+{ return (wcstod(nptr, endptr)); }
+#endif /* __NO_ISOCEXT */
+
+long wcstol (const wchar_t*, wchar_t**, int);
+unsigned long wcstoul (const wchar_t*, wchar_t**, int);
+#define _WSTDLIB_DEFINED
+#endif
+
+size_t wcstombs (char*, const wchar_t*, size_t);
+int wctomb (char*, wchar_t);
+
+int mblen (const char*, size_t);
+size_t mbstowcs (wchar_t*, const char*, size_t);
+int mbtowc (wchar_t*, const char*, size_t);
+
+int rand (void);
+void srand (unsigned int);
+
+void* calloc (size_t, size_t);
+void* malloc (size_t);
+void* realloc (void*, size_t);
+void free (void*);
+
+void abort (void) _ATTRIB_NORETURN;
+void exit (int) _ATTRIB_NORETURN;
+int atexit (void (*)(void));
+
+int system (const char*);
+char* getenv (const char*);
+
+void* bsearch (const void*, const void*, size_t, size_t,
+ int (*)(const void*, const void*));
+void qsort (const void*, size_t, size_t,
+ int (*)(const void*, const void*));
+
+int abs (int);
+long labs (long);
+
+/*
+ * div_t and ldiv_t are structures used to return the results of div and
+ * ldiv.
+ *
+ * NOTE: div and ldiv appear not to work correctly unless
+ * -fno-pcc-struct-return is specified. This is included in the
+ * mingw32 specs file.
+ */
+typedef struct { int quot, rem; } div_t;
+typedef struct { long quot, rem; } ldiv_t;
+
+div_t div (int, int);
+ldiv_t ldiv (long, long);
+
+#ifndef __STRICT_ANSI__
+
+/*
+ * NOTE: Officially the three following functions are obsolete. The Win32 API
+ * functions SetErrorMode, Beep and Sleep are their replacements.
+ */
+void _beep (unsigned int, unsigned int);
+void _seterrormode (int);
+void _sleep (unsigned long);
+
+void _exit (int) _ATTRIB_NORETURN;
+/* C99 function name */
+static __inline__ void _Exit(int status)
+ { _exit(status); }
+
+/* _onexit is MS extension. Use atexit for portability. */
+typedef int (* _onexit_t)(void);
+_onexit_t _onexit( _onexit_t );
+
+int _putenv (const char*);
+void _searchenv (const char*, const char*, char*);
+
+
+char* _ecvt (double, int, int*, int*);
+char* _fcvt (double, int, int*, int*);
+char* _gcvt (double, int, char*);
+
+void _makepath (char*, const char*, const char*, const char*, const char*);
+void _splitpath (const char*, char*, char*, char*, char*);
+char* _fullpath (char*, const char*, size_t);
+
+
+char* _itoa (int, char*, int);
+char* _ltoa (long, char*, int);
+char* _ultoa(unsigned long, char*, int);
+wchar_t* _itow (int, wchar_t*, int);
+wchar_t* _ltow (long, wchar_t*, int);
+wchar_t* _ultow (unsigned long, wchar_t*, int);
+
+#ifdef __MSVCRT__
+__int64 _atoi64(const char *);
+char* _i64toa(__int64, char *, int);
+char* _ui64toa(unsigned __int64, char *, int);
+__int64 _wtoi64(const wchar_t *);
+wchar_t* _i64tow(__int64, wchar_t *, int);
+wchar_t* _ui64tow(unsigned __int64, wchar_t *, int);
+
+wchar_t* _wgetenv(const wchar_t*);
+int _wputenv(const wchar_t*);
+void _wsearchenv(const wchar_t*, const wchar_t*, wchar_t*);
+void _wmakepath(wchar_t*, const wchar_t*, const wchar_t*, const wchar_t*, const wchar_t*);
+void _wsplitpath (const wchar_t*, wchar_t*, wchar_t*, wchar_t*, wchar_t*);
+wchar_t* _wfullpath (wchar_t*, const wchar_t*, size_t);
+#endif
+
+#ifndef _NO_OLDNAMES
+
+int putenv (const char*);
+void searchenv (const char*, const char*, char*);
+
+char* itoa (int, char*, int);
+char* ltoa (long, char*, int);
+
+#ifndef _UWIN
+char* ecvt (double, int, int*, int*);
+char* fcvt (double, int, int*, int*);
+char* gcvt (double, int, char*);
+#endif /* _UWIN */
+#endif /* Not _NO_OLDNAMES */
+
+#endif /* Not __STRICT_ANSI__ */
+
+/* C99 names */
+
+#if !defined __NO_ISOCEXT /* externs in static libmingwex.a */
+
+typedef struct { long long quot, rem; } lldiv_t;
+
+lldiv_t lldiv (long long, long long);
+
+extern __inline__ long long llabs(long long _j)
+ {return (_j >= 0 ? _j : -_j);}
+
+long long strtoll (const char* __restrict__, char** __restrict, int);
+unsigned long long strtoull (const char* __restrict__, char** __restrict__, int);
+
+#if defined (__MSVCRT__) /* these are stubs for MS _i64 versions */
+long long atoll (const char *);
+
+#if !defined (__STRICT_ANSI__)
+long long wtoll(const wchar_t *);
+char* lltoa(long long, char *, int);
+char* ulltoa(unsigned long long , char *, int);
+wchar_t* lltow(long long, wchar_t *, int);
+wchar_t* ulltow(unsigned long long, wchar_t *, int);
+
+ /* inline using non-ansi functions */
+extern __inline__ long long atoll (const char * _c)
+ { return _atoi64 (_c); }
+extern __inline__ char* lltoa(long long _n, char * _c, int _i)
+ { return _i64toa (_n, _c, _i); }
+extern __inline__ char* ulltoa(unsigned long long _n, char * _c, int _i)
+ { return _ui64toa (_n, _c, _i); }
+extern __inline__ long long wtoll(const wchar_t * _w)
+ { return _wtoi64 (_w); }
+extern __inline__ wchar_t* lltow(long long _n, wchar_t * _w, int _i)
+ { return _i64tow (_n, _w, _i); }
+extern __inline__ wchar_t* ulltow(unsigned long long _n, wchar_t * _w, int _i)
+ { return _ui64tow (_n, _w, _i); }
+#endif /* (__STRICT_ANSI__) */
+
+#endif /* __MSVCRT__ */
+
+#endif /* !__NO_ISOCEXT */
+
+/*
+ * Undefine the no return attribute used in some function definitions
+ */
+#undef _ATTRIB_NORETURN
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* Not RC_INVOKED */
+
+#endif /* Not _STDLIB_H_ */
+
diff --git a/winsup/mingw/include/wchar.h b/winsup/mingw/include/wchar.h
new file mode 100644
index 00000000000..c0eae520533
--- /dev/null
+++ b/winsup/mingw/include/wchar.h
@@ -0,0 +1,309 @@
+/*
+ * wchar.h
+ *
+ * Defines of all functions for supporting wide characters. Actually it
+ * just includes all those headers, which is not a good thing to do from a
+ * processing time point of view, but it does mean that everything will be
+ * in sync.
+ *
+ * This file is part of the Mingw32 package.
+ *
+ * THIS SOFTWARE IS NOT COPYRIGHTED
+ *
+ * This source code is offered for use in the public domain. You may
+ * use, modify or distribute it freely.
+ *
+ * This code is distributed in the hope that it will be useful but
+ * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
+ * DISCLAIMED. This includes but is not limited to warranties of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * $Revision$
+ * $Author$
+ * $Date$
+ *
+ */
+
+#ifndef _WCHAR_H_
+#define _WCHAR_H_
+
+/* All the headers include this file. */
+#include <_mingw.h>
+
+#include <ctype.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+#include <sys/types.h>
+
+#define __need_size_t
+#define __need_wint_t
+#define __need_wchar_t
+#ifndef RC_INVOKED
+#include <stddef.h>
+#endif /* Not RC_INVOKED */
+
+#define WCHAR_MIN 0
+#define WCHAR_MAX ((wchar_t)-1)
+
+#ifndef RC_INVOKED
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef __STRICT_ANSI__
+
+#ifndef _FSIZE_T_DEFINED
+typedef unsigned long _fsize_t;
+#define _FSIZE_T_DEFINED
+#endif
+
+#ifndef _WFINDDATA_T_DEFINED
+struct _wfinddata_t {
+ unsigned attrib;
+ time_t time_create; /* -1 for FAT file systems */
+ time_t time_access; /* -1 for FAT file systems */
+ time_t time_write;
+ _fsize_t size;
+ wchar_t name[FILENAME_MAX]; /* may include spaces. */
+};
+struct _wfinddatai64_t {
+ unsigned attrib;
+ time_t time_create;
+ time_t time_access;
+ time_t time_write;
+ __int64 size;
+ wchar_t name[FILENAME_MAX];
+};
+#define _WFINDDATA_T_DEFINED
+#endif
+
+/* Wide character versions. Also defined in io.h. */
+/* CHECK: I believe these only exist in MSVCRT, and not in CRTDLL. Also
+ applies to other wide character versions? */
+#if !defined (_WIO_DEFINED)
+#if defined (__MSVCRT__)
+int _waccess(const wchar_t*, int);
+int _wchmod(const wchar_t*, int);
+int _wcreat(const wchar_t*, int);
+long _wfindfirst(wchar_t*, struct _wfinddata_t *);
+int _wfindnext(long, struct _wfinddata_t *);
+int _wunlink(const wchar_t*);
+int _wopen(const wchar_t*, int, ...);
+int _wsopen(const wchar_t*, int, int, ...);
+wchar_t * _wmktemp(wchar_t*);
+long _wfindfirsti64(const wchar_t*, struct _wfinddatai64_t*);
+int _wfindnexti64(long, struct _wfinddatai64_t*);
+#endif /* defined (__MSVCRT__) */
+#define _WIO_DEFINED
+#endif /* _WIO_DEFINED */
+
+#ifndef _WSTDIO_DEFINED
+/* also in stdio.h - keep in sync */
+int fwprintf (FILE*, const wchar_t*, ...);
+int wprintf (const wchar_t*, ...);
+int swprintf (wchar_t*, const wchar_t*, ...);
+int vfwprintf (FILE*, const wchar_t*, va_list);
+int vwprintf (const wchar_t*, va_list);
+int vswprintf (wchar_t*, const wchar_t*, va_list);
+int fwscanf (FILE*, const wchar_t*, ...);
+int wscanf (const wchar_t*, ...);
+int swscanf (const wchar_t*, const wchar_t*, ...);
+wint_t fgetwc (FILE*);
+wint_t fputwc (wchar_t, FILE*);
+wint_t ungetwc (wchar_t, FILE*);
+
+#ifdef __MSVCRT__
+wchar_t* fgetws (wchar_t*, int, FILE*);
+int fputws (const wchar_t*, FILE*);
+wint_t getwc (FILE*);
+wint_t getwchar (void);
+wchar_t* _getws (wchar_t*);
+wint_t putwc (wint_t, FILE*);
+int _putws (const wchar_t*);
+wint_t putwchar (wint_t);
+
+FILE* _wfopen (const wchar_t*, const wchar_t*);
+FILE* _wfreopen (const wchar_t*, const wchar_t*, FILE*);
+FILE* _wfsopen(const wchar_t*, const wchar_t*, int);
+wchar_t* _wtmpnam (wchar_t*);
+wchar_t* _wtempnam (const wchar_t*, const wchar_t*);
+int _wrename(const wchar_t*, const wchar_t*);
+int _wremove (const wchar_t*)
+
+FILE* _wpopen(const wchar_t*, const wchar_t*)
+void _wperror(const wchar_t*);
+#endif /* __MSVCRT__ */
+#define _WSTDIO_DEFINED
+#endif /* _WSTDIO_DEFINED */
+
+#ifndef _WDIRECT_DEFINED
+/* Also in direct.h */
+#ifdef __MSVCRT__
+int _wchdir(const wchar_t*);
+wchar_t* _wgetcwd(wchar_t*, int);
+wchar_t* _wgetdcwd(int, wchar_t*, int);
+int _wmkdir(const wchar_t*);
+int _wrmdir(const wchar_t*);
+#endif /* __MSVCRT__ */
+#define _WDIRECT_DEFINED
+#endif /* _WDIRECT_DEFINED */
+
+#ifndef _STAT_DEFINED
+/*
+ * The structure manipulated and returned by stat and fstat.
+ *
+ * NOTE: If called on a directory the values in the time fields are not only
+ * invalid, they will cause localtime et. al. to return NULL. And calling
+ * asctime with a NULL pointer causes an Invalid Page Fault. So watch it!
+ */
+struct _stat
+{
+ _dev_t st_dev; /* Equivalent to drive number 0=A 1=B ... */
+ _ino_t st_ino; /* Always zero ? */
+ _mode_t st_mode; /* See above constants */
+ short st_nlink; /* Number of links. */
+ short st_uid; /* User: Maybe significant on NT ? */
+ short st_gid; /* Group: Ditto */
+ _dev_t st_rdev; /* Seems useless (not even filled in) */
+ _off_t st_size; /* File size in bytes */
+ time_t st_atime; /* Accessed date (always 00:00 hrs local
+ * on FAT) */
+ time_t st_mtime; /* Modified time */
+ time_t st_ctime; /* Creation time */
+};
+
+struct stat
+{
+ _dev_t st_dev; /* Equivalent to drive number 0=A 1=B ... */
+ _ino_t st_ino; /* Always zero ? */
+ _mode_t st_mode; /* See above constants */
+ short st_nlink; /* Number of links. */
+ short st_uid; /* User: Maybe significant on NT ? */
+ short st_gid; /* Group: Ditto */
+ _dev_t st_rdev; /* Seems useless (not even filled in) */
+ _off_t st_size; /* File size in bytes */
+ time_t st_atime; /* Accessed date (always 00:00 hrs local
+ * on FAT) */
+ time_t st_mtime; /* Modified time */
+ time_t st_ctime; /* Creation time */
+};
+#if defined (__MSVCRT__)
+struct _stati64 {
+ _dev_t st_dev;
+ _ino_t st_ino;
+ unsigned short st_mode;
+ short st_nlink;
+ short st_uid;
+ short st_gid;
+ _dev_t st_rdev;
+ __int64 st_size;
+ time_t st_atime;
+ time_t st_mtime;
+ time_t st_ctime;
+ };
+#endif /* __MSVCRT__ */
+#define _STAT_DEFINED
+#endif /* _STAT_DEFINED */
+
+#if !defined ( _WSTAT_DEFINED)
+/* also declared in sys/stat.h */
+#if defined __MSVCRT__
+int _wstat(const wchar_t*, struct _stat*);
+int _wstati64 (const wchar_t*, struct _stati64*);
+#endif /* __MSVCRT__ */
+#define _WSTAT_DEFINED
+#endif /* ! _WSTAT_DEFIND */
+
+#ifndef _WTIME_DEFINED
+#ifdef __MSVCRT__
+/* wide function prototypes, also declared in time.h */
+wchar_t * _wasctime(const struct tm*);
+wchar_t * _wctime(const time_t*);
+wchar_t* _wstrdate(wchar_t*);
+wchar_t* _wstrtime(wchar_t*);
+#endif /* __MSVCRT__ */
+size_t wcsftime(wchar_t*, size_t, const wchar_t*, const struct tm*);
+#define _WTIME_DEFINED
+#endif /* _WTIME_DEFINED */
+
+#ifndef _WLOCALE_DEFINED /* also declared in locale.h */
+wchar_t* _wsetlocale(int, const wchar_t*);
+#define _WLOCALE_DEFINED
+#endif
+
+#ifndef _WSTDLIB_DEFINED /* also declared in stdlib.h */
+long wcstol (const wchar_t*, wchar_t**, int);
+unsigned long wcstoul (const wchar_t*, wchar_t**, int);
+double wcstod (const wchar_t*, wchar_t**);
+#if !defined __NO_ISOCEXT /* extern stub in static libmingwex.a */
+extern __inline__ float wcstof( const wchar_t *nptr, wchar_t **endptr)
+{ return (wcstod(nptr, endptr)); }
+#endif /* __NO_ISOCEXT */
+#define _WSTDLIB_DEFINED
+#endif
+
+
+#ifndef _NO_OLDNAMES
+
+/* Wide character versions. Also declared in io.h. */
+/* CHECK: Are these in the oldnames??? NO! */
+#if (0)
+int waccess(const wchar_t *, int);
+int wchmod(const wchar_t *, int);
+int wcreat(const wchar_t *, int);
+long wfindfirst(wchar_t *, struct _wfinddata_t *);
+int wfindnext(long, struct _wfinddata_t *);
+int wunlink(const wchar_t *);
+int wrename(const wchar_t *, const wchar_t *);
+int wremove (const wchar_t *);
+int wopen(const wchar_t *, int, ...);
+int wsopen(const wchar_t *, int, int, ...);
+wchar_t * wmktemp(wchar_t *);
+#endif
+#endif /* _NO_OLDNAMES */
+
+#endif /* not __STRICT_ANSI__ */
+
+/* These are resolved by -lmsvcp60 */
+/* If you don't have msvcp60.dll in your windows system directory, you can
+ easily obtain it with a search from your favorite search engine. */
+typedef int mbstate_t;
+typedef wchar_t _Wint_t;
+
+wint_t btowc(int);
+size_t mbrlen(const char *, size_t, mbstate_t *);
+size_t mbrtowc(wchar_t *, const char *, size_t, mbstate_t *);
+size_t mbsrtowcs(wchar_t *, const char **, size_t, mbstate_t *);
+
+size_t wcrtomb(char *, wchar_t, mbstate_t *);
+size_t wcsrtombs(char *, const wchar_t **, size_t, mbstate_t *);
+int wctob(wint_t);
+
+#ifndef __NO_ISOCEXT /* these need static lib libmingwex.a */
+extern inline int fwide(FILE* stream, int mode) {return -1;} /* limited to byte orientation */
+extern inline int mbsinit(const mbstate_t* ps) {return 1;}
+wchar_t* wmemset(wchar_t* s, wchar_t c, size_t n);
+wchar_t* wmemchr(const wchar_t* s, wchar_t c, size_t n);
+int wmemcmp(const wchar_t* s1, const wchar_t * s2, size_t n);
+wchar_t* wmemcpy(wchar_t* __restrict__ s1, const wchar_t* __restrict__ s2,
+ size_t n);
+wchar_t* wmemmove(wchar_t* s1, const wchar_t* s2, size_t n);
+long long wcstoll(const wchar_t* __restrict__ nptr,
+ wchar_t** __restrict__ endptr, int base);
+unsigned long long wcstoull(const wchar_t* __restrict__ nptr,
+ wchar_t ** __restrict__ endptr, int base);
+
+#endif /* __NO_ISOCEXT */
+
+
+#ifdef __cplusplus
+} /* end of extern "C" */
+#endif
+
+#endif /* Not RC_INVOKED */
+
+#endif /* not _WCHAR_H_ */
+