diff options
author | Danny Smith <dannysmith@users.sourceforge.net> | 2002-09-21 02:55:32 +0000 |
---|---|---|
committer | Danny Smith <dannysmith@users.sourceforge.net> | 2002-09-21 02:55:32 +0000 |
commit | 5c1b12ba9adbd33a9d0efc36a729eb7069c43a58 (patch) | |
tree | d8dd852b82d401753380088be2aa2b7bd049e5e4 | |
parent | 179f3ad6e929694878302811448450ffd09f1960 (diff) | |
download | gdb-5c1b12ba9adbd33a9d0efc36a729eb7069c43a58.tar.gz |
* include/stdio.h: Reorder ANSI vs non-ANSI declarations
Use C++ c-header compatability defines.
* include/wchar.h: Likewise.
* include/time.h: Use C++ c-header compatability defines.
* include/tchar.h: ANSI-fy comment.
-rw-r--r-- | winsup/mingw/ChangeLog | 9 | ||||
-rw-r--r-- | winsup/mingw/include/stdio.h | 72 | ||||
-rw-r--r-- | winsup/mingw/include/tchar.h | 397 | ||||
-rw-r--r-- | winsup/mingw/include/time.h | 220 | ||||
-rw-r--r-- | winsup/mingw/include/wchar.h | 91 |
5 files changed, 730 insertions, 59 deletions
diff --git a/winsup/mingw/ChangeLog b/winsup/mingw/ChangeLog index bc89d43fac2..db18b76f61a 100644 --- a/winsup/mingw/ChangeLog +++ b/winsup/mingw/ChangeLog @@ -1,3 +1,12 @@ +2002-09-20 Danny Smith <dannysmith@users.sourceforge.net> + + * include/stdio.h: Reorder ANSI vs non-ANSI declarations + Use C++ c-header compatability defines. + * include/wchar.h: Likewise. + * include/time.h: Use C++ c-header compatability 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. diff --git a/winsup/mingw/include/stdio.h b/winsup/mingw/include/stdio.h index 23b470b9e79..cad5e991fad 100644 --- a/winsup/mingw/include/stdio.h +++ b/winsup/mingw/include/stdio.h @@ -158,7 +158,28 @@ typedef struct _iobuf char* _tmpfname; } FILE; #endif /* Not _FILE_DEFINED */ +/* + * An opaque data type used for storing file positions... The contents of + * this type are unknown, but we (the compiler) need to know the size + * because the programmer using fgetpos and fsetpos will be setting aside + * storage for fpos_t structres. Actually I tested using a byte array and + * it is fairly evident that the fpos_t type is a long (in CRTDLL.DLL). + * Perhaps an unsigned long? TODO? It's definitely a 64-bit number in + * MSVCRT however, and for now `long long' will do. + */ +#ifdef __MSVCRT__ +typedef long long fpos_t; +#else +typedef long fpos_t; +#endif +#if defined __cplusplus +namespace std +{ + using ::FILE; + using ::fpos_t; +} +#endif /* * The standard file handles @@ -179,9 +200,7 @@ __MINGW_IMPORT FILE _iob[]; /* An array of FILE imported from DLL. */ #define stdout (&_iob[STDOUT_FILENO]) #define stderr (&_iob[STDERR_FILENO]) -#ifdef __cplusplus -extern "C" { -#endif +__BEGIN_CSTD_NAMESPACE /* * File Operations @@ -212,10 +231,14 @@ void setbuf (FILE*, char*); int fprintf (FILE*, const char*, ...); int printf (const char*, ...); int sprintf (char*, const char*, ...); -int _snprintf (char*, size_t, const char*, ...); int vfprintf (FILE*, const char*, __VALIST); int vprintf (const char*, __VALIST); int vsprintf (char*, const char*, __VALIST); + +__END_CSTD_NAMESPACE +__BEGIN_CGLOBAL_NAMESPACE + +int _snprintf (char*, size_t, const char*, ...); int _vsnprintf (char*, size_t, const char*, __VALIST); #ifndef __NO_ISOCEXT /* externs in libmingwex.a */ @@ -225,6 +248,9 @@ extern __inline__ int vsnprintf (char* s, size_t n, const char* format, { return _vsnprintf ( s, n, format, arg); } #endif +__END_CGLOBAL_NAMESPACE +__BEGIN_CSTD_NAMESPACE + /* * Formatted Input */ @@ -263,21 +289,6 @@ int fseek (FILE*, long, int); long ftell (FILE*); void rewind (FILE*); -/* - * An opaque data type used for storing file positions... The contents of - * this type are unknown, but we (the compiler) need to know the size - * because the programmer using fgetpos and fsetpos will be setting aside - * storage for fpos_t structres. Actually I tested using a byte array and - * it is fairly evident that the fpos_t type is a long (in CRTDLL.DLL). - * Perhaps an unsigned long? TODO? It's definitely a 64-bit number in - * MSVCRT however, and for now `long long' will do. - */ -#ifdef __MSVCRT__ -typedef long long fpos_t; -#else -typedef long fpos_t; -#endif - int fgetpos (FILE*, fpos_t*); int fsetpos (FILE*, const fpos_t*); @@ -290,6 +301,8 @@ int feof (FILE*); int ferror (FILE*); void perror (const char*); +__END_CSTD_NAMESPACE +__BEGIN_CGLOBAL_NAMESPACE #ifndef __STRICT_ANSI__ /* @@ -322,18 +335,19 @@ int fileno (FILE*); #endif /* Not __STRICT_ANSI__ */ +__END_CGLOBAL_NAMESPACE + /* Wide versions */ #ifndef _WSTDIO_DEFINED +__BEGIN_CSTD_NAMESPACE /* 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 _snwprintf (wchar_t*, size_t, const wchar_t*, ...); int vfwprintf (FILE*, const wchar_t*, __VALIST); int vwprintf (const wchar_t*, __VALIST); int vswprintf (wchar_t*, const wchar_t*, __VALIST); -int _vsnwprintf (wchar_t*, size_t, const wchar_t*, __VALIST); int fwscanf (FILE*, const wchar_t*, ...); int wscanf (const wchar_t*, ...); int swscanf (const wchar_t*, const wchar_t*, ...); @@ -347,7 +361,12 @@ wint_t getwc (FILE*); wint_t getwchar (void); wint_t putwc (wint_t, FILE*); wint_t putwchar (wint_t); +#endif + +__END_CSTD_NAMESPACE +__BEGIN_CGLOBAL_NAMESPACE +#ifdef __MSVCRT__ #ifndef __STRICT_ANSI__ wchar_t* _getws (wchar_t*); int _putws (const wchar_t*); @@ -364,6 +383,9 @@ FILE* _wpopen (const wchar_t*, const wchar_t*); #endif /* Not __STRICT_ANSI__ */ #endif /* __MSVCRT__ */ +/* C99 names, but non-standard behaviour */ +int _snwprintf (wchar_t*, size_t, const wchar_t*, ...); +int _vsnwprintf (wchar_t*, size_t, const wchar_t*, __VALIST); #ifndef __NO_ISOCEXT /* externs in libmingwex.a */ int snwprintf(wchar_t* s, size_t n, const wchar_t* format, ...); extern __inline__ int @@ -371,9 +393,13 @@ vsnwprintf (wchar_t* s, size_t n, const wchar_t* format, __VALIST arg) { return _vsnwprintf ( s, n, format, arg);} #endif +__END_CGLOBAL_NAMESPACE + #define _WSTDIO_DEFINED #endif /* _WSTDIO_DEFINED */ +__BEGIN_CGLOBAL_NAMESPACE + #ifndef __STRICT_ANSI__ #ifdef __MSVCRT__ #ifndef NO_OLDNAMES @@ -409,9 +435,7 @@ int __mingw_fwrite (const void*, size_t, size_t, FILE*); #endif /* __STRICT_ANSI */ -#ifdef __cplusplus -} -#endif +__END_CGLOBAL_NAMESPACE #endif /* Not RC_INVOKED */ diff --git a/winsup/mingw/include/tchar.h b/winsup/mingw/include/tchar.h new file mode 100644 index 00000000000..9a5c1a1ae56 --- /dev/null +++ b/winsup/mingw/include/tchar.h @@ -0,0 +1,397 @@ +/* + * tchar.h + * + * Unicode mapping layer for the standard C library. By including this + * file and using the 't' names for string functions + * (eg. _tprintf) you can make code which can be easily adapted to both + * Unicode and non-unicode environments. In a unicode enabled compile define + * _UNICODE before including tchar.h, otherwise the standard non-unicode + * library functions will be used. + * + * Note that you still need to include string.h or stdlib.h etc. to define + * the appropriate functions. Also note that there are several defines + * included for non-ANSI functions which are commonly available (but using + * the convention of prepending an underscore to non-ANSI library function + * names). + * + * 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 _TCHAR_H_ +#define _TCHAR_H_ + +/* All the headers include this file. */ +#include <_mingw.h> + +/* + * NOTE: This tests _UNICODE, which is different from the UNICODE define + * used to differentiate Win32 API calls. + */ +#ifdef _UNICODE + + +/* + * Use TCHAR instead of char or wchar_t. It will be appropriately translated + * if _UNICODE is correctly defined (or not). + */ +#ifndef _TCHAR_DEFINED +#ifndef RC_INVOKED +typedef wchar_t TCHAR; +typedef wchar_t _TCHAR; +#endif /* Not RC_INVOKED */ +#define _TCHAR_DEFINED +#endif + + +/* + * __TEXT is a private macro whose specific use is to force the expansion of a + * macro passed as an argument to the macros _T or _TEXT. DO NOT use this + * macro within your programs. It's name and function could change without + * notice. + */ +#define __TEXT(q) L##q + +/* 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 +#define _sntprintf _snwprintf +#define _vtprintf vwprintf +#define _vftprintf vfwprintf +#define _vstprintf vswprintf +#define _vsntprintf _vsnwprintf +#define _tscanf wscanf +#define _ftscanf fwscanf +#define _stscanf swscanf +#define _fgettc fgetwc +#define _fgettchar _fgetwchar +#define _fgetts fgetws +#define _fputtc fputwc +#define _fputtchar _fputwchar +#define _fputts fputws +#define _gettc getwc +#define _getts _getws +#define _puttc putwc +#define _putts _putws +#define _ungettc ungetwc +#define _tcstod wcstod +#define _tcstol wcstol +#define _tcstoul wcstoul +#define _itot _itow +#define _ltot _ltow +#define _ultot _ultow +#define _ttoi _wtoi +#define _ttol _wtol +#define _tcscat wcscat +#define _tcschr wcschr +#define _tcscmp wcscmp +#define _tcscpy wcscpy +#define _tcscspn wcscspn +#define _tcslen wcslen +#define _tcsncat wcsncat +#define _tcsncmp wcsncmp +#define _tcsncpy wcsncpy +#define _tcspbrk wcspbrk +#define _tcsrchr wcsrchr +#define _tcsspn wcsspn +#define _tcsstr wcsstr +#define _tcstok wcstok +#define _tcsdup _wcsdup +#define _tcsicmp _wcsicmp +#define _tcsnicmp _wcsnicmp +#define _tcsnset _wcsnset +#define _tcsrev _wcsrev +#define _tcsset _wcsset +#define _tcslwr _wcslwr +#define _tcsupr _wcsupr +#define _tcsxfrm wcsxfrm +#define _tcscoll wcscoll +#define _tcsicoll _wcsicoll +#define _istalpha iswalpha +#define _istupper iswupper +#define _istlower iswlower +#define _istdigit iswdigit +#define _istxdigit iswxdigit +#define _istspace iswspace +#define _istpunct iswpunct +#define _istalnum iswalnum +#define _istprint iswprint +#define _istgraph iswgraph +#define _istcntrl iswcntrl +#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 _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 _tfdopen _wfdopen +#define _tfopen _wfopen +#define _tgetenv _wgetenv +#define _tputenv _wputenv +#define _tsearchenv _wsearchenv +#define _tmakepath _wmakepath +#define _tsplitpath _wsplitpath +#define _tfullpath _wfullpath +#define _tmktemp _wmktemp +#define _topen _wopen +#define _tremove _wremove +#define _trename _wrename +#define _tsopen _wsopen +#define _tsetlocale _wsetlocale +#define _tunlink _wunlink +#define _tfinddata_t _wfinddata_t +#define _tfindfirsti64 _wfindfirsti64 +#define _tfindnexti64 _wfindnexti64 +#define _tfinddatai64_t _wfinddatai64_t +#endif /* __MSVCRT__ */ + +/* dirent structures and functions */ +#define _tdirent _wdirent +#define _TDIR _WDIR +#define _topendir _wopendir +#define _tclosedir _wclosedir +#define _treaddir _wreaddir +#define _trewinddir _wrewinddir +#define _ttelldir _wtelldir +#define _tseekdir _wseekdir +#else /* Not _UNICODE */ + +/* + * TCHAR, the type you should use instead of char. + */ +#ifndef _TCHAR_DEFINED +#ifndef RC_INVOKED +typedef char TCHAR; +typedef char _TCHAR; +#endif +#define _TCHAR_DEFINED +#endif + +/* + * __TEXT is a private macro whose specific use is to force the expansion of a + * macro passed as an argument to the macros _T or _TEXT. DO NOT use this + * macro within your programs. It's name and function could change without + * notice. + */ +#define __TEXT(q) q + +/* for porting from other Windows compilers */ +#define _tmain main +#define _tWinMain WinMain +#define _tenviron _environ +#define __targv __argv + +/* + * Non-unicode (standard) functions + */ + +#define _tprintf printf +#define _ftprintf fprintf +#define _stprintf sprintf +#define _sntprintf _snprintf +#define _vtprintf vprintf +#define _vftprintf vfprintf +#define _vstprintf vsprintf +#define _vsntprintf _vsnprintf +#define _tscanf scanf +#define _ftscanf fscanf +#define _stscanf sscanf +#define _fgettc fgetc +#define _fgettchar _fgetchar +#define _fgetts fgets +#define _fputtc fputc +#define _fputtchar _fputchar +#define _fputts fputs +#define _tfdopen _fdopen +#define _tfopen fopen +#define _tgetenv getenv +#define _tputenv _putenv +#define _tsearchenv _searchenv +#define _tmakepath _makepath +#define _tsplitpath _splitpath +#define _tfullpath _fullpath +#define _gettc getc +#define _getts gets +#define _puttc putc +#define _putts puts +#define _ungettc ungetc +#define _tcstod strtod +#define _tcstol strtol +#define _tcstoul strtoul +#define _itot _itoa +#define _ltot _ltoa +#define _ultot _ultoa +#define _ttoi atoi +#define _ttol atol +#define _tcscat strcat +#define _tcschr strchr +#define _tcscmp strcmp +#define _tcscpy strcpy +#define _tcscspn strcspn +#define _tcslen strlen +#define _tcsncat strncat +#define _tcsncmp strncmp +#define _tcsncpy strncpy +#define _tcspbrk strpbrk +#define _tcsrchr strrchr +#define _tcsspn strspn +#define _tcsstr strstr +#define _tcstok strtok +#define _tcsdup _strdup +#define _tcsicmp _stricmp +#define _tcsnicmp _strnicmp +#define _tcsnset _strnset +#define _tcsrev _strrev +#define _tcsset _strset +#define _tcslwr _strlwr +#define _tcsupr _strupr +#define _tcsxfrm strxfrm +#define _tcscoll strcoll +#define _tcsicoll _stricoll +#define _istalpha isalpha +#define _istupper isupper +#define _istlower islower +#define _istdigit isdigit +#define _istxdigit isxdigit +#define _istspace isspace +#define _istpunct ispunct +#define _istalnum isalnum +#define _istprint isprint +#define _istgraph isgraph +#define _istcntrl iscntrl +#define _istascii isascii +#define _totupper toupper +#define _totlower tolower +#define _tasctime asctime +#define _tctime ctime +#define _tstrdate _strdate +#define _tstrtime _strtime +#define _tutime _utime +#define _tcsftime strftime +/* 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 _tsetlocale setlocale +#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__ */ + +/* dirent structures and functions */ +#define _tdirent dirent +#define _TDIR DIR +#define _topendir opendir +#define _tclosedir closedir +#define _treaddir readdir +#define _trewinddir rewinddir +#define _ttelldir telldir +#define _tseekdir seekdir + +#endif /* Not _UNICODE */ + +/* + * UNICODE a constant string when _UNICODE is defined else returns the string + * unmodified. Also defined in w32api/winnt.h. + */ +#define _TEXT(x) __TEXT(x) +#define _T(x) __TEXT(x) + +#endif /* Not _TCHAR_H_ */ + diff --git a/winsup/mingw/include/time.h b/winsup/mingw/include/time.h new file mode 100644 index 00000000000..8a29efac898 --- /dev/null +++ b/winsup/mingw/include/time.h @@ -0,0 +1,220 @@ +/* + * time.h + * + * Date and time functions and types. + * + * 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 _TIME_H_ +#define _TIME_H_ + +/* All the headers include this file. */ +#include <_mingw.h> + +#define __need_wchar_t +#define __need_size_t +#define __need_NULL +#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'. + */ +#define CLOCKS_PER_SEC ((clock_t)1000) +#define CLK_TCK CLOCKS_PER_SEC + + +#ifndef RC_INVOKED + +__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 + */ +#ifndef _TIME_T_DEFINED +typedef long time_t; +#define _TIME_T_DEFINED +#endif + +/* + * A type for measuring processor time (in clock ticks). + */ +#ifndef _CLOCK_T_DEFINED +typedef long clock_t; +#define _CLOCK_T_DEFINED +#endif + + +/* + * A structure for storing all kinds of useful information about the + * current (or another) time. + */ +struct tm +{ + int tm_sec; /* Seconds: 0-59 (K&R says 0-61?) */ + int tm_min; /* Minutes: 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 Jan. 1: 0-365 */ + int tm_isdst; /* +1 Daylight Savings Time, 0 No DST, + * -1 don't know */ +}; + + +clock_t clock (void); +time_t time (time_t*); +double difftime (time_t, time_t); +time_t mktime (struct tm*); + +/* + * These functions write to and return pointers to static buffers that may + * be overwritten by other function calls. Yikes! + * + * NOTE: localtime, and perhaps the others of the four functions grouped + * below may return NULL if their argument is not 'acceptable'. Also note + * that calling asctime with a NULL pointer will produce an Invalid Page + * Fault and crap out your program. Guess how I know. Hint: stat called on + * a directory gives 'invalid' times in st_atime etc... + */ +char* asctime (const struct tm*); +char* ctime (const time_t*); +struct tm* gmtime (const time_t*); +struct tm* localtime (const time_t*); + + +size_t strftime (char*, size_t, const char*, const struct tm*); + +size_t wcsftime (wchar_t*, size_t, const wchar_t*, const struct tm*); + +__END_CSTD_NAMESPACE +__BEGIN_CGLOBAL_NAMESPACE + +#ifndef __STRICT_ANSI__ +extern void _tzset (void); + +#ifndef _NO_OLDNAMES +extern void tzset (void); +#endif + +size_t strftime(char*, size_t, const char*, const struct tm*); +char* _strdate(char*); +char* _strtime(char*); + +#endif /* Not __STRICT_ANSI__ */ + +/* + * _daylight: non zero if daylight savings time is used. + * _timezone: difference in seconds between GMT and local time. + * _tzname: standard/daylight savings time zone names (an array with two + * elements). + */ +#ifdef __MSVCRT__ + +/* These are for compatibility with pre-VC 5.0 suppied MSVCRT. */ +extern int* __p__daylight (void); +extern long* __p__timezone (void); +extern char** __p__tzname (void); + +__MINGW_IMPORT int _daylight; +__MINGW_IMPORT long _timezone; +__MINGW_IMPORT char *_tzname[2]; + +#else /* not __MSVCRT (ie. crtdll) */ + +#ifndef __DECLSPEC_SUPPORTED + +extern int* _imp___daylight_dll; +extern long* _imp___timezone_dll; +extern char** _imp___tzname; + +#define _daylight (*_imp___daylight_dll) +#define _timezone (*_imp___timezone_dll) +#define _tzname (*_imp___tzname) + +#else /* __DECLSPEC_SUPPORTED */ + +__MINGW_IMPORT int _daylight_dll; +__MINGW_IMPORT long _timezone_dll; +__MINGW_IMPORT char* _tzname[2]; + +#define _daylight _daylight_dll +#define _timezone _timezone_dll + +#endif /* __DECLSPEC_SUPPORTED */ + +#endif /* not __MSVCRT__ */ + +#ifndef _NO_OLDNAMES + +#ifdef __MSVCRT__ + +/* These go in the oldnames import library for MSVCRT. */ +__MINGW_IMPORT int daylight; +__MINGW_IMPORT long timezone; +__MINGW_IMPORT char *tzname[2]; + +#ifndef _WTIME_DEFINED + +/* wide function prototypes, also declared in wchar.h */ + +wchar_t * _wasctime(const struct tm*); +wchar_t * _wctime(const time_t*); +wchar_t* _wstrdate(wchar_t*); +wchar_t* _wstrtime(wchar_t*); + +#define _WTIME_DEFINED +#endif /* _WTIME_DEFINED */ + + +#else /* not __MSVCRT__ */ + +/* CRTDLL is royally messed up when it comes to these macros. + TODO: import and alias these via oldnames import library instead + of macros. */ + +#define daylight _daylight +/* NOTE: timezone not defined because it would conflict with sys/timeb.h. + Also, tzname used to a be macro, but now it's in moldname. */ +__MINGW_IMPORT char *tzname[2]; + +#endif /* not __MSVCRT__ */ + +#endif /* Not _NO_OLDNAMES */ + +__END_CGLOBAL_NAMESPACE + +#endif /* Not RC_INVOKED */ + +#endif /* Not _TIME_H_ */ + diff --git a/winsup/mingw/include/wchar.h b/winsup/mingw/include/wchar.h index e67ecb65181..01c584e88e0 100644 --- a/winsup/mingw/include/wchar.h +++ b/winsup/mingw/include/wchar.h @@ -47,9 +47,7 @@ #ifndef RC_INVOKED -#ifdef __cplusplus -extern "C" { -#endif +__BEGIN_CGLOBAL_NAMESPACE #ifndef __STRICT_ANSI__ @@ -99,57 +97,73 @@ int _wfindnexti64 (long, struct _wfinddatai64_t*); #endif /* _WIO_DEFINED */ #endif /* __STRICT_ANSI__ */ +__END_CGLOBAL_NAMESPACE + #ifndef _WSTDIO_DEFINED -/* also in stdio.h - keep in sync */ +__BEGIN_CSTD_NAMESPACE +/* 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 _snwprintf (wchar_t*, size_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 _vsnwprintf (wchar_t*, size_t, const wchar_t*, va_list); +int vfwprintf (FILE*, const wchar_t*, __VALIST); +int vwprintf (const wchar_t*, __VALIST); +int vswprintf (wchar_t*, const wchar_t*, __VALIST); 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*); - -#ifndef __NO_ISOCEXT /* externs in libmingwex.a */ -int snwprintf(wchar_t* s, size_t n, const wchar_t* format, ...); -extern __inline__ int vsnwprintf (wchar_t* s, size_t n, const wchar_t* format, - va_list arg) - { return _vsnwprintf ( s, n, format, arg); } -#endif - #ifdef __MSVCRT__ wchar_t* fgetws (wchar_t*, int, FILE*); int fputws (const wchar_t*, FILE*); wint_t getwc (FILE*); -wint_t getwchar (void); +wint_t getwchar (void); wint_t putwc (wint_t, FILE*); wint_t putwchar (wint_t); +#endif +__END_CSTD_NAMESPACE +__BEGIN_CGLOBAL_NAMESPACE + +#ifdef __MSVCRT__ #ifndef __STRICT_ANSI__ wchar_t* _getws (wchar_t*); int _putws (const wchar_t*); FILE* _wfdopen(int, wchar_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); +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 /* __STRICT_ANSI__ */ +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 /* Not __STRICT_ANSI__ */ #endif /* __MSVCRT__ */ + +/* C99 names, but non-standard behaviour */ +int _snwprintf (wchar_t*, size_t, const wchar_t*, ...); +int _vsnwprintf (wchar_t*, size_t, const wchar_t*, __VALIST); +#ifndef __NO_ISOCEXT /* externs in libmingwex.a */ +int snwprintf(wchar_t* s, size_t n, const wchar_t* format, ...); +extern __inline__ int +vsnwprintf (wchar_t* s, size_t n, const wchar_t* format, __VALIST arg) + { return _vsnwprintf ( s, n, format, arg);} +#endif +__END_CGLOBAL_NAMESPACE #define _WSTDIO_DEFINED #endif /* _WSTDIO_DEFINED */ + +__BEGIN_CGLOBAL_NAMESPACE + #ifndef __STRICT_ANSI__ +/* + * wide char functions from direct.h, sys/stat.h and + * locale.h + */ #ifndef _WDIRECT_DEFINED /* Also in direct.h */ #ifdef __MSVCRT__ @@ -229,9 +243,16 @@ int _wstati64 (const wchar_t*, struct _stati64*); #define _WSTAT_DEFINED #endif /* ! _WSTAT_DEFIND */ -#endif /* __STRICT_ANSI__ */ +#ifndef _WLOCALE_DEFINED /* also declared in locale.h */ +wchar_t* _wsetlocale (int, const wchar_t*); +#define _WLOCALE_DEFINED +#endif +#endif /* __STRICT_ANSI__ */ + +__END_CGLOBAL_NAMESPACE #ifndef _WTIME_DEFINED +__BEGIN_CGLOBAL_NAMESPACE #ifdef __MSVCRT__ #ifndef __STRICT_ANSI__ /* wide function prototypes, also declared in time.h */ @@ -241,18 +262,15 @@ wchar_t* _wstrdate (wchar_t*); wchar_t* _wstrtime (wchar_t*); #endif /* __MSVCRT__ */ #endif /* __STRICT_ANSI__ */ +__END_CGLOBAL_NAMESPACE +__BEGIN_CSTD_NAMESPACE size_t wcsftime (wchar_t*, size_t, const wchar_t*, const struct tm*); +__END_CSTD_NAMESPACE #define _WTIME_DEFINED #endif /* _WTIME_DEFINED */ -#ifndef __STRICT_ANSI__ -#ifndef _WLOCALE_DEFINED /* also declared in locale.h */ -wchar_t* _wsetlocale (int, const wchar_t*); -#define _WLOCALE_DEFINED -#endif -#endif /* __STRICT_ANSI__ */ - #ifndef _WSTDLIB_DEFINED /* also declared in stdlib.h */ +__BEGIN_CSTD_NAMESPACE long wcstol (const wchar_t*, wchar_t**, int); unsigned long wcstoul (const wchar_t*, wchar_t**, int); double wcstod (const wchar_t*, wchar_t**); @@ -260,9 +278,11 @@ double wcstod (const wchar_t*, wchar_t**); extern __inline__ float wcstof( const wchar_t *nptr, wchar_t **endptr) { return (wcstod(nptr, endptr)); } #endif /* __NO_ISOCEXT */ +__END_CSTD_NAMESPACE #define _WSTDLIB_DEFINED #endif +__BEGIN_CGLOBAL_NAMESPACE #ifndef __STRICT_ANSI__ #ifndef _NO_OLDNAMES @@ -284,6 +304,9 @@ wchar_t* wmktemp (wchar_t *); #endif /* _NO_OLDNAMES */ #endif /* not __STRICT_ANSI__ */ +__END_CGLOBAL_NAMESPACE +__BEGIN_CSTD_NAMESPACE + /* 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. */ @@ -315,9 +338,7 @@ unsigned long long wcstoull(const wchar_t* __restrict__ nptr, #endif /* __NO_ISOCEXT */ -#ifdef __cplusplus -} /* end of extern "C" */ -#endif +__END_CSTD_NAMESPACE #endif /* Not RC_INVOKED */ |