wchar.h
上传用户:fy98168
上传日期:2015-06-26
资源大小:13771k
文件大小:8k
- /*
- * Benedict R. Gaster
- * Copyright STMicroelectronics 1999
- */
- #ifndef __wchar_h
- #define __wchar_h
- #ifdef __cplusplus
- extern "C" {
- #endif
- #include "stddef.h"
- #include "stdio.h"
- #include "stdarg.h"
- #ifndef __size_t
- # define __size_t
- # ifndef _STDC_C_TYPES_H
- /*typedef unsigned int size_t; */ /* see :<stddef.h>, <stdio.h> */
- # endif
- #endif
- #ifndef __wint_t
- # define __wint_t
- typedef int wint_t;
- #endif
- #ifndef NULL
- # ifdef __cplusplus
- # define NULL 0
- # else
- # define NULL (void *)0
- # endif
- /* also in <stddef.h> */
- #endif
- /* incomplete struct tm see <time.h> also */
- struct tm ;
- /* mbstate_t type definition */
- typedef struct
- {
- char _State;
- wchar_t _Wchar;
- } mbstate_t ;
- /*
- * benedict 20/2/2000
- * the following two hash defines are used in the definitions of WCHAR_MIN
- * and WCHAR_MAX, respetively. they are copies of the same hash defines
- * from <limits.h> but are included here as it is not a requirment for
- * <limits.h> to be included for <wchar.h>.
- *
- * it would be nice to have no copies but this would require pulling out
- * the definitions of CHAR_MIN and CHAR_MAX from <limits.h>, putting
- * them in a seperate header and then including that header from both
- * <limits.h> and <wchar.h>.
- */
- #ifdef __SIGNED_CHAR__
- # if !(defined(CHAR_MIN))
- # define CHAR_MIN (-128)
- # endif
- # if !(defined(CHAR_MAX))
- # define CHAR_MAX 127
- # endif
- #else
- # if !(defined(CHAR_MIN))
- # define CHAR_MIN 0
- # endif
- # if !(defined(CHAR_MAX))
- # define CHAR_MAX 255
- # endif
- #endif
- #if !(defined(CHAR_MIN))
- /*#define CHAR_MIN (-0x80)*/ /* min value of a "signed char" */
- #define CHAR_MIN (-128) /* min value of a "signed char" */
- #endif
- #if !(defined(CHAR_MAX))
- /*#define CHAR_MAX 0x7f*/ /* max value of a "signed char" */
- #define CHAR_MAX 127 /* max value of a "signed char" */
- #endif
- /***********************************************************************/
- /* MACROS DEFINITIONS */
- /***********************************************************************/
- #define WCHAR_MAX CHAR_MAX
- /*max value representable by an object of type wchar_t */
- #define WCHAR_MIN CHAR_MIN
- /*min value representable by an object of type wchar_t */
- #ifndef WEOF /* wide end of file */
- #define WEOF (-1)
- #endif
- /***********************************************************************/
- /* EXTENDED MULTIBYTE AND WIDE CHARACTER CONVERSION UTILITIES */
- /***********************************************************************/
- wint_t btowc(int c);
- int wctob(wint_t c);
- int mbsinit(const mbstate_t *ps);
- /***********************************************************************
- * RESTARTABLE CONVERSION FUNCTIONS *
- ***********************************************************************/
- size_t mbrlen(const char *s, size_t n , mbstate_t *ps);
- size_t mbrtowc(wchar_t *pwc , const char *s, size_t n,
- mbstate_t *ps);
- size_t wcrtomb(char *s , wchar_t wc , mbstate_t *ps );
- size_t mbsrtowcs( wchar_t *ws , const char **ps , size_t n,
- mbstate_t *pcs );
- size_t wcsrtombs(char *s, const wchar_t **pws , size_t n,
- mbstate_t *pcs );
- /***********************************************************************
- * WIDE-STRING FUNCTIONS *
- ***********************************************************************/
- wchar_t *wcscat( wchar_t *dest, const wchar_t *src );
- wchar_t *wcsncat( wchar_t *dest , const wchar_t *src ,size_t n);
- int wcscmp(const wchar_t *s1 , const wchar_t *s2);
- int wcsncmp( const wchar_t *s1, const wchar_t *s2 , size_t n);
- wchar_t *wcscpy(wchar_t *dest , const wchar_t *src);
- wchar_t *wcsncpy( wchar_t *dest , const wchar_t *src ,size_t n);
- size_t wcslen( const wchar_t *s);
- size_t wcsspn( const wchar_t *s ,const wchar_t *set);
- size_t wcscspn(const wchar_t *s , const wchar_t *set);
- wchar_t *wcstok ( wchar_t *str , const wchar_t *set , wchar_t **ptr);
- double wcstod ( const wchar_t *str , wchar_t **ptr);
- long wcstol(const wchar_t *str , wchar_t **ptr , int base);
- unsigned long wcstoul ( const wchar_t *str , wchar_t **ptr , int base);
- int wcscoll( const wchar_t *s1 , const wchar_t *s2);
- size_t wcsxfrm(wchar_t *dest , const wchar_t *src , size_t len);
- #ifdef __cplusplus
- extern const wchar_t* wcschr(const wchar_t* s, wchar_t c);
- extern const wchar_t* wcspbrk(const wchar_t* s, const wchar_t* set);
- extern const wchar_t* wcsrchr(const wchar_t* s, wchar_t c);
- extern const wchar_t* wcsstr(const wchar_t* src, const wchar_t* sub);
- extern "C++"
- {
- extern inline wchar_t* wcschr(wchar_t* s, wchar_t c)
- {
- return (wchar_t*) (wcschr((const wchar_t*) s, c));
- }
- extern inline wchar_t* wcspbrk(wchar_t* s, const wchar_t* set)
- {
- return (wchar_t*) (wcspbrk((const wchar_t*) s, set));
- }
- extern inline wchar_t* wcsrchr(wchar_t* s, wchar_t c)
- {
- return (wchar_t*) (wcsrchr((const wchar_t*) s, c));
- }
- extern inline wchar_t* wcsstr(wchar_t* src, const wchar_t* sub)
- {
- return (wchar_t*) (wcsstr((const wchar_t*) src, sub));
- }
- }
- #else
- wchar_t *wcschr( const wchar_t *s , wchar_t c);
- wchar_t *wcsrchr(const wchar_t *s , wchar_t c);
- wchar_t *wcspbrk( const wchar_t *s , const wchar_t *set);
- wchar_t *wcsstr ( const wchar_t *src , const wchar_t *sub);
- #endif /* __cplusplus */
- /************************************************************************
- * MEMORY FUNCTIONS *
- ************************************************************************/
- int wmemcmp (const wchar_t *ptr1 ,const wchar_t *ptr2 , size_t len);
- wchar_t *wmemcpy( wchar_t *dest , const wchar_t *src ,size_t len);
- wchar_t *wmemmove( wchar_t *dest , const wchar_t *src ,size_t len);
- wchar_t *wmemset( wchar_t *ptr, wchar_t val, size_t len);
- #ifdef __cplusplus
- extern const wchar_t* wmemchr(const wchar_t* s, wchar_t c, size_t n);
- extern "C++"
- {
- extern inline wchar_t* wmemchr(wchar_t* s, wchar_t c, size_t n)
- {
- return (wchar_t*) (wmemchr((const wchar_t*) s, c, n));
- }
- }
- #else /* __cplusplus */
- wchar_t *wmemchr(const wchar_t * , wchar_t , size_t );
- #endif /* __cplusplus */
- /***************************************************************************
- * WIDE-STRING TIME CONVERSION FUNCTION *
- ***************************************************************************/
- size_t wcsftime (wchar_t *s, size_t msz, const wchar_t *fmt, const struct tm *tm);
- /*typedef struct __sFILE __FILE ;*/ /* avoid to introduce stdio.h */
- /************************************************************************
- * WIDE- CHARACTER I/O FUNCTIONS AND MACROS *
- ************************************************************************/
- wint_t fgetwc(FILE *stream);
- wchar_t *fgetws(wchar_t *s , int n, FILE *stream);
- wint_t fputwc(wchar_t c, FILE *stream);
- int fputws( const wchar_t *s , FILE *stream );
- wint_t (getwc)(FILE *stream);
- wint_t (getwchar)(void);
- wint_t putwc (wchar_t c ,FILE *stream);
- wint_t putwchar( wchar_t c);
- wint_t ungetwc(wint_t c, FILE *stream);
- int fwide (FILE *stream ,int mode);
- /************************************************************************
- WIDE- CHARACTER I/O STREAMS FUNCTIONS
- ************************************************************************/
- /*typedef char * _va_list[1] ;*/ /* that avoids to include stdarg.h */
- int fwscanf( FILE *stream , const wchar_t *format , ...);
- int wscanf( const wchar_t *format , ...);
- int swscanf(const wchar_t *s , const wchar_t *format , ...);
- int fwprintf( FILE *stream , const wchar_t *format , ...);
- int wprintf( const wchar_t *format , ...);
- int swprintf(wchar_t *s , size_t n , const wchar_t * format , ...);
- int vfwprintf( FILE *stream , const wchar_t *format, va_list a);
- int vwprintf(const wchar_t *format, va_list arg);
- int vswprintf(wchar_t *s, size_t n , const wchar_t *format,va_list a);
- #ifdef __cplusplus
- }
- #endif
- #endif