summaryrefslogtreecommitdiff
path: root/src/lib/libast/features/wchar
diff options
context:
space:
mode:
authorIgor Pashev <pashev.igor@gmail.com>2012-06-24 22:28:35 +0000
committerIgor Pashev <pashev.igor@gmail.com>2012-06-24 22:28:35 +0000
commit3950ffe2a485479f6561c27364d3d7df5a21d124 (patch)
tree468c6e14449d1b1e279222ec32f676b0311917d2 /src/lib/libast/features/wchar
downloadksh-upstream.tar.gz
Imported Upstream version 93u+upstream
Diffstat (limited to 'src/lib/libast/features/wchar')
-rw-r--r--src/lib/libast/features/wchar158
1 files changed, 158 insertions, 0 deletions
diff --git a/src/lib/libast/features/wchar b/src/lib/libast/features/wchar
new file mode 100644
index 0000000..ac51f0f
--- /dev/null
+++ b/src/lib/libast/features/wchar
@@ -0,0 +1,158 @@
+set prototyped
+iff
+set stdio ast_common.h
+set include .
+
+cat{
+ #ifndef _AST_WCHAR_H
+ #define _AST_WCHAR_H 1
+}end
+
+lib mbstowcs,wctomb,wcrtomb,wcslen,wcstombs,wcwidth stdlib.h stdio.h wchar.h
+lib towlower,towupper stdlib.h stdio.h wchar.h
+typ mbstate_t stdlib.h stdio.h wchar.h
+nxt wchar
+
+cat{
+ #ifndef _SFSTDIO_H
+ #include <ast_common.h>
+ #include <stdio.h>
+ #endif
+}end
+
+if tst note{ <wchar.h> requires native <stdio.h> }end nocompile{
+ /*<NOSTDIO>*/
+ #define _STDIO_INCLUDED 1
+ #define FILE void
+ #include <wchar.h>
+ int tst;
+ }end
+ if tst note{ <stdio.h> defines __va_list for <wchar.h> }end compile{
+ /*<NOSTDIO>*/
+ #define _STDIO_INCLUDED 1
+ #define FILE void
+ #include <stdarg.h>
+ #define __va_list va_list
+ #include <wchar.h>
+ int tst;
+ }end && {
+ #define __va_list va_list
+ }
+ endif
+endif
+
+if hdr - wctype wchar.h
+ if ! npt - iswalpha wchar.h {
+ #include <wctype.h> /* <wchar.h> includes <wctype.h> */
+ }
+ endif
+endif
+
+run{
+cat <<!
+ #if _hdr_wchar && defined(_nxt_wchar)
+ #include ${_nxt_wchar-_nxt_wchar} /* the native wchar.h */
+ #endif
+
+ #ifndef WEOF
+ #define WEOF (-1)
+ #endif
+
+ #undef fgetwc
+ #undef fgetws
+ #undef fputwc
+ #undef fputws
+ #undef getwc
+ #undef getwchar
+ #undef getws
+ #undef putwc
+ #undef putwchar
+ #undef ungetwc
+
+ #define fgetwc _ast_fgetwc
+ #define fgetws _ast_fgetws
+ #define fputwc _ast_fputwc
+ #define fputws _ast_fputws
+ #define fwide _ast_fwide
+ #define fwprintf _ast_fwprintf
+ #define fwscanf _ast_fwscanf
+ #define getwc _ast_getwc
+ #define getwchar _ast_getwchar
+ #define getws _ast_getws
+ #define putwc _ast_putwc
+ #define putwchar _ast_putwchar
+ #define swprintf _ast_swprintf
+ #define swscanf _ast_swscanf
+ #define ungetwc _ast_ungetwc
+ #define vfwprintf _ast_vfwprintf
+ #define vfwscanf _ast_vfwscanf
+ #define vswprintf _ast_vswprintf
+ #define vswscanf _ast_vswscanf
+ #define vwprintf _ast_vwprintf
+ #define vwscanf _ast_vwscanf
+ #define wprintf _ast_wprintf
+ #define wscanf _ast_wscanf
+
+ #if !_typ_mbstate_t
+ #undef _typ_mbstate_t
+ #define _typ_mbstate_t 1
+ typedef char mbstate_t;
+ #endif
+
+ #if _BLD_ast && defined(__EXPORT__)
+ #define extern __EXPORT__
+ #endif
+
+ #if !_lib_mbstowcs
+ extern size_t mbstowcs(wchar_t*, const char*, size_t);
+ #endif
+ #if !_lib_wctomb
+ extern int wctomb(char*, wchar_t);
+ #endif
+ #if !_lib_wcrtomb
+ extern size_t wcrtomb(char*, wchar_t, mbstate_t*);
+ #endif
+ #if !_lib_wcslen
+ extern size_t wcslen(const wchar_t*);
+ #endif
+ #if !_lib_wcstombs
+ extern size_t wcstombs(char*, const wchar_t*, size_t);
+ #endif
+
+ extern int fwprintf(FILE*, const wchar_t*, ...);
+ extern int fwscanf(FILE*, const wchar_t*, ...);
+ extern wint_t fgetwc(FILE*);
+ extern wchar_t* fgetws(wchar_t*, int, FILE*);
+ extern wint_t fputwc(wchar_t, FILE*);
+ extern int fputws(const wchar_t*, FILE*);
+ extern int fwide(FILE*, int);
+ extern wint_t getwc(FILE*);
+ extern wint_t getwchar(void);
+ extern wchar_t* getws(wchar_t*);
+ extern wint_t putwc(wchar_t, FILE*);
+ extern wint_t putwchar(wchar_t);
+ extern int swprintf(wchar_t*, size_t, const wchar_t*, ...);
+ extern int swscanf(const wchar_t*, const wchar_t*, ...);
+ extern wint_t ungetwc(wint_t, FILE*);
+ extern int vfwprintf(FILE*, const wchar_t*, va_list);
+ extern int vfwscanf(FILE*, const wchar_t*, va_list);
+ extern int vwprintf(const wchar_t*, va_list);
+ extern int vwscanf(const wchar_t*, va_list);
+ extern int vswprintf(wchar_t*, size_t, const wchar_t*, va_list);
+ extern int vswscanf(const wchar_t*, const wchar_t*, va_list);
+ extern int wprintf(const wchar_t*, ...);
+ extern int wscanf(const wchar_t*, ...);
+
+ #undef extern
+
+ #else
+
+ /* on some systems <wchar.h> is included multiple times with multiple effects */
+
+ #if _hdr_wchar && defined(_nxt_wchar)
+ #include ${_nxt_wchar-_nxt_wchar} /* the native wchar.h */
+ #endif
+
+ #endif
+!
+}end