diff options
author | Jeff Johnston <jjohnstn@redhat.com> | 2004-04-23 21:44:22 +0000 |
---|---|---|
committer | Jeff Johnston <jjohnstn@redhat.com> | 2004-04-23 21:44:22 +0000 |
commit | f777e3a5ac5d2fda9047dc2b7939d3f60bdef609 (patch) | |
tree | a4a669023388c6d657033d6242adf5d306173195 | |
parent | 27c7566ca4f436cc6184fdaf568dd84ca9c501f1 (diff) | |
download | newlib-f777e3a5ac5d2fda9047dc2b7939d3f60bdef609.zip newlib-f777e3a5ac5d2fda9047dc2b7939d3f60bdef609.tar.gz newlib-f777e3a5ac5d2fda9047dc2b7939d3f60bdef609.tar.bz2 |
2004-04-23 Artem B. Bityuckiy <abitytsky@softminecorp.com>
* configure.in: Define _MB_CAPABLE if mb supported.
* configure: Regenerated.
* configure.host: Remove manual setting of MB_CAPABLE compiler
flag.
* newlib.hin: Add _MB_CAPABLE flag.
* libc/ctype/iswalpha.c, libc/ctype/iswblank.c: Include <newlib.h>
and check for _MB_CAPABLE flag instead of MB_CAPABLE.
* libc/ctype/iswcntrl.c, libc/ctype/iswprint.c: Ditto.
* libc/ctype/iswpunct.c, libc/ctype/iswspace.c: Ditto.
* libc/ctype/jp2uc.c: Ditto.
* libc/ctype/towlower.c, libc/ctype/towupper.c: Ditto.
* libc/locale/locale.c: Ditto
* libc/machine/powerpc/vfscanf.c: Ditto
* libc/stdio/vfprintf.c, libc/stdio/vfscanf.c: Ditto
* libc/stdlib/mblen.c: Ditto
* libc/stdlib/mblen_r.c, libc/stdlib/mbrlen.c: Ditto
* libc/stdlib/mbrtowc.c, libc/stdlib/mbsrtowcs.c: Ditto
* libc/stdlib/mbstowcs.c, libc/stdlib/mbtowc.c: Ditto
* libc/stdlib/mbtowc_r.c, libc/stdlib/wcrtomb.c: Ditto
* libc/stdlib/wcsrtombs.c, libc/stdlib/wcstombs.c: Ditto
* libc/stdlib/wctomb.c, libc/sys/linux/intl/dcigettext.c: Ditto
* libc/sys/linux/intl/explodename.c: Ditto
* libc/sys/linux/intl/finddomain.c: Ditto
* libc/sys/linux/intl/l10nflist.c: Ditto
* libc/sys/linux/intl/loadmsgcat.c: Ditto
* libc/sys/linux/intl/localealias.c: Ditto
36 files changed, 170 insertions, 99 deletions
diff --git a/newlib/ChangeLog b/newlib/ChangeLog index 06959f6..19e7ebd 100644 --- a/newlib/ChangeLog +++ b/newlib/ChangeLog @@ -1,3 +1,32 @@ +2004-04-23 Artem B. Bityuckiy <abitytsky@softminecorp.com> + + * configure.in: Define _MB_CAPABLE if mb supported. + * configure: Regenerated. + * configure.host: Remove manual setting of MB_CAPABLE compiler + flag. + * newlib.hin: Add _MB_CAPABLE flag. + * libc/ctype/iswalpha.c, libc/ctype/iswblank.c: Include <newlib.h> + and check for _MB_CAPABLE flag instead of MB_CAPABLE. + * libc/ctype/iswcntrl.c, libc/ctype/iswprint.c: Ditto. + * libc/ctype/iswpunct.c, libc/ctype/iswspace.c: Ditto. + * libc/ctype/jp2uc.c: Ditto. + * libc/ctype/towlower.c, libc/ctype/towupper.c: Ditto. + * libc/locale/locale.c: Ditto + * libc/machine/powerpc/vfscanf.c: Ditto + * libc/stdio/vfprintf.c, libc/stdio/vfscanf.c: Ditto + * libc/stdlib/mblen.c: Ditto + * libc/stdlib/mblen_r.c, libc/stdlib/mbrlen.c: Ditto + * libc/stdlib/mbrtowc.c, libc/stdlib/mbsrtowcs.c: Ditto + * libc/stdlib/mbstowcs.c, libc/stdlib/mbtowc.c: Ditto + * libc/stdlib/mbtowc_r.c, libc/stdlib/wcrtomb.c: Ditto + * libc/stdlib/wcsrtombs.c, libc/stdlib/wcstombs.c: Ditto + * libc/stdlib/wctomb.c, libc/sys/linux/intl/dcigettext.c: Ditto + * libc/sys/linux/intl/explodename.c: Ditto + * libc/sys/linux/intl/finddomain.c: Ditto + * libc/sys/linux/intl/l10nflist.c: Ditto + * libc/sys/linux/intl/loadmsgcat.c: Ditto + * libc/sys/linux/intl/localealias.c: Ditto + 2004-04-23 Jeff Johnston <jjohnstn@redhat.com> * libc/machine/powerpc/vfscanf.c (NNZDIGITS): New define. diff --git a/newlib/configure b/newlib/configure index 05c5ae9..eec333c 100755 --- a/newlib/configure +++ b/newlib/configure @@ -3207,6 +3207,10 @@ fi if test "${newlib_mb}" = "yes"; then cat >> confdefs.h <<EOF +#define _MB_CAPABLE 1 +EOF + +cat >> confdefs.h <<EOF #define _MB_LEN_MAX 8 EOF diff --git a/newlib/configure.host b/newlib/configure.host index d1b0bfb..bfc64e9 100644 --- a/newlib/configure.host +++ b/newlib/configure.host @@ -250,10 +250,6 @@ if [ "x${newlib_mb}" = "x" ]; then esac fi -if [ "x${newlib_mb}" = "xyes" ] ; then - newlib_cflags="${newlib_cflags} -DMB_CAPABLE" -fi - # Disable printf/scanf floating-point support if requested. if [ "${newlib_io_float}" = "no" ] ; then diff --git a/newlib/configure.in b/newlib/configure.in index fe4a36f..91a21c7 100644 --- a/newlib/configure.in +++ b/newlib/configure.in @@ -145,6 +145,7 @@ AC_DEFINE_UNQUOTED(_ELIX_LEVEL,${newlib_elix_level}) fi if test "${newlib_mb}" = "yes"; then +AC_DEFINE_UNQUOTED(_MB_CAPABLE) AC_DEFINE_UNQUOTED(_MB_LEN_MAX,8) else AC_DEFINE_UNQUOTED(_MB_LEN_MAX,1) diff --git a/newlib/libc/ctype/iswalpha.c b/newlib/libc/ctype/iswalpha.c index 97fda7f..0e987a9 100644 --- a/newlib/libc/ctype/iswalpha.c +++ b/newlib/libc/ctype/iswalpha.c @@ -56,14 +56,15 @@ PORTABILITY No supporting OS subroutines are required. */ #include <_ansi.h> +#include <newlib.h> #include <wctype.h> #include <string.h> #include <ctype.h> #include "local.h" -#ifdef MB_CAPABLE +#ifdef _MB_CAPABLE #include "utf8alpha.h" -#endif /* MB_CAPABLE */ +#endif /* _MB_CAPABLE */ int _DEFUN(iswalpha,(c), wint_t c) @@ -74,7 +75,7 @@ _DEFUN(iswalpha,(c), wint_t c) unicode = 0; /* fall-through */ } -#ifdef MB_CAPABLE +#ifdef _MB_CAPABLE else if (!strcmp (__lc_ctype, "C-JIS")) { c = __jp2uc (c, JP_JIS); @@ -335,7 +336,7 @@ _DEFUN(iswalpha,(c), wint_t c) /* not in table */ return 0; } -#endif /* MB_CAPABLE */ +#endif /* _MB_CAPABLE */ return (c < (wint_t)0x100 ? isalpha (c) : 0); } diff --git a/newlib/libc/ctype/iswblank.c b/newlib/libc/ctype/iswblank.c index 8834e95..b10756d 100644 --- a/newlib/libc/ctype/iswblank.c +++ b/newlib/libc/ctype/iswblank.c @@ -56,6 +56,7 @@ PORTABILITY No supporting OS subroutines are required. */ #include <_ansi.h> +#include <newlib.h> #include <wctype.h> #include <ctype.h> #include <string.h> @@ -70,7 +71,7 @@ _DEFUN(iswblank,(c), wint_t c) unicode = 0; /* fall-through */ } -#ifdef MB_CAPABLE +#ifdef _MB_CAPABLE else if (!strcmp (__lc_ctype, "C-JIS")) { c = __jp2uc (c, JP_JIS); @@ -98,7 +99,7 @@ _DEFUN(iswblank,(c), wint_t c) (c >= 0x2008 && c <= 0x200b) || c == 0x205f || c == 0x3000); } -#endif /* MB_CAPABLE */ +#endif /* _MB_CAPABLE */ return (c < 0x100 ? isblank (c) : 0); } diff --git a/newlib/libc/ctype/iswcntrl.c b/newlib/libc/ctype/iswcntrl.c index b33af01..d092952 100644 --- a/newlib/libc/ctype/iswcntrl.c +++ b/newlib/libc/ctype/iswcntrl.c @@ -56,6 +56,7 @@ PORTABILITY No supporting OS subroutines are required. */ #include <_ansi.h> +#include <newlib.h> #include <wctype.h> #include <ctype.h> #include <string.h> @@ -70,7 +71,7 @@ _DEFUN(iswcntrl,(c), wint_t c) unicode = 0; /* fall-through */ } -#ifdef MB_CAPABLE +#ifdef _MB_CAPABLE else if (!strcmp (__lc_ctype, "C-JIS")) { c = __jp2uc (c, JP_JIS); @@ -97,7 +98,7 @@ _DEFUN(iswcntrl,(c), wint_t c) (c >= 0x007f && c <= 0x009f) || c == 0x2028 || c == 0x2029); } -#endif /* MB_CAPABLE */ +#endif /* _MB_CAPABLE */ return (c < 0x100 ? iscntrl (c) : 0); } diff --git a/newlib/libc/ctype/iswprint.c b/newlib/libc/ctype/iswprint.c index 5acba9c..f4ec087 100644 --- a/newlib/libc/ctype/iswprint.c +++ b/newlib/libc/ctype/iswprint.c @@ -56,14 +56,15 @@ PORTABILITY No supporting OS subroutines are required. */ #include <_ansi.h> +#include <newlib.h> #include <wctype.h> #include <string.h> #include <ctype.h> #include "local.h" -#ifdef MB_CAPABLE +#ifdef _MB_CAPABLE #include "utf8print.h" -#endif /* MB_CAPABLE */ +#endif /* _MB_CAPABLE */ int _DEFUN(iswprint,(c), wint_t c) @@ -74,7 +75,7 @@ _DEFUN(iswprint,(c), wint_t c) unicode = 0; /* fall-through */ } -#ifdef MB_CAPABLE +#ifdef _MB_CAPABLE else if (!strcmp (__lc_ctype, "C-JIS")) { c = __jp2uc (c, JP_JIS); @@ -390,7 +391,7 @@ _DEFUN(iswprint,(c), wint_t c) /* not in table */ return 0; } -#endif /* MB_CAPABLE */ +#endif /* _MB_CAPABLE */ return (c < (wint_t)0x100 ? isprint (c) : 0); } diff --git a/newlib/libc/ctype/iswpunct.c b/newlib/libc/ctype/iswpunct.c index 716fe5f..88442b6 100644 --- a/newlib/libc/ctype/iswpunct.c +++ b/newlib/libc/ctype/iswpunct.c @@ -56,14 +56,15 @@ PORTABILITY No supporting OS subroutines are required. */ #include <_ansi.h> +#include <newlib.h> #include <wctype.h> #include <string.h> #include <ctype.h> #include "local.h" -#ifdef MB_CAPABLE +#ifdef _MB_CAPABLE #include "utf8punct.h" -#endif /* MB_CAPABLE */ +#endif /* _MB_CAPABLE */ int _DEFUN(iswpunct,(c), wint_t c) @@ -74,7 +75,7 @@ _DEFUN(iswpunct,(c), wint_t c) unicode = 0; /* fall-through */ } -#ifdef MB_CAPABLE +#ifdef _MB_CAPABLE else if (!strcmp (__lc_ctype, "C-JIS")) { c = __jp2uc (c, JP_JIS); @@ -325,7 +326,7 @@ _DEFUN(iswpunct,(c), wint_t c) /* not in table */ return 0; } -#endif /* MB_CAPABLE */ +#endif /* _MB_CAPABLE */ return (c < (wint_t)0x100 ? ispunct (c) : 0); } diff --git a/newlib/libc/ctype/iswspace.c b/newlib/libc/ctype/iswspace.c index cd3d85a..f4d0a0b 100644 --- a/newlib/libc/ctype/iswspace.c +++ b/newlib/libc/ctype/iswspace.c @@ -56,6 +56,7 @@ PORTABILITY No supporting OS subroutines are required. */ #include <_ansi.h> +#include <newlib.h> #include <wctype.h> #include <ctype.h> #include <string.h> @@ -70,7 +71,7 @@ _DEFUN(iswspace,(c), wint_t c) unicode = 0; /* fall-through */ } -#ifdef MB_CAPABLE +#ifdef _MB_CAPABLE else if (!strcmp (__lc_ctype, "C-JIS")) { c = __jp2uc (c, JP_JIS); @@ -99,7 +100,7 @@ _DEFUN(iswspace,(c), wint_t c) c == 0x2028 || c == 0x2029 || c == 0x205f || c == 0x3000); } -#endif /* MB_CAPABLE */ +#endif /* _MB_CAPABLE */ return (c < 0x100 ? isspace (c) : 0); } diff --git a/newlib/libc/ctype/jp2uc.c b/newlib/libc/ctype/jp2uc.c index 044c76b..9d26a7a 100644 --- a/newlib/libc/ctype/jp2uc.c +++ b/newlib/libc/ctype/jp2uc.c @@ -29,7 +29,9 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifdef MB_CAPABLE +#include <newlib.h> + +#ifdef _MB_CAPABLE #include <_ansi.h> #include <wctype.h> @@ -140,4 +142,4 @@ _DEFUN (__jp2uc, (c, type), wint_t c _AND int type) return WEOF; } -#endif /* MB_CAPABLE */ +#endif /* _MB_CAPABLE */ diff --git a/newlib/libc/ctype/towlower.c b/newlib/libc/ctype/towlower.c index a0b03b8..5c36a31 100644 --- a/newlib/libc/ctype/towlower.c +++ b/newlib/libc/ctype/towlower.c @@ -59,6 +59,7 @@ No supporting OS subroutines are required. */ #include <_ansi.h> +#include <newlib.h> #include <string.h> #include <reent.h> #include <ctype.h> @@ -75,7 +76,7 @@ _DEFUN(towlower,(c), wint_t c) unicode = 0; /* fall-through */ } -#ifdef MB_CAPABLE +#ifdef _MB_CAPABLE else if (!strcmp (__lc_ctype, "C-JIS")) { c = __jp2uc (c, JP_JIS); @@ -471,7 +472,7 @@ _DEFUN(towlower,(c), wint_t c) return 0x00e5; } } -#endif /* MB_CAPABLE */ +#endif /* _MB_CAPABLE */ return (c < 0x00ff ? (wint_t)(tolower ((int)c)) : c); } diff --git a/newlib/libc/ctype/towupper.c b/newlib/libc/ctype/towupper.c index b14e5aa..530aebf 100644 --- a/newlib/libc/ctype/towupper.c +++ b/newlib/libc/ctype/towupper.c @@ -59,6 +59,7 @@ No supporting OS subroutines are required. */ #include <_ansi.h> +#include <newlib.h> #include <string.h> #include <reent.h> #include <ctype.h> @@ -75,7 +76,7 @@ _DEFUN(towupper,(c), wint_t c) unicode = 0; /* fall-through */ } -#ifdef MB_CAPABLE +#ifdef _MB_CAPABLE else if (!strcmp (__lc_ctype, "C-JIS")) { c = __jp2uc (c, JP_JIS); @@ -498,7 +499,7 @@ _DEFUN(towupper,(c), wint_t c) return (c - 0x28); } } -#endif /* MB_CAPABLE */ +#endif /* _MB_CAPABLE */ return (c < 0x00ff ? (wint_t)(toupper ((int)c)) : c); } diff --git a/newlib/libc/locale/locale.c b/newlib/libc/locale/locale.c index 66c93d7..d48a53a 100644 --- a/newlib/libc/locale/locale.c +++ b/newlib/libc/locale/locale.c @@ -44,7 +44,7 @@ locale. This is a minimal implementation, supporting only the required <<"C">> value for <[locale]>; strings representing other locales are not -honored unless MB_CAPABLE is defined in which case three new +honored unless _MB_CAPABLE is defined in which case three new extensions are allowed for LC_CTYPE or LC_MESSAGES only: <<"C-JIS">>, <<"C-EUCJP">>, <<"C-SJIS">>, or <<"C-ISO-8859-1">>. (<<"">> is also accepted; it represents the default locale @@ -86,6 +86,7 @@ No supporting OS subroutines are required. * (Only "C" or null supported). */ +#include <newlib.h> #include <locale.h> #include <string.h> #include <limits.h> @@ -120,7 +121,7 @@ _DEFUN(_setlocale_r, (p, category, locale), int category _AND _CONST char *locale) { -#ifndef MB_CAPABLE +#ifndef _MB_CAPABLE if (locale) { if (strcmp (locale, "C") && strcmp (locale, "")) diff --git a/newlib/libc/machine/powerpc/vfscanf.c b/newlib/libc/machine/powerpc/vfscanf.c index add1211..00aafb5 100644 --- a/newlib/libc/machine/powerpc/vfscanf.c +++ b/newlib/libc/machine/powerpc/vfscanf.c @@ -103,6 +103,7 @@ Supporting OS subroutines required: */ #include <_ansi.h> +#include <newlib.h> #include <ctype.h> #include <stdio.h> #include <stdlib.h> @@ -279,7 +280,7 @@ __svfscanf_r (rptr, fp, fmt0, ap) char buf[BUF]; /* buffer for numeric conversions */ vec_union vec_buf; char *lptr; /* literal pointer */ -#ifdef MB_CAPABLE +#ifdef _MB_CAPABLE mbstate_t state; /* value to keep track of multibyte state */ #endif @@ -304,7 +305,7 @@ __svfscanf_r (rptr, fp, fmt0, ap) nread = 0; for (;;) { -#ifndef MB_CAPABLE +#ifndef _MB_CAPABLE wc = *fmt; #else memset (&state, '\0', sizeof (state)); diff --git a/newlib/libc/stdio/vfprintf.c b/newlib/libc/stdio/vfprintf.c index b61c78d..ab40b2f 100644 --- a/newlib/libc/stdio/vfprintf.c +++ b/newlib/libc/stdio/vfprintf.c @@ -180,6 +180,7 @@ static char *rcsid = "$Id$"; #endif #include <_ansi.h> +#include <newlib.h> #include <reent.h> #include <stdio.h> #include <stdlib.h> @@ -440,7 +441,7 @@ _DEFUN(_VFPRINTF_R, (data, fp, fmt0, ap), struct __siov iov[NIOV];/* ... and individual io vectors */ char buf[BUF]; /* space for %c, %[diouxX], %[eEfgG] */ char ox[2]; /* space for 0x hex-prefix */ -#ifdef MB_CAPABLE +#ifdef _MB_CAPABLE wchar_t wc; mbstate_t state; /* mbtowc calls from library must not change state */ #endif @@ -457,7 +458,7 @@ _DEFUN(_VFPRINTF_R, (data, fp, fmt0, ap), static _CONST char zeroes[PADSIZE] = {'0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0'}; -#ifdef MB_CAPABLE +#ifdef _MB_CAPABLE memset (&state, '\0', sizeof (state)); #endif /* @@ -560,7 +561,7 @@ _DEFUN(_VFPRINTF_R, (data, fp, fmt0, ap), */ for (;;) { cp = fmt; -#ifdef MB_CAPABLE +#ifdef _MB_CAPABLE while ((n = _mbtowc_r (data, &wc, fmt, MB_CUR_MAX, &state)) > 0) { if (wc == '%') break; @@ -574,7 +575,7 @@ _DEFUN(_VFPRINTF_R, (data, fp, fmt0, ap), PRINT (cp, m); ret += m; } -#ifdef MB_CAPABLE +#ifdef _MB_CAPABLE if (n <= 0) goto done; #else @@ -1491,7 +1492,7 @@ _DEFUN(get_arg, (data, n, fmt, ap, numargs_p, args, arg_type, last_fmt), int pos, last_arg; int max_pos_arg = n; enum types { INT, LONG_INT, SHORT_INT, QUAD_INT, CHAR, CHAR_PTR, DOUBLE, LONG_DOUBLE, WIDE_CHAR }; -#ifdef MB_CAPABLE +#ifdef _MB_CAPABLE wchar_t wc; mbstate_t wc_state; int nbytes; @@ -1501,7 +1502,7 @@ _DEFUN(get_arg, (data, n, fmt, ap, numargs_p, args, arg_type, last_fmt), if (*last_fmt != NULL) fmt = *last_fmt; -#ifdef MB_CAPABLE +#ifdef _MB_CAPABLE memset (&wc_state, '\0', sizeof (wc_state)); #endif @@ -1509,7 +1510,7 @@ _DEFUN(get_arg, (data, n, fmt, ap, numargs_p, args, arg_type, last_fmt), read the desired parameter from the vararg list. */ while (*fmt && n >= numargs) { -#ifdef MB_CAPABLE +#ifdef _MB_CAPABLE while ((nbytes = _mbtowc_r (data, &wc, fmt, MB_CUR_MAX, &wc_state)) > 0) { fmt += nbytes; diff --git a/newlib/libc/stdio/vfscanf.c b/newlib/libc/stdio/vfscanf.c index 7e4f335..7f83e16 100644 --- a/newlib/libc/stdio/vfscanf.c +++ b/newlib/libc/stdio/vfscanf.c @@ -103,6 +103,7 @@ Supporting OS subroutines required: */ #include <_ansi.h> +#include <newlib.h> #include <reent.h> #include <ctype.h> #include <wctype.h> @@ -293,7 +294,7 @@ _DEFUN(__svfscanf_r, (rptr, fp, fmt0, ap), nread = 0; for (;;) { -#ifndef MB_CAPABLE +#ifndef _MB_CAPABLE wc = *fmt; #else memset (&state, '\0', sizeof (state)); diff --git a/newlib/libc/stdlib/mblen.c b/newlib/libc/stdlib/mblen.c index b131095..6df27b9 100644 --- a/newlib/libc/stdlib/mblen.c +++ b/newlib/libc/stdlib/mblen.c @@ -16,20 +16,20 @@ TRAD_SYNOPSIS size_t <[n]>; DESCRIPTION -When MB_CAPABLE is not defined, this is a minimal ANSI-conforming +When _MB_CAPABLE is not defined, this is a minimal ANSI-conforming implementation of <<mblen>>. In this case, the only ``multi-byte character sequences'' recognized are single bytes, and thus <<1>> is returned unless <[s]> is the null pointer or has a length of 0 or is the empty string. -When MB_CAPABLE is defined, this routine calls <<_mbtowc_r>> to perform +When _MB_CAPABLE is defined, this routine calls <<_mbtowc_r>> to perform the conversion, passing a state variable to allow state dependent decoding. The result is based on the locale setting which may be restricted to a defined set of locales. RETURNS This implementation of <<mblen>> returns <<0>> if -<[s]> is <<NULL>> or the empty string; it returns <<1>> if not MB_CAPABLE or +<[s]> is <<NULL>> or the empty string; it returns <<1>> if not _MB_CAPABLE or the character is a single-byte character; it returns <<-1>> if the multi-byte character is invalid; otherwise it returns the number of bytes in the multibyte character. @@ -43,6 +43,7 @@ effects vary with the locale. #ifndef _REENT_ONLY +#include <newlib.h> #include <stdlib.h> #include <wchar.h> @@ -51,7 +52,7 @@ _DEFUN (mblen, (s, n), const char *s _AND size_t n) { -#ifdef MB_CAPABLE +#ifdef _MB_CAPABLE int retval = 0; mbstate_t *state; @@ -66,13 +67,13 @@ _DEFUN (mblen, (s, n), else return retval; -#else /* not MB_CAPABLE */ +#else /* not _MB_CAPABLE */ if (s == NULL || *s == '\0') return 0; if (n == 0) return -1; return 1; -#endif /* not MB_CAPABLE */ +#endif /* not _MB_CAPABLE */ } #endif /* !_REENT_ONLY */ diff --git a/newlib/libc/stdlib/mblen_r.c b/newlib/libc/stdlib/mblen_r.c index 1d66597..9361f65 100644 --- a/newlib/libc/stdlib/mblen_r.c +++ b/newlib/libc/stdlib/mblen_r.c @@ -18,20 +18,20 @@ TRAD_SYNOPSIS int *<[state]>; DESCRIPTION -When MB_CAPABLE is not defined, this is a minimal ANSI-conforming +When _MB_CAPABLE is not defined, this is a minimal ANSI-conforming implementation of <<_mblen_r>>. In this case, the only ``multi-byte character sequences'' recognized are single bytes, and thus <<1>> is returned unless <[s]> is the null pointer or has a length of 0 or is the empty string. -When MB_CAPABLE is defined, this routine calls <<_mbtowc_r>> to perform +When _MB_CAPABLE is defined, this routine calls <<_mbtowc_r>> to perform the conversion, passing a state variable to allow state dependent decoding. The result is based on the locale setting which may be restricted to a defined set of locales. RETURNS This implementation of <<_mblen_r>> returns <<0>> if -<[s]> is <<NULL>> or the empty string; it returns <<1>> if not MB_CAPABLE or +<[s]> is <<NULL>> or the empty string; it returns <<1>> if not _MB_CAPABLE or the character is a single-byte character; it returns <<-1>> if the multi-byte character is invalid; otherwise it returns the number of bytes in the multibyte character. @@ -43,6 +43,7 @@ effects vary with the locale. <<_mblen_r>> requires no supporting OS subroutines. */ +#include <newlib.h> #include <stdlib.h> #include <wchar.h> @@ -53,7 +54,7 @@ _DEFUN (_mblen_r, (r, s, n, state), size_t n _AND mbstate_t *state) { -#ifdef MB_CAPABLE +#ifdef _MB_CAPABLE int retval; retval = _mbtowc_r (r, NULL, s, n, state); @@ -64,12 +65,12 @@ _DEFUN (_mblen_r, (r, s, n, state), } return retval; -#else /* not MB_CAPABLE */ +#else /* not _MB_CAPABLE */ if (s == NULL || *s == '\0') return 0; if (n == 0) return -1; return 1; -#endif /* not MB_CAPABLE */ +#endif /* not _MB_CAPABLE */ } diff --git a/newlib/libc/stdlib/mbrlen.c b/newlib/libc/stdlib/mbrlen.c index cf14add..ac9aa32 100644 --- a/newlib/libc/stdlib/mbrlen.c +++ b/newlib/libc/stdlib/mbrlen.c @@ -1,4 +1,5 @@ #include <reent.h> +#include <newlib.h> #include <wchar.h> #include <stdlib.h> #include <stdio.h> @@ -7,7 +8,7 @@ size_t mbrlen(const char *s, size_t n, mbstate_t *ps) { -#ifdef MB_CAPABLE +#ifdef _MB_CAPABLE if (ps == NULL) { _REENT_CHECK_MISC(_REENT); diff --git a/newlib/libc/stdlib/mbrtowc.c b/newlib/libc/stdlib/mbrtowc.c index 3a96592..c5e700d 100644 --- a/newlib/libc/stdlib/mbrtowc.c +++ b/newlib/libc/stdlib/mbrtowc.c @@ -1,4 +1,5 @@ #include <reent.h> +#include <newlib.h> #include <wchar.h> #include <stdlib.h> #include <stdio.h> @@ -15,7 +16,7 @@ _DEFUN (_mbrtowc_r, (ptr, pwc, s, n, ps), { int retval = 0; -#ifdef MB_CAPABLE +#ifdef _MB_CAPABLE if (ps == NULL) { _REENT_CHECK_MISC(ptr); diff --git a/newlib/libc/stdlib/mbsrtowcs.c b/newlib/libc/stdlib/mbsrtowcs.c index d050bf8..2eaa0fe 100644 --- a/newlib/libc/stdlib/mbsrtowcs.c +++ b/newlib/libc/stdlib/mbsrtowcs.c @@ -1,4 +1,5 @@ #include <reent.h> +#include <newlib.h> #include <wchar.h> #include <stdlib.h> #include <stdio.h> @@ -18,7 +19,7 @@ _DEFUN (_mbsrtowcs_r, (r, dst, src, n, ps), size_t count = 0; int bytes; -#ifdef MB_CAPABLE +#ifdef _MB_CAPABLE if (ps == NULL) { _REENT_CHECK_MISC(r); diff --git a/newlib/libc/stdlib/mbstowcs.c b/newlib/libc/stdlib/mbstowcs.c index cb09f31..334b5f5 100644 --- a/newlib/libc/stdlib/mbstowcs.c +++ b/newlib/libc/stdlib/mbstowcs.c @@ -17,13 +17,13 @@ TRAD_SYNOPSIS size_t <[n]>; DESCRIPTION -When MB_CAPABLE is not defined, this is a minimal ANSI-conforming +When _MB_CAPABLE is not defined, this is a minimal ANSI-conforming implementation of <<mbstowcs>>. In this case, the only ``multi-byte character sequences'' recognized are single bytes, and they are ``converted'' to wide-char versions simply by byte extension. -When MB_CAPABLE is defined, this routine calls <<_mbstowcs_r>> to perform +When _MB_CAPABLE is defined, this routine calls <<_mbstowcs_r>> to perform the conversion, passing a state variable to allow state dependent decoding. The result is based on the locale setting which may be restricted to a defined set of locales. @@ -31,7 +31,7 @@ be restricted to a defined set of locales. RETURNS This implementation of <<mbstowcs>> returns <<0>> if <[s]> is <<NULL>> or is the empty string; -it returns <<-1>> if MB_CAPABLE and one of the +it returns <<-1>> if _MB_CAPABLE and one of the multi-byte characters is invalid or incomplete; otherwise it returns the minimum of: <<n>> or the number of multi-byte characters in <<s>> plus 1 (to @@ -49,6 +49,7 @@ effects vary with the locale. #ifndef _REENT_ONLY +#include <newlib.h> #include <stdlib.h> #include <wchar.h> @@ -58,12 +59,12 @@ _DEFUN (mbstowcs, (pwcs, s, n), const char *s _AND size_t n) { -#ifdef MB_CAPABLE +#ifdef _MB_CAPABLE mbstate_t state; state.__count = 0; return _mbstowcs_r (_REENT, pwcs, s, n, &state); -#else /* not MB_CAPABLE */ +#else /* not _MB_CAPABLE */ int count = 0; @@ -76,7 +77,7 @@ _DEFUN (mbstowcs, (pwcs, s, n), } return count; -#endif /* not MB_CAPABLE */ +#endif /* not _MB_CAPABLE */ } #endif /* !_REENT_ONLY */ diff --git a/newlib/libc/stdlib/mbtowc.c b/newlib/libc/stdlib/mbtowc.c index e1e725d..3f34b8a 100644 --- a/newlib/libc/stdlib/mbtowc.c +++ b/newlib/libc/stdlib/mbtowc.c @@ -17,7 +17,7 @@ TRAD_SYNOPSIS size_t <[n]>; DESCRIPTION -When MB_CAPABLE is not defined, this is a minimal ANSI-conforming +When _MB_CAPABLE is not defined, this is a minimal ANSI-conforming implementation of <<mbtowc>>. In this case, only ``multi-byte character sequences'' recognized are single bytes, and they are ``converted'' to themselves. @@ -25,7 +25,7 @@ Each call to <<mbtowc>> copies one character from <<*<[s]>>> to <<*<[pwc]>>>, unless <[s]> is a null pointer. The argument n is ignored. -When MB_CAPABLE is defined, this routine calls <<_mbtowc_r>> to perform +When _MB_CAPABLE is defined, this routine calls <<_mbtowc_r>> to perform the conversion, passing a state variable to allow state dependent decoding. The result is based on the locale setting which may be restricted to a defined set of locales. @@ -33,7 +33,7 @@ be restricted to a defined set of locales. RETURNS This implementation of <<mbtowc>> returns <<0>> if <[s]> is <<NULL>> or is the empty string; -it returns <<1>> if not MB_CAPABLE or +it returns <<1>> if not _MB_CAPABLE or the character is a single-byte character; it returns <<-1>> if n is <<0>> or the multi-byte character is invalid; otherwise it returns the number of bytes in the multibyte character. @@ -51,6 +51,7 @@ effects vary with the locale. #ifndef _REENT_ONLY +#include <newlib.h> #include <stdlib.h> #include <wchar.h> @@ -60,7 +61,7 @@ _DEFUN (mbtowc, (pwc, s, n), const char *s _AND size_t n) { -#ifdef MB_CAPABLE +#ifdef _MB_CAPABLE int retval = 0; mbstate_t *ps; @@ -75,7 +76,7 @@ _DEFUN (mbtowc, (pwc, s, n), return -1; } return retval; -#else /* not MB_CAPABLE */ +#else /* not _MB_CAPABLE */ if (s == NULL) return 0; if (n == 0) @@ -83,7 +84,7 @@ _DEFUN (mbtowc, (pwc, s, n), if (pwc) *pwc = (wchar_t) *s; return (*s != '\0'); -#endif /* not MB_CAPABLE */ +#endif /* not _MB_CAPABLE */ } #endif /* !_REENT_ONLY */ diff --git a/newlib/libc/stdlib/mbtowc_r.c b/newlib/libc/stdlib/mbtowc_r.c index c7c7eff..7f0dd11 100644 --- a/newlib/libc/stdlib/mbtowc_r.c +++ b/newlib/libc/stdlib/mbtowc_r.c @@ -1,10 +1,11 @@ +#include <newlib.h> #include <stdlib.h> #include <locale.h> #include "mbctype.h" #include <wchar.h> #include <string.h> -#ifdef MB_CAPABLE +#ifdef _MB_CAPABLE typedef enum { ESCAPE, DOLLAR, BRACKET, AT, B, J, NUL, JIS_CHAR, OTHER, JIS_C_NUM } JIS_CHAR_TYPE; typedef enum { ASCII, JIS, A_ESC, A_ESC_DL, JIS_1, J_ESC, J_ESC_BR, @@ -39,7 +40,7 @@ static JIS_ACTION JIS_action_table[JIS_S_NUM][JIS_C_NUM] = { /* J_ESC */ { ERROR, ERROR, NOOP, ERROR, ERROR, ERROR, ERROR, ERROR, ERROR }, /* J_ESC_BR */{ ERROR, ERROR, ERROR, ERROR, MAKE_A, MAKE_A, ERROR, ERROR, ERROR }, }; -#endif /* MB_CAPABLE */ +#endif /* _MB_CAPABLE */ /* we override the mbstate_t __count field for more complex encodings and use it store a state value */ #define __state __count @@ -63,7 +64,7 @@ _DEFUN (_mbtowc_r, (r, pwc, s, n, state), if (s != NULL && n == 0) return -2; -#ifdef MB_CAPABLE +#ifdef _MB_CAPABLE if (__lc_ctype == NULL || (strlen (__lc_ctype) <= 1)) { /* fall-through */ } @@ -455,7 +456,7 @@ _DEFUN (_mbtowc_r, (r, pwc, s, n, state), state->__state = curr_state; return -2; /* n < bytes needed */ } -#endif /* MB_CAPABLE */ +#endif /* _MB_CAPABLE */ /* otherwise this must be the "C" locale or unknown locale */ if (s == NULL) diff --git a/newlib/libc/stdlib/wcrtomb.c b/newlib/libc/stdlib/wcrtomb.c index fbd71b1..06e4874 100644 --- a/newlib/libc/stdlib/wcrtomb.c +++ b/newlib/libc/stdlib/wcrtomb.c @@ -1,4 +1,5 @@ #include <reent.h> +#include <newlib.h> #include <wchar.h> #include <stdlib.h> #include <stdio.h> @@ -14,7 +15,7 @@ _DEFUN (_wcrtomb_r, (ptr, s, wc, ps), int retval = 0; char buf[10]; -#ifdef MB_CAPABLE +#ifdef _MB_CAPABLE if (ps == NULL) { _REENT_CHECK_MISC(ptr); diff --git a/newlib/libc/stdlib/wcsrtombs.c b/newlib/libc/stdlib/wcsrtombs.c index 8c55b08..6871d0c 100644 --- a/newlib/libc/stdlib/wcsrtombs.c +++ b/newlib/libc/stdlib/wcsrtombs.c @@ -1,4 +1,5 @@ #include <reent.h> +#include <newlib.h> #include <wchar.h> #include <stdlib.h> #include <stdio.h> @@ -18,7 +19,7 @@ _DEFUN (_wcsrtombs_r, (r, dst, src, len, ps), size_t n; int i; -#ifdef MB_CAPABLE +#ifdef _MB_CAPABLE if (ps == NULL) { _REENT_CHECK_MISC(r); diff --git a/newlib/libc/stdlib/wcstombs.c b/newlib/libc/stdlib/wcstombs.c index f02d4ab..83e48da 100644 --- a/newlib/libc/stdlib/wcstombs.c +++ b/newlib/libc/stdlib/wcstombs.c @@ -17,12 +17,12 @@ TRAD_SYNOPSIS size_t <[n]>; DESCRIPTION -When MB_CAPABLE is not defined, this is a minimal ANSI-conforming +When _MB_CAPABLE is not defined, this is a minimal ANSI-conforming implementation of <<wcstombs>>. In this case, all wide-characters are expected to represent single bytes and so are converted simply by casting to char. -When MB_CAPABLE is defined, this routine calls <<_wcstombs_r>> to perform +When _MB_CAPABLE is defined, this routine calls <<_wcstombs_r>> to perform the conversion, passing a state variable to allow state dependent decoding. The result is based on the locale setting which may be restricted to a defined set of locales. @@ -30,7 +30,7 @@ be restricted to a defined set of locales. RETURNS This implementation of <<wcstombs>> returns <<0>> if <[s]> is <<NULL>> or is the empty string; -it returns <<-1>> if MB_CAPABLE and one of the +it returns <<-1>> if _MB_CAPABLE and one of the wide-char characters does not represent a valid multi-byte character; otherwise it returns the minimum of: <<n>> or the number of bytes that are transferred to <<s>>, not including the @@ -50,6 +50,7 @@ effects vary with the locale. #ifndef _REENT_ONLY +#include <newlib.h> #include <stdlib.h> #include <wchar.h> @@ -59,12 +60,12 @@ _DEFUN (wcstombs, (s, pwcs, n), const wchar_t *pwcs _AND size_t n) { -#ifdef MB_CAPABLE +#ifdef _MB_CAPABLE mbstate_t state; state.__count = 0; return _wcstombs_r (_REENT, s, pwcs, n, &state); -#else /* not MB_CAPABLE */ +#else /* not _MB_CAPABLE */ int count = 0; if (n != 0) { @@ -76,7 +77,7 @@ _DEFUN (wcstombs, (s, pwcs, n), } return count; -#endif /* not MB_CAPABLE */ +#endif /* not _MB_CAPABLE */ } #endif /* !_REENT_ONLY */ diff --git a/newlib/libc/stdlib/wctomb.c b/newlib/libc/stdlib/wctomb.c index 5cff10f..f2c6249 100644 --- a/newlib/libc/stdlib/wctomb.c +++ b/newlib/libc/stdlib/wctomb.c @@ -16,24 +16,24 @@ TRAD_SYNOPSIS wchar_t <[wchar]>; DESCRIPTION -When MB_CAPABLE is not defined, this is a minimal ANSI-conforming +When _MB_CAPABLE is not defined, this is a minimal ANSI-conforming implementation of <<wctomb>>. The only ``wide characters'' recognized are single bytes, and they are ``converted'' to themselves. -When MB_CAPABLE is defined, this routine calls <<_wctomb_r>> to perform +When _MB_CAPABLE is defined, this routine calls <<_wctomb_r>> to perform the conversion, passing a state variable to allow state dependent decoding. The result is based on the locale setting which may be restricted to a defined set of locales. Each call to <<wctomb>> modifies <<*<[s]>>> unless <[s]> is a null -pointer or MB_CAPABLE is defined and <[wchar]> is invalid. +pointer or _MB_CAPABLE is defined and <[wchar]> is invalid. RETURNS This implementation of <<wctomb>> returns <<0>> if -<[s]> is <<NULL>>; it returns <<-1>> if MB_CAPABLE is enabled +<[s]> is <<NULL>>; it returns <<-1>> if _MB_CAPABLE is enabled and the wchar is not a valid multi-byte character, it returns <<1>> -if MB_CAPABLE is not defined or the wchar is in reality a single +if _MB_CAPABLE is not defined or the wchar is in reality a single byte character, otherwise it returns the number of bytes in the multi-byte character. @@ -46,6 +46,7 @@ effects vary with the locale. #ifndef _REENT_ONLY +#include <newlib.h> #include <stdlib.h> int @@ -53,17 +54,17 @@ _DEFUN (wctomb, (s, wchar), char *s _AND wchar_t wchar) { -#ifdef MB_CAPABLE +#ifdef _MB_CAPABLE _REENT_CHECK_MISC(_REENT); return _wctomb_r (_REENT, s, wchar, &(_REENT_WCTOMB_STATE(_REENT))); -#else /* not MB_CAPABLE */ +#else /* not _MB_CAPABLE */ if (s == NULL) return 0; *s = (char) wchar; return 1; -#endif /* not MB_CAPABLE */ +#endif /* not _MB_CAPABLE */ } #endif /* !_REENT_ONLY */ diff --git a/newlib/libc/sys/linux/intl/dcigettext.c b/newlib/libc/sys/linux/intl/dcigettext.c index 017be46..de47064 100644 --- a/newlib/libc/sys/linux/intl/dcigettext.c +++ b/newlib/libc/sys/linux/intl/dcigettext.c @@ -17,7 +17,9 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#ifdef MB_CAPABLE +#include <newlib.h> + +#ifdef _MB_CAPABLE /* Tell glibc's <string.h> to provide a prototype for mempcpy(). This must come before <config.h> because <config.h> may include @@ -1237,7 +1239,7 @@ free_mem (void) text_set_element (__libc_subfreeres, free_mem); #endif -#else /* !MB_CAPABLE */ +#else /* !_MB_CAPABLE */ #include <machine/weakalias.h> #include <sys/lock.h> @@ -1281,4 +1283,4 @@ __dcigettext (domainname, msgid1, msgid2, plural, n, category) } weak_alias(__dcigettext, dcigettext) -#endif /* !MB_CAPABLE */ +#endif /* !_MB_CAPABLE */ diff --git a/newlib/libc/sys/linux/intl/explodename.c b/newlib/libc/sys/linux/intl/explodename.c index d36b045..6effd33 100644 --- a/newlib/libc/sys/linux/intl/explodename.c +++ b/newlib/libc/sys/linux/intl/explodename.c @@ -1,4 +1,6 @@ -#ifdef MB_CAPABLE +#include <newlib.h> + +#ifdef _MB_CAPABLE /* Copyright (C) 1995-1998, 2000, 2001 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -201,4 +203,4 @@ _nl_explode_name (name, language, modifier, territory, codeset, return mask; } -#endif /* MB_CAPABLE */ +#endif /* _MB_CAPABLE */ diff --git a/newlib/libc/sys/linux/intl/finddomain.c b/newlib/libc/sys/linux/intl/finddomain.c index f643057..4f27790 100644 --- a/newlib/libc/sys/linux/intl/finddomain.c +++ b/newlib/libc/sys/linux/intl/finddomain.c @@ -1,4 +1,6 @@ -#ifdef MB_CAPABLE +#include <newlib.h> + +#ifdef _MB_CAPABLE /* Handle list of needed message catalogs Copyright (C) 1995-1999, 2000, 2001 Free Software Foundation, Inc. @@ -217,4 +219,4 @@ free_mem (void) text_set_element (__libc_subfreeres, free_mem); #endif -#endif /* MB_CAPABLE */ +#endif /* _MB_CAPABLE */ diff --git a/newlib/libc/sys/linux/intl/l10nflist.c b/newlib/libc/sys/linux/intl/l10nflist.c index 1a5cf1e..564df73 100644 --- a/newlib/libc/sys/linux/intl/l10nflist.c +++ b/newlib/libc/sys/linux/intl/l10nflist.c @@ -1,4 +1,6 @@ -#ifdef MB_CAPABLE +#include <newlib.h> + +#ifdef _MB_CAPABLE /* Copyright (C) 1995-1999, 2000, 2001 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -418,4 +420,4 @@ stpcpy (dest, src) } #endif -#endif /* MB_CAPABLE */ +#endif /* _MB_CAPABLE */ diff --git a/newlib/libc/sys/linux/intl/loadmsgcat.c b/newlib/libc/sys/linux/intl/loadmsgcat.c index 94f3e9a..b5f722e 100644 --- a/newlib/libc/sys/linux/intl/loadmsgcat.c +++ b/newlib/libc/sys/linux/intl/loadmsgcat.c @@ -1,4 +1,6 @@ -#ifdef MB_CAPABLE +#include <newlib.h> + +#ifdef _MB_CAPABLE /* Load needed message catalogs. Copyright (C) 1995-1999, 2000, 2001 Free Software Foundation, Inc. diff --git a/newlib/libc/sys/linux/intl/localealias.c b/newlib/libc/sys/linux/intl/localealias.c index 03b6304..f3a8923 100644 --- a/newlib/libc/sys/linux/intl/localealias.c +++ b/newlib/libc/sys/linux/intl/localealias.c @@ -1,4 +1,6 @@ -#ifdef MB_CAPABLE +#include <newlib.h> + +#ifdef _MB_CAPABLE /* Handle aliases for locale names. Copyright (C) 1995-1999, 2000, 2001 Free Software Foundation, Inc. @@ -440,4 +442,4 @@ alias_compare (map1, map2) #endif } -#endif /* MB_CAPABLE */ +#endif /* _MB_CAPABLE */ diff --git a/newlib/newlib.hin b/newlib/newlib.hin index 6f5497c..dfdf198 100644 --- a/newlib/newlib.hin +++ b/newlib/newlib.hin @@ -8,6 +8,9 @@ /* Newlib version */ #undef _NEWLIB_VERSION +/* Multibyte supported */ +#undef _MB_CAPABLE + /* MB_LEN_MAX */ #undef _MB_LEN_MAX |