Mercurial > hg > octave-lyh > gnulib-hg
changeset 10910:e79b85bd0a7d
New module 'mbrlen'.
author | Bruno Haible <bruno@clisp.org> |
---|---|
date | Fri, 19 Dec 2008 13:01:07 +0100 |
parents | 796f25c7bd1a |
children | be669cca12c4 |
files | ChangeLog doc/posix-functions/mbrlen.texi lib/wchar.in.h m4/wchar.m4 modules/wchar |
diffstat | 5 files changed, 37 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2008-12-19 Bruno Haible <bruno@clisp.org> + + New module 'mbrlen'. + * lib/wchar.in.h (mbrlen): New declaration. + * lib/mbrlen.c: New file. + * m4/mbrlen.m4: New file. + * modules/mbrlen: New file. + * m4/wchar.m4 (gl_WCHAR_H_DEFAULTS): Initialize GNULIB_MBRLEN and + HAVE_MBRLEN. + * modules/wchar (Makefile.am): Substitute GNULIB_MBRLEN and + HAVE_MBRLEN. + * doc/posix-functions/mbrlen.texi: Document the new module. + 2008-12-19 Bruno Haible <bruno@clisp.org> * lib/mbrtowc.c: Include verify.h. Verify an assumption.
--- a/doc/posix-functions/mbrlen.texi +++ b/doc/posix-functions/mbrlen.texi @@ -4,15 +4,15 @@ POSIX specification: @url{http://www.opengroup.org/onlinepubs/9699919799/functions/mbrlen.html} -Gnulib module: --- +Gnulib module: mbrlen Portability problems fixed by Gnulib: @itemize -@end itemize - -Portability problems not fixed by Gnulib: -@itemize @item This function is missing on some platforms: HP-UX 11, IRIX 6.5, Solaris 2.6, mingw, Interix 3.5. @end itemize + +Portability problems not fixed by Gnulib: +@itemize +@end itemize
--- a/lib/wchar.in.h +++ b/lib/wchar.in.h @@ -137,6 +137,20 @@ #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 + + /* Return the number of screen columns needed for WC. */ #if @GNULIB_WCWIDTH@ # if @REPLACE_WCWIDTH@
--- a/m4/wchar.m4 +++ b/m4/wchar.m4 @@ -7,7 +7,7 @@ dnl Written by Eric Blake. -# wchar.m4 serial 9 +# wchar.m4 serial 10 AC_DEFUN([gl_WCHAR_H], [ @@ -65,12 +65,14 @@ GNULIB_WCTOB=0; AC_SUBST([GNULIB_WCTOB]) GNULIB_MBSINIT=0; AC_SUBST([GNULIB_MBSINIT]) GNULIB_MBRTOWC=0; AC_SUBST([GNULIB_MBRTOWC]) + GNULIB_MBRLEN=0; AC_SUBST([GNULIB_MBRLEN]) GNULIB_WCWIDTH=0; AC_SUBST([GNULIB_WCWIDTH]) dnl Assume proper GNU behavior unless another module says otherwise. HAVE_BTOWC=1; AC_SUBST([HAVE_BTOWC]) HAVE_WCTOB=1; AC_SUBST([HAVE_WCTOB]) HAVE_MBSINIT=1; AC_SUBST([HAVE_MBSINIT]) HAVE_MBRTOWC=1; AC_SUBST([HAVE_MBRTOWC]) + HAVE_MBRLEN=1; AC_SUBST([HAVE_MBRLEN]) HAVE_DECL_WCWIDTH=1; AC_SUBST([HAVE_DECL_WCWIDTH]) REPLACE_WCWIDTH=0; AC_SUBST([REPLACE_WCWIDTH]) WCHAR_H=''; AC_SUBST([WCHAR_H])
--- a/modules/wchar +++ b/modules/wchar @@ -29,12 +29,14 @@ -e 's|@''GNULIB_WCTOB''@|$(GNULIB_WCTOB)|g' \ -e 's|@''GNULIB_MBSINIT''@|$(GNULIB_MBSINIT)|g' \ -e 's|@''GNULIB_MBRTOWC''@|$(GNULIB_MBRTOWC)|g' \ + -e 's|@''GNULIB_MBRLEN''@|$(GNULIB_MBRLEN)|g' \ -e 's|@''GNULIB_WCWIDTH''@|$(GNULIB_WCWIDTH)|g' \ -e 's|@''HAVE_WINT_T''@|$(HAVE_WINT_T)|g' \ -e 's|@''HAVE_BTOWC''@|$(HAVE_BTOWC)|g' \ -e 's|@''HAVE_WCTOB''@|$(HAVE_WCTOB)|g' \ -e 's|@''HAVE_MBSINIT''@|$(HAVE_MBSINIT)|g' \ -e 's|@''HAVE_MBRTOWC''@|$(HAVE_MBRTOWC)|g' \ + -e 's|@''HAVE_MBRLEN''@|$(HAVE_MBRLEN)|g' \ -e 's|@''HAVE_DECL_WCWIDTH''@|$(HAVE_DECL_WCWIDTH)|g' \ -e 's|@''REPLACE_WCWIDTH''@|$(REPLACE_WCWIDTH)|g' \ -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \