From fbe47c7b5c67b377275dec0561c995a9a9467a3e Mon Sep 17 00:00:00 2001 From: =?utf8?q?V=C3=A1clav=20Slav=C3=ADk?= Date: Sun, 20 Jun 2004 17:18:50 +0000 Subject: [PATCH] check for wputc wputchar putws fputws availability git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@27913 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- configure | 5 ++++- configure.in | 2 +- include/wx/wxchar.h | 29 ++++++++++++++++++++--------- setup.h.in | 13 +++++++++++-- setup.h_vms | 13 +++++++++++-- src/common/wxchar.cpp | 8 ++++---- 6 files changed, 51 insertions(+), 19 deletions(-) diff --git a/configure b/configure index 3a997b4760..41ffb63e76 100755 --- a/configure +++ b/configure @@ -30215,7 +30215,10 @@ if test "$wxUSE_UNICODE" = yes; then -for ac_func in fputwc wprintf vswprintf + + + +for ac_func in wputc wputchar putws fputws wprintf vswprintf do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` echo "$as_me:$LINENO: checking for $ac_func" >&5 diff --git a/configure.in b/configure.in index 4a47f64294..4d2984ade3 100644 --- a/configure.in +++ b/configure.in @@ -3709,7 +3709,7 @@ fi if test "$wxUSE_UNICODE" = yes; then dnl also look if we have wide char IO functions - AC_CHECK_FUNCS(fputwc wprintf vswprintf) + AC_CHECK_FUNCS(wputc wputchar putws fputws wprintf vswprintf) dnl MinGW has a vswprintf with a different prototype, and dnl a _vsnwprintf with the correct prototype, but AC_CHECK_FUNCS diff --git a/include/wx/wxchar.h b/include/wx/wxchar.h index 99cf662689..5e65c13bce 100644 --- a/include/wx/wxchar.h +++ b/include/wx/wxchar.h @@ -415,22 +415,33 @@ #define wxGets getws #define wxUngetc ungetwc - #ifdef HAVE_FPUTWC - #define wxPutc wputc - #define wxPutchar wputchar - #define wxPuts putws - #define wxFputs fputws + #ifdef HAVE_FPUTWS + #define wxFputs fputws #else - #define wxNEED_FPUTWC - + #define wxNEED_FPUTS #include - int wxFputs(const wxChar *ch, FILE *stream); + #endif + + #ifdef HAVE_WPUTC + #define wxPutc wputc + #else + #define wxNEED_PUTC + #include int wxPutc(wxChar ch, FILE *stream); + #endif - #define wxPuts(ws) wxFputs(ws, stdout) + #ifdef HAVE_WPUTCHAR + #define wxPutchar wputchar + #else #define wxPutchar(wch) wxPutc(wch, stdout) #endif + + #ifdef HAVE_PUTWS + #define wxPuts putws + #else + #define wxPuts(ws) wxFputs(ws, stdout) + #endif /* we need %s to %ls conversion for printf and scanf etc */ #define wxNEED_PRINTF_CONVERSION diff --git a/setup.h.in b/setup.h.in index b746329504..f8df8e47e4 100644 --- a/setup.h.in +++ b/setup.h.in @@ -1229,8 +1229,17 @@ /* Define if you have wcsrtombs() function */ #undef HAVE_WCSRTOMBS -/* Define this if you have fputws() and putwc() */ -#undef HAVE_FPUTWC +/* Define this if you have wputc() */ +#undef HAVE_WPUTC + +/* Define this if you have wputchar() */ +#undef HAVE_WPUTCHAR + +/* Define this if you have putws() */ +#undef HAVE_PUTWS + +/* Define this if you have fputws() */ +#undef HAVE_FPUTWS /* Define this if you have strcasecmp() function in */ #undef HAVE_STRCASECMP_IN_STRING_H diff --git a/setup.h_vms b/setup.h_vms index 7ce91e99ef..8932864838 100644 --- a/setup.h_vms +++ b/setup.h_vms @@ -1244,8 +1244,17 @@ /* Define if you have wcsrtombs() function */ #define HAVE_WCSRTOMBS 1 -/* Define this if you have fputws() and putwc() */ -#define HAVE_FPUTWC 1 +/* Define this if you have wputc() */ +#define HAVE_WPUTC 1 + +/* Define this if you have wputchar() */ +#define HAVE_WPUTCHAR 1 + +/* Define this if you have putws() */ +#define HAVE_PUTWS 1 + +/* Define this if you have fputws() */ +#define HAVE_FPUTWS 1 /* Define this if you have strcasecmp() function in */ #define HAVE_STRCASECMP_IN_STRING_H 1 diff --git a/src/common/wxchar.cpp b/src/common/wxchar.cpp index 7184706d32..b7e5c75272 100644 --- a/src/common/wxchar.cpp +++ b/src/common/wxchar.cpp @@ -604,23 +604,23 @@ int WXDLLEXPORT wxSnprintf_(wxChar *buf, size_t len, const wxChar *format, ...) // implement the standard IO functions for wide char if libc doesn't have them // ---------------------------------------------------------------------------- -#ifdef wxNEED_FPUTWC - +#ifdef wxNEED_FPUTS int wxFputs(const wchar_t *ws, FILE *stream) { // counting the number of wide characters written isn't worth the trouble, // simply distinguish between ok and error return fputs(wxConvLibc.cWC2MB(ws), stream) == -1 ? -1 : 0; } +#endif // wxNEED_FPUTS +#ifdef wxNEED_PUTC int /* not wint_t */ wxPutc(wchar_t wc, FILE *stream) { wchar_t ws[2] = { wc, L'\0' }; return wxFputs(ws, stream); } - -#endif // wxNEED_FPUTWC +#endif // wxNEED_PUTC // NB: we only implement va_list functions here, the ones taking ... are // defined below for wxNEED_PRINTF_CONVERSION case anyhow and we reuse -- 2.45.2