X-Git-Url: https://erislabs.net/gitweb/?a=blobdiff_plain;f=lib%2Fwchar.in.h;h=af0d978a0fbdb4988c1ecfd8726fcef931674e8c;hb=7ec4dd0757faee6c51e3b20119dded0b321c3199;hp=445530d4b712b981d03d4d18f84a24c6b48d977c;hpb=82b3be219d2636717f419e68ceaca40f3b5b8514;p=gnulib.git diff --git a/lib/wchar.in.h b/lib/wchar.in.h index 445530d4b..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@ @@ -85,6 +95,20 @@ extern wint_t btowc (int c); #endif +/* Convert a wide character to a single-byte character. */ +#if @GNULIB_WCTOB@ +# if !@HAVE_WCTOB@ +extern int wctob (wint_t wc); +# endif +#elif defined GNULIB_POSIXCHECK +# undef wctob +# define wctob(w) \ + (GL_LINK_WARNING ("wctob is unportable - " \ + "use gnulib module wctob for portability"), \ + wctob (w)) +#endif + + /* Test whether *PS is in the initial state. */ #if @GNULIB_MBSINIT@ # if !@HAVE_MBSINIT@ @@ -99,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@