]> pd.if.org Git - pdclib/blob - includes/wchar.h
Re-import from Subversion.
[pdclib] / includes / wchar.h
1 /* ----------------------------------------------------------------------------
2  * $Id$
3  * ----------------------------------------------------------------------------
4  * Public Domain C Library - http://pdclib.sourceforge.net
5  * This code is Public Domain. Use, modify, and redistribute at will.
6  * ----------------------------------------------------------------------------
7  * Extended multibyte and wide character utilities
8  * --------------------------------------------------------------------------*/
9
10 #ifndef _WCHAR_H
11 #define _WCHAR_H _CHAR_H
12
13 #ifndef _NULL
14 #include "__intern.h"
15 #endif
16
17 /* TODO: Documentation */
18
19 /* ----------------------------------------------------------------------------
20  * MACROS
21  * --------------------------------------------------------------------------*/
22
23 #define NULL _NULL
24 #define WCHAR_MAX _WCHAR_MAX
25 #define WCHAR_MIN _WCHAR_MIN
26 #define WEOF _WEOF
27
28 /* ----------------------------------------------------------------------------
29  * TYPEDEFS
30  * --------------------------------------------------------------------------*/
31
32 /* TODO: Get struct tm into __intern.h */
33
34 #ifndef _SIZE_T
35 #define _SIZE_T _SIZE_T
36 typedef __size_t size_t;
37 #endif /* _SIZE_T */
38
39 #ifndef _WCHAR_T
40 #define _WCHAR_T _WCHAR_T
41 typedef __wchar_t wchar_t;
42 #endif /* _WCHAR_T */
43
44 #ifndef _WINT_T
45 #define _WINT_T _WINT_T
46 typedef __wint_t wint_t;
47 #endif /* _WINT_T */
48
49 typedef mbstate_t; /* TODO - to __intern.h / __personality.h? */
50
51 /* ----------------------------------------------------------------------------
52  * FUNCTIONS
53  * --------------------------------------------------------------------------*/
54
55 wint_t fgetwc( FILE * stream );
56 wchar_t * fgetws( wchar_t * restrict s, int n, FILE * restrict stream );
57 wint_t fputwc( wchar_t c, FILE * stream );
58 int fputws( const wchar_t * restrict s, FILE * restrict stream );
59 int fwide( FILE * stream, int mode );
60 wint_t getwc( FILE * stream );
61 wint_t getwchar( void );
62 wint_t putwc( wchar_t c, FILE * stream );
63 wint_t putwchar( wchar_t c );
64 wint_t ungetwc( wint_t c, FILE * stream );
65
66 int fwscanf( FILE * restrict stream, const wchar_t * restrict format, ... );
67 int swscanf( const wchar_t * restrict s, const wchar_t * restrict format, ... );
68 int wscanf( const wchar_t * restrict format, ... );
69 int fwprintf( FILE * restrict stream, const wchar_t * restrict format, ... );
70 int swprintf( wchar_t * restrict s, size_t n, const wchar_t * restrict format, ... );
71 int wprintf( const wchar_t * restrict format, ... );
72 int vfwscanf( FILE * restrict stream, const wchar_t * restrict format, va_list arg );
73 int vswscanf( const wchar_t * restrict s, size_t n, const wchar_t * restrict format, va_list arg );
74 int vwscanf( const wchar_t * restrict format, va_list arg );
75 int vfwprintf( FILE * restrict stream, const wchar_t * restrict format, va_list arg );
76 int vswprintf( wchar_t * restrict s, size_t n, const wchar_t * restrict format, va_list arg );
77 int vwprintf( const wchar_t * restrict format, va_list arg );
78
79 size_t wcsftime( wchar_t * restrict s, size_t maxsize, const wchar_t * restrict format, const struct tm * restrict timeptr );
80
81 wint_t btowc( int c );
82 size_t mbrlen( const char * restrict s, size_t n, mbstate_t * restrict ps );
83 size_t mbrtowc( wchar_t * restrict pwc, const char * restrict s, size_t n, mbstate_t * restrict ps );
84 int mbsinit( const mbstate_t * ps );
85 size_t mbsrtowcs( wchar_t * restrict dst, const char * * restrict src, size_t len, mbstate_t * restrict ps );
86 size_t wcrtomb( char * restrict s, wchar_t wc, mbstate_t * restrict ps );
87 size_t wcsrtombs(char * restrict dst, const wchar_t * * restrict src, size_t len, mbstate_t * restrict ps );
88 double wcstod( const wchar_t * restrict nptr, wchar_t * * restrict endptr );
89 float wcstof( const wchar_t * restrict nptr, wchar_t * * restrict endptr);
90 long double wcstold( const wchar_t * restrict nptr, wchar_t * * restrict endptr);
91 long long wcstoll( const wchar_t * restrict nptr, wchar_t * * restrict endptr, int base );
92 unsigned long long wcstoull( const wchar_t * restrict nptr, wchar_t * * restrict endptr, int base );
93 long wcstol( const wchar_t * restrict nptr, wchar_t * * restrict endptr, int base );
94 unsigned long wcstoul( const wchar_t * restrict nptr, wchar_t * * restrict endptr, int base );
95 int wctob( wint_t c );
96
97 wchar_t * wcscat( wchar_t * restrict s1, const wchar_t * restrict s2);
98 int wcscmp( const wchar_t * s1, const wchar_t * s2 );
99 int wcscoll( const wchar_t * s1, const wchar_t * s2 );
100 wchar_t * wcscpy( wchar_t * restrict s1, const wchar_t * restrict s2 );
101 size_t wcscspn( const wchar_t * s1, const wchar_t * s2 );
102 size_t wcslen( const wchar_t * s );
103 wchar_t * wcsncat( wchar_t * restrict s1, const wchar_t * restrict s2, size_t n );
104 int wcsncmp( const wchar_t * s1, const wchar_t * s2, size_t n );
105 wchar_t * wcsncpy( wchar_t * restrict s1, const wchar_t * restrict s2, size_t n );
106 size_t wcsspn( const wchar_t * s1, const wchar_t * s2 );
107 wchar_t * wcsstr( const wchar_t * s1, const wchar_t * s2 );
108 wchar_t * wcstok( wchar_t * restrict s1, const wchar_t * restrict s2, wchar_t * * restrict ptr );
109 size_t wcsxfrm( wchar_t * restrict s1, const wchar_t * restrict s2, size_t n );
110 int wmemcmp( const wchar_t * s1, const wchar_t * s2, size_t n );
111 wchar_t * wmemcpy( wchar_t * restrict s1, const wchar_t * restrict s2, size_t n );
112 wchar_t * wmemmove( wchar_t * s1, const wchar_t * s2, size_t n );
113 wchar_t * wmemset( wchar_t * s, wchar_t c, size_t n );
114
115 wchar_t * wcschr( const wchar_t * s, wchar_t c ); 
116 wchar_t * wcspbrk( const wchar_t * s1, const wchar_t * s2 );
117 wchar_t * wcsrchr( const wchar_t * s, wchar_t c );
118 wchar_t * wcsstr( const wchar_t * s1, const wchar_t * s2 );
119 wchar_t * wmemchr( const wchar_t * s, wchar_t c, size_t n);
120
121 #endif /* _WCHAR_H */