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
This commit is contained in:
Jeff Johnston
2004-04-23 21:44:22 +00:00
parent 27c7566ca4
commit f777e3a5ac
36 changed files with 170 additions and 99 deletions

View File

@ -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;

View File

@ -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));