diff options
Diffstat (limited to 'newlib/libc/include')
-rw-r--r-- | newlib/libc/include/langinfo.h | 140 | ||||
-rw-r--r-- | newlib/libc/include/stdlib.h | 10 | ||||
-rw-r--r-- | newlib/libc/include/sys/_types.h | 25 | ||||
-rw-r--r-- | newlib/libc/include/sys/config.h | 4 | ||||
-rw-r--r-- | newlib/libc/include/sys/errno.h | 1 | ||||
-rw-r--r-- | newlib/libc/include/sys/reent.h | 32 | ||||
-rw-r--r-- | newlib/libc/include/sys/syslimits.h | 65 | ||||
-rw-r--r-- | newlib/libc/include/wchar.h | 30 |
8 files changed, 289 insertions, 18 deletions
diff --git a/newlib/libc/include/langinfo.h b/newlib/libc/include/langinfo.h new file mode 100644 index 000000000..33ae8d0a4 --- /dev/null +++ b/newlib/libc/include/langinfo.h @@ -0,0 +1,140 @@ +/*- + * Copyright (c) 2001 Alexey Zelkin <phantom@FreeBSD.org> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD: src/include/langinfo.h,v 1.5 2002/03/23 17:24:53 imp Exp $ + */ + +#ifndef _LANGINFO_H_ +#define _LANGINFO_H_ + +#include <sys/cdefs.h> + +typedef int nl_item; + +/* Extract the category and item index from a constructed `nl_item' value. */ +#define _NL_ITEM_CATEGORY(item) ((int) (item) >> 16) +#define _NL_ITEM_INDEX(item) ((int) (item) & 0xffff) + +#define CODESET 0 /* codeset name */ +#define D_T_FMT 1 /* string for formatting date and time */ +#define D_FMT 2 /* date format string */ +#define T_FMT 3 /* time format string */ +#define T_FMT_AMPM 4 /* a.m. or p.m. time formatting string */ +#define AM_STR 5 /* Ante Meridian affix */ +#define PM_STR 6 /* Post Meridian affix */ + +/* week day names */ +#define DAY_1 7 +#define DAY_2 8 +#define DAY_3 9 +#define DAY_4 10 +#define DAY_5 11 +#define DAY_6 12 +#define DAY_7 13 + +/* abbreviated week day names */ +#define ABDAY_1 14 +#define ABDAY_2 15 +#define ABDAY_3 16 +#define ABDAY_4 17 +#define ABDAY_5 18 +#define ABDAY_6 19 +#define ABDAY_7 20 + +/* month names */ +#define MON_1 21 +#define MON_2 22 +#define MON_3 23 +#define MON_4 24 +#define MON_5 25 +#define MON_6 26 +#define MON_7 27 +#define MON_8 28 +#define MON_9 29 +#define MON_10 30 +#define MON_11 31 +#define MON_12 32 + +/* abbreviated month names */ +#define ABMON_1 33 +#define ABMON_2 34 +#define ABMON_3 35 +#define ABMON_4 36 +#define ABMON_5 37 +#define ABMON_6 38 +#define ABMON_7 39 +#define ABMON_8 40 +#define ABMON_9 41 +#define ABMON_10 42 +#define ABMON_11 43 +#define ABMON_12 44 + +#define ERA 45 /* era description segments */ +#define ERA_D_FMT 46 /* era date format string */ +#define ERA_D_T_FMT 47 /* era date and time format string */ +#define ERA_T_FMT 48 /* era time format string */ +#define ALT_DIGITS 49 /* alternative symbols for digits */ + +#define RADIXCHAR 50 /* radix char */ +#define THOUSEP 51 /* separator for thousands */ + +#define YESEXPR 52 /* affirmative response expression */ +#define NOEXPR 53 /* negative response expression */ +#define YESSTR 54 /* affirmative response for yes/no queries */ +#define NOSTR 55 /* negative response for yes/no queries */ + +#define CRNCYSTR 56 /* currency symbol */ + +#define D_MD_ORDER 57 /* month/day order (local extension) */ + +#define _NL_CTYPE_TRANSLIT_TAB_SIZE 58 +#define _NL_CTYPE_TRANSLIT_FROM_IDX 59 +#define _NL_CTYPE_TRANSLIT_FROM_TBL 60 +#define _NL_CTYPE_TRANSLIT_TO_IDX 61 +#define _NL_CTYPE_TRANSLIT_TO_TBL 62 +#define _NL_CTYPE_TRANSLIT_DEFAULT_MISSING_LEN 63 +#define _NL_CTYPE_TRANSLIT_DEFAULT_MISSING 64 +#define _NL_CTYPE_TRANSLIT_IGNORE_LEN 65 +#define _NL_CTYPE_TRANSLIT_IGNORE 66 +#define _NL_CTYPE_EXTRA_MAP_1 70 +#define _NL_CTYPE_EXTRA_MAP_2 71 +#define _NL_CTYPE_EXTRA_MAP_3 72 +#define _NL_CTYPE_EXTRA_MAP_4 73 +#define _NL_CTYPE_EXTRA_MAP_5 74 +#define _NL_CTYPE_EXTRA_MAP_6 75 +#define _NL_CTYPE_EXTRA_MAP_7 76 +#define _NL_CTYPE_EXTRA_MAP_8 77 +#define _NL_CTYPE_EXTRA_MAP_9 78 +#define _NL_CTYPE_EXTRA_MAP_10 79 +#define _NL_CTYPE_EXTRA_MAP_11 80 +#define _NL_CTYPE_EXTRA_MAP_12 81 +#define _NL_CTYPE_EXTRA_MAP_13 82 +#define _NL_CTYPE_EXTRA_MAP_14 83 + +__BEGIN_DECLS +char *nl_langinfo(nl_item); +__END_DECLS + +#endif /* !_LANGINFO_H_ */ diff --git a/newlib/libc/include/stdlib.h b/newlib/libc/include/stdlib.h index d7401ec57..d7246c386 100644 --- a/newlib/libc/include/stdlib.h +++ b/newlib/libc/include/stdlib.h @@ -72,15 +72,15 @@ long _EXFUN(labs,(long)); ldiv_t _EXFUN(ldiv,(long __numer, long __denom)); _PTR _EXFUN(malloc,(size_t __size)); int _EXFUN(mblen,(const char *, size_t)); -int _EXFUN(_mblen_r,(struct _reent *, const char *, size_t, int *)); +int _EXFUN(_mblen_r,(struct _reent *, const char *, size_t, _mbstate_t *)); int _EXFUN(mbtowc,(wchar_t *, const char *, size_t)); -int _EXFUN(_mbtowc_r,(struct _reent *, wchar_t *, const char *, size_t, int *)); +int _EXFUN(_mbtowc_r,(struct _reent *, wchar_t *, const char *, size_t, _mbstate_t *)); int _EXFUN(wctomb,(char *, wchar_t)); -int _EXFUN(_wctomb_r,(struct _reent *, char *, wchar_t, int *)); +int _EXFUN(_wctomb_r,(struct _reent *, char *, wchar_t, _mbstate_t *)); size_t _EXFUN(mbstowcs,(wchar_t *, const char *, size_t)); -size_t _EXFUN(_mbstowcs_r,(struct _reent *, wchar_t *, const char *, size_t, int *)); +size_t _EXFUN(_mbstowcs_r,(struct _reent *, wchar_t *, const char *, size_t, _mbstate_t *)); size_t _EXFUN(wcstombs,(char *, const wchar_t *, size_t)); -size_t _EXFUN(_wcstombs_r,(struct _reent *, char *, const wchar_t *, size_t, int *)); +size_t _EXFUN(_wcstombs_r,(struct _reent *, char *, const wchar_t *, size_t, _mbstate_t *)); #ifndef __STRICT_ANSI__ #ifndef _REENT_ONLY int _EXFUN(mkstemp,(char *)); diff --git a/newlib/libc/include/sys/_types.h b/newlib/libc/include/sys/_types.h index a487676bc..9f3b05b39 100644 --- a/newlib/libc/include/sys/_types.h +++ b/newlib/libc/include/sys/_types.h @@ -18,4 +18,29 @@ typedef int _ssize_t; typedef long _ssize_t; #endif +#define __need_wint_t +#include <stddef.h> + +#ifndef _MBSTATE_T +#define _MBSTATE_T +/* Conversion state information. */ +typedef struct +{ + int __count; + union + { + wint_t __wch; + char __wchb[4]; + } __value; /* Value so far. */ +} _mbstate_t; +#endif /* _MBSTATE_T */ + +#ifdef __CYGWIN__ +# ifndef MBSTATE_T +# define MBSTATE_T +typedef _mbstate_t mbstate_t; +# endif /* MBSTATE_T */ +# define WEOF (0xffffffffu) +#endif /* __CYGWIN__ */ + #endif /* _SYS__TYPES_H */ diff --git a/newlib/libc/include/sys/config.h b/newlib/libc/include/sys/config.h index 89abbfd9e..d8bdc9c36 100644 --- a/newlib/libc/include/sys/config.h +++ b/newlib/libc/include/sys/config.h @@ -3,6 +3,10 @@ #include <machine/ieeefp.h> /* floating point macros */ +/* Length of longest possible multibyte sequence among all supported + locales. */ +#define MB_LEN_MAX 8 + /* exceptions first */ #if defined(__H8300__) || defined(__H8500__) || defined (__H8300H__) || defined(__W65__) || defined (__H8300S__) #define __SMALL_BITFIELDS diff --git a/newlib/libc/include/sys/errno.h b/newlib/libc/include/sys/errno.h index 17a5611cb..f88d563c5 100644 --- a/newlib/libc/include/sys/errno.h +++ b/newlib/libc/include/sys/errno.h @@ -146,6 +146,7 @@ extern __IMPORT int sys_nerr; #define ENOMEDIUM 135 /* No medium (in tape drive) */ #define ENOSHARE 136 /* No such host or network path */ #define ECASECLASH 137 /* Filename exists with different case */ +#define EILSEQ 138 /* From cygwin32. */ #define EWOULDBLOCK EAGAIN /* Operation would block */ diff --git a/newlib/libc/include/sys/reent.h b/newlib/libc/include/sys/reent.h index 4b570cee7..ebdf32a8e 100644 --- a/newlib/libc/include/sys/reent.h +++ b/newlib/libc/include/sys/reent.h @@ -307,9 +307,9 @@ struct _misc_reent { /* miscellaneous reentrant data */ char *_strtok_last; - int _mblen_state; - int _wctomb_state; - int _mbtowc_state; + _mbstate_t _mblen_state; + _mbstate_t _wctomb_state; + _mbstate_t _mbtowc_state; char _l64a_buf[8]; int _getdate_err; }; @@ -463,9 +463,12 @@ struct _reent #define _REENT_INIT_MISC(var) do { \ struct _reent *_r = (var); \ _r->_misc->_strtok_last = _NULL; \ - _r->_misc->_mblen_state = 0; \ - _r->_misc->_wctomb_state = 0; \ - _r->_misc->_mbtowc_state = 0; \ + _r->_misc->_mblen_state.__count = 0; \ + _r->_misc->_mblen_state.__value.__wch = 0; \ + _r->_misc->_wctomb_state.__count = 0; \ + _r->_misc->_wctomb_state.__value.__wch = 0; \ + _r->_misc->_mbtowc_state.__count = 0; \ + _r->_misc->_mbtowc_state.__value.__wch = 0; \ _r->_misc->_l64a_buf[0] = '\0'; \ _r->_misc->_getdate_err = 0; \ } while (0) @@ -537,9 +540,9 @@ struct _reent int _gamma_signgam; __extension__ unsigned long long _rand_next; struct _rand48 _r48; - int _mblen_state; - int _mbtowc_state; - int _wctomb_state; + _mbstate_t _mblen_state; + _mbstate_t _mbtowc_state; + _mbstate_t _wctomb_state; char _l64a_buf[8]; char _signal_buf[_REENT_SIGNAL_SIZE]; int _getdate_err; @@ -575,7 +578,7 @@ struct _reent { 0,0,0,0,0,0,0,0}, 0, 1, \ {{_RAND48_SEED_0, _RAND48_SEED_1, _RAND48_SEED_2}, \ {_RAND48_MULT_0, _RAND48_MULT_1, _RAND48_MULT_2}, _RAND48_ADD}, \ - 0, 0, 0, "", "", 0} } } + {0, {0}}, {0, {0}}, {0, {0}}, "", "", 0} } } #define _REENT_INIT_PTR(var) \ { int i; \ @@ -612,9 +615,12 @@ struct _reent var->_new._reent._r48._mult[1] = _RAND48_MULT_1; \ var->_new._reent._r48._mult[2] = _RAND48_MULT_2; \ var->_new._reent._r48._add = _RAND48_ADD; \ - var->_new._reent._mblen_state = 0; \ - var->_new._reent._mbtowc_state = 0; \ - var->_new._reent._wctomb_state = 0; \ + var->_new._reent._mblen_state.__count = 0; \ + var->_new._reent._mblen_state.__value.__wch = 0; \ + var->_new._reent._mbtowc_state.__count = 0; \ + var->_new._reent._mbtowc_state.__value.__wch = 0; \ + var->_new._reent._wctomb_state.__count = 0; \ + var->_new._reent._wctomb_state.__value.__wch = 0; \ var->_new._reent._l64a_buf[0] = '\0'; \ var->_new._reent._signal_buf[0] = '\0'; \ var->_new._reent._getdate_err = 0; \ diff --git a/newlib/libc/include/sys/syslimits.h b/newlib/libc/include/sys/syslimits.h new file mode 100644 index 000000000..ba9dbd667 --- /dev/null +++ b/newlib/libc/include/sys/syslimits.h @@ -0,0 +1,65 @@ +/* + * Copyright (c) 1988, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)syslimits.h 8.1 (Berkeley) 6/2/93 + * $FreeBSD: src/sys/sys/syslimits.h,v 1.10 2001/06/18 20:24:54 wollman Exp $ + */ + +#ifndef _SYS_SYSLIMITS_H_ +#define _SYS_SYSLIMITS_H_ + +#define ARG_MAX 65536 /* max bytes for an exec function */ +#ifndef CHILD_MAX +#define CHILD_MAX 40 /* max simultaneous processes */ +#endif +#define LINK_MAX 32767 /* max file link count */ +#define MAX_CANON 255 /* max bytes in term canon input line */ +#define MAX_INPUT 255 /* max bytes in terminal input */ +#define NAME_MAX 255 /* max bytes in a file name */ +#define NGROUPS_MAX 16 /* max supplemental group id's */ +#ifndef OPEN_MAX +#define OPEN_MAX 64 /* max open files per process */ +#endif +#define PATH_MAX 1024 /* max bytes in pathname */ +#define PIPE_BUF 512 /* max bytes for atomic pipe writes */ +#define IOV_MAX 1024 /* max elements in i/o vector */ + +#define BC_BASE_MAX 99 /* max ibase/obase values in bc(1) */ +#define BC_DIM_MAX 2048 /* max array elements in bc(1) */ +#define BC_SCALE_MAX 99 /* max scale value in bc(1) */ +#define BC_STRING_MAX 1000 /* max const string length in bc(1) */ +#define COLL_WEIGHTS_MAX 0 /* max weights for order keyword */ +#define EXPR_NEST_MAX 32 /* max expressions nested in expr(1) */ +#define LINE_MAX 2048 /* max bytes in an input line */ +#define RE_DUP_MAX 255 /* max RE's in interval notation */ + +#endif diff --git a/newlib/libc/include/wchar.h b/newlib/libc/include/wchar.h new file mode 100644 index 000000000..41b8fdc1b --- /dev/null +++ b/newlib/libc/include/wchar.h @@ -0,0 +1,30 @@ +#ifndef _WCHAR_H_ +#define _WCHAR_H_ + +#define __need_size_t +#define __need_wchar_t +#define __need_wint_t +#include <stddef.h> + +/* For _mbstate_t definition. */ +#include <sys/_types.h> + +#ifndef WEOF +# define WEOF (0xffffffffu) +#endif + +#ifndef MBSTATE_T +#define MBSTATE_T +typedef _mbstate_t mbstate_t; +#endif /* MBSTATE_T */ + +wint_t btowc (int c); +int wctob (wint_t c); +int mbsinit(const mbstate_t *ps); +size_t mbrlen(const char *s, size_t n, mbstate_t *ps); +size_t mbrtowc(wchar_t *pwc, const char *s, size_t n, mbstate_t *ps); +size_t wcrtomb(char *s, wchar_t wc, mbstate_t *ps); +size_t mbsrtowcs(wchar_t *dst, const char **src, size_t len, mbstate_t *ps); +size_t wcsrtombs(char *dst, const wchar_t **src, size_t len, mbstate_t *ps); + +#endif /* _WCHAR_H_ */ |