2000-02-17 20:38:33 +01:00
|
|
|
/*
|
|
|
|
* 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
|
2001-12-05 16:01:06 +01:00
|
|
|
* DISCLAIMED. This includes but is not limited to warranties of
|
2000-02-17 20:38:33 +01:00
|
|
|
* 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. */
|
|
|
|
};
|
2000-11-21 03:50:03 +01:00
|
|
|
struct _wfinddatai64_t {
|
|
|
|
unsigned attrib;
|
|
|
|
time_t time_create;
|
|
|
|
time_t time_access;
|
|
|
|
time_t time_write;
|
|
|
|
__int64 size;
|
|
|
|
wchar_t name[FILENAME_MAX];
|
|
|
|
};
|
2000-02-17 20:38:33 +01:00
|
|
|
#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? */
|
2000-11-21 03:50:03 +01:00
|
|
|
#if !defined (_WIO_DEFINED)
|
|
|
|
#if defined (__MSVCRT__)
|
2003-02-10 22:13:34 +01:00
|
|
|
_CRTIMP int __cdecl _waccess (const wchar_t*, int);
|
|
|
|
_CRTIMP int __cdecl _wchmod (const wchar_t*, int);
|
|
|
|
_CRTIMP int __cdecl _wcreat (const wchar_t*, int);
|
|
|
|
_CRTIMP long __cdecl _wfindfirst (const wchar_t*, struct _wfinddata_t *);
|
|
|
|
_CRTIMP int __cdecl _wfindnext (long, struct _wfinddata_t *);
|
|
|
|
_CRTIMP int __cdecl _wunlink (const wchar_t*);
|
|
|
|
_CRTIMP int __cdecl _wopen (const wchar_t*, int, ...);
|
|
|
|
_CRTIMP int __cdecl _wsopen (const wchar_t*, int, int, ...);
|
|
|
|
_CRTIMP wchar_t* __cdecl _wmktemp (wchar_t*);
|
|
|
|
_CRTIMP long __cdecl _wfindfirsti64 (const wchar_t*, struct _wfinddatai64_t*);
|
|
|
|
_CRTIMP int __cdecl _wfindnexti64 (long, struct _wfinddatai64_t*);
|
2000-11-21 03:50:03 +01:00
|
|
|
#endif /* defined (__MSVCRT__) */
|
|
|
|
#define _WIO_DEFINED
|
|
|
|
#endif /* _WIO_DEFINED */
|
|
|
|
|
|
|
|
#ifndef _WSTDIO_DEFINED
|
|
|
|
/* also in stdio.h - keep in sync */
|
2003-02-10 22:13:34 +01:00
|
|
|
_CRTIMP int __cdecl fwprintf (FILE*, const wchar_t*, ...);
|
|
|
|
_CRTIMP int __cdecl wprintf (const wchar_t*, ...);
|
|
|
|
_CRTIMP int __cdecl swprintf (wchar_t*, const wchar_t*, ...);
|
|
|
|
_CRTIMP int __cdecl _snwprintf (wchar_t*, size_t, const wchar_t*, ...);
|
|
|
|
_CRTIMP int __cdecl vfwprintf (FILE*, const wchar_t*, __VA_LIST);
|
|
|
|
_CRTIMP int __cdecl vwprintf (const wchar_t*, __VA_LIST);
|
|
|
|
_CRTIMP int __cdecl vswprintf (wchar_t*, const wchar_t*, __VA_LIST);
|
|
|
|
_CRTIMP int __cdecl _vsnwprintf (wchar_t*, size_t, const wchar_t*, __VA_LIST);
|
|
|
|
_CRTIMP int __cdecl fwscanf (FILE*, const wchar_t*, ...);
|
|
|
|
_CRTIMP int __cdecl wscanf (const wchar_t*, ...);
|
|
|
|
_CRTIMP int __cdecl swscanf (const wchar_t*, const wchar_t*, ...);
|
|
|
|
_CRTIMP wint_t __cdecl fgetwc (FILE*);
|
|
|
|
_CRTIMP wint_t __cdecl fputwc (wchar_t, FILE*);
|
|
|
|
_CRTIMP wint_t __cdecl ungetwc (wchar_t, FILE*);
|
2000-11-21 03:50:03 +01:00
|
|
|
|
2002-06-13 12:20:48 +02:00
|
|
|
#ifndef __NO_ISOCEXT /* externs in libmingwex.a */
|
2003-02-10 22:13:34 +01:00
|
|
|
int __cdecl snwprintf(wchar_t* s, size_t n, const wchar_t* format, ...);
|
|
|
|
extern __inline__ int __cdecl vsnwprintf (wchar_t* s, size_t n, const wchar_t* format,
|
|
|
|
__VA_LIST arg)
|
2002-06-13 12:20:48 +02:00
|
|
|
{ return _vsnwprintf ( s, n, format, arg); }
|
|
|
|
#endif
|
|
|
|
|
2000-11-21 03:50:03 +01:00
|
|
|
#ifdef __MSVCRT__
|
2003-02-10 22:13:34 +01:00
|
|
|
_CRTIMP wchar_t* __cdecl fgetws (wchar_t*, int, FILE*);
|
|
|
|
_CRTIMP int __cdecl fputws (const wchar_t*, FILE*);
|
|
|
|
_CRTIMP wint_t __cdecl getwc (FILE*);
|
|
|
|
_CRTIMP wint_t __cdecl getwchar (void);
|
|
|
|
_CRTIMP wchar_t* __cdecl _getws (wchar_t*);
|
|
|
|
_CRTIMP wint_t __cdecl putwc (wint_t, FILE*);
|
|
|
|
_CRTIMP int __cdecl _putws (const wchar_t*);
|
|
|
|
_CRTIMP wint_t __cdecl putwchar (wint_t);
|
|
|
|
_CRTIMP FILE* __cdecl _wfdopen(int, wchar_t *);
|
|
|
|
_CRTIMP FILE* __cdecl _wfopen (const wchar_t*, const wchar_t*);
|
|
|
|
_CRTIMP FILE* __cdecl _wfreopen (const wchar_t*, const wchar_t*, FILE*);
|
|
|
|
_CRTIMP FILE* __cdecl _wfsopen (const wchar_t*, const wchar_t*, int);
|
|
|
|
_CRTIMP wchar_t* __cdecl _wtmpnam (wchar_t*);
|
|
|
|
_CRTIMP wchar_t* __cdecl _wtempnam (const wchar_t*, const wchar_t*);
|
|
|
|
_CRTIMP int __cdecl _wrename (const wchar_t*, const wchar_t*);
|
|
|
|
_CRTIMP int __cdecl _wremove (const wchar_t*)
|
|
|
|
|
|
|
|
_CRTIMP FILE* __cdecl _wpopen (const wchar_t*, const wchar_t*)
|
|
|
|
_CRTIMP void __cdecl _wperror (const wchar_t*);
|
2000-11-21 03:50:03 +01:00
|
|
|
#endif /* __MSVCRT__ */
|
|
|
|
#define _WSTDIO_DEFINED
|
|
|
|
#endif /* _WSTDIO_DEFINED */
|
2000-02-17 20:38:33 +01:00
|
|
|
|
|
|
|
#ifndef _WDIRECT_DEFINED
|
|
|
|
/* Also in direct.h */
|
2000-11-21 03:50:03 +01:00
|
|
|
#ifdef __MSVCRT__
|
2003-02-10 22:13:34 +01:00
|
|
|
_CRTIMP int __cdecl _wchdir (const wchar_t*);
|
|
|
|
_CRTIMP wchar_t* __cdecl _wgetcwd (wchar_t*, int);
|
|
|
|
_CRTIMP wchar_t* __cdecl _wgetdcwd (int, wchar_t*, int);
|
|
|
|
_CRTIMP int __cdecl _wmkdir (const wchar_t*);
|
|
|
|
_CRTIMP int __cdecl _wrmdir (const wchar_t*);
|
2000-11-21 03:50:03 +01:00
|
|
|
#endif /* __MSVCRT__ */
|
2000-02-17 20:38:33 +01:00
|
|
|
#define _WDIRECT_DEFINED
|
2000-11-21 03:50:03 +01:00
|
|
|
#endif /* _WDIRECT_DEFINED */
|
2000-02-17 20:38:33 +01:00
|
|
|
|
|
|
|
#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 */
|
|
|
|
};
|
2000-11-21 03:50:03 +01:00
|
|
|
#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__ */
|
2000-02-17 20:38:33 +01:00
|
|
|
#define _STAT_DEFINED
|
|
|
|
#endif /* _STAT_DEFINED */
|
|
|
|
|
2000-11-21 03:50:03 +01:00
|
|
|
#if !defined ( _WSTAT_DEFINED)
|
2000-02-17 20:38:33 +01:00
|
|
|
/* also declared in sys/stat.h */
|
2000-11-21 03:50:03 +01:00
|
|
|
#if defined __MSVCRT__
|
2003-02-10 22:13:34 +01:00
|
|
|
_CRTIMP int __cdecl _wstat (const wchar_t*, struct _stat*);
|
|
|
|
_CRTIMP int __cdecl _wstati64 (const wchar_t*, struct _stati64*);
|
2000-11-21 03:50:03 +01:00
|
|
|
#endif /* __MSVCRT__ */
|
2000-02-17 20:38:33 +01:00
|
|
|
#define _WSTAT_DEFINED
|
2000-11-21 03:50:03 +01:00
|
|
|
#endif /* ! _WSTAT_DEFIND */
|
2000-02-17 20:38:33 +01:00
|
|
|
|
|
|
|
#ifndef _WTIME_DEFINED
|
|
|
|
#ifdef __MSVCRT__
|
|
|
|
/* wide function prototypes, also declared in time.h */
|
2003-02-10 22:13:34 +01:00
|
|
|
_CRTIMP wchar_t* __cdecl _wasctime (const struct tm*);
|
|
|
|
_CRTIMP wchar_t* __cdecl _wctime (const time_t*);
|
|
|
|
_CRTIMP wchar_t* __cdecl _wstrdate (wchar_t*);
|
|
|
|
_CRTIMP wchar_t* __cdecl _wstrtime (wchar_t*);
|
2000-02-17 20:38:33 +01:00
|
|
|
#endif /* __MSVCRT__ */
|
2003-02-10 22:13:34 +01:00
|
|
|
_CRTIMP size_t __cdecl wcsftime (wchar_t*, size_t, const wchar_t*, const struct tm*);
|
2000-02-17 20:38:33 +01:00
|
|
|
#define _WTIME_DEFINED
|
|
|
|
#endif /* _WTIME_DEFINED */
|
|
|
|
|
2000-11-21 03:50:03 +01:00
|
|
|
#ifndef _WLOCALE_DEFINED /* also declared in locale.h */
|
2003-02-10 22:13:34 +01:00
|
|
|
_CRTIMP wchar_t* __cdecl _wsetlocale (int, const wchar_t*);
|
2000-11-21 03:50:03 +01:00
|
|
|
#define _WLOCALE_DEFINED
|
|
|
|
#endif
|
|
|
|
|
2002-06-13 12:20:48 +02:00
|
|
|
#ifndef _WSTDLIB_DEFINED /* also declared in stdlib.h */
|
2003-02-10 22:13:34 +01:00
|
|
|
_CRTIMP long __cdecl wcstol (const wchar_t*, wchar_t**, int);
|
|
|
|
_CRTIMP unsigned long __cdecl wcstoul (const wchar_t*, wchar_t**, int);
|
|
|
|
_CRTIMP double __cdecl wcstod (const wchar_t*, wchar_t**);
|
2002-06-13 12:20:48 +02:00
|
|
|
#if !defined __NO_ISOCEXT /* extern stub in static libmingwex.a */
|
2003-02-10 22:13:34 +01:00
|
|
|
extern __inline__ float __cdecl wcstof( const wchar_t *nptr, wchar_t **endptr)
|
2002-06-13 12:20:48 +02:00
|
|
|
{ return (wcstod(nptr, endptr)); }
|
2003-02-10 22:13:34 +01:00
|
|
|
long double __cdecl wcstold (const wchar_t * __restrict__, wchar_t ** __restrict__);
|
2002-06-13 12:20:48 +02:00
|
|
|
#endif /* __NO_ISOCEXT */
|
|
|
|
#define _WSTDLIB_DEFINED
|
|
|
|
#endif
|
|
|
|
|
2000-02-17 20:38:33 +01:00
|
|
|
|
|
|
|
#ifndef _NO_OLDNAMES
|
|
|
|
|
2000-11-21 03:50:03 +01:00
|
|
|
/* Wide character versions. Also declared in io.h. */
|
|
|
|
/* CHECK: Are these in the oldnames??? NO! */
|
|
|
|
#if (0)
|
2003-02-10 22:13:34 +01:00
|
|
|
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 *);
|
2000-11-21 03:50:03 +01:00
|
|
|
#endif
|
2000-02-17 20:38:33 +01:00
|
|
|
#endif /* _NO_OLDNAMES */
|
|
|
|
|
|
|
|
#endif /* not __STRICT_ANSI__ */
|
|
|
|
|
2001-01-28 19:06:17 +01:00
|
|
|
/* 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. */
|
2000-02-17 20:38:33 +01:00
|
|
|
typedef int mbstate_t;
|
|
|
|
typedef wchar_t _Wint_t;
|
|
|
|
|
2003-02-10 22:13:34 +01:00
|
|
|
wint_t __cdecl btowc(int);
|
|
|
|
size_t __cdecl mbrlen(const char *, size_t, mbstate_t *);
|
|
|
|
size_t __cdecl mbrtowc(wchar_t *, const char *, size_t, mbstate_t *);
|
|
|
|
size_t __cdecl mbsrtowcs(wchar_t *, const char **, size_t, mbstate_t *);
|
2000-02-17 20:38:33 +01:00
|
|
|
|
2003-02-10 22:13:34 +01:00
|
|
|
size_t __cdecl wcrtomb(char *, wchar_t, mbstate_t *);
|
|
|
|
size_t __cdecl wcsrtombs(char *, const wchar_t **, size_t, mbstate_t *);
|
|
|
|
int __cdecl wctob(wint_t);
|
2000-02-17 20:38:33 +01:00
|
|
|
|
2002-06-13 12:20:48 +02:00
|
|
|
#ifndef __NO_ISOCEXT /* these need static lib libmingwex.a */
|
2003-02-10 22:13:34 +01:00
|
|
|
extern __inline__ int __cdecl fwide(FILE* stream, int mode) {return -1;} /* limited to byte orientation */
|
|
|
|
extern __inline__ int __cdecl mbsinit(const mbstate_t* ps) {return 1;}
|
|
|
|
wchar_t* __cdecl wmemset(wchar_t* s, wchar_t c, size_t n);
|
|
|
|
wchar_t* __cdecl wmemchr(const wchar_t* s, wchar_t c, size_t n);
|
2002-06-13 12:20:48 +02:00
|
|
|
int wmemcmp(const wchar_t* s1, const wchar_t * s2, size_t n);
|
2003-02-10 22:13:34 +01:00
|
|
|
wchar_t* __cdecl wmemcpy(wchar_t* __restrict__ s1, const wchar_t* __restrict__ s2,
|
2002-06-13 12:20:48 +02:00
|
|
|
size_t n);
|
2003-02-10 22:13:34 +01:00
|
|
|
wchar_t* __cdecl wmemmove(wchar_t* s1, const wchar_t* s2, size_t n);
|
|
|
|
long long __cdecl wcstoll(const wchar_t* __restrict__ nptr,
|
2002-06-13 12:20:48 +02:00
|
|
|
wchar_t** __restrict__ endptr, int base);
|
2003-02-10 22:13:34 +01:00
|
|
|
unsigned long long __cdecl wcstoull(const wchar_t* __restrict__ nptr,
|
2002-06-13 12:20:48 +02:00
|
|
|
wchar_t ** __restrict__ endptr, int base);
|
|
|
|
#endif /* __NO_ISOCEXT */
|
|
|
|
|
|
|
|
|
2000-11-21 03:50:03 +01:00
|
|
|
#ifdef __cplusplus
|
|
|
|
} /* end of extern "C" */
|
2000-02-17 20:38:33 +01:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif /* Not RC_INVOKED */
|
|
|
|
|
|
|
|
#endif /* not _WCHAR_H_ */
|
|
|
|
|