From: Bruno Haible Date: Wed, 28 Mar 2007 21:37:36 +0000 (+0000) Subject: New modules 'unistr/u8-mbtoucr', 'unistr/u16-mbtoucr', 'unistr/u32-mbtoucr'. X-Git-Tag: cvs-readonly~643 X-Git-Url: http://erislabs.org.uk/gitweb/?a=commitdiff_plain;h=fbdb50df6fdb8a013db967d52c14131c5c6db234;p=gnulib.git New modules 'unistr/u8-mbtoucr', 'unistr/u16-mbtoucr', 'unistr/u32-mbtoucr'. --- diff --git a/ChangeLog b/ChangeLog index a7710c4b9..f6fc6eba1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2007-03-28 Bruno Haible + + * 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 Bruno Haible diff --git a/lib/unistr.h b/lib/unistr.h index 5bab492e1..24218fbda 100644 --- a/lib/unistr.h +++ b/lib/unistr.h @@ -269,6 +269,29 @@ u32_mbtouc (ucs4_t *puc, const uint32_t *s, size_t n) # 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. */