1set prototyped 2iff 3set stdio ast_common.h 4set include . 5 6cat{ 7 #ifndef _AST_WCHAR_H 8 #define _AST_WCHAR_H 1 9 #define _STDFILE_DECLARED 10}end 11 12lib mbstowcs,wctomb,wcscmp,wcscoll,wcslen,wcstombs,wcsxfrm,wcwidth stdlib.h stdio.h wchar.h 13lib mbrlen,mbrtowc,mbsrtowcs,wcrtomb,wcsrtombs stdlib.h stdio.h wchar.h 14lib towlower,towupper stdlib.h stdio.h wchar.h 15typ mbstate_t stdlib.h stdio.h wchar.h 16nxt wchar 17 18cat{ 19 #ifndef _SFSTDIO_H 20 #include <ast_common.h> 21 #include <stdio.h> 22 #endif 23}end 24 25if tst note{ <wchar.h> requires native <stdio.h> }end nocompile{ 26 /*<NOSTDIO>*/ 27 #define _STDIO_INCLUDED 1 28 #define FILE void 29 #include <wchar.h> 30 int tst; 31 }end 32 if tst note{ <stdio.h> defines __va_list for <wchar.h> }end compile{ 33 /*<NOSTDIO>*/ 34 #define _STDIO_INCLUDED 1 35 #define FILE void 36 #include <stdarg.h> 37 #define __va_list va_list 38 #include <wchar.h> 39 int tst; 40 }end && { 41 #define __va_list va_list 42 } 43 endif 44endif 45 46if hdr - wctype wchar.h 47 if ! npt - iswalpha wchar.h { 48 #include <wctype.h> /* <wchar.h> includes <wctype.h> */ 49 } 50 endif 51endif 52 53run{ 54cat <<! 55 #if _hdr_wchar && defined(_nxt_wchar) 56 #include ${_nxt_wchar-_nxt_wchar} /* the native wchar.h */ 57 #endif 58 59 #ifndef WEOF 60 #define WEOF (-1) 61 #endif 62 63 #undef fgetwc 64 #undef fgetws 65 #undef fputwc 66 #undef fputws 67 #undef getwc 68 #undef getwchar 69 #undef getws 70 #undef putwc 71 #undef putwchar 72 #undef ungetwc 73 74 #define fgetwc _ast_fgetwc 75 #define fgetws _ast_fgetws 76 #define fputwc _ast_fputwc 77 #define fputws _ast_fputws 78 #define fwide _ast_fwide 79 #define fwprintf _ast_fwprintf 80 #define fwscanf _ast_fwscanf 81 #define getwc _ast_getwc 82 #define getwchar _ast_getwchar 83 #define getws _ast_getws 84 #define putwc _ast_putwc 85 #define putwchar _ast_putwchar 86 #define swprintf _ast_swprintf 87 #define swscanf _ast_swscanf 88 #define ungetwc _ast_ungetwc 89 #define vfwprintf _ast_vfwprintf 90 #define vfwscanf _ast_vfwscanf 91 #define vswprintf _ast_vswprintf 92 #define vswscanf _ast_vswscanf 93 #define vwprintf _ast_vwprintf 94 #define vwscanf _ast_vwscanf 95 #define wprintf _ast_wprintf 96 #define wscanf _ast_wscanf 97 98 #if !_typ_mbstate_t 99 #undef _typ_mbstate_t 100 #define _typ_mbstate_t 1 101 typedef char mbstate_t; 102 #endif 103 104 #if _BLD_ast && defined(__EXPORT__) 105 #define extern __EXPORT__ 106 #endif 107 108 #if !_lib_mbrlen 109 extern size_t mbrlen(const char*, size_t, mbstate_t*); 110 #endif 111 112 #if !_lib_mbrtowc 113 extern size_t mbrtowc(wchar_t*, const char*, size_t, mbstate_t*); 114 #endif 115 116 #if !_lib_mbsrtowcs 117 extern size_t mbsrtowcs(wchar_t*, const char**, size_t, mbstate_t*); 118 #endif 119 120 #if !_lib_wcrtomb 121 extern size_t wcrtomb(char*, wchar_t, mbstate_t*); 122 #endif 123 124 #if !_lib_wcsrtombs 125 extern size_t wcsrtombs(char*, const wchar_t**, size_t, mbstate_t*); 126 #endif 127 128 /* the remaining mb*() and wc*() functions are obsolete */ 129 130 #if !_lib_mbstowcs 131 extern size_t mbstowcs(wchar_t*, const char*, size_t); 132 #endif 133 #if !_lib_wctomb 134 extern int wctomb(char*, wchar_t); 135 #endif 136 #if !_lib_wcslen 137 extern size_t wcslen(const wchar_t*); 138 #endif 139 #if !_lib_wcstombs 140 extern size_t wcstombs(char*, const wchar_t*, size_t); 141 #endif 142 143 extern int fwprintf(FILE*, const wchar_t*, ...); 144 extern int fwscanf(FILE*, const wchar_t*, ...); 145 extern wint_t fgetwc(FILE*); 146 extern wchar_t* fgetws(wchar_t*, int, FILE*); 147 extern wint_t fputwc(wchar_t, FILE*); 148 extern int fputws(const wchar_t*, FILE*); 149 extern int fwide(FILE*, int); 150 extern wint_t getwc(FILE*); 151 extern wint_t getwchar(void); 152 extern wchar_t* getws(wchar_t*); 153 extern wint_t putwc(wchar_t, FILE*); 154 extern wint_t putwchar(wchar_t); 155 extern int swprintf(wchar_t*, size_t, const wchar_t*, ...); 156 extern int swscanf(const wchar_t*, const wchar_t*, ...); 157 extern wint_t ungetwc(wint_t, FILE*); 158 extern int vfwprintf(FILE*, const wchar_t*, va_list); 159 extern int vfwscanf(FILE*, const wchar_t*, va_list); 160 extern int vwprintf(const wchar_t*, va_list); 161 extern int vwscanf(const wchar_t*, va_list); 162 extern int vswprintf(wchar_t*, size_t, const wchar_t*, va_list); 163 extern int vswscanf(const wchar_t*, const wchar_t*, va_list); 164 extern int wprintf(const wchar_t*, ...); 165 extern int wscanf(const wchar_t*, ...); 166 167 #undef extern 168 169 #else 170 171 /* on some systems <wchar.h> is included multiple times with multiple effects */ 172 173 #if _hdr_wchar && defined(_nxt_wchar) 174 #include ${_nxt_wchar-_nxt_wchar} /* the native wchar.h */ 175 #endif 176 177 #endif 178! 179}end 180