* 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 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.
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
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
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)
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)
unicode = 0;
/* fall-through */
}
-#ifdef MB_CAPABLE
+#ifdef _MB_CAPABLE
else if (!strcmp (__lc_ctype, "C-JIS"))
{
c = __jp2uc (c, JP_JIS);
/* not in table */
return 0;
}
-#endif /* MB_CAPABLE */
+#endif /* _MB_CAPABLE */
return (c < (wint_t)0x100 ? isalpha (c) : 0);
}
No supporting OS subroutines are required.
*/
#include <_ansi.h>
+#include <newlib.h>
#include <wctype.h>
#include <ctype.h>
#include <string.h>
unicode = 0;
/* fall-through */
}
-#ifdef MB_CAPABLE
+#ifdef _MB_CAPABLE
else if (!strcmp (__lc_ctype, "C-JIS"))
{
c = __jp2uc (c, JP_JIS);
(c >= 0x2008 && c <= 0x200b) ||
c == 0x205f || c == 0x3000);
}
-#endif /* MB_CAPABLE */
+#endif /* _MB_CAPABLE */
return (c < 0x100 ? isblank (c) : 0);
}
No supporting OS subroutines are required.
*/
#include <_ansi.h>
+#include <newlib.h>
#include <wctype.h>
#include <ctype.h>
#include <string.h>
unicode = 0;
/* fall-through */
}
-#ifdef MB_CAPABLE
+#ifdef _MB_CAPABLE
else if (!strcmp (__lc_ctype, "C-JIS"))
{
c = __jp2uc (c, JP_JIS);
(c >= 0x007f && c <= 0x009f) ||
c == 0x2028 || c == 0x2029);
}
-#endif /* MB_CAPABLE */
+#endif /* _MB_CAPABLE */
return (c < 0x100 ? iscntrl (c) : 0);
}
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)
unicode = 0;
/* fall-through */
}
-#ifdef MB_CAPABLE
+#ifdef _MB_CAPABLE
else if (!strcmp (__lc_ctype, "C-JIS"))
{
c = __jp2uc (c, JP_JIS);
/* not in table */
return 0;
}
-#endif /* MB_CAPABLE */
+#endif /* _MB_CAPABLE */
return (c < (wint_t)0x100 ? isprint (c) : 0);
}
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)
unicode = 0;
/* fall-through */
}
-#ifdef MB_CAPABLE
+#ifdef _MB_CAPABLE
else if (!strcmp (__lc_ctype, "C-JIS"))
{
c = __jp2uc (c, JP_JIS);
/* not in table */
return 0;
}
-#endif /* MB_CAPABLE */
+#endif /* _MB_CAPABLE */
return (c < (wint_t)0x100 ? ispunct (c) : 0);
}
No supporting OS subroutines are required.
*/
#include <_ansi.h>
+#include <newlib.h>
#include <wctype.h>
#include <ctype.h>
#include <string.h>
unicode = 0;
/* fall-through */
}
-#ifdef MB_CAPABLE
+#ifdef _MB_CAPABLE
else if (!strcmp (__lc_ctype, "C-JIS"))
{
c = __jp2uc (c, JP_JIS);
c == 0x2028 || c == 0x2029 ||
c == 0x205f || c == 0x3000);
}
-#endif /* MB_CAPABLE */
+#endif /* _MB_CAPABLE */
return (c < 0x100 ? isspace (c) : 0);
}
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>
return WEOF;
}
-#endif /* MB_CAPABLE */
+#endif /* _MB_CAPABLE */
*/
#include <_ansi.h>
+#include <newlib.h>
#include <string.h>
#include <reent.h>
#include <ctype.h>
unicode = 0;
/* fall-through */
}
-#ifdef MB_CAPABLE
+#ifdef _MB_CAPABLE
else if (!strcmp (__lc_ctype, "C-JIS"))
{
c = __jp2uc (c, JP_JIS);
return 0x00e5;
}
}
-#endif /* MB_CAPABLE */
+#endif /* _MB_CAPABLE */
return (c < 0x00ff ? (wint_t)(tolower ((int)c)) : c);
}
*/
#include <_ansi.h>
+#include <newlib.h>
#include <string.h>
#include <reent.h>
#include <ctype.h>
unicode = 0;
/* fall-through */
}
-#ifdef MB_CAPABLE
+#ifdef _MB_CAPABLE
else if (!strcmp (__lc_ctype, "C-JIS"))
{
c = __jp2uc (c, JP_JIS);
return (c - 0x28);
}
}
-#endif /* MB_CAPABLE */
+#endif /* _MB_CAPABLE */
return (c < 0x00ff ? (wint_t)(toupper ((int)c)) : c);
}
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
* (Only "C" or null supported).
*/
+#include <newlib.h>
#include <locale.h>
#include <string.h>
#include <limits.h>
int category _AND
_CONST char *locale)
{
-#ifndef MB_CAPABLE
+#ifndef _MB_CAPABLE
if (locale)
{
if (strcmp (locale, "C") && strcmp (locale, ""))
*/
#include <_ansi.h>
+#include <newlib.h>
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
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
nread = 0;
for (;;)
{
-#ifndef MB_CAPABLE
+#ifndef _MB_CAPABLE
wc = *fmt;
#else
memset (&state, '\0', sizeof (state));
#endif
#include <_ansi.h>
+#include <newlib.h>
#include <reent.h>
#include <stdio.h>
#include <stdlib.h>
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
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
/*
*/
for (;;) {
cp = fmt;
-#ifdef MB_CAPABLE
+#ifdef _MB_CAPABLE
while ((n = _mbtowc_r (data, &wc, fmt, MB_CUR_MAX, &state)) > 0) {
if (wc == '%')
break;
PRINT (cp, m);
ret += m;
}
-#ifdef MB_CAPABLE
+#ifdef _MB_CAPABLE
if (n <= 0)
goto done;
#else
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;
if (*last_fmt != NULL)
fmt = *last_fmt;
-#ifdef MB_CAPABLE
+#ifdef _MB_CAPABLE
memset (&wc_state, '\0', sizeof (wc_state));
#endif
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;
*/
#include <_ansi.h>
+#include <newlib.h>
#include <reent.h>
#include <ctype.h>
#include <wctype.h>
nread = 0;
for (;;)
{
-#ifndef MB_CAPABLE
+#ifndef _MB_CAPABLE
wc = *fmt;
#else
memset (&state, '\0', sizeof (state));
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.
#ifndef _REENT_ONLY
+#include <newlib.h>
#include <stdlib.h>
#include <wchar.h>
const char *s _AND
size_t n)
{
-#ifdef MB_CAPABLE
+#ifdef _MB_CAPABLE
int retval = 0;
mbstate_t *state;
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 */
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.
<<_mblen_r>> requires no supporting OS subroutines.
*/
+#include <newlib.h>
#include <stdlib.h>
#include <wchar.h>
size_t n _AND
mbstate_t *state)
{
-#ifdef MB_CAPABLE
+#ifdef _MB_CAPABLE
int retval;
retval = _mbtowc_r (r, NULL, 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 */
}
#include <reent.h>
+#include <newlib.h>
#include <wchar.h>
#include <stdlib.h>
#include <stdio.h>
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);
#include <reent.h>
+#include <newlib.h>
#include <wchar.h>
#include <stdlib.h>
#include <stdio.h>
{
int retval = 0;
-#ifdef MB_CAPABLE
+#ifdef _MB_CAPABLE
if (ps == NULL)
{
_REENT_CHECK_MISC(ptr);
#include <reent.h>
+#include <newlib.h>
#include <wchar.h>
#include <stdlib.h>
#include <stdio.h>
size_t count = 0;
int bytes;
-#ifdef MB_CAPABLE
+#ifdef _MB_CAPABLE
if (ps == NULL)
{
_REENT_CHECK_MISC(r);
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.
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
#ifndef _REENT_ONLY
+#include <newlib.h>
#include <stdlib.h>
#include <wchar.h>
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;
}
return count;
-#endif /* not MB_CAPABLE */
+#endif /* not _MB_CAPABLE */
}
#endif /* !_REENT_ONLY */
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.
<<*<[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.
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.
#ifndef _REENT_ONLY
+#include <newlib.h>
#include <stdlib.h>
#include <wchar.h>
const char *s _AND
size_t n)
{
-#ifdef MB_CAPABLE
+#ifdef _MB_CAPABLE
int retval = 0;
mbstate_t *ps;
return -1;
}
return retval;
-#else /* not MB_CAPABLE */
+#else /* not _MB_CAPABLE */
if (s == NULL)
return 0;
if (n == 0)
if (pwc)
*pwc = (wchar_t) *s;
return (*s != '\0');
-#endif /* not MB_CAPABLE */
+#endif /* not _MB_CAPABLE */
}
#endif /* !_REENT_ONLY */
+#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,
/* 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
if (s != NULL && n == 0)
return -2;
-#ifdef MB_CAPABLE
+#ifdef _MB_CAPABLE
if (__lc_ctype == NULL ||
(strlen (__lc_ctype) <= 1))
{ /* fall-through */ }
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)
#include <reent.h>
+#include <newlib.h>
#include <wchar.h>
#include <stdlib.h>
#include <stdio.h>
int retval = 0;
char buf[10];
-#ifdef MB_CAPABLE
+#ifdef _MB_CAPABLE
if (ps == NULL)
{
_REENT_CHECK_MISC(ptr);
#include <reent.h>
+#include <newlib.h>
#include <wchar.h>
#include <stdlib.h>
#include <stdio.h>
size_t n;
int i;
-#ifdef MB_CAPABLE
+#ifdef _MB_CAPABLE
if (ps == NULL)
{
_REENT_CHECK_MISC(r);
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.
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
#ifndef _REENT_ONLY
+#include <newlib.h>
#include <stdlib.h>
#include <wchar.h>
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) {
}
return count;
-#endif /* not MB_CAPABLE */
+#endif /* not _MB_CAPABLE */
}
#endif /* !_REENT_ONLY */
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.
#ifndef _REENT_ONLY
+#include <newlib.h>
#include <stdlib.h>
int
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 */
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
text_set_element (__libc_subfreeres, free_mem);
#endif
-#else /* !MB_CAPABLE */
+#else /* !_MB_CAPABLE */
#include <machine/weakalias.h>
#include <sys/lock.h>
}
weak_alias(__dcigettext, dcigettext)
-#endif /* !MB_CAPABLE */
+#endif /* !_MB_CAPABLE */
-#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.
return mask;
}
-#endif /* MB_CAPABLE */
+#endif /* _MB_CAPABLE */
-#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.
text_set_element (__libc_subfreeres, free_mem);
#endif
-#endif /* MB_CAPABLE */
+#endif /* _MB_CAPABLE */
-#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.
}
#endif
-#endif /* MB_CAPABLE */
+#endif /* _MB_CAPABLE */
-#ifdef MB_CAPABLE
+#include <newlib.h>
+
+#ifdef _MB_CAPABLE
/* Load needed message catalogs.
Copyright (C) 1995-1999, 2000, 2001 Free Software Foundation, Inc.
-#ifdef MB_CAPABLE
+#include <newlib.h>
+
+#ifdef _MB_CAPABLE
/* Handle aliases for locale names.
Copyright (C) 1995-1999, 2000, 2001 Free Software Foundation, Inc.
#endif
}
-#endif /* MB_CAPABLE */
+#endif /* _MB_CAPABLE */
/* Newlib version */
#undef _NEWLIB_VERSION
+/* Multibyte supported */
+#undef _MB_CAPABLE
+
/* MB_LEN_MAX */
#undef _MB_LEN_MAX