From 6126c12345d31cdd4714b3bb40ba54f13347016d Mon Sep 17 00:00:00 2001 From: Earnie Boyd Date: Tue, 21 Nov 2000 02:50:03 +0000 Subject: * include/direct.h: add guard around MSVCRT-only prototytpes * include/io.h: add __int64 struct definitions and function prototypes; add guard for MSVCRT-only prototypes * include/limits.h: add ISO C9x macros LLONG_MIN, LLONG_MAX, ULLONG_MAX * include/stdio.h: add wchar function prototypes (__MSVCRT__); put wchar functions together to make sync with wchar.h easier * include/stdlib.h: add wide char functions (__MSVCRT__) * include/string.h: add string collation functions ( __MSVCRT__) * include/sys/stat.h: add __int64 struct and function ( __MSVCRT__) * include/tchar.h: add macros and macro function definitions * include/wchar.h: add wide char function prototypes ( __MSVCRT__ ); enclose more functions in __MSVCRT__ guard; some oldname wide char function prototypes #if (0)'d * profile/gmon.h: add guard around BSD-ish typedefs --- winsup/mingw/ChangeLog | 19 ++++++ winsup/mingw/include/direct.h | 5 +- winsup/mingw/include/io.h | 56 ++++++++++++++---- winsup/mingw/include/limits.h | 5 ++ winsup/mingw/include/stdio.h | 119 +++++++++++++++++++------------------ winsup/mingw/include/stdlib.h | 27 ++++++--- winsup/mingw/include/string.h | 13 +++- winsup/mingw/include/sys/stat.h | 27 +++++++-- winsup/mingw/include/tchar.h | 106 +++++++++++++++++++++++++++++++-- winsup/mingw/include/wchar.h | 128 ++++++++++++++++++++++++++++++---------- winsup/mingw/profile/gmon.h | 2 + 11 files changed, 386 insertions(+), 121 deletions(-) diff --git a/winsup/mingw/ChangeLog b/winsup/mingw/ChangeLog index 33b426458..77ec0243f 100644 --- a/winsup/mingw/ChangeLog +++ b/winsup/mingw/ChangeLog @@ -1,3 +1,22 @@ +2000-11-20 Earnie Boyd + + * Merge in changes from + 2000-10-23 Danny Smith + * include/direct.h: add guard around MSVCRT-only prototytpes + * include/io.h: add __int64 struct definitions and function prototypes; + add guard for MSVCRT-only prototypes + * include/limits.h: add ISO C9x macros LLONG_MIN, LLONG_MAX, ULLONG_MAX + * include/stdio.h: add wchar function prototypes (__MSVCRT__); + put wchar functions together to make sync with wchar.h easier + * include/stdlib.h: add wide char functions (__MSVCRT__) + * include/string.h: add string collation functions ( __MSVCRT__) + * include/sys/stat.h: add __int64 struct and function ( __MSVCRT__) + * include/tchar.h: add macros and macro function definitions + * include/wchar.h: add wide char function prototypes ( __MSVCRT__ ); + enclose more functions in __MSVCRT__ guard; + some oldname wide char function prototypes #if (0)'d + * profile/gmon.h: add guard around BSD-ish typedefs + Mon Nov 20 18:58:12 2000 Christopher Faylor * Makefile.in: Use a different variable name for subdirectory since the diff --git a/winsup/mingw/include/direct.h b/winsup/mingw/include/direct.h index cac11a8df..c5b07aafb 100644 --- a/winsup/mingw/include/direct.h +++ b/winsup/mingw/include/direct.h @@ -72,15 +72,14 @@ unsigned _getdiskfree (unsigned, struct _diskfree_t *); #endif #ifndef _WDIRECT_DEFINED - /* wide character versions. Also in wchar.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 diff --git a/winsup/mingw/include/io.h b/winsup/mingw/include/io.h index e30f8687e..6cb65a4da 100644 --- a/winsup/mingw/include/io.h +++ b/winsup/mingw/include/io.h @@ -75,6 +75,16 @@ struct _finddata_t char name[FILENAME_MAX]; /* 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]; +}; + + #ifndef _WFINDDATA_T_DEFINED struct _wfinddata_t { unsigned attrib; @@ -84,6 +94,15 @@ struct _wfinddata_t { _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 @@ -107,6 +126,14 @@ int _mkdir (const char*); char* _mktemp (char*); int _rmdir (const char*); +#ifdef __MSVCRT__ +__int64 _filelengthi64(int); +long _findfirsti64(const char*, struct _finddatai64_t*); +int _findnexti64(long, struct _finddatai64_t*); +__int64 _lseeki64(int, __int64, int); +__int64 _telli64(int); +#endif /* __MSVCRT__ */ + #ifndef _NO_OLDNAMES @@ -193,17 +220,23 @@ int _unlink (const char*); int _write (int, const void*, unsigned int); /* Wide character versions. Also declared in wchar.h. */ -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 *); +/* Not in crtdll.dll */ +#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 _wrename(const wchar_t *, const wchar_t *); -int _wopen(const wchar_t *, int, ...); -int _wsopen(const wchar_t *, int, int, ...); -wchar_t * _wmktemp(wchar_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 _NO_OLDNAMES /* @@ -233,6 +266,8 @@ int write (int, const void*, unsigned int); #endif /* _UWIN */ /* Wide character versions. Also declared in wchar.h. */ +/* Where do these live? Not in libmoldname.a nor in libmsvcrt.a */ +#if 0 int waccess(const wchar_t *, int); int wchmod(const wchar_t *, int); int wcreat(const wchar_t *, int); @@ -243,6 +278,7 @@ int wrename(const wchar_t *, const wchar_t *); int wopen(const wchar_t *, int, ...); int wsopen(const wchar_t *, int, int, ...); wchar_t * wmktemp(wchar_t *); +#endif #endif /* Not _NO_OLDNAMES */ diff --git a/winsup/mingw/include/limits.h b/winsup/mingw/include/limits.h index 9bd3aab91..725d56ec5 100644 --- a/winsup/mingw/include/limits.h +++ b/winsup/mingw/include/limits.h @@ -104,6 +104,11 @@ #define ULONG_LONG_MAX (2ULL * LONG_LONG_MAX + 1) +/* ISO C9x macro names */ +#define LLONG_MAX LONG_LONG_MAX +#define LLONG_MIN LONG_LONG_MIN +#define ULLONG_MAX ULONG_LONG_MAX + #endif /* Not Strict ANSI and GNU C compiler */ diff --git a/winsup/mingw/include/stdio.h b/winsup/mingw/include/stdio.h index 7922a24dd..c2b1cd496 100644 --- a/winsup/mingw/include/stdio.h +++ b/winsup/mingw/include/stdio.h @@ -83,14 +83,9 @@ */ #define L_tmpnam (260) -/* - * The three possible buffering mode (nMode) values for setvbuf. - * NOTE: _IOFBF works, but _IOLBF seems to work like unbuffered... - * maybe I'm testing it wrong? - */ -#define _IOFBF 0 /* fully buffered */ -#define _IOLBF 1 /* line buffered */ -#define _IONBF 2 /* unbuffered */ +#define _IOFBF 0x0000 +#define _IOLBF 0x0040 +#define _IONBF 0x0004 /* * The buffer size as used by setbuf such that it is equivalent to @@ -175,11 +170,11 @@ extern "C" { /* * File Operations */ - FILE* fopen (const char*, const char*); FILE* freopen (const char*, const char*, FILE*); int fflush (FILE*); int fclose (FILE*); +/* MS puts remove & rename (but not wide versions) in io.h also */ int remove (const char*); int rename (const char*, const char*); FILE* tmpfile (void); @@ -207,13 +202,6 @@ int vprintf (const char*, va_list); int vsprintf (char*, const char*, va_list); int _vsnprintf (char*, size_t, const char*, va_list); -/* Wide character versions */ -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); /* * Formatted Input @@ -222,12 +210,6 @@ int vswprintf (wchar_t*, const wchar_t*, va_list); int fscanf (FILE*, const char*, ...); int scanf (const char*, ...); int sscanf (const char*, const char*, ...); - -/* Wide character versions */ -int fwscanf (FILE*, const wchar_t*, ...); -int wscanf (const wchar_t*, ...); -int swscanf (wchar_t*, const wchar_t*, ...); - /* * Character Input and Output Functions */ @@ -244,23 +226,6 @@ int putchar (int); int puts (const char*); int ungetc (int, FILE*); -/* Wide character versions */ -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); -#endif /* __MSVCRT__ */ - /* * Direct Input and Output Functions */ @@ -268,7 +233,6 @@ wint_t putwchar (wint_t); size_t fread (void*, size_t, size_t, FILE*); size_t fwrite (const void*, size_t, size_t, FILE*); - /* * File Positioning Functions */ @@ -306,7 +270,6 @@ void perror (const char*); #ifndef __STRICT_ANSI__ - /* * Pipes */ @@ -318,11 +281,64 @@ FILE* popen (const char*, const char*); int pclose (FILE*); #endif -/* The wide character version, only available in MSVCRT DLL versions, not - * CRTDLL. */ -#ifdef __MSVCRT__ -FILE* _wpopen (const wchar_t*, const wchar_t*); +/* + * Other Non ANSI functions + */ +int _flushall(void); +int _fgetchar (void); +int _fputchar (int); +FILE* _fdopen (int, const char*); +int _fileno (FILE*); + +#ifndef _NO_OLDNAMES +int fgetchar (void); +int fputchar (int); +FILE* fdopen (int, const char*); +int fileno (FILE*); +#endif /* Not _NO_OLDNAMES */ + +#endif /* Not __STRICT_ANSI__ */ + +/* Wide versions */ + +#ifndef _WSTDIO_DEFINED +/* also in wchar.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 (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*); +void _wperror(const wchar_t*); +FILE* _wpopen(const wchar_t*, const wchar_t*); +#endif /* __MSVCRT__ */ +#define _WSTDIO_DEFINED +#endif /* _WSTDIO_DEFINED */ +#ifndef __STRICT_ANSI__ +#ifdef __MSVCRT__ #ifndef NO_OLDNAMES #if 0 FILE* wpopen (const wchar_t*, const wchar_t*); @@ -335,34 +351,25 @@ FILE* wpopen (const wchar_t*, const wchar_t*); */ #define wpopen _wpopen #endif /* Always true */ - #endif /* not NO_OLDNAMES */ #endif /* MSVCRT runtime */ /* - * Other Non ANSI functions + * Other Non ANSI wide functions */ -int _fgetchar (void); -int _fputchar (int); -FILE* _fdopen (int, const char*); wint_t _fgetwchar(void); wint_t _fputwchar(wint_t); -int _fileno (FILE*); int _getw (FILE*); int _putw (int, FILE*); #ifndef _NO_OLDNAMES -int fgetchar (void); -int fputchar (int); -FILE* fdopen (int, const char*); wint_t fgetwchar(void); wint_t fputwchar(wint_t); -int fileno (FILE*); int getw (FILE*); int putw (int, FILE*); #endif /* Not _NO_OLDNAMES */ -#endif /* Not __STRICT_ANSI__ */ +#endif /* __STRICT_ANSI */ #ifdef __cplusplus } diff --git a/winsup/mingw/include/stdlib.h b/winsup/mingw/include/stdlib.h index fade92772..31a00cf9f 100644 --- a/winsup/mingw/include/stdlib.h +++ b/winsup/mingw/include/stdlib.h @@ -263,6 +263,8 @@ __MINGW_IMPORT unsigned int _winminor_dll; 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**); double wcstod (const wchar_t*, wchar_t**); @@ -332,8 +334,6 @@ void _exit (int) _ATTRIB_NORETURN; int _putenv (const char*); void _searchenv (const char*, const char*, char*); -char* _itoa (int, char*, int); -char* _ltoa (long, char*, int); char* _ecvt (double, int, int*, int*); char* _fcvt (double, int, int*, int*); @@ -342,17 +342,30 @@ 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); -int _wtoi (const wchar_t *); -long _wtol (const wchar_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 _atoi64(const char *); - +__int64 _wtoi64(const wchar_t *); wchar_t* _i64tow(__int64, wchar_t *, int); wchar_t* _ui64tow(unsigned __int64, wchar_t *, int); -__int64 _wtoi64(const wchar_t *); +int _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 diff --git a/winsup/mingw/include/string.h b/winsup/mingw/include/string.h index 322d6b626..55aa0bfcb 100644 --- a/winsup/mingw/include/string.h +++ b/winsup/mingw/include/string.h @@ -98,8 +98,12 @@ unsigned char* _mbschr (unsigned char*, unsigned char*); unsigned char* _mbsncat (unsigned char*, const unsigned char*, size_t); unsigned char* _mbstok (unsigned char*, unsigned char*); -#endif /* Not __STRICT_ANSI__ */ +#ifdef __MSVCRT__ +int _strncoll(const char*, const char*, size_t); +int _strnicoll(const char*, const char*, size_t); +#endif +#endif /* Not __STRICT_ANSI__ */ /* * Unicode versions of the standard calls. @@ -122,7 +126,6 @@ wchar_t* wcsstr(const wchar_t*, const wchar_t*); wchar_t* wcstok(wchar_t*, const wchar_t*); size_t wcsxfrm(wchar_t*, const wchar_t*, size_t); - #ifndef __STRICT_ANSI__ /* * Unicode versions of non-ANSI functions provided by CRTDLL. @@ -141,6 +144,12 @@ wchar_t* _wcsrev (wchar_t*); wchar_t* _wcsset (wchar_t*, wchar_t); wchar_t* _wcsupr (wchar_t*); +#ifdef __MSVCRT__ +int _wcsncoll(const wchar_t*, const wchar_t*, size_t); +int _wcsnicoll(const wchar_t*, const wchar_t*, size_t); +#endif + + #endif /* Not __STRICT_ANSI__ */ diff --git a/winsup/mingw/include/sys/stat.h b/winsup/mingw/include/sys/stat.h index f1b327e46..0178660bd 100644 --- a/winsup/mingw/include/sys/stat.h +++ b/winsup/mingw/include/sys/stat.h @@ -132,7 +132,21 @@ struct stat 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 */ @@ -144,14 +158,15 @@ int _fstat (int, struct _stat*); int _chmod (const char*, int); int _stat (const char*, struct _stat*); -#ifndef _WSTAT_DEFINED - -/* also declared in wchar.h */ - +#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 diff --git a/winsup/mingw/include/tchar.h b/winsup/mingw/include/tchar.h index 34fc3c9e7..c2eb90527 100644 --- a/winsup/mingw/include/tchar.h +++ b/winsup/mingw/include/tchar.h @@ -70,10 +70,17 @@ typedef wchar_t TCHAR; #define _T(x) L ## x #endif +/* for porting from other Windows compilers */ +#if 0 // no wide startup module +#define _tmain wmain +#define _tWinMain wWinMain +#define _tenviron _wenviron +#define __targv __wargv +#endif + /* * Unicode functions */ - #define _tprintf wprintf #define _ftprintf fwprintf #define _stprintf swprintf @@ -143,14 +150,55 @@ typedef wchar_t TCHAR; #define _istascii iswascii #define _totupper towupper #define _totlower towlower +#define _tcsftime wcsftime +/* Macro functions */ +#define _tcsdec _wcsdec +#define _tcsinc _wcsinc +#define _tcsnbcnt _wcsncnt +#define _tcsnccnt _wcsncnt +#define _tcsnextc _wcsnextc +#define _tcsninc _wcsninc +#define _tcsspnp _wcsspnp +#define _wcsdec(_wcs1, _wcs2) ((_wcs1)>=(_wcs2) ? NULL : (_wcs2)-1) +#define _wcsinc(_wcs) ((_wcs)+1) +#define _wcsnextc(_wcs) ((unsigned int) *(_wcs)) +#define _wcsninc(_wcs, _inc) (((_wcs)+(_inc))) +#define _wcsncnt(_wcs, _cnt) ((wcslen(_wcs)>_cnt) ? _count : wcslen(_wcs)) +#define _wcsspnp(_wcs1, _wcs2) ((*((_wcs1)+wcsspn(_wcs1,_wcs2))) ? ((_wcs1)+wcsspn(_wcs1,_wcs2)) : NULL) + +#if 1 // defined __MSVCRT__ +/* + * These wide functions not in crtdll.dll. + * Define macros anyway so that _wfoo rather than _tfoo is undefined + */ +#define _ttoi64 _wtoi64 +#define _i64tot _i64tow +#define _ui64tot _ui64tow #define _tasctime _wasctime #define _tctime _wctime #define _tstrdate _wstrdate #define _tstrtime _wstrtime #define _tutime _wutime -#define _tcsftime wcsftime -#define _ttoi _wtoi -#define _ttol _wtol +#define _tcsnccoll _wcsncoll +#define _tcsncoll _wcsncoll +#define _tcsncicoll _wcsnicoll +#define _tcsnicoll _wcsnicoll +#define _taccess _waccess +#define _tchmod _wchmod +#define _tcreat _wcreat +#define _tfindfirst _wfindfirst +#define _tfindnext _wfindnext +#define _tmktemp _wmktemp +#define _topen _wopen +#define _tremove _wremove +#define _trename _wrename +#define _tsopen _wsopen +#define _tunlink _wunlink +#define _tfinddata_t _wfinddata_t +#define _tfindfirsti64 _wfindfirsti64 +#define _tfindnexti64 _wfindnexti64 +#define _tfinddatai64_t _wfinddatai64_t +#endif /* __MSVCRT__ */ #else /* Not _UNICODE */ @@ -173,6 +221,12 @@ typedef char TCHAR; #define _T(x) x #endif +/* for porting from other Windows compilers */ +#define _tmain main +#define _tWinMain WinMain +#define _tenviron _environ +#define __targv __argv + /* * Non-unicode (standard) functions */ @@ -252,8 +306,48 @@ typedef char TCHAR; #define _tstrtime _strtime #define _tutime _utime #define _tcsftime strftime -#define _ttoi atoi -#define _ttol atol +/* Macro functions */ +#define _tcsdec _strdec +#define _tcsinc _strinc +#define _tcsnbcnt _strncnt +#define _tcsnccnt _strncnt +#define _tcsnextc _strnextc +#define _tcsninc _strninc +#define _tcsspnp _strspnp +#define _strdec(_str1, _str2) ((_str1)>=(_str2) ? NULL : (_str2)-1) +#define _strinc(_str) ((_str)+1) +#define _strnextc(_str) ((unsigned int) *(_str)) +#define _strninc(_str, _inc) (((_str)+(_inc))) +#define _strncnt(_str, _cnt) ((strlen(_str)>_cnt) ? _count : strlen(_str)) +#define _strspnp(_str1, _str2) ((*((_str1)+strspn(_str1,_str2))) ? ((_str1)+strspn(_str1,_str2)) : NULL) + +#define _tchmod _chmod +#define _tcreat _creat +#define _tfindfirst _findfirst +#define _tfindnext _findnext +#define _tmktemp _mktemp +#define _topen _open +#define _taccess _access +#define _tremove remove +#define _trename rename +#define _tsopen _sopen +#define _tunlink _unlink +#define _tfinddata_t _finddata_t + + +#if 1 // defined __MSVCRT__ +/* Not in crtdll.dll. Define macros anyway? */ +#define _ttoi64 _atoi64 +#define _i64tot _i64toa +#define _ui64tot _ui64toa +#define _tcsnccoll _strncoll +#define _tcsncoll _strncoll +#define _tcsncicoll _strnicoll +#define _tcsnicoll _strnicoll +#define _tfindfirsti64 _findfirsti64 +#define _tfindnexti64 _findnexti64 +#define _tfinddatai64_t _finddatai64_t +#endif /* __MSVCRT__ */ #endif /* Not _UNICODE */ diff --git a/winsup/mingw/include/wchar.h b/winsup/mingw/include/wchar.h index d2bc09415..9d598e80e 100644 --- a/winsup/mingw/include/wchar.h +++ b/winsup/mingw/include/wchar.h @@ -69,36 +69,87 @@ struct _wfinddata_t { _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? */ -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 *); +#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 _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 *); +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 (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 +#endif /* _WDIRECT_DEFINED */ #ifndef _STAT_DEFINED /* @@ -139,41 +190,56 @@ struct stat 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 */ -#ifndef _WSTAT_DEFINED - +#if !defined ( _WSTAT_DEFINED) /* also declared in sys/stat.h */ - -int _wstat(const wchar_t *, struct _stat *); - +#if defined __MSVCRT__ +int _wstat(const wchar_t*, struct _stat*); +int _wstati64 (const wchar_t*, struct _stati64*); +#endif /* __MSVCRT__ */ #define _WSTAT_DEFINED -#endif /* _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 _NO_OLDNAMES -/* Wide character versions. Also declared in wchar.h. */ -/* CHECK: Are these in the olnames??? */ +/* 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); @@ -185,7 +251,7 @@ 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__ */ @@ -202,8 +268,8 @@ size_t wcrtomb(char *, wchar_t, mbstate_t *); size_t wcsrtombs(char *, const wchar_t **, size_t, mbstate_t *); int wctob(wint_t); -#ifdef __cplusplus -} +#ifdef __cplusplus +} /* end of extern "C" */ #endif #endif /* Not RC_INVOKED */ diff --git a/winsup/mingw/profile/gmon.h b/winsup/mingw/profile/gmon.h index c9f1cac8f..ddcd48986 100644 --- a/winsup/mingw/profile/gmon.h +++ b/winsup/mingw/profile/gmon.h @@ -51,10 +51,12 @@ #include #ifdef __MINGW32__ +#if !defined _BSDTYPES_DEFINED typedef unsigned char u_char; typedef unsigned short u_short; typedef unsigned int u_int; typedef unsigned long u_long; +#define _BSDTYPES_DEFINED #endif /* -- cgit v1.2.3