New module 'mbrlen'.
authorBruno Haible <bruno@clisp.org>
Fri, 19 Dec 2008 12:01:07 +0000 (13:01 +0100)
committerBruno Haible <bruno@clisp.org>
Fri, 19 Dec 2008 12:01:07 +0000 (13:01 +0100)
ChangeLog
doc/posix-functions/mbrlen.texi
lib/wchar.in.h
m4/wchar.m4
modules/wchar

index f8fa73c..d6e8cdc 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,18 @@
 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.
        * modules/mbrtowc (Depends-on): Add verify.
        Suggested by Paul Eggert.
index 4878f26..ce5358c 100644 (file)
@@ -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
+@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
-@item
-This function is missing on some platforms:
-HP-UX 11, IRIX 6.5, Solaris 2.6, mingw, Interix 3.5.
 @end itemize
index 104fc9b..7ead930 100644 (file)
@@ -137,6 +137,20 @@ extern size_t mbrtowc (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps);
 #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@
index d3e928a..2d81744 100644 (file)
@@ -7,7 +7,7 @@ dnl with or without modifications, as long as this notice is preserved.
 
 dnl Written by Eric Blake.
 
-# wchar.m4 serial 9
+# wchar.m4 serial 10
 
 AC_DEFUN([gl_WCHAR_H],
 [
@@ -65,12 +65,14 @@ AC_DEFUN([gl_WCHAR_H_DEFAULTS],
   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])
index fedd7aa..6042d19 100644 (file)
@@ -29,12 +29,14 @@ wchar.h: wchar.in.h
              -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)' \