summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDanny Smith <dannysmith@users.sourceforge.net>2002-09-25 23:50:29 +0000
committerDanny Smith <dannysmith@users.sourceforge.net>2002-09-25 23:50:29 +0000
commit57ba8c6aa4329499a712dc17d25cd01c7db86dd4 (patch)
treee98348caf242279dce1765444330f840f5a0d3b1
parent2164cca3eaced86870f5033f82a658a9e0dff16b (diff)
downloadgdb-57ba8c6aa4329499a712dc17d25cd01c7db86dd4.tar.gz
* include/settjmp.h: Use C++ c-header compatibility defines.
* include/time.h: Don't include non-ISO sys/types.h. (struct tm): Define in __CSTD, if not already done. (_wasctime): Qualify tm with __CSTD. (_wctime): Qualify time_t with __CSTD. * include/wchar.h (ctype.h): Don't #include. (stdio.h): Don't #include. (time.h): Don't #include. (wctype.h): Include in C, but not in C++ in ANSI mode. (time_t): Define in __CSTD, if not already done. Qualify with __CSTD throughout. (struct tm): Likewise. (FILENAME_MAX): Replace with numeric constant throughout. Whitespace. * include/io.h (stdio.h): Don't #include. (time_t): Define in __CSTD, if not already done. Qualify with __CSTD throughout. (FILENAME_MAX): Replace with numeric constant throughout. Consolidate RC_INVOKED. __cplusplus blocks. * include/dir.h: Add header guard. * include/sys/time.h: Add header guard. * include/sys/types.h (time_t): Define in __CSTD. * include/sys/utime.h (_utimbuf, utimbuf): Qualify time_t with __CSTD. Correct spelling of compatibility in ChangeLog.
-rw-r--r--winsup/mingw/ChangeLog45
-rw-r--r--winsup/mingw/include/dir.h27
-rw-r--r--winsup/mingw/include/io.h107
-rw-r--r--winsup/mingw/include/setjmp.h68
-rw-r--r--winsup/mingw/include/sys/stat.h190
-rw-r--r--winsup/mingw/include/sys/time.h24
-rw-r--r--winsup/mingw/include/sys/types.h121
-rw-r--r--winsup/mingw/include/sys/utime.h89
-rw-r--r--winsup/mingw/include/time.h16
-rw-r--r--winsup/mingw/include/wchar.h100
10 files changed, 674 insertions, 113 deletions
diff --git a/winsup/mingw/ChangeLog b/winsup/mingw/ChangeLog
index ef7c712c5b2..998832f3ba4 100644
--- a/winsup/mingw/ChangeLog
+++ b/winsup/mingw/ChangeLog
@@ -1,3 +1,30 @@
+2002-09-27 Danny Smith <dannysmith@users.sourceforge.net>
+
+ * include/settjmp.h: Use C++ c-header compatibility defines.
+ * include/time.h; Don't include non-ISO sys/types.h.
+ (struct tm): Define in __CSTD, if not already done.
+ (_wasctime): Qualify tm with __CSTD.
+ (_wctime): Qualify time_t with __CSTD.
+ * include/wchar.h (ctype.h): Don't #include.
+ (stdio.h): Don't #include.
+ (time.h): Don't #include.
+ (wctype.h): Include in C, but not in C++ in ANSI mode.
+ (time_t): Define in __CSTD, if not already done. Qualify
+ with __CSTD throughout.
+ (struct tm): Likewise.
+ (FILENAME_MAX): Replace with numeric constant throughout.
+ Whitespace.
+ * include/io.h (stdio.h): Don't #include.
+ (time_t): Define in __CSTD, if not already done. Qualify
+ with __CSTD throughout.
+ (FILENAME_MAX): Replace with numeric constant throughout.
+ Consolidate RC_INVOKED. __cplusplus blocks.
+ * include/sys/types.h (time_t): Define in __CSTD.
+ * include/sys/utime.h (_utimbuf, utimbuf): Qualify
+ time_t with __CSTD.
+ * include/dir.h: Add header guard.
+ * include/sys/time.h: Add header guard.
+
2002-09-25 Danny Smith <dannysmith@users.sourceforge.net>
* include/stdio.h (tempnam): Move out of __CSTD namespace.
@@ -11,30 +38,30 @@
* include/io.h: Move wide char prototypes together.
* include/string.h: Untangle wide char protototypes.
- Use C++ c-header compatability defines.
+ Use C++ c-header compatibility defines.
*include/wchar.h: Copy wide char string prototypes from
string.h.
Resync with io.h.
- * include/signal.h: Use C++ c-header compatability defines.
+ * include/signal.h: Use C++ c-header compatibility defines.
* include/stdio.h: Add __HAVE_STD_CXX guard.
2002-09-21 Danny Smith <dannysmith@users.sourceforge.net>
* include/stdio.h: Reorder ANSI vs non-ANSI declarations
- Use C++ c-header compatability defines.
+ Use C++ c-header compatibility defines.
* include/wchar.h: Likewise.
- * include/time.h: Use C++ c-header compatability defines.
+ * include/time.h: Use C++ c-header compatibility defines.
* include/tchar.h: ANSI-fy comment.
2002-09-21 Danny Smith <dannysmith@users.sourceforge.net>
* include/stdlib.h: Move _Exit prototype into main C99 block.
- Use C++ c-header compatability defines.
+ Use C++ c-header compatibility defines.
2002-09-20 Danny Smith <dannysmith@users.sourceforge.net>
- * include/math.h: Use C++ c-header compatability defines.
+ * include/math.h: Use C++ c-header compatibility defines.
* mingwex/math/fpclassify.c: Add non-underscored alias.
* mingwex/math/fpclassifyf.c: Likewise.
@@ -42,15 +69,15 @@
2002-09-20 Danny Smith <dannysmith@users.sourceforge.net>
- * include/locale.h: Use C++ c-header compatability defines.
+ * include/locale.h: Use C++ c-header compatibility defines.
2002-09-20 Danny Smith <dannysmith@users.sourceforge.net>
* include/_mingw.h (__BEGIN_CSTD_NAMESPACE,__END_CSTD_NAMESPACE
__BEGIN_CGLOBAL_NAMESPACE, __END_CGLOBAL_NAMESPACE, __CSTD,
- __CGLOBAL): Add defines for for ISO C++ c-header compatability.
+ __CGLOBAL): Add defines for for ISO C++ c-header compatibility.
- * include/ctype.h: Use C++ c-header compatability defines.
+ * include/ctype.h: Use C++ c-header compatibility defines.
* include/wctype.h: Likewise.
2002-09-19 Danny Smith <dannysmith@users.sourceforge.net>
diff --git a/winsup/mingw/include/dir.h b/winsup/mingw/include/dir.h
new file mode 100644
index 00000000000..24731b5cb7e
--- /dev/null
+++ b/winsup/mingw/include/dir.h
@@ -0,0 +1,27 @@
+/*
+ * dir.h
+ *
+ * This file OBSOLESCENT and only provided for backward compatibility.
+ * Please use io.h instead.
+ *
+ * This file is part of the Mingw32 package.
+ *
+ * Contributors:
+ * Created by Colin Peters <colin@bird.fu.is.saga-u.ac.jp>
+ * Mumit Khan <khan@xraylith.wisc.edu>
+ *
+ * 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.
+ *
+ */
+#ifndef _DIR_H_
+#define _DIR_H_
+#include <io.h>
+#endif
diff --git a/winsup/mingw/include/io.h b/winsup/mingw/include/io.h
index a4864fc11b5..f4a676f78a2 100644
--- a/winsup/mingw/include/io.h
+++ b/winsup/mingw/include/io.h
@@ -31,16 +31,6 @@
/* All the headers include this file. */
#include <_mingw.h>
-
-/* We need the definition of FILE anyway... */
-#include <stdio.h>
-
-/* MSVC's io.h contains the stuff from dir.h, so I will too.
- * NOTE: This also defines off_t, the file offset type, through
- * an inclusion of sys/types.h */
-
-#include <sys/types.h> /* To get time_t. */
-
/*
* Attributes of files as returned by _findfirst et al.
*/
@@ -52,9 +42,30 @@
#define _A_SUBDIR 0x00000010
#define _A_ARCH 0x00000020
+/* TODO: Maximum number of open handles has not been tested, I just set
+ * it the same as FOPEN_MAX. */
+#define HANDLE_MAX 20
+
+
+/* Some defines for _access nAccessMode (MS doesn't define them, but
+ * it doesn't seem to hurt to add them). */
+#define F_OK 0 /* Check for file existence */
+#define X_OK 1 /* Check for execute permission. */
+#define W_OK 2 /* Check for write permission */
+#define R_OK 4 /* Check for read permission */
+
#ifndef RC_INVOKED
+#ifndef _TIME_T_DEFINED
+__BEGIN_CSTD_NAMESPACE
+typedef long time_t;
+__END_CSTD_NAMESPACE
+#define _TIME_T_DEFINED
+#endif
+
+__BEGIN_CGLOBAL_NAMESPACE
+
#ifndef _FSIZE_T_DEFINED
typedef unsigned long _fsize_t;
#define _FSIZE_T_DEFINED
@@ -67,48 +78,43 @@ typedef unsigned long _fsize_t;
struct _finddata_t
{
unsigned attrib; /* Attributes, see constants above. */
- time_t time_create;
- time_t time_access; /* always midnight local time */
- time_t time_write;
+ __CSTD time_t time_create;
+ __CSTD time_t time_access; /* always midnight local time */
+ __CSTD time_t time_write;
_fsize_t size;
- char name[FILENAME_MAX]; /* may include spaces. */
+ char name[260]; /* may include spaces. */
};
struct _finddatai64_t {
- unsigned attrib;
- time_t time_create;
- time_t time_access;
- time_t time_write;
- __int64 size;
- char name[FILENAME_MAX];
+ unsigned attrib;
+ __CSTD time_t time_create;
+ __CSTD time_t time_access;
+ __CSTD time_t time_write;
+ __int64 size;
+ char name[260];
};
-
#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;
+ __CSTD time_t time_create; /* -1 for FAT file systems */
+ __CSTD time_t time_access; /* -1 for FAT file systems */
+ __CSTD time_t time_write;
_fsize_t size;
- wchar_t name[FILENAME_MAX]; /* may include spaces. */
+ wchar_t name[260]; /* 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];
+ unsigned attrib;
+ __CSTD time_t time_create;
+ __CSTD time_t time_access;
+ __CSTD time_t time_write;
+ __int64 size;
+ wchar_t name[260];
};
#define _WFINDDATA_T_DEFINED
#endif
-#ifdef __cplusplus
-extern "C" {
-#endif
-
/*
* Functions for searching for files. _findfirst returns -1 if no match
* is found. Otherwise it returns a handle to be used in _findnext and
@@ -126,7 +132,6 @@ char* _mktemp (char*);
int _rmdir (const char*);
int _chmod (const char*, int);
-
#ifdef __MSVCRT__
__int64 _filelengthi64(int);
long _findfirsti64(const char*, struct _finddatai64_t*);
@@ -135,7 +140,6 @@ __int64 _lseeki64(int, __int64, int);
__int64 _telli64(int);
#endif /* __MSVCRT__ */
-
#ifndef _NO_OLDNAMES
#ifndef _UWIN
@@ -149,31 +153,6 @@ int chmod (const char*, int);
#endif /* Not _NO_OLDNAMES */
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* Not RC_INVOKED */
-
-
-/* TODO: Maximum number of open handles has not been tested, I just set
- * it the same as FOPEN_MAX. */
-#define HANDLE_MAX FOPEN_MAX
-
-
-/* Some defines for _access nAccessMode (MS doesn't define them, but
- * it doesn't seem to hurt to add them). */
-#define F_OK 0 /* Check for file existence */
-#define X_OK 1 /* Check for execute permission. */
-#define W_OK 2 /* Check for write permission */
-#define R_OK 4 /* Check for read permission */
-
-#ifndef RC_INVOKED
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
int _access (const char*, int);
int _chsize (int, long);
int _close (int);
@@ -283,9 +262,7 @@ wchar_t * wmktemp(wchar_t *);
#define _WIO_DEFINED
#endif /* _WIO_DEFINED */
-#ifdef __cplusplus
-}
-#endif
+__END_CGLOBAL_NAMESPACE
#endif /* Not RC_INVOKED */
diff --git a/winsup/mingw/include/setjmp.h b/winsup/mingw/include/setjmp.h
new file mode 100644
index 00000000000..7d67a2e87c6
--- /dev/null
+++ b/winsup/mingw/include/setjmp.h
@@ -0,0 +1,68 @@
+/*
+ * setjmp.h
+ *
+ * Declarations supporting setjmp and longjump, a method for avoiding
+ * the normal function call return sequence. (Bleah!)
+ *
+ * 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 _SETJMP_H_
+#define _SETJMP_H_
+
+/* All the headers include this file. */
+#include <_mingw.h>
+
+#ifndef RC_INVOKED
+
+__BEGIN_CSTD_NAMESPACE
+/*
+ * The buffer used by setjmp to store the information used by longjmp
+ * to perform it's evil goto-like work. The size of this buffer was
+ * determined through experimentation; it's contents are a mystery.
+ * NOTE: This was determined on an i386 (actually a Pentium). The
+ * contents could be different on an Alpha or something else.
+ */
+#define _JBLEN 16
+#define _JBTYPE int
+typedef _JBTYPE jmp_buf[_JBLEN];
+
+/*
+ * The function provided by CRTDLL which appears to do the actual work
+ * of setjmp.
+ */
+int _setjmp (jmp_buf);
+
+#define setjmp(x) _setjmp(x)
+
+/*
+ * Return to the last setjmp call and act as if setjmp had returned
+ * nVal (which had better be non-zero!).
+ */
+void longjmp (jmp_buf, int);
+
+__END_CSTD_NAMESPACE
+
+
+#endif /* Not RC_INVOKED */
+
+#endif /* Not _SETJMP_H_ */
+
diff --git a/winsup/mingw/include/sys/stat.h b/winsup/mingw/include/sys/stat.h
new file mode 100644
index 00000000000..6b4a25f1fb2
--- /dev/null
+++ b/winsup/mingw/include/sys/stat.h
@@ -0,0 +1,190 @@
+/*
+ * stat.h
+ *
+ * Symbolic constants for opening and creating files, also stat, fstat and
+ * chmod 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 __STRICT_ANSI__
+
+#ifndef _STAT_H_
+#define _STAT_H_
+
+/* All the headers include this file. */
+#include <_mingw.h>
+
+#define __need_size_t
+#define __need_wchar_t
+#ifndef RC_INVOKED
+#include <stddef.h>
+#endif /* Not RC_INVOKED */
+
+#include <sys/types.h>
+
+/*
+ * Constants for the stat st_mode member.
+ */
+#define _S_IFIFO 0x1000 /* FIFO */
+#define _S_IFCHR 0x2000 /* Character */
+#define _S_IFBLK 0x3000 /* Block: Is this ever set under w32? */
+#define _S_IFDIR 0x4000 /* Directory */
+#define _S_IFREG 0x8000 /* Regular */
+
+#define _S_IFMT 0xF000 /* File type mask */
+
+#define _S_IEXEC 0x0040
+#define _S_IWRITE 0x0080
+#define _S_IREAD 0x0100
+
+#define _S_IRWXU (_S_IREAD | _S_IWRITE | _S_IEXEC)
+#define _S_IXUSR _S_IEXEC
+#define _S_IWUSR _S_IWRITE
+#define _S_IRUSR _S_IREAD
+
+#define _S_ISDIR(m) (((m) & _S_IFMT) == _S_IFDIR)
+#define _S_ISFIFO(m) (((m) & _S_IFMT) == _S_IFIFO)
+#define _S_ISCHR(m) (((m) & _S_IFMT) == _S_IFCHR)
+#define _S_ISBLK(m) (((m) & _S_IFMT) == _S_IFBLK)
+#define _S_ISREG(m) (((m) & _S_IFMT) == _S_IFREG)
+
+#ifndef _NO_OLDNAMES
+
+#define S_IFIFO _S_IFIFO
+#define S_IFCHR _S_IFCHR
+#define S_IFBLK _S_IFBLK
+#define S_IFDIR _S_IFDIR
+#define S_IFREG _S_IFREG
+#define S_IFMT _S_IFMT
+#define S_IEXEC _S_IEXEC
+#define S_IWRITE _S_IWRITE
+#define S_IREAD _S_IREAD
+#define S_IRWXU _S_IRWXU
+#define S_IXUSR _S_IXUSR
+#define S_IWUSR _S_IWUSR
+#define S_IRUSR _S_IRUSR
+
+#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
+#define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO)
+#define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR)
+#define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK)
+#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
+
+#endif /* Not _NO_OLDNAMES */
+
+#ifndef RC_INVOKED
+
+#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 */
+ __CSTD time_t st_atime; /* Accessed date (always 00:00 hrs local
+ * on FAT) */
+ __CSTD time_t st_mtime; /* Modified time */
+ __CSTD 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 */
+ __CSTD time_t st_atime; /* Accessed date (always 00:00 hrs local
+ * on FAT) */
+ __CSTD time_t st_mtime; /* Modified time */
+ __CSTD 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;
+ __CSTD time_t st_atime;
+ __CSTD time_t st_mtime;
+ __CSTD time_t st_ctime;
+};
+#endif /* __MSVCRT__ */
+#define _STAT_DEFINED
+#endif /* _STAT_DEFINED */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int _fstat (int, struct _stat*);
+int _chmod (const char*, int);
+int _stat (const char*, struct _stat*);
+
+#if defined (__MSVCRT__)
+int _fstati64(int, struct _stati64 *);
+int _stati64(const char *, struct _stati64 *);
+#if !defined ( _WSTAT_DEFINED) /* also declared in wchar.h */
+int _wstat(const wchar_t*, struct _stat*);
+int _wstati64 (const wchar_t*, struct _stati64*);
+#define _WSTAT_DEFINED
+#endif /* _WSTAT_DEFIND */
+#endif /* __MSVCRT__ */
+
+#ifndef _NO_OLDNAMES
+
+/* These functions live in liboldnames.a. */
+int fstat (int, struct stat*);
+int chmod (const char*, int);
+int stat (const char*, struct stat*);
+
+#endif /* Not _NO_OLDNAMES */
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* Not RC_INVOKED */
+
+#endif /* Not _STAT_H_ */
+
+#endif /* Not __STRICT_ANSI__ */
+
diff --git a/winsup/mingw/include/sys/time.h b/winsup/mingw/include/sys/time.h
new file mode 100644
index 00000000000..d4a41c264e3
--- /dev/null
+++ b/winsup/mingw/include/sys/time.h
@@ -0,0 +1,24 @@
+#ifndef _SYS_TIME_H_
+#define _SYS_TIME_H_
+
+#include <time.h>
+
+#ifndef __STRICT_ANSI__
+#ifndef _TIMEVAL_DEFINED /* also in winsock[2].h */
+#define _TIMEVAL_DEFINED
+struct timeval {
+ long tv_sec;
+ long tv_usec;
+};
+#define timerisset(tvp) ((tvp)->tv_sec || (tvp)->tv_usec)
+#define timercmp(tvp, uvp, cmp) \
+ (((tvp)->tv_sec != (uvp)->tv_sec) ? \
+ ((tvp)->tv_sec cmp (uvp)->tv_sec) : \
+ ((tvp)->tv_usec cmp (uvp)->tv_usec))
+#define timerclear(tvp) (tvp)->tv_sec = (tvp)->tv_usec = 0
+#endif /* _TIMEVAL_DEFINED */
+
+#endif /* __STRICT_ANSI__ */
+
+#endif /* _SYS_TIME_H_ */
+
diff --git a/winsup/mingw/include/sys/types.h b/winsup/mingw/include/sys/types.h
new file mode 100644
index 00000000000..dd78a741a80
--- /dev/null
+++ b/winsup/mingw/include/sys/types.h
@@ -0,0 +1,121 @@
+/*
+ * types.h
+ *
+ * The definition of constants, data types and global variables.
+ *
+ * This file is part of the Mingw32 package.
+ *
+ * Contributors:
+ * Created by Colin Peters <colin@bird.fu.is.saga-u.ac.jp>
+ * Lots of types supplied by Pedro A. Aranda <paag@tid.es>
+ *
+ * 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 WARRENTIES, EXPRESS OR IMPLIED ARE HEREBY
+ * DISCLAIMED. This includes but is not limited to warrenties of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * $Revision$
+ * $Author$
+ * $Date$
+ *
+ */
+
+#ifndef _TYPES_H_
+#define _TYPES_H_
+
+/* All the headers include this file. */
+#include <_mingw.h>
+
+#define __need_wchar_t
+#define __need_size_t
+#define __need_ptrdiff_t
+#ifndef RC_INVOKED
+#include <stddef.h>
+#endif /* Not RC_INVOKED */
+
+#ifndef RC_INVOKED
+
+
+#ifndef _TIME_T_DEFINED
+__BEGIN_CSTD_NAMESPACE
+typedef long time_t;
+__END_CSTD_NAMESPACE
+#define _TIME_T_DEFINED
+#endif
+
+
+#ifndef __STRICT_ANSI__
+
+#ifndef _OFF_T_
+#define _OFF_T_
+typedef long _off_t;
+
+#ifndef _NO_OLDNAMES
+typedef _off_t off_t;
+#endif
+#endif /* Not _OFF_T_ */
+
+
+#ifndef _DEV_T_
+#define _DEV_T_
+#ifdef __MSVCRT__
+typedef unsigned int _dev_t;
+#else
+typedef short _dev_t;
+#endif
+
+#ifndef _NO_OLDNAMES
+typedef _dev_t dev_t;
+#endif
+#endif /* Not _DEV_T_ */
+
+
+#ifndef _INO_T_
+#define _INO_T_
+typedef short _ino_t;
+
+#ifndef _NO_OLDNAMES
+typedef _ino_t ino_t;
+#endif
+#endif /* Not _INO_T_ */
+
+
+#ifndef _PID_T_
+#define _PID_T_
+typedef int _pid_t;
+
+#ifndef _NO_OLDNAMES
+typedef _pid_t pid_t;
+#endif
+#endif /* Not _PID_T_ */
+
+
+#ifndef _MODE_T_
+#define _MODE_T_
+typedef unsigned short _mode_t;
+
+#ifndef _NO_OLDNAMES
+typedef _mode_t mode_t;
+#endif
+#endif /* Not _MODE_T_ */
+
+
+#ifndef _SIGSET_T_
+#define _SIGSET_T_
+typedef int _sigset_t;
+
+#ifndef _NO_OLDNAMES
+typedef _sigset_t sigset_t;
+#endif
+#endif /* Not _SIGSET_T_ */
+
+#endif /* Not __STRICT_ANSI__ */
+
+#endif /* Not RC_INVOKED */
+
+#endif /* Not _TYPES_H_ */
diff --git a/winsup/mingw/include/sys/utime.h b/winsup/mingw/include/sys/utime.h
new file mode 100644
index 00000000000..d81e2b479c3
--- /dev/null
+++ b/winsup/mingw/include/sys/utime.h
@@ -0,0 +1,89 @@
+/*
+ * utime.h
+ *
+ * Support for the utime function.
+ *
+ * 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 __STRICT_ANSI__
+
+#ifndef _UTIME_H_
+#define _UTIME_H_
+
+/* All the headers include this file. */
+#include <_mingw.h>
+
+#define __need_wchar_t
+#define __need_size_t
+#ifndef RC_INVOKED
+#include <stddef.h>
+#endif /* Not RC_INVOKED */
+#include <sys/types.h>
+
+#ifndef RC_INVOKED
+
+/*
+ * Structure used by _utime function.
+ */
+struct _utimbuf
+{
+ __CSTD time_t actime; /* Access time */
+ __CSTD time_t modtime; /* Modification time */
+};
+
+
+#ifndef _NO_OLDNAMES
+/* NOTE: Must be the same as _utimbuf above. */
+struct utimbuf
+{
+ __CSTD time_t actime;
+ __CSTD time_t modtime;
+};
+#endif /* Not _NO_OLDNAMES */
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int _utime (const char*, struct _utimbuf*);
+int _futime (int, struct _utimbuf*);
+
+/* The wide character version, only available for MSVCRT versions of the
+ * C runtime library. */
+#ifdef __MSVCRT__
+int _wutime (const wchar_t*, struct _utimbuf*);
+#endif /* MSVCRT runtime */
+#ifndef _NO_OLDNAMES
+int utime (const char*, struct utimbuf*);
+#endif /* Not _NO_OLDNAMES */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* Not RC_INVOKED */
+
+#endif /* Not _UTIME_H_ */
+
+#endif /* Not __STRICT_ANSI__ */
+
diff --git a/winsup/mingw/include/time.h b/winsup/mingw/include/time.h
index 8a29efac898..2e520fb9f9f 100644
--- a/winsup/mingw/include/time.h
+++ b/winsup/mingw/include/time.h
@@ -36,12 +36,6 @@
#ifndef RC_INVOKED
#include <stddef.h>
#endif /* Not RC_INVOKED */
-
-/*
- * Need a definition of time_t.
- */
-#include <sys/types.h>
-
/*
* Number of clock ticks per second. A clock tick is the unit by which
* processor time is measured and is returned by 'clock'.
@@ -57,7 +51,7 @@ __BEGIN_CSTD_NAMESPACE
/*
* A type for storing the current time and date. This is the number of
* seconds since midnight Jan 1, 1970.
- * NOTE: Normally this is defined by the above include of sys/types.h
+ * NOTE: This is also defined in non-ISO sys/types.h
*/
#ifndef _TIME_T_DEFINED
typedef long time_t;
@@ -77,6 +71,7 @@ typedef long clock_t;
* A structure for storing all kinds of useful information about the
* current (or another) time.
*/
+#ifndef _TM_DEFINED
struct tm
{
int tm_sec; /* Seconds: 0-59 (K&R says 0-61?) */
@@ -90,7 +85,8 @@ struct tm
int tm_isdst; /* +1 Daylight Savings Time, 0 No DST,
* -1 don't know */
};
-
+#define _TM_DEFINED
+#endif
clock_t clock (void);
time_t time (time_t*);
@@ -188,8 +184,8 @@ __MINGW_IMPORT char *tzname[2];
/* wide function prototypes, also declared in wchar.h */
-wchar_t * _wasctime(const struct tm*);
-wchar_t * _wctime(const time_t*);
+wchar_t * _wasctime(const struct __CSTD tm*);
+wchar_t * _wctime(const __CSTD time_t*);
wchar_t* _wstrdate(wchar_t*);
wchar_t* _wstrtime(wchar_t*);
diff --git a/winsup/mingw/include/wchar.h b/winsup/mingw/include/wchar.h
index fe27a07fe13..6ff5b44cf1c 100644
--- a/winsup/mingw/include/wchar.h
+++ b/winsup/mingw/include/wchar.h
@@ -30,10 +30,6 @@
/* All the headers include this file. */
#include <_mingw.h>
-#include <ctype.h>
-#include <stdio.h> /* for FILE, FILENAME_MAX */
-#include <time.h> /* for struct tm */
-
#define __need_size_t
#define __need_wint_t
#define __need_wchar_t
@@ -42,11 +38,59 @@
#include <stddef.h>
#endif /* Not RC_INVOKED */
+/*
+ * FIXME:
+ * MSDN says that isw* char classifications are in wchar.h.
+ * ISO C says they are wctype.h and ISO C++ expects them there as well.
+ * Including wctype.h here in C++ will cause the std symbols to be in
+ * global namespace as well as in std. That is rude.
+ */
+#if !(defined __STRICT_ANSI__ && defined __cplusplus)
+#include <wctype.h>
+#endif
+
#define WCHAR_MIN 0
#define WCHAR_MAX ((wchar_t)-1)
#ifndef RC_INVOKED
+__BEGIN_CSTD_NAMESPACE
+#ifndef _FILE_DEFINED
+#define _FILE_DEFINED
+typedef struct _iobuf
+{
+ char* _ptr;
+ int _cnt;
+ char* _base;
+ int _flag;
+ int _file;
+ int _charbuf;
+ int _bufsiz;
+ char* _tmpfname;
+} FILE;
+#endif /* Not _FILE_DEFINED */
+
+#ifndef _TIME_T_DEFINED
+typedef long time_t;
+#define _TIME_T_DEFINED
+#endif
+
+#ifndef _TM_DEFINED
+struct tm {
+ int tm_sec; /* seconds after the minute - [0,59] */
+ int tm_min; /* minutes after the hour - [0,59] */
+ int tm_hour; /* hours since midnight - [0,23] */
+ int tm_mday; /* day of the month - [1,31] */
+ int tm_mon; /* months since January - [0,11] */
+ int tm_year; /* years since 1900 */
+ int tm_wday; /* days since Sunday - [0,6] */
+ int tm_yday; /* days since January 1 - [0,365] */
+ int tm_isdst; /* daylight savings time flag */
+ };
+#define _TM_DEFINED
+#endif
+__END_CSTD_NAMESPACE
+
#ifndef _WSTDIO_DEFINED
__BEGIN_CSTD_NAMESPACE
/* also in stdio.h - keep in sync */
@@ -174,7 +218,6 @@ __END_CGLOBAL_NAMESPACE
#define _WSTRING_DEFINED
#endif /* _WSTRING_DEFINED */
-
#ifndef __STRICT_ANSI__
__BEGIN_CGLOBAL_NAMESPACE
/*
@@ -189,19 +232,19 @@ typedef unsigned long _fsize_t;
#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;
+ __CSTD time_t time_create; /* -1 for FAT file systems */
+ __CSTD time_t time_access; /* -1 for FAT file systems */
+ __CSTD time_t time_write;
_fsize_t size;
- wchar_t name[FILENAME_MAX]; /* may include spaces. */
+ wchar_t name[260]; /* 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];
+ unsigned attrib;
+ __CSTD time_t time_create;
+ __CSTD time_t time_access;
+ __CSTD time_t time_write;
+ __int64 size;
+ wchar_t name[260];
};
#define _WFINDDATA_T_DEFINED
#endif
@@ -271,10 +314,10 @@ struct _stat
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 */
+ __CSTD time_t st_atime; /* Accessed date (always 00:00 hrs local
+ * on FAT) */
+ __CSTD time_t st_mtime; /* Modified time */
+ __CSTD time_t st_ctime; /* Creation time */
};
struct stat
@@ -287,10 +330,10 @@ struct stat
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 */
+ __CSTD time_t st_atime; /* Accessed date (always 00:00 hrs local
+ * on FAT) */
+ __CSTD time_t st_mtime; /* Modified time */
+ __CSTD time_t st_ctime; /* Creation time */
};
#if defined (__MSVCRT__)
struct _stati64 {
@@ -302,9 +345,9 @@ struct _stati64 {
short st_gid;
_dev_t st_rdev;
__int64 st_size;
- time_t st_atime;
- time_t st_mtime;
- time_t st_ctime;
+ __CSTD time_t st_atime;
+ __CSTD time_t st_mtime;
+ __CSTD time_t st_ctime;
};
#endif /* __MSVCRT__ */
@@ -327,14 +370,13 @@ wchar_t* _wsetlocale (int, const wchar_t*);
__END_CGLOBAL_NAMESPACE
#endif /* __STRICT_ANSI__ */
-
#ifndef _WTIME_DEFINED
__BEGIN_CGLOBAL_NAMESPACE
#ifdef __MSVCRT__
#ifndef __STRICT_ANSI__
/* wide function prototypes, also declared in time.h */
-wchar_t* _wasctime (const struct tm*);
-wchar_t* _wctime (const time_t*);
+wchar_t* _wasctime (const struct __CSTD tm*);
+wchar_t* _wctime (const __CSTD time_t*);
wchar_t* _wstrdate (wchar_t*);
wchar_t* _wstrtime (wchar_t*);
#endif /* __MSVCRT__ */