changeset 8575:3c161e212eeb

New modules 'unistr/u8-mbtoucr', 'unistr/u16-mbtoucr', 'unistr/u32-mbtoucr'.
author Bruno Haible <bruno@clisp.org>
date Wed, 28 Mar 2007 21:37:36 +0000
parents ba28246401dd
children e2facecc862e
files ChangeLog lib/unistr.h
diffstat 2 files changed, 33 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2007-03-28  Bruno Haible  <bruno@clisp.org>
+
+	* modules/unistr/u8-mbtoucr: New file.
+	* lib/unistr/u8-mbtoucr.c: New file.
+	* modules/unistr/u16-mbtoucr: New file.
+	* lib/unistr/u16-mbtoucr.c: New file.
+	* modules/unistr/u16-mbtoucr: New file.
+	* lib/unistr/u16-mbtoucr.c: New file.
+	* lib/unistr.h (u8_mbtoucr, u16_mbtoucr, u32_mbtoucr): New declarations.
+
 2007-03-27  Simon Josefsson  <simon@josefsson.org>
 	    Bruno Haible  <bruno@clisp.org>
 
--- a/lib/unistr.h
+++ b/lib/unistr.h
@@ -269,6 +269,29 @@
 # endif
 #endif
 
+/* Return the length (number of units) of the first character in S, putting
+   its 'ucs4_t' representation in *PUC.  Upon failure, *PUC is set to 0xfffd,
+   and -1 is returned for an invalid sequence of units, -2 is returned for an
+   incomplete sequence of units.
+   The number of available units, N, must be > 0.  */
+/* Similar to u*_mbtouc(), except that the return value gives more details
+   about the failure, similar to mbrtowc().  */
+
+#ifdef GNULIB_UNISTR_U8_MBTOUCR
+extern int
+       u8_mbtoucr (ucs4_t *puc, const uint8_t *s, size_t n);
+#endif
+
+#ifdef GNULIB_UNISTR_U16_MBTOUCR
+extern int
+       u16_mbtoucr (ucs4_t *puc, const uint16_t *s, size_t n);
+#endif
+
+#ifdef GNULIB_UNISTR_U32_MBTOUCR
+extern int
+       u32_mbtoucr (ucs4_t *puc, const uint32_t *s, size_t n);
+#endif
+
 /* Put the multibyte character represented by UC in S, returning its
    length.  Return -1 upon failure, -2 if the number of available units, N,
    is too small.  The latter case cannot occur if N >= 6/2/1, respectively.  */