From a37215120b3461103df702186805a3d4a88d5b77 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Wed, 4 Jul 2007 16:18:34 +0000 Subject: [PATCH] * libc/include/wchar.h: Add prototype for wcsxfrm. * libc/string/Makefile.am (GENERAL_SOURCES): Add wcsxfrm.c. (CHEWOUT_FILES): Add wcsxfrm.def. * libc/string/Makefile.in: Regenerate. * libc/string/wcsxfrm.c: New file. * libc/string/wcstrings.tex: Add wcsxfrm. --- newlib/ChangeLog | 9 ++++++ newlib/libc/include/wchar.h | 1 + newlib/libc/string/Makefile.am | 3 +- newlib/libc/string/Makefile.in | 20 ++++++++---- newlib/libc/string/wcstrings.tex | 4 +++ newlib/libc/string/wcsxfrm.c | 52 ++++++++++++++++++++++++++++++++ 6 files changed, 82 insertions(+), 7 deletions(-) create mode 100644 newlib/libc/string/wcsxfrm.c diff --git a/newlib/ChangeLog b/newlib/ChangeLog index bd610389a..aa10c13be 100644 --- a/newlib/ChangeLog +++ b/newlib/ChangeLog @@ -1,3 +1,12 @@ +2007-07-04 Corinna Vinschen + + * libc/include/wchar.h: Add prototype for wcsxfrm. + * libc/string/Makefile.am (GENERAL_SOURCES): Add wcsxfrm.c. + (CHEWOUT_FILES): Add wcsxfrm.def. + * libc/string/Makefile.in: Regenerate. + * libc/string/wcsxfrm.c: New file. + * libc/string/wcstrings.tex: Add wcsxfrm. + 2007-06-28 Corinna Vinschen * libc/include/string.h: Add prototypes for stpcpy and stpncpy. diff --git a/newlib/libc/include/wchar.h b/newlib/libc/include/wchar.h index eeabd35c1..dfc8c68d2 100644 --- a/newlib/libc/include/wchar.h +++ b/newlib/libc/include/wchar.h @@ -71,6 +71,7 @@ wchar_t *_EXFUN(wcsrchr, (const wchar_t *, wchar_t)); size_t _EXFUN(wcsspn, (const wchar_t *, const wchar_t *)); wchar_t *_EXFUN(wcsstr, (const wchar_t *, const wchar_t *)); int _EXFUN(wcswidth, (const wchar_t *, size_t)); +size_t _EXFUN(wcsxfrm, (wchar_t *, const wchar_t *, size_t)); int _EXFUN(wcwidth, (const wchar_t)); wchar_t *_EXFUN(wmemchr, (const wchar_t *, wchar_t, size_t)); int _EXFUN(wmemcmp, (const wchar_t *, const wchar_t *, size_t)); diff --git a/newlib/libc/string/Makefile.am b/newlib/libc/string/Makefile.am index 94d1868fa..7c2778b13 100644 --- a/newlib/libc/string/Makefile.am +++ b/newlib/libc/string/Makefile.am @@ -63,6 +63,7 @@ GENERAL_SOURCES = \ wcsspn.c \ wcsstr.c \ wcswidth.c \ + wcsxfrm.c \ wcwidth.c \ wmemchr.c \ wmemcmp.c \ @@ -113,7 +114,7 @@ wcscpy.def wcscspn.def \ wcslcat.def wcslcpy.def wcslen.def wcsncat.def \ wcsncmp.def wcsncpy.def wcsnlen.def wcspbrk.def \ wcsrchr.def wcsspn.def wcsstr.def \ -wcswidth.def wcwidth.def wmemchr.def \ +wcswidth.def wcsxfrm.def wcwidth.def wmemchr.def \ wmemcmp.def wmemcpy.def wmemmove.def wmemset.def SUFFIXES = .def diff --git a/newlib/libc/string/Makefile.in b/newlib/libc/string/Makefile.in index 8c5406cf0..687725943 100644 --- a/newlib/libc/string/Makefile.in +++ b/newlib/libc/string/Makefile.in @@ -84,9 +84,10 @@ am__objects_1 = lib_a-bcopy.$(OBJEXT) lib_a-bzero.$(OBJEXT) \ lib_a-wcsnlen.$(OBJEXT) lib_a-wcspbrk.$(OBJEXT) \ lib_a-wcsrchr.$(OBJEXT) lib_a-wcsspn.$(OBJEXT) \ lib_a-wcsstr.$(OBJEXT) lib_a-wcswidth.$(OBJEXT) \ - lib_a-wcwidth.$(OBJEXT) lib_a-wmemchr.$(OBJEXT) \ - lib_a-wmemcmp.$(OBJEXT) lib_a-wmemcpy.$(OBJEXT) \ - lib_a-wmemmove.$(OBJEXT) lib_a-wmemset.$(OBJEXT) + lib_a-wcsxfrm.$(OBJEXT) lib_a-wcwidth.$(OBJEXT) \ + lib_a-wmemchr.$(OBJEXT) lib_a-wmemcmp.$(OBJEXT) \ + lib_a-wmemcpy.$(OBJEXT) lib_a-wmemmove.$(OBJEXT) \ + lib_a-wmemset.$(OBJEXT) @ELIX_LEVEL_1_FALSE@am__objects_2 = lib_a-bcmp.$(OBJEXT) \ @ELIX_LEVEL_1_FALSE@ lib_a-memccpy.$(OBJEXT) \ @ELIX_LEVEL_1_FALSE@ lib_a-mempcpy.$(OBJEXT) \ @@ -111,8 +112,8 @@ am__objects_3 = bcopy.lo bzero.lo index.lo memchr.lo memcmp.lo \ wcschr.lo wcscmp.lo wcscoll.lo wcscpy.lo wcscspn.lo \ wcslcat.lo wcslcpy.lo wcslen.lo wcsncat.lo wcsncmp.lo \ wcsncpy.lo wcsnlen.lo wcspbrk.lo wcsrchr.lo wcsspn.lo wcsstr.lo \ - wcswidth.lo wcwidth.lo wmemchr.lo wmemcmp.lo wmemcpy.lo \ - wmemmove.lo wmemset.lo + wcswidth.lo wcsxfrm.lo wcwidth.lo wmemchr.lo wmemcmp.lo \ + wmemcpy.lo wmemmove.lo wmemset.lo @ELIX_LEVEL_1_FALSE@am__objects_4 = bcmp.lo memccpy.lo mempcpy.lo \ @ELIX_LEVEL_1_FALSE@ stpcpy.lo stpncpy.lo strndup.lo \ @ELIX_LEVEL_1_FALSE@ strcasestr.lo strndup_r.lo @@ -354,6 +355,7 @@ GENERAL_SOURCES = \ wcsspn.c \ wcsstr.c \ wcswidth.c \ + wcsxfrm.c \ wcwidth.c \ wmemchr.c \ wmemcmp.c \ @@ -394,7 +396,7 @@ wcscpy.def wcscspn.def \ wcslcat.def wcslcpy.def wcslen.def wcsncat.def \ wcsncmp.def wcsncpy.def wcsnlen.def wcspbrk.def \ wcsrchr.def wcsspn.def wcsstr.def \ -wcswidth.def wcwidth.def wmemchr.def \ +wcswidth.def wcsxfrm.def wcwidth.def wmemchr.def \ wmemcmp.def wmemcpy.def wmemmove.def wmemset.def SUFFIXES = .def @@ -816,6 +818,12 @@ lib_a-wcswidth.o: wcswidth.c lib_a-wcswidth.obj: wcswidth.c $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-wcswidth.obj `if test -f 'wcswidth.c'; then $(CYGPATH_W) 'wcswidth.c'; else $(CYGPATH_W) '$(srcdir)/wcswidth.c'; fi` +lib_a-wcsxfrm.o: wcsxfrm.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-wcsxfrm.o `test -f 'wcsxfrm.c' || echo '$(srcdir)/'`wcsxfrm.c + +lib_a-wcsxfrm.obj: wcsxfrm.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-wcsxfrm.obj `if test -f 'wcsxfrm.c'; then $(CYGPATH_W) 'wcsxfrm.c'; else $(CYGPATH_W) '$(srcdir)/wcsxfrm.c'; fi` + lib_a-wcwidth.o: wcwidth.c $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-wcwidth.o `test -f 'wcwidth.c' || echo '$(srcdir)/'`wcwidth.c diff --git a/newlib/libc/string/wcstrings.tex b/newlib/libc/string/wcstrings.tex index df6edc47c..04a95f6de 100644 --- a/newlib/libc/string/wcstrings.tex +++ b/newlib/libc/string/wcstrings.tex @@ -29,6 +29,7 @@ declarations are in @file{wchar.h}. * wcsspn:: Find initial match in wide-character string * wcsstr:: Find wide-character string segment * wcswidth:: Number of column positions of a wide-character string +* wcsxfrm:: Locale-specific wide-character string transformation * wcwidth:: Number of column positions of a wide-character code @end menu @@ -101,6 +102,9 @@ declarations are in @file{wchar.h}. @page @include string/wcswidth.def +@page +@include string/wcsxfrm.def + @page @include string/wcwidth.def diff --git a/newlib/libc/string/wcsxfrm.c b/newlib/libc/string/wcsxfrm.c new file mode 100644 index 000000000..439bdd036 --- /dev/null +++ b/newlib/libc/string/wcsxfrm.c @@ -0,0 +1,52 @@ +/* +FUNCTION + <>---locale-specific wide-character string transformation + +INDEX + wcsxfrm + +ANSI_SYNOPSIS + #include + int wcsxfrm(wchar_t *<[stra]>, const wchar_t * <[strb]>, size_t <[n]>); + +TRAD_SYNOPSIS + #include + size_t wcsxfrm(<[stra]>, <[strb]>, <[n]>) + wchar_t *<[stra]>; + wchar_t *<[strb]>; + size_t <[n]> + +DESCRIPTION + <> transforms the wide-character string pointed to by + <[strb]> to the wide-character string pointed to by <[stra]>, + Comparing two transformed wide strings with <> should return + the same result as comparing the original strings with <>. + No more than <[n]> wide characters are transformed, including the + trailing null character. + + If <[n]> is 0, <[stra]> may be a NULL pointer. + + The current implementation of <> simply uses <> + and does not support any language-specific transformations. + +RETURNS + <> returns the length of the transformed wide character + string. if the return value is greater or equal to <[n]>, the + content of <[stra]> is undefined. + +PORTABILITY +<> is ISO/IEC 9899/AMD1:1995 (ISO C). +*/ + +#include <_ansi.h> +#include + +size_t +_DEFUN (wcsxfrm, (a, b, n), + wchar_t *a _AND + _CONST wchar_t *b _AND + size_t n) + +{ + return wcslcpy (a, b, n); +}