X-Git-Url: https://erislabs.net/gitweb/?a=blobdiff_plain;ds=sidebyside;f=lib%2Fwchar.in.h;h=af0d978a0fbdb4988c1ecfd8726fcef931674e8c;hb=7ec4dd0757faee6c51e3b20119dded0b321c3199;hp=bf73b5cebaac9788211f7193c239773bb44c5ac4;hpb=172b44d208f0bf8f949168d2e42b76202ee4180f;p=gnulib.git diff --git a/lib/wchar.in.h b/lib/wchar.in.h index bf73b5ceb..af0d978a0 100644 --- a/lib/wchar.in.h +++ b/lib/wchar.in.h @@ -71,6 +71,16 @@ extern "C" { #endif +/* Override mbstate_t if it is too small. + On IRIX 6.5, sizeof (mbstate_t) == 1, which is not sufficient for + implementing mbrtowc for encodings like UTF-8. */ +#if !(@HAVE_MBSINIT@ && @HAVE_MBRTOWC@) +typedef int rpl_mbstate_t; +# undef mbstate_t +# define mbstate_t rpl_mbstate_t +#endif + + /* Convert a single-byte character to a wide character. */ #if @GNULIB_BTOWC@ # if !@HAVE_BTOWC@ @@ -113,6 +123,48 @@ extern int mbsinit (const mbstate_t *ps); #endif +/* Convert a multibyte character to a wide character. */ +#if @GNULIB_MBRTOWC@ +# if !@HAVE_MBRTOWC@ +extern size_t mbrtowc (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps); +# endif +#elif defined GNULIB_POSIXCHECK +# undef mbrtowc +# define mbrtowc(w,s,n,p) \ + (GL_LINK_WARNING ("mbrtowc is unportable - " \ + "use gnulib module mbrtowc for portability"), \ + mbrtowc (w, s, n, p)) +#endif + + +/* Recognize a multibyte character. */ +#if @GNULIB_MBRLEN@ +# if !@HAVE_MBRLEN@ +extern size_t mbrlen (const char *s, size_t n, mbstate_t *ps); +# endif +#elif defined GNULIB_POSIXCHECK +# undef mbrlen +# define mbrlen(s,n,p) \ + (GL_LINK_WARNING ("mbrlen is unportable - " \ + "use gnulib module mbrlen for portability"), \ + mbrlen (s, n, p)) +#endif + + +/* Convert a string to a wide string. */ +#if @GNULIB_MBSRTOWCS@ +# if !@HAVE_MBSRTOWCS@ +extern size_t mbsrtowcs (wchar_t *dest, const char **srcp, size_t len, mbstate_t *ps); +# endif +#elif defined GNULIB_POSIXCHECK +# undef mbsrtowcs +# define mbsrtowcs(d,s,l,p) \ + (GL_LINK_WARNING ("mbsrtowcs is unportable - " \ + "use gnulib module mbsrtowcs for portability"), \ + mbsrtowcs (d, s, l, p)) +#endif + + /* Return the number of screen columns needed for WC. */ #if @GNULIB_WCWIDTH@ # if @REPLACE_WCWIDTH@