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