diff options
author | Alon Zakai <alonzakai@gmail.com> | 2011-09-26 20:40:19 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2011-09-26 20:40:19 -0700 |
commit | 5f5c99ded3fc10bcdc513e0ff78d0e71c67ccdba (patch) | |
tree | 306874d826dca1013c718c260f76ba92ccede730 | |
parent | 57c012482aed42154a0cad98c7b3a65363f4d276 (diff) |
header surgery
-rw-r--r-- | system/include/libc/ctype.h | 100 | ||||
-rw-r--r-- | system/include/libc/locale.h | 6 | ||||
-rw-r--r-- | system/include/libc/math.h | 2 | ||||
-rw-r--r-- | system/include/libcxx/__locale | 6 | ||||
-rw-r--r-- | system/include/libcxx/locale | 14 |
5 files changed, 121 insertions, 7 deletions
diff --git a/system/include/libc/ctype.h b/system/include/libc/ctype.h index f478a56a..32e39bc3 100644 --- a/system/include/libc/ctype.h +++ b/system/include/libc/ctype.h @@ -112,4 +112,104 @@ extern __IMPORT _CONST char _ctype_[]; _END_STD_C + + + + + + + + + + + + + + +/* + * Copyright (c) 2000, 2005, 2008 Apple Inc. All rights reserved. + * + * @APPLE_LICENSE_HEADER_START@ + * + * This file contains Original Code and/or Modifications of Original Code + * as defined in and that are subject to the Apple Public Source License + * Version 2.0 (the 'License'). You may not use this file except in + * compliance with the License. Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this + * file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and + * limitations under the License. + * + * @APPLE_LICENSE_HEADER_END@ + */ +/* + * Copyright (c) 1989, 1993 + * The Regents of the University of California. All rights reserved. + * (c) UNIX System Laboratories, Inc. + * All or some portions of this file are derived from material licensed + * to the University of California by American Telephone and Telegraph + * Co. or Unix System Laboratories, Inc. and are reproduced herein with + * the permission of UNIX System Laboratories, Inc. + * + * This code is derived from software contributed to Berkeley by + * Paul Borman at Krystal Technologies. + * + * 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. + * + * @(#)ctype.h 8.4 (Berkeley) 1/21/94 + */ + +#define _CTYPE_A 0x00000100L /* Alpha */ +#define _CTYPE_C 0x00000200L /* Control */ +#define _CTYPE_D 0x00000400L /* Digit */ +#define _CTYPE_G 0x00000800L /* Graph */ +#define _CTYPE_L 0x00001000L /* Lower */ +#define _CTYPE_P 0x00002000L /* Punct */ +#define _CTYPE_S 0x00004000L /* Space */ +#define _CTYPE_U 0x00008000L /* Upper */ +#define _CTYPE_X 0x00010000L /* X digit */ +#define _CTYPE_B 0x00020000L /* Blank */ +#define _CTYPE_R 0x00040000L /* Print */ +#define _CTYPE_I 0x00080000L /* Ideogram */ +#define _CTYPE_T 0x00100000L /* Special */ +#define _CTYPE_Q 0x00200000L /* Phonogram */ +#define _CTYPE_SW0 0x20000000L /* 0 width character */ +#define _CTYPE_SW1 0x40000000L /* 1 width character */ +#define _CTYPE_SW2 0x80000000L /* 2 width character */ +#define _CTYPE_SW3 0xc0000000L /* 3 width character */ +#define _CTYPE_SWM 0xe0000000L /* Mask for screen width data */ +#define _CTYPE_SWS 30 /* Bits to shift to get width */ + #endif /* _CTYPE_H_ */ diff --git a/system/include/libc/locale.h b/system/include/libc/locale.h index fa5c270f..532faaa5 100644 --- a/system/include/libc/locale.h +++ b/system/include/libc/locale.h @@ -60,6 +60,12 @@ struct _reent; char *_EXFUN(_setlocale_r,(struct _reent *, int category, const char *locale)); struct lconv *_EXFUN(_localeconv_r,(struct _reent *)); +/* XXX Emscripten */ +typedef void* locale_t; +locale_t newlocale(int category_mask, const char *locale, locale_t base); +void freelocale(locale_t locobj); +locale_t uselocale(locale_t newloc); + _END_STD_C #endif /* _LOCALE_H_ */ diff --git a/system/include/libc/math.h b/system/include/libc/math.h index c5c6bdb9..d963c6c8 100644 --- a/system/include/libc/math.h +++ b/system/include/libc/math.h @@ -232,7 +232,7 @@ extern int __signbitd (double x); /* Non ANSI double precision functions. */ -extern double infinity _PARAMS((void)); +/* XXX Emscripten extern double infinity _PARAMS((void)); */ extern double nan _PARAMS((const char *)); extern int finite _PARAMS((double)); extern double copysign _PARAMS((double, double)); diff --git a/system/include/libcxx/__locale b/system/include/libcxx/__locale index 5cd9e024..b1c0dd7c 100644 --- a/system/include/libcxx/__locale +++ b/system/include/libcxx/__locale @@ -8,6 +8,8 @@ // //===----------------------------------------------------------------------===// +//class locale; // XXX Emscripten + #ifndef _LIBCPP___LOCALE #define _LIBCPP___LOCALE @@ -42,6 +44,7 @@ public: class id; typedef int category; + /* XXX Emscripten static const category // values assigned here are for exposition only none = 0, collate = LC_COLLATE_MASK, @@ -51,6 +54,7 @@ public: time = LC_TIME_MASK, messages = LC_MESSAGES_MASK, all = collate | ctype | monetary | numeric | time | messages; + */ // construct/copy/destroy: locale() _NOEXCEPT; @@ -333,7 +337,7 @@ public: #else // __GLIBC__ || _WIN32 #if __APPLE__ typedef __uint32_t mask; -#elif __FreeBSD__ +#elif defined(__FreeBSD__) or defined(EMSCRIPTEN) typedef unsigned long mask; #endif static const mask space = _CTYPE_S; diff --git a/system/include/libcxx/locale b/system/include/libcxx/locale index e9a18e32..153038ee 100644 --- a/system/include/libcxx/locale +++ b/system/include/libcxx/locale @@ -189,7 +189,7 @@ template <class charT> class messages_byname; #if _WIN32 #include <support/win32/support.h> // vasprintf #else // _WIN32 -#include <nl_types.h> +// XXX Emscripten #include <nl_types.h> #endif // !_WIN32 #pragma GCC system_header @@ -800,6 +800,7 @@ template <class _CharT, class _InputIterator> locale::id num_get<_CharT, _InputIterator>::id; +/* XXX Emscripten template <class _Tp> _Tp __num_get_signed_integral(const char* __a, const char* __a_end, @@ -1307,6 +1308,8 @@ num_get<_CharT, _InputIterator>::do_get(iter_type __b, iter_type __e, return __b; } +*/ + extern template class num_get<char>; extern template class num_get<wchar_t>; @@ -1389,7 +1392,7 @@ void __num_put<_CharT>::__widen_and_group_float(char* __nb, char* __np, char* __ne, _CharT* __ob, _CharT*& __op, _CharT*& __oe, const locale& __loc) -{ +;/* XXX Emscripten { const ctype<_CharT>& __ct = use_facet<ctype<_CharT> > (__loc); const numpunct<_CharT>& __npt = use_facet<numpunct<_CharT> >(__loc); string __grouping = __npt.grouping(); @@ -1464,6 +1467,7 @@ __num_put<_CharT>::__widen_and_group_float(char* __nb, char* __np, char* __ne, else __op = __ob + (__np - __nb); } +*/ extern template class __num_put<char>; extern template class __num_put<wchar_t>; @@ -3713,7 +3717,7 @@ template <class _CharT> typename messages<_CharT>::catalog messages<_CharT>::do_open(const basic_string<char>& __nm, const locale&) const { -#if _WIN32 +#if defined(_WIN32) || defined(EMSCRIPTEN) return -1; #else // _WIN32 catalog __cat = reinterpret_cast<catalog>(catopen(__nm.c_str(), NL_CAT_LOCALE)); @@ -3728,7 +3732,7 @@ typename messages<_CharT>::string_type messages<_CharT>::do_get(catalog __c, int __set, int __msgid, const string_type& __dflt) const { -#if _WIN32 +#if defined(_WIN32) || defined(EMSCRIPTEN) return __dflt; #else // _WIN32 string __ndflt; @@ -3750,7 +3754,7 @@ template <class _CharT> void messages<_CharT>::do_close(catalog __c) const { -#if !_WIN32 +#if !defined(_WIN32) && !defined(EMSCRIPTEN) if (__c != -1) __c <<= 1; nl_catd __cat = reinterpret_cast<nl_catd>(__c); |