check for wputc wputchar putws fputws availability

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@27913 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Václav Slavík
2004-06-20 17:18:50 +00:00
parent 290e4c83d9
commit fbe47c7b5c
6 changed files with 52 additions and 20 deletions

5
configure vendored
View File

@@ -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 do
as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
echo "$as_me:$LINENO: checking for $ac_func" >&5 echo "$as_me:$LINENO: checking for $ac_func" >&5

View File

@@ -3709,7 +3709,7 @@ fi
if test "$wxUSE_UNICODE" = yes; then if test "$wxUSE_UNICODE" = yes; then
dnl also look if we have wide char IO functions 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 MinGW has a vswprintf with a different prototype, and
dnl a _vsnwprintf with the correct prototype, but AC_CHECK_FUNCS dnl a _vsnwprintf with the correct prototype, but AC_CHECK_FUNCS

View File

@@ -415,23 +415,34 @@
#define wxGets getws #define wxGets getws
#define wxUngetc ungetwc #define wxUngetc ungetwc
#ifdef HAVE_FPUTWC #ifdef HAVE_FPUTWS
#define wxPutc wputc
#define wxPutchar wputchar
#define wxPuts putws
#define wxFputs fputws #define wxFputs fputws
#else #else
#define wxNEED_FPUTWC #define wxNEED_FPUTS
#include <stdio.h> #include <stdio.h>
int wxFputs(const wxChar *ch, FILE *stream); int wxFputs(const wxChar *ch, FILE *stream);
int wxPutc(wxChar ch, FILE *stream); #endif
#define wxPuts(ws) wxFputs(ws, stdout) #ifdef HAVE_WPUTC
#define wxPutc wputc
#else
#define wxNEED_PUTC
#include <stdio.h>
int wxPutc(wxChar ch, FILE *stream);
#endif
#ifdef HAVE_WPUTCHAR
#define wxPutchar wputchar
#else
#define wxPutchar(wch) wxPutc(wch, stdout) #define wxPutchar(wch) wxPutc(wch, stdout)
#endif #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 */ /* we need %s to %ls conversion for printf and scanf etc */
#define wxNEED_PRINTF_CONVERSION #define wxNEED_PRINTF_CONVERSION

View File

@@ -1229,8 +1229,17 @@
/* Define if you have wcsrtombs() function */ /* Define if you have wcsrtombs() function */
#undef HAVE_WCSRTOMBS #undef HAVE_WCSRTOMBS
/* Define this if you have fputws() and putwc() */ /* Define this if you have wputc() */
#undef HAVE_FPUTWC #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 <string.h> */ /* Define this if you have strcasecmp() function in <string.h> */
#undef HAVE_STRCASECMP_IN_STRING_H #undef HAVE_STRCASECMP_IN_STRING_H

View File

@@ -1244,8 +1244,17 @@
/* Define if you have wcsrtombs() function */ /* Define if you have wcsrtombs() function */
#define HAVE_WCSRTOMBS 1 #define HAVE_WCSRTOMBS 1
/* Define this if you have fputws() and putwc() */ /* Define this if you have wputc() */
#define HAVE_FPUTWC 1 #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 <string.h> */ /* Define this if you have strcasecmp() function in <string.h> */
#define HAVE_STRCASECMP_IN_STRING_H 1 #define HAVE_STRCASECMP_IN_STRING_H 1

View File

@@ -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 // 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) int wxFputs(const wchar_t *ws, FILE *stream)
{ {
// counting the number of wide characters written isn't worth the trouble, // counting the number of wide characters written isn't worth the trouble,
// simply distinguish between ok and error // simply distinguish between ok and error
return fputs(wxConvLibc.cWC2MB(ws), stream) == -1 ? -1 : 0; 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) int /* not wint_t */ wxPutc(wchar_t wc, FILE *stream)
{ {
wchar_t ws[2] = { wc, L'\0' }; wchar_t ws[2] = { wc, L'\0' };
return wxFputs(ws, stream); return wxFputs(ws, stream);
} }
#endif // wxNEED_PUTC
#endif // wxNEED_FPUTWC
// NB: we only implement va_list functions here, the ones taking ... are // NB: we only implement va_list functions here, the ones taking ... are
// defined below for wxNEED_PRINTF_CONVERSION case anyhow and we reuse // defined below for wxNEED_PRINTF_CONVERSION case anyhow and we reuse