summaryrefslogtreecommitdiff
path: root/StdLib/LibC/Locale
diff options
context:
space:
mode:
Diffstat (limited to 'StdLib/LibC/Locale')
-rw-r--r--StdLib/LibC/Locale/Locale.inf64
-rw-r--r--StdLib/LibC/Locale/__mb_cur_max.c39
-rw-r--r--StdLib/LibC/Locale/__wctoint.h79
-rw-r--r--StdLib/LibC/Locale/_def_messages.c24
-rw-r--r--StdLib/LibC/Locale/_def_monetary.c42
-rw-r--r--StdLib/LibC/Locale/_def_numeric.c23
-rw-r--r--StdLib/LibC/Locale/_def_time.c42
-rw-r--r--StdLib/LibC/Locale/_wcstod.h126
-rw-r--r--StdLib/LibC/Locale/_wcstol.h153
-rw-r--r--StdLib/LibC/Locale/_wcstoul.h133
-rw-r--r--StdLib/LibC/Locale/aliasname.c129
-rw-r--r--StdLib/LibC/Locale/aliasname_local.h29
-rw-r--r--StdLib/LibC/Locale/ctypeio.c186
-rw-r--r--StdLib/LibC/Locale/ctypeio.h35
-rw-r--r--StdLib/LibC/Locale/iswctype_sb.c234
-rw-r--r--StdLib/LibC/Locale/localeconv.c85
-rw-r--r--StdLib/LibC/Locale/multibyte_Utf8.c1008
-rw-r--r--StdLib/LibC/Locale/multibyte_sb.c287
-rw-r--r--StdLib/LibC/Locale/nl_langinfo.c125
-rw-r--r--StdLib/LibC/Locale/rune.h100
-rw-r--r--StdLib/LibC/Locale/runetype.h221
-rw-r--r--StdLib/LibC/Locale/setlocale.c424
-rw-r--r--StdLib/LibC/Locale/setlocale1.c61
-rw-r--r--StdLib/LibC/Locale/setlocale32.c46
-rw-r--r--StdLib/LibC/Locale/wcscoll.c47
-rw-r--r--StdLib/LibC/Locale/wcsftime.c109
-rw-r--r--StdLib/LibC/Locale/wcstod.c51
-rw-r--r--StdLib/LibC/Locale/wcstof.c53
-rw-r--r--StdLib/LibC/Locale/wcstoimax.c59
-rw-r--r--StdLib/LibC/Locale/wcstol.c58
-rw-r--r--StdLib/LibC/Locale/wcstold.c53
-rw-r--r--StdLib/LibC/Locale/wcstoll.c58
-rw-r--r--StdLib/LibC/Locale/wcstoul.c58
-rw-r--r--StdLib/LibC/Locale/wcstoull.c58
-rw-r--r--StdLib/LibC/Locale/wcstoumax.c59
-rw-r--r--StdLib/LibC/Locale/wcsxfrm.c66
36 files changed, 0 insertions, 4424 deletions
diff --git a/StdLib/LibC/Locale/Locale.inf b/StdLib/LibC/Locale/Locale.inf
deleted file mode 100644
index e0f163cb13..0000000000
--- a/StdLib/LibC/Locale/Locale.inf
+++ /dev/null
@@ -1,64 +0,0 @@
-## @file
-# Standard C library: Locale implementation.
-#
-# Copyright (c) 2010-2012, Intel Corporation. All rights reserved.<BR>
-#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-##
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = LibLocale
- FILE_GUID = 9205cde5-5ae5-4a4b-bfbf-f6211967eef9
- MODULE_TYPE = UEFI_APPLICATION
- VERSION_STRING = 1.0
- LIBRARY_CLASS = LibLocale
-
-#
-# VALID_ARCHITECTURES = IA32 X64 IPF
-#
-
-[Sources]
- __mb_cur_max.c #
- _def_messages.c #
- _def_monetary.c #
- _def_numeric.c #
- _def_time.c #
- aliasname.c #
- ctypeio.c #
- localeconv.c #
- nl_langinfo.c #
- setlocale1.c #
- setlocale32.c #
- setlocale.c #
- wcscoll.c #
- wcsftime.c #
- wcstoimax.c #
- wcstol.c #
- wcstoll.c #
- wcstoul.c #
- wcstoull.c #
- wcstoumax.c #
- wcstod.c #
- wcstof.c #
- wcstold.c #
- wcsxfrm.c #
- multibyte_Utf8.c #
-
- # Single-byte locale to avoid bringing in citrus
- iswctype_sb.c #
-
-[Packages]
- StdLib/StdLib.dec
- StdLibPrivateInternalFiles/DoNotUse.dec
- MdePkg/MdePkg.dec
-
-[LibraryClasses]
- LibC
- LibCType
diff --git a/StdLib/LibC/Locale/__mb_cur_max.c b/StdLib/LibC/Locale/__mb_cur_max.c
deleted file mode 100644
index 394c6c2eed..0000000000
--- a/StdLib/LibC/Locale/__mb_cur_max.c
+++ /dev/null
@@ -1,39 +0,0 @@
-/* $NetBSD: __mb_cur_max.c,v 1.2 2001/01/25 01:25:06 itojun Exp $ */
-
-/*-
- * Copyright (c)1999 Citrus Project,
- * 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.
- */
-#include <LibConfig.h>
-#include <sys/EfiCdefs.h>
-#if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: __mb_cur_max.c,v 1.2 2001/01/25 01:25:06 itojun Exp $");
-#endif /* LIBC_SCCS and not lint */
-
-#include <sys/types.h>
-#include <limits.h>
-
-size_t __mb_cur_max = 1;
-size_t __mb_len_max_runtime = MB_LEN_MAX;
-
diff --git a/StdLib/LibC/Locale/__wctoint.h b/StdLib/LibC/Locale/__wctoint.h
deleted file mode 100644
index 47d1e74686..0000000000
--- a/StdLib/LibC/Locale/__wctoint.h
+++ /dev/null
@@ -1,79 +0,0 @@
-/* $NetBSD: __wctoint.h,v 1.1 2001/09/28 11:25:37 yamt Exp $ */
-
-/*-
- * Copyright (c)2001 Citrus Project,
- * 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.
- *
- * $Citrus: xpg4dl/FreeBSD/lib/libc/locale/__wctoint.h,v 1.1 2001/09/21 13:52:32 yamt Exp $
- */
-
-
-__inline static int
-__wctoint(wchar_t wc)
-{
- int n;
-
- /* XXX I expect compiler to optimize this. :D */
- switch (wc) {
- case L'0': n = 0; break;
- case L'1': n = 1; break;
- case L'2': n = 2; break;
- case L'3': n = 3; break;
- case L'4': n = 4; break;
- case L'5': n = 5; break;
- case L'6': n = 6; break;
- case L'7': n = 7; break;
- case L'8': n = 8; break;
- case L'9': n = 9; break;
- case L'A': case L'a': n = 10; break;
- case L'B': case L'b': n = 11; break;
- case L'C': case L'c': n = 12; break;
- case L'D': case L'd': n = 13; break;
- case L'E': case L'e': n = 14; break;
- case L'F': case L'f': n = 15; break;
- case L'G': case L'g': n = 16; break;
- case L'H': case L'h': n = 17; break;
- case L'I': case L'i': n = 18; break;
- case L'J': case L'j': n = 19; break;
- case L'K': case L'k': n = 20; break;
- case L'L': case L'l': n = 21; break;
- case L'M': case L'm': n = 22; break;
- case L'N': case L'n': n = 23; break;
- case L'O': case L'o': n = 24; break;
- case L'P': case L'p': n = 25; break;
- case L'Q': case L'q': n = 26; break;
- case L'R': case L'r': n = 27; break;
- case L'S': case L's': n = 28; break;
- case L'T': case L't': n = 29; break;
- case L'U': case L'u': n = 30; break;
- case L'V': case L'v': n = 31; break;
- case L'W': case L'w': n = 32; break;
- case L'X': case L'x': n = 33; break;
- case L'Y': case L'y': n = 34; break;
- case L'Z': case L'z': n = 35; break;
- default: n = -1; break; /* error */
- }
-
- return n;
-}
diff --git a/StdLib/LibC/Locale/_def_messages.c b/StdLib/LibC/Locale/_def_messages.c
deleted file mode 100644
index 2481febf53..0000000000
--- a/StdLib/LibC/Locale/_def_messages.c
+++ /dev/null
@@ -1,24 +0,0 @@
-/* $NetBSD: _def_messages.c,v 1.6 2005/06/12 05:21:27 lukem Exp $ */
-
-/*
- * Written by J.T. Conklin <jtc@NetBSD.org>.
- * Public domain.
- */
-#include <LibConfig.h>
-#include <sys/EfiCdefs.h>
-#if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: _def_messages.c,v 1.6 2005/06/12 05:21:27 lukem Exp $");
-#endif /* LIBC_SCCS and not lint */
-
-#include <sys/localedef.h>
-#include <locale.h>
-
-const _MessagesLocale _DefaultMessagesLocale =
-{
- "^[Yy]",
- "^[Nn]",
- "yes",
- "no"
-} ;
-
-const _MessagesLocale *_CurrentMessagesLocale = &_DefaultMessagesLocale;
diff --git a/StdLib/LibC/Locale/_def_monetary.c b/StdLib/LibC/Locale/_def_monetary.c
deleted file mode 100644
index af11866859..0000000000
--- a/StdLib/LibC/Locale/_def_monetary.c
+++ /dev/null
@@ -1,42 +0,0 @@
-/* $NetBSD: _def_monetary.c,v 1.8 2005/06/12 05:21:27 lukem Exp $ */
-
-/*
- * Written by J.T. Conklin <jtc@NetBSD.org>.
- * Public domain.
- */
-#include <LibConfig.h>
-#include <sys/EfiCdefs.h>
-#if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: _def_monetary.c,v 1.8 2005/06/12 05:21:27 lukem Exp $");
-#endif /* LIBC_SCCS and not lint */
-
-#include <sys/localedef.h>
-#include <limits.h>
-#include <locale.h>
-
-const _MonetaryLocale _DefaultMonetaryLocale =
-{
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- (char)CHAR_MAX,
- (char)CHAR_MAX,
- (char)CHAR_MAX,
- (char)CHAR_MAX,
- (char)CHAR_MAX,
- (char)CHAR_MAX,
- (char)CHAR_MAX,
- (char)CHAR_MAX,
- (char)CHAR_MAX,
- (char)CHAR_MAX,
- (char)CHAR_MAX,
- (char)CHAR_MAX,
- (char)CHAR_MAX,
- (char)CHAR_MAX
-};
-
-const _MonetaryLocale *_CurrentMonetaryLocale = &_DefaultMonetaryLocale;
diff --git a/StdLib/LibC/Locale/_def_numeric.c b/StdLib/LibC/Locale/_def_numeric.c
deleted file mode 100644
index 10a6cec004..0000000000
--- a/StdLib/LibC/Locale/_def_numeric.c
+++ /dev/null
@@ -1,23 +0,0 @@
-/* $NetBSD: _def_numeric.c,v 1.6 2005/06/12 05:21:27 lukem Exp $ */
-
-/*
- * Written by J.T. Conklin <jtc@NetBSD.org>.
- * Public domain.
- */
-#include <LibConfig.h>
-#include <sys/EfiCdefs.h>
-#if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: _def_numeric.c,v 1.6 2005/06/12 05:21:27 lukem Exp $");
-#endif /* LIBC_SCCS and not lint */
-
-#include <sys/localedef.h>
-#include <locale.h>
-
-const _NumericLocale _DefaultNumericLocale =
-{
- ".",
- "",
- ""
-};
-
-const _NumericLocale *_CurrentNumericLocale = &_DefaultNumericLocale;
diff --git a/StdLib/LibC/Locale/_def_time.c b/StdLib/LibC/Locale/_def_time.c
deleted file mode 100644
index 102fff554d..0000000000
--- a/StdLib/LibC/Locale/_def_time.c
+++ /dev/null
@@ -1,42 +0,0 @@
-/* $NetBSD: _def_time.c,v 1.8 2005/06/12 05:21:27 lukem Exp $ */
-
-/*
- * Written by J.T. Conklin <jtc@NetBSD.org>.
- * Public domain.
- */
-#include <LibConfig.h>
-#include <sys/EfiCdefs.h>
-#if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: _def_time.c,v 1.8 2005/06/12 05:21:27 lukem Exp $");
-#endif /* LIBC_SCCS and not lint */
-
-#include <sys/localedef.h>
-#include <locale.h>
-
-const _TimeLocale _DefaultTimeLocale =
-{
- {
- "Sun","Mon","Tue","Wed","Thu","Fri","Sat",
- },
- {
- "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday",
- "Friday", "Saturday"
- },
- {
- "Jan", "Feb", "Mar", "Apr", "May", "Jun",
- "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
- },
- {
- "January", "February", "March", "April", "May", "June", "July",
- "August", "September", "October", "November", "December"
- },
- {
- "AM", "PM"
- },
- "%a %b %e %H:%M:%S %Y",
- "%m/%d/%y",
- "%H:%M:%S",
- "%I:%M:%S %p"
-};
-
-const _TimeLocale *_CurrentTimeLocale = &_DefaultTimeLocale;
diff --git a/StdLib/LibC/Locale/_wcstod.h b/StdLib/LibC/Locale/_wcstod.h
deleted file mode 100644
index 4b0a833728..0000000000
--- a/StdLib/LibC/Locale/_wcstod.h
+++ /dev/null
@@ -1,126 +0,0 @@
-/* $NetBSD: _wcstod.h,v 1.1 2006/04/15 12:17:23 tnozaki Exp $ */
-
-/*-
- * Copyright (c) 2002 Tim J. Robbins
- * 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.
- *
- * Original version ID:
- * FreeBSD: /repoman/r/ncvs/src/lib/libc/locale/wcstod.c,v 1.4 2004/04/07 09:47:56 tjr Exp
- * NetBSD: wcstod.c,v 1.8 2006/04/13 01:25:13 tnozaki Exp
- */
-
-/*
- * function template for wcstof, wcstod, wcstold.
- *
- * parameters:
- * _FUNCNAME : function name
- * _RETURN_TYPE : return type
- * _STRTOD_FUNC : real conversion function
- */
-#ifndef __WCSTOD_H_
-#define __WCSTOD_H_
-
-/*
- * Convert a string to a double-precision number.
- *
- * This is the wide-character counterpart of strto{f,d,ld}(). So that
- * we do not have to duplicate the code of strto{f,d,ld}() here,
- * we convert the supplied wide character string to multibyte and
- * call strto{f,d,ld}() on the result.
- * This assumes that the multibyte encoding is compatible with ASCII
- * for at least the digits, radix character and letters.
- */
-_RETURN_TYPE
-_FUNCNAME(const wchar_t * __restrict nptr, wchar_t ** __restrict endptr)
-{
- const wchar_t *src, *start;
- _RETURN_TYPE val;
- char *buf, *end;
- size_t bufsiz, len;
-
- _DIAGASSERT(nptr != NULL);
- /* endptr may be null */
-
- src = nptr;
- while (iswspace((wint_t)*src) != 0)
- ++src;
- if (*src == L'\0')
- goto no_convert;
-
- /*
- * Convert the supplied numeric wide char. string to multibyte.
- *
- * We could attempt to find the end of the numeric portion of the
- * wide char. string to avoid converting unneeded characters but
- * choose not to bother; optimising the uncommon case where
- * the input string contains a lot of text after the number
- * duplicates a lot of strto{f,d,ld}()'s functionality and
- * slows down the most common cases.
- */
- start = src;
- len = wcstombs(NULL, src, 0);
- if (len == (size_t)-1)
- /* errno = EILSEQ */
- goto no_convert;
-
- _DIAGASSERT(len > 0);
-
- bufsiz = len;
- buf = (void *)malloc(bufsiz + 1);
- if (buf == NULL)
- /* errno = ENOMEM */
- goto no_convert;
-
- len = wcstombs(buf, src, bufsiz + 1);
-
- _DIAGASSERT(len == bufsiz);
- _DIAGASSERT(buf[len] == '\0');
-
- /* Let strto{f,d,ld}() do most of the work for us. */
- val = _STRTOD_FUNC(buf, &end);
- if (buf == end) {
- free(buf);
- goto no_convert;
- }
-
- /*
- * We only know where the number ended in the _multibyte_
- * representation of the string. If the caller wants to know
- * where it ended, count multibyte characters to find the
- * corresponding position in the wide char string.
- */
- if (endptr != NULL)
- /* XXX Assume each wide char is one byte. */
- *endptr = __UNCONST(start + (size_t)(end - buf));
-
- free(buf);
-
- return val;
-
-no_convert:
- if (endptr != NULL)
- *endptr = __UNCONST(nptr);
- return 0.0;
-}
-#endif /*__WCSTOD_H_*/
diff --git a/StdLib/LibC/Locale/_wcstol.h b/StdLib/LibC/Locale/_wcstol.h
deleted file mode 100644
index 97d0dc9a95..0000000000
--- a/StdLib/LibC/Locale/_wcstol.h
+++ /dev/null
@@ -1,153 +0,0 @@
-/** @file
- Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>
- This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- Copyright (c) 1990, 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. 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.
-
- Original version ID:
- @(#)strtol.c 8.1 (Berkeley) 6/4/93
- NetBSD: wcstol.c,v 1.1 2001/09/27 16:30:36 yamt Exp
- Citrus: xpg4dl/FreeBSD/lib/libc/locale/wcstol.c,v 1.2 2001/09/21 16:11:41 yamt Exp
- NetBSD: _wcstol.h,v 1.3 2005/11/29 03:11:59 christos Exp
- */
-
-/*
- * function template for wcstol, wcstoll and wcstoimax.
- *
- * parameters:
- * _FUNCNAME : function name
- * __wINT : return type
- * __wINT_MIN : lower limit of the return type
- * __wINT_MAX : upper limit of the return type
- */
-
-__wINT
-_FUNCNAME(
- const wchar_t *nptr,
- wchar_t **endptr,
- int base
- )
-{
- const wchar_t *s;
- __wINT acc, cutoff;
- wint_t wc;
- int i;
- int neg, any, cutlim;
-
- _DIAGASSERT(nptr != NULL);
- /* endptr may be NULL */
-
-#ifdef __GNUC__
- (void)&acc; (void)&cutoff;
-#endif
-
- /* check base value */
- if (base && (base < 2 || base > 36)) {
- errno = EINVAL;
- return 0;
- }
-
- /*
- * Skip white space and pick up leading +/- sign if any.
- * If base is 0, allow 0x for hex and 0 for octal, else
- * assume decimal; if base is already 16, allow 0x.
- */
- s = nptr;
- do {
- wc = (wchar_t) *s++;
- } while (iswspace(wc));
- if (wc == L'-') {
- neg = 1;
- wc = *s++;
- } else {
- neg = 0;
- if (wc == L'+')
- wc = *s++;
- }
- if ((base == 0 || base == 16) &&
- wc == L'0' && (*s == L'x' || *s == L'X')) {
- wc = s[1];
- s += 2;
- base = 16;
- }
- if (base == 0)
- base = ((wc == L'0') ? 8 : 10);
-
- /*
- * See strtol for comments as to the logic used.
- */
- cutoff = neg ? __wINT_MIN : __wINT_MAX;
- cutlim = (int)(cutoff % base);
- cutoff /= base;
- if (neg) {
- if (cutlim > 0) {
- cutlim -= base;
- cutoff += 1;
- }
- cutlim = -cutlim;
- }
- for (acc = 0, any = 0;; wc = (wchar_t) *s++) {
- i = __wctoint((wchar_t)wc);
- if (i == -1)
- break;
- if (i >= base)
- break;
- if (any < 0)
- continue;
- if (neg) {
- if (acc < cutoff || (acc == cutoff && i > cutlim)) {
- any = -1;
- acc = __wINT_MIN;
- errno = ERANGE;
- } else {
- any = 1;
- acc *= base;
- acc -= i;
- }
- } else {
- if (acc > cutoff || (acc == cutoff && i > cutlim)) {
- any = -1;
- acc = __wINT_MAX;
- errno = ERANGE;
- } else {
- any = 1;
- acc *= base;
- acc += i;
- }
- }
- }
- if (endptr != 0)
- *endptr = __UNCONST(any ? s - 1 : nptr);
- return (acc);
-}
diff --git a/StdLib/LibC/Locale/_wcstoul.h b/StdLib/LibC/Locale/_wcstoul.h
deleted file mode 100644
index 2131d4b5c1..0000000000
--- a/StdLib/LibC/Locale/_wcstoul.h
+++ /dev/null
@@ -1,133 +0,0 @@
-/** @file
- Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>
- This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- Copyright (c) 1990, 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. 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.
-
- Original version ID:
- @(#)strtoul.c 8.1 (Berkeley) 6/4/93
- Citrus: xpg4dl/FreeBSD/lib/libc/locale/wcstoul.c,v 1.2 2001/09/21 16:11:41 yamt Exp
- NetBSD: wcstoul.c,v 1.1 2001/09/27 16:30:37 yamt Exp
- NetBSD: _wcstoul.h,v 1.3 2005/11/29 03:11:59 christos Exp
- */
-
-#include <Library/BaseLib.h>
-
-/*
- * function template for wcstoul, wcstoull and wcstoumax.
- *
- * parameters:
- * _FUNCNAME : function name
- * __wUINT : return type
- * __wINT : signed version of __wUINT
- * __wUINT_MAX : upper limit of the return type
- */
-
-__wUINT
-_FUNCNAME(
- const wchar_t *nptr,
- wchar_t **endptr,
- int base
- )
-{
- const wchar_t *s;
- __wUINT acc, cutoff;
- wint_t wc;
- int i;
- int neg, any, cutlim;
-
- _DIAGASSERT(nptr != NULL);
- /* endptr may be NULL */
-
- if (base && (base < 2 || base > 36)) {
- errno = EINVAL;
- return 0;
- }
-
- /*
- * Skip white space and pick up leading +/- sign if any.
- * If base is 0, allow 0x for hex and 0 for octal, else
- * assume decimal; if base is already 16, allow 0x.
- */
- s = nptr;
- do {
- wc = (wchar_t) *s++;
- } while (iswspace(wc));
- if (wc == L'-') {
- neg = 1;
- wc = *s++;
- } else {
- neg = 0;
- if (wc == L'+')
- wc = *s++;
- }
- if ((base == 0 || base == 16) &&
- wc == L'0' && (*s == L'x' || *s == L'X')) {
- wc = s[1];
- s += 2;
- base = 16;
- }
- if (base == 0)
- base = wc == L'0' ? 8 : 10;
-
- /*
- * See strtoul for comments as to the logic used.
- */
- cutoff = (__wUINT)DivU64x32 ((UINT64) __wUINT_MAX, (UINT32) base);
- cutlim = (int) ModU64x32 ((UINT64) __wUINT_MAX, (UINT32) base);
- for (acc = 0, any = 0;; wc = (wint_t) *s++) {
- i = __wctoint((wchar_t)wc);
- if (i == -1) {
- break;
- }
- if (i >= base)
- break;
- if (any < 0)
- continue;
- if (acc > cutoff || (acc == cutoff && i > cutlim)) {
- any = -1;
- acc = __wUINT_MAX;
- errno = ERANGE;
- } else {
- any = 1;
- acc *= (__wUINT)base;
- acc += i;
- }
- }
- if (neg && any > 0)
- acc = (__wUINT)(-((__wINT)acc));
- if (endptr != 0)
- *endptr = __UNCONST(any ? s - 1 : nptr);
- return (acc);
-}
diff --git a/StdLib/LibC/Locale/aliasname.c b/StdLib/LibC/Locale/aliasname.c
deleted file mode 100644
index 56303e97fe..0000000000
--- a/StdLib/LibC/Locale/aliasname.c
+++ /dev/null
@@ -1,129 +0,0 @@
-/* $NetBSD: aliasname.c,v 1.2 2005/02/09 21:35:46 kleink Exp $ */
-
-/*-
- * Copyright (c)2002 YAMAMOTO Takashi,
- * 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.
- */
-#include <LibConfig.h>
-#include <sys/EfiCdefs.h>
-#if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: aliasname.c,v 1.2 2005/02/09 21:35:46 kleink Exp $");
-#endif /* LIBC_SCCS and not lint */
-
-#include "namespace.h"
-#include <assert.h>
-#include <stdio.h>
-#include <string.h>
-
-#include "aliasname_local.h"
-
-__inline int __is_ws(char);
-
-__inline int __is_ws(char ch)
-{
-
- return (ch == ' ' || ch == '\t');
-}
-
-const char *
-__unaliasname(const char *dbname, const char *alias, void *buf, size_t bufsize)
-{
- FILE *fp = NULL;
- const char *result = alias;
- size_t resultlen;
- size_t aliaslen;
- const char *p;
- size_t len;
-
- _DIAGASSERT(dbname != NULL);
- _DIAGASSERT(alias != NULL);
- _DIAGASSERT(buf != NULL);
-
- fp = fopen(dbname, "r");
- if (fp == NULL)
- goto quit;
-
- aliaslen = strlen(alias);
-
- while (/*CONSTCOND*/ 1) {
- p = fgetln(fp, &len);
- if (p == NULL)
- goto quit; /* eof or error */
-
- _DIAGASSERT(len != 0);
-
- /* ignore terminating NL */
- if (p[len - 1] == '\n')
- len--;
-
- /* ignore null line and comment */
- if (len == 0 || p[0] == '#')
- continue;
-
- if (aliaslen > len)
- continue;
-
- if (memcmp(alias, p, aliaslen))
- continue;
-
- p += aliaslen;
- len -= aliaslen;
-
- if (len == 0 || !__is_ws(*p))
- continue;
-
- /* entry was found here */
- break;
-
- /* NOTREACHED */
- }
-
- /* skip white spaces */
- do {
- p++;
- len--;
- } while (len != 0 && __is_ws(*p));
-
- if (len == 0)
- goto quit;
-
- /* count length of result */
- resultlen = 0;
- while (resultlen < len && !__is_ws(*p))
- resultlen++;
-
- /* check if space is enough */
- if (bufsize < resultlen + 1)
- goto quit;
-
- memcpy(buf, p, resultlen);
- ((char *)buf)[resultlen] = 0;
- result = buf;
-
-quit:
- if (fp)
- fclose(fp);
-
- return result;
-}
diff --git a/StdLib/LibC/Locale/aliasname_local.h b/StdLib/LibC/Locale/aliasname_local.h
deleted file mode 100644
index 9daec022b2..0000000000
--- a/StdLib/LibC/Locale/aliasname_local.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/* $NetBSD: aliasname_local.h,v 1.1 2002/02/13 07:45:52 yamt Exp $ */
-
-/*-
- * Copyright (c)2002 YAMAMOTO Takashi,
- * 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.
- */
-
-const char *__unaliasname(const char *, const char *, void *, size_t);
diff --git a/StdLib/LibC/Locale/ctypeio.c b/StdLib/LibC/Locale/ctypeio.c
deleted file mode 100644
index 8679dcd884..0000000000
--- a/StdLib/LibC/Locale/ctypeio.c
+++ /dev/null
@@ -1,186 +0,0 @@
-/** @file
- Internal C-type locale functions.
-
- Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>
-
- This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php.
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- Copyright (c) 1997 Christos Zoulas. 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 Christos Zoulas.
- 4. The name of the author may not be used to endorse or promote products
- derived from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 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.
-
- NetBSD: ctypeio.c,v 1.7 2005/11/29 03:11:59 christos Exp
-**/
-#include <LibConfig.h>
-#include <sys/EfiCdefs.h>
-#if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: ctypeio.c,v 1.7 2005/11/29 03:11:59 christos Exp $");
-#endif /* LIBC_SCCS and not lint */
-
-#include <sys/types.h>
-
-#include <assert.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#define _CTYPE_PRIVATE
-#include <ctype.h>
-#include "ctypeio.h"
-
-int
-__loadctype(const char *name)
-{
- FILE *fp;
- char id[sizeof(_CTYPE_ID) - 1];
- u_int32_t i, len;
- unsigned short *new_ctype = NULL;
- unsigned char *new_toupper = NULL, *new_tolower = NULL;
-
- _DIAGASSERT(name != NULL);
-
- if ((fp = fopen(name, "r")) == NULL)
- return 0;
-
- if (fread(id, sizeof(id), 1, fp) != 1)
- goto bad;
-
- if (memcmp(id, _CTYPE_ID, sizeof(id)) != 0)
- goto bad;
-
- if (fread(&i, sizeof(u_int32_t), 1, fp) != 1)
- goto bad;
-
- if ((i = ntohl(i)) != _CTYPE_REV)
- goto bad;
-
- if (fread(&len, sizeof(u_int32_t), 1, fp) != 1)
- goto bad;
-
- if ((len = ntohl(len)) != _CTYPE_NUM_CHARS)
- goto bad;
-
- if ((new_ctype = malloc(sizeof(UINT16) * (1 + len))) == NULL)
- goto bad;
-
- new_ctype[0] = 0;
- if (fread(&new_ctype[1], sizeof(UINT16), len, fp) != len)
- goto bad;
-
- if ((new_toupper = malloc(sizeof(UINT8) * (1 + len))) == NULL)
- goto bad;
-
- new_toupper[0] = (UINT8)EOF;
- if (fread(&new_toupper[1], sizeof(UINT8), len, fp) != len)
- goto bad;
-
- if ((new_tolower = malloc(sizeof(UINT8) * (1 + len))) == NULL)
- goto bad;
-
- new_tolower[0] = (UINT8)EOF;
- if (fread(&new_tolower[1], sizeof(UINT8), len, fp) != len)
- goto bad;
-
-#if BYTE_ORDER == LITTLE_ENDIAN
- for (i = 1; i <= len; i++) {
- new_ctype[i] = ntohs(new_ctype[i]);
- }
-#endif
-
- (void) fclose(fp);
- if (_cClass != _C_CharClassTable)
- free(__UNCONST(_cClass));
- _cClass = new_ctype;
- if (_uConvT != _C_ToUpperTable)
- free(__UNCONST(_uConvT));
- _uConvT = new_toupper;
- if (_lConvT != _C_ToLowerTable)
- free(__UNCONST(_lConvT));
- _lConvT = new_tolower;
-
- return 1;
-bad:
- free(new_tolower);
- free(new_toupper);
- free(new_ctype);
- (void) fclose(fp);
- return 0;
-}
-
-int
-__savectype(
- const char *name,
- unsigned short *new_ctype,
- unsigned char *new_toupper,
- unsigned char *new_tolower
- )
-{
- FILE *fp;
- u_int32_t i, len = _CTYPE_NUM_CHARS;
-
- _DIAGASSERT(name != NULL);
- _DIAGASSERT(new_ctype != NULL);
- _DIAGASSERT(new_toupper != NULL);
- _DIAGASSERT(new_tolower != NULL);
-
- if ((fp = fopen(name, "w")) == NULL)
- return 0;
-
- if (fwrite(_CTYPE_ID, sizeof(_CTYPE_ID) - 1, 1, fp) != 1)
- goto bad;
-
- i = htonl(_CTYPE_REV);
- if (fwrite(&i, sizeof(u_int32_t), 1, fp) != 1)
- goto bad;
-
- i = htonl(len);
- if (fwrite(&i, sizeof(u_int32_t), 1, fp) != 1)
- goto bad;
-
-#if BYTE_ORDER == LITTLE_ENDIAN
- for (i = 1; i <= len; i++) {
- new_ctype[i] = htons(new_ctype[i]);
- }
-#endif
- if (fwrite(&new_ctype[1], sizeof(UINT16), len, fp) != len)
- goto bad;
-
- if (fwrite(&new_toupper[1], sizeof(UINT8), len, fp) != len)
- goto bad;
-
- if (fwrite(&new_tolower[1], sizeof(UINT8), len, fp) != len)
- goto bad;
-
- (void) fclose(fp);
- return 1;
-bad:
- (void) fclose(fp);
- return 0;
-}
diff --git a/StdLib/LibC/Locale/ctypeio.h b/StdLib/LibC/Locale/ctypeio.h
deleted file mode 100644
index 919889fa84..0000000000
--- a/StdLib/LibC/Locale/ctypeio.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/* $NetBSD: ctypeio.h,v 1.1 1997/06/02 09:52:48 kleink Exp $ */
-
-/*
- * Copyright (c) 1997 Christos Zoulas. 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 Christos Zoulas.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 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.
- */
-
-__BEGIN_DECLS
-int __loadctype (const char *);
-int __savectype (const char *, unsigned short *, unsigned char *, unsigned char *);
-__END_DECLS
diff --git a/StdLib/LibC/Locale/iswctype_sb.c b/StdLib/LibC/Locale/iswctype_sb.c
deleted file mode 100644
index 454201543f..0000000000
--- a/StdLib/LibC/Locale/iswctype_sb.c
+++ /dev/null
@@ -1,234 +0,0 @@
-/** @file
- Wide character classification and conversion functions.
-
- Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>
- This program and the accompanying materials are licensed and made available under
- the terms and conditions of the BSD License that accompanies this distribution.
- The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php.
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- Copyright (c) 1989 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.
-
- 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. 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.
-
- NetBSD: iswctype_sb.c,v 1.4 2004/07/21 20:27:46 tshiozak Exp
-**/
-#include <LibConfig.h>
-#include <sys/EfiCdefs.h>
-#if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: iswctype_sb.c,v 1.4 2004/07/21 20:27:46 tshiozak Exp $");
-#endif /* LIBC_SCCS and not lint */
-
-#include <ctype.h>
-#include <string.h>
-#include <wchar.h>
-#include <wctype.h>
-
-#undef iswalnum
-int
-iswalnum(wint_t c)
-{
- return isalnum((int)c);
-}
-
-#undef iswalpha
-int
-iswalpha(wint_t c)
-{
- return isalpha((int)c);
-}
-
-#undef iswblank
-int
-iswblank(wint_t c)
-{
- return isblank((int)c);
-}
-
-#undef iswcntrl
-int
-iswcntrl(wint_t c)
-{
- return iscntrl((int)c);
-}
-
-#undef iswdigit
-int
-iswdigit(wint_t c)
-{
- return isdigit((int)c);
-}
-
-#undef iswgraph
-int
-iswgraph(wint_t c)
-{
- return isgraph((int)c);
-}
-
-#undef iswlower
-int
-iswlower(wint_t c)
-{
- return islower((int)c);
-}
-
-#undef iswprint
-int
-iswprint(wint_t c)
-{
- return isprint((int)c);
-}
-
-#undef iswpunct
-int
-iswpunct(wint_t c)
-{
- return ispunct((int)c);
-}
-
-#undef iswspace
-int
-iswspace(wint_t c)
-{
- return isspace((int)c);
-}
-
-#undef iswupper
-int
-iswupper(wint_t c)
-{
- return isupper((int)c);
-}
-
-#undef iswxdigit
-int
-iswxdigit(wint_t c)
-{
- return isxdigit((int)c);
-}
-
-#undef towupper
-wint_t
-towupper(wint_t c)
-{
- return toupper((int)c);
-}
-
-#undef towlower
-wint_t
-towlower(wint_t c)
-{
- return tolower((int)c);
-}
-
-#undef wcwidth
-int
-/*ARGSUSED*/
-wcwidth(wchar_t c)
-{
- return 1;
-}
-
-#undef iswctype
-int
-iswctype(wint_t c, wctype_t charclass)
-{
- /*
- * SUSv3: If charclass is 0, iswctype() shall return 0.
- */
- return (__isCClass((int)c, (unsigned int)charclass));
-}
-
-// Additional functions in <wctype.h> but not in NetBSD _sb code.
-static
-struct _typestrval {
- char *name;
- wctype_t value;
-} typestrval[] = {
- { "alnum", (_CD | _CU | _CL | _XA) },
- { "alpha", (_CU | _CL | _XA) },
- { "blank", (_CB) },
- { "cntrl", (_CC) },
- { "digit", (_CD) },
- { "graph", (_CG) },
- { "lower", (_CL) },
- { "print", (_CS | _CG) },
- { "punct", (_CP) },
- { "space", (_CW) },
- { "upper", (_CU) },
- { "xdigit", (_CD | _CX) }
-};
-
-#define NUM_PROPVAL (sizeof(typestrval) / sizeof(struct _typestrval))
-
-static
-struct _transtrval {
- char *name;
- wctrans_t function;
-} transtrval[] = {
- { "tolower", towlower },
- { "toupper", towupper }
-};
-
-#define NUM_TRANSVAL (sizeof(transtrval) / sizeof(struct _transtrval))
-
-wctype_t wctype(const char *property)
-{
- int i;
-
- for(i = 0; i < NUM_PROPVAL; ++i) {
- if( strcmp(typestrval[i].name, property) == 0) {
- return typestrval[i].value;
- }
- }
- return 0;
-}
-
-wint_t towctrans(wint_t p1, wctrans_t tranfunc)
-{
- return tranfunc(p1);
-}
-
-wctrans_t wctrans(const char *property)
-{
- int i;
-
- for(i = 0; i < NUM_TRANSVAL; ++i) {
- if( strcmp(transtrval[i].name, property) == 0) {
- return transtrval[i].function;
- }
- }
- return NULL;
-}
diff --git a/StdLib/LibC/Locale/localeconv.c b/StdLib/LibC/Locale/localeconv.c
deleted file mode 100644
index 46430f9c48..0000000000
--- a/StdLib/LibC/Locale/localeconv.c
+++ /dev/null
@@ -1,85 +0,0 @@
-/* $NetBSD: localeconv.c,v 1.13 2005/11/29 03:11:59 christos Exp $ */
-
-/*
- * Written by J.T. Conklin <jtc@NetBSD.org>.
- * Public domain.
- */
-#include <LibConfig.h>
-#include <sys/EfiCdefs.h>
-#if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: localeconv.c,v 1.13 2005/11/29 03:11:59 christos Exp $");
-#endif /* LIBC_SCCS and not lint */
-
-#include <sys/localedef.h>
-#include <locale.h>
-
-/*
- * The localeconv() function constructs a struct lconv from the current
- * monetary and numeric locales.
- *
- * Because localeconv() may be called many times (especially by library
- * routines like printf() & strtod()), the approprate members of the
- * lconv structure are computed only when the monetary or numeric
- * locale has been changed.
- */
-int __mlocale_changed = 1;
-int __nlocale_changed = 1;
-
-/*
- * Return the current locale conversion.
- */
-struct lconv *
-localeconv()
-{
- static struct lconv ret;
-
- if (__mlocale_changed) {
- /* LC_MONETARY */
- ret.int_curr_symbol =
- __UNCONST(_CurrentMonetaryLocale->int_curr_symbol);
- ret.currency_symbol =
- __UNCONST(_CurrentMonetaryLocale->currency_symbol);
- ret.mon_decimal_point =
- __UNCONST(_CurrentMonetaryLocale->mon_decimal_point);
- ret.mon_thousands_sep =
- __UNCONST(_CurrentMonetaryLocale->mon_thousands_sep);
- ret.mon_grouping =
- __UNCONST(_CurrentMonetaryLocale->mon_grouping);
- ret.positive_sign =
- __UNCONST(_CurrentMonetaryLocale->positive_sign);
- ret.negative_sign =
- __UNCONST(_CurrentMonetaryLocale->negative_sign);
- ret.int_frac_digits = _CurrentMonetaryLocale->int_frac_digits;
- ret.frac_digits = _CurrentMonetaryLocale->frac_digits;
- ret.p_cs_precedes = _CurrentMonetaryLocale->p_cs_precedes;
- ret.p_sep_by_space = _CurrentMonetaryLocale->p_sep_by_space;
- ret.n_cs_precedes = _CurrentMonetaryLocale->n_cs_precedes;
- ret.n_sep_by_space = _CurrentMonetaryLocale->n_sep_by_space;
- ret.p_sign_posn = _CurrentMonetaryLocale->p_sign_posn;
- ret.n_sign_posn = _CurrentMonetaryLocale->n_sign_posn;
- ret.int_p_cs_precedes =
- _CurrentMonetaryLocale->int_p_cs_precedes;
- ret.int_n_cs_precedes =
- _CurrentMonetaryLocale->int_n_cs_precedes;
- ret.int_p_sep_by_space =
- _CurrentMonetaryLocale->int_p_sep_by_space;
- ret.int_n_sep_by_space =
- _CurrentMonetaryLocale->int_n_sep_by_space;
- ret.int_p_sign_posn = _CurrentMonetaryLocale->int_p_sign_posn;
- ret.int_n_sign_posn = _CurrentMonetaryLocale->int_n_sign_posn;
- __mlocale_changed = 0;
- }
-
- if (__nlocale_changed) {
- /* LC_NUMERIC */
- ret.decimal_point =
- __UNCONST(_CurrentNumericLocale->decimal_point);
- ret.thousands_sep =
- __UNCONST(_CurrentNumericLocale->thousands_sep);
- ret.grouping =
- __UNCONST(_CurrentNumericLocale->grouping);
- __nlocale_changed = 0;
- }
-
- return (&ret);
-}
diff --git a/StdLib/LibC/Locale/multibyte_Utf8.c b/StdLib/LibC/Locale/multibyte_Utf8.c
deleted file mode 100644
index ffe3dee231..0000000000
--- a/StdLib/LibC/Locale/multibyte_Utf8.c
+++ /dev/null
@@ -1,1008 +0,0 @@
-/** @file
- Copyright (c) 2012, Intel Corporation. All rights reserved.<BR>
- This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-**/
-#include <assert.h>
-#include <string.h>
-#include <errno.h>
-#include <stdlib.h>
-#include <wchar.h>
-#include <sys/types.h>
-#include <limits.h>
-
-typedef int ch_UCS4;
-
-static mbstate_t LocalConvState = {0};
-
-/** Map a UTF-8 encoded prefix byte to a sequence length.
- Zero means illegal prefix, but valid surrogate if < 0xC0.
- One indicates an ASCII-7 equivalent character.
- Two, three, and four are the first byte for 2, 3, and 4 byte sequences, respectively.
- See RFC 3629 for details.
-
- TABLE ENCODING:
- Low Nibble decodes the first byte into the number of bytes in the sequence.
- A value of zero indicates an invalid byte.
- The High Nibble encodes a bit mask to be used to match against the high nibble of the second byte.
-
- example:
- SequenceLength = code[c0] & 0x0F;
- Mask = 0x80 | code[c0];
-
- Surrogate bytes are valid if: code[cX] & Mask > 0x80;
-
-*/
-static
-UINT8 utf8_code_length[256] = {
- 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, /* 00-0F */
- 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
- 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
- 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
- 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
- 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
- 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
- 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, /* 70-7F */
- 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, /* 80-8F */
- 0xA0, 0xA0, 0xA0, 0xA0, 0xA0, 0xA0, 0xA0, 0xA0, 0xA0, 0xA0, 0xA0, 0xA0, 0xA0, 0xA0, 0xA0, 0xA0, /* 90-9F */
- 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, /* A0-AF */
- 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, /* B0-BF */
- 0x00, 0x00, 0x72, 0x72, 0x72, 0x72, 0x72, 0x72, 0x72, 0x72, 0x72, 0x72, 0x72, 0x72, 0x72, 0x72, /* C0-C1 + C2-CF */
- 0x72, 0x72, 0x72, 0x72, 0x72, 0x72, 0x72, 0x72, 0x72, 0x72, 0x72, 0x72, 0x72, 0x72, 0x72, 0x72, /* D0-DF */
- 0x43, 0x73, 0x73, 0x73, 0x73, 0x73, 0x73, 0x73, 0x73, 0x73, 0x73, 0x73, 0x73, 0x33, 0x73, 0x73, /* E0-EF */
- 0x64, 0x74, 0x74, 0x74, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 /* F0-F4 + F5-FF */
-};
-
-/** Process one byte of a multibyte character.
-
- @param[in] ch One byte of a multibyte character.
- @param[in,out] ps Pointer to a conversion state object.
-
- @retval -2 ch is an incomplete but potentially valid character.
- @retval -1 ch is not valid in this context.
- @retval 1:4 The length, in bytes, of the character ch just completed.
-**/
-static
-int
-ProcessOneByte(unsigned char ch, mbstate_t *ps)
-{
- UINT32 Mask;
- UINT32 Length;
- int RetVal = 0;
-
- if(ps->A > 3) {
- // We are in an invalid state
- ps->A = 0; // Initial State
- }
- ps->C[ps->A] = ch; // Save the current character
- Mask = utf8_code_length[ch];
-
- if(ps->A == 0) { // Initial State. First byte of sequence.
- ps->E = Mask | 0x80;
- Length = Mask & 0xF;
- switch(Length) {
- case 0: // State 0, Code 0
- errno = EILSEQ;
- RetVal = -1;
- ps->E = 1; // Consume this character
- break;
- case 1: // State 0, Code 1
- // ASCII-7 Character
- ps->B = ps->D[0] = ch;
- RetVal = 1;
- break;
- default: // State 0, Code 2, 3, 4
- ps->A = 1; // Next state is State-1
- RetVal = -2; // Incomplete but potentially valid character
- break;
- }
- }
- else {
- // We are in state 1, 2, or 3 and processing a surrogate byte
- Length = ps->E & 0xF;
- if((Mask & ps->E) > 0x80) {
- // This byte is valid
- switch(ps->A) { // Process based upon our current state
- case 1: // Second byte of the sequence.
- if(Length == 2) { // State 1, Code 2
- Length = ((ps->C[0] & 0x1f) << 6) + (ps->C[1] & 0x3f);
- assert ((Length > 0x007F) && (Length <= 0x07FF));
- ps->B = ps->D[0] = (UINT16)Length;
- ps->A = 0; // Next state is State-0
- RetVal = 2;
- }
- else { // This isn't the last character, get more. State 1, Code 3 or 4
- ps->A = 2;
- RetVal = -2;
- }
- break;
- case 2: // Third byte of the sequence
- if(Length == 3) {
- Length = ((ps->C[0] & 0x0f) << 12) + ((ps->C[1] & 0x3f) << 6) + (ps->C[2] & 0x3f);
- assert ((Length > 0x07FF) && (Length <= 0xFFFF));
- ps->B = ps->D[0] = (UINT16)Length;
- ps->A = 0; // Next state is State-0
- RetVal = 3;
- }
- else {
- ps->A = 3;
- RetVal = -2;
- }
- break;
- case 3: // Fourth byte of the sequence
- if(Length == 4) {
- Length = ((ps->C[0] & 0x7) << 18) + ((ps->C[1] & 0x3f) << 12) +
- ((ps->C[2] & 0x3f) << 6) + (ps->C[3] & 0x3f);
- ps->B = Length;
- assert ((Length > 0xFFFF) && (Length <= 0x10ffff));
-
- /* compute and append the two surrogates: */
-
- /* translate from 10000..10FFFF to 0..FFFF */
- Length -= 0x10000;
-
- /* high surrogate = top 10 bits added to D800 */
- ps->D[0] = (UINT16)(0xD800 + (Length >> 10));
-
- /* low surrogate = bottom 10 bits added to DC00 */
- ps->D[1] = (UINT16)(0xDC00 + (Length & 0x03FF));
- ps->A = 0; // Next state is State-0
- RetVal = 4;
- }
- else {
- errno = EILSEQ;
- ps->A = 0;
- RetVal = -1;
- ps->E = 4; // Can't happen, but consume this character anyway
- }
- break;
- }
- }
- else { // Invalid surrogate character
- errno = EILSEQ;
- ps->A = 0; // Next is State-0
- RetVal = -1;
- ps->E = 0; // Don't Consume, it may be an initial byte
- }
- }
- return RetVal;
-}
-
-/** Convert one Multibyte sequence.
-
- @param[out] Dest Pointer to output location, or NULL
- @param[in] Src Multibyte Source (UTF8)
- @param[in] Len Max Number of bytes to convert
- @param[in] pS Pointer to State struct., or NULL
-
- @retval -2 Bytes processed comprise an incomplete, but potentially valid, character.
- @retval -1 An encoding error was encountered. ps->E indicates the number of bytes consumed.
- @retval 0 Either Src is NULL or it points to a NUL character.
- @retval 1:N N bytes were consumed producing a valid wide character.
-**/
-int
-DecodeOneStateful(
- wchar_t *Dest, // Pointer to output location, or NULL
- const char *Src, // Multibyte Source (UTF8)
- ssize_t Len, // Max Number of bytes to convert
- mbstate_t *pS // Pointer to State struct., or NULL
- )
-{
- const char *SrcEnd;
- int NumConv;
- unsigned char ch;
-
- if(pS == NULL) {
- pS = &LocalConvState;
- }
- NumConv = 0;
- if(Src != NULL) {
- if(*Src != 0) {
- SrcEnd = Src + Len;
- while(Src < SrcEnd) {
- ch = (unsigned char)*Src++;
- NumConv = ProcessOneByte(ch, pS);
- if(NumConv != -2) {
- break;
- }
- }
- }
- else if(Dest != NULL) {
- *Dest = 0;
- }
- }
- if((NumConv > 0) && (Dest != NULL)) {
- Dest[0] = pS->D[0];
- if(NumConv == 4) {
- Dest[1] = pS->D[1];
- }
- }
- return NumConv;
-}
-
-/* Determine the number of bytes needed to represent a Wide character
- as a MBCS character.
-
- A single wide character may convert into a one, two, three, or four byte
- narrow (MBCS or UTF-8) character. The number of MBCS bytes can be determined
- as follows.
-
- If WCS char < 0x00000080 One Byte
- Else if WCS char < 0x0000D800 Two Bytes
- Else Three Bytes
-
- Since UEFI only supports the Unicode Base Multilingual Plane (BMP),
- Four-byte characters are not supported.
-
- @param[in] InCh Wide character to test.
-
- @retval -1 Improperly formed character
- @retval 0 InCh is 0x0000
- @retval >0 Number of bytes needed for the MBCS character
-*/
-int
-EFIAPI
-OneWcToMcLen(const wchar_t InCh)
-{
- ssize_t NumBytes;
-
- if(InCh == 0) { // Is this a NUL, 0x0000 ?
- NumBytes = 0;
- }
- else if(InCh < 0x0080) { // Is this a 1-byte character?
- NumBytes = 1;
- }
- else if(InCh < 0x0800) { // Is this a 2-byte character?
- NumBytes = 2;
- }
- else if((InCh >= 0xD800) && (InCh < 0xE000)) { // Is this a surrogate?
- NumBytes = -1;
- }
- else {
- NumBytes = 3; // Otherwise, it must be a 3-byte character.
- }
- return (int)NumBytes; // Return extimate of required bytes.
-}
-
-/* Determine the number of bytes needed to represent a Wide character string
- as a MBCS string of given maximum length. Will optionally return the number
- of wide characters that would be consumed.
-
- A single wide character may convert into a one, two, three, or four byte
- narrow (MBCS or UTF-8) character. The number of MBCS bytes can be determined
- as follows.
-
- If WCS char < 0x00000080 One Byte
- Else if WCS char < 0x00000800 Two Bytes
- Else if WCS char < 0x00010000 Three Bytes
- Else Four Bytes
-
- Since UEFI only supports the Unicode Base Multilingual Plane (BMP),
- Four-byte characters should not be encountered.
-
- @param[in] Src Pointer to a wide character string.
- @param[in] Limit Maximum number of bytes the converted string may occupy.
- @param[out] NumChar Pointer to where to store the number of wide characters, or NULL.
-
- @return The number of bytes required to convert Src to MBCS,
- not including the terminating NUL. If NumChar is not NULL, the number
- of characters represented by the return value will be written to
- where it points.
-*/
-size_t
-EFIAPI
-EstimateWtoM(const wchar_t * Src, size_t Limit, size_t *NumChar)
-{
- ssize_t Estimate;
- size_t CharCount;
- ssize_t NumBytes;
- wchar_t EChar;
-
- Estimate = 0;
- CharCount = 0;
- EChar = *Src++; // Get the initial character and point to next
- while(((NumBytes = OneWcToMcLen(EChar)) > 0) &&
- ((size_t)(Estimate + NumBytes) < Limit))
- { // Until one of the source characters is NUL
- ++CharCount; // Count this character.
- Estimate += NumBytes; // Count the Bytes for this character
- EChar = *Src++; // Get the next source character and point to the next.
- }
- if(NumChar != NULL) {
- *NumChar = CharCount;
- }
- return (size_t)Estimate; // Return esimate of required bytes.
-}
-
-/* Determine the number of characters in a MBCS string.
- MBCS characters are one to four bytes long. By examining the first byte
- of a MBCS character, one can determine the number of bytes comprising the
- character.
-
- 0x00 - 0x7F One
- 0xC0 - 0xDF Two
- 0xE0 - 0xEF Three
- 0xF0 - 0xF7 Four
-
- Since UEFI only supports the Unicode Base Multilingual Plane (BMP),
- Four-byte characters should not be encountered.
-
- @param[in] Src The string to examine
-
- @return The number of characters represented by the MBCS string.
-**/
-size_t
-EFIAPI
-CountMbcsChars(const char *Src)
-{
- size_t Count;
- char EChar;
-
- Count = 0;
- EChar = *Src++;
- while(EChar != 0) {
- if(EChar < 0x80) {
- ++Count;
- }
- else if(EChar < 0xE0) {
- Count += 2;
- ++Src;
- }
- else if(EChar < 0xF0) {
- Count += 3;
- Src += 2;
- }
- else {
- // Ill-formed character
- break;
- }
- }
- return Count;
-}
-
-/** Convert a wide character (UTF16) into a multibyte character (UTF8)
-
- Converts a wide character into a corresponding multibyte character that
- begins in the conversion state described by the object pointed to by ps.
- If dst is not a null pointer, the converted character is then stored into
- the array pointed to by dst.
-
- It is the caller's responsibility to ensure that Dest is large enough to
- hold the resulting MBCS sequence.
-
- @param s Pointer to the wide-character string to convert
- @param Dest Pointer to the buffer in which to place the converted sequence, or NULL.
-
- @retval -1 An error occurred. The error reason is in errno.
- @retval >=0 The number of bytes stored into Dest.
-**/
-ssize_t
-EncodeUtf8(char *Dest, wchar_t ch)
-{
- char *p; /* next free byte in build buffer */
- int NumInBuff; // number of bytes in Buff
- char Buff[4]; // Buffer into which each character is built
-
- p = Buff;
-
- NumInBuff = 0;
- if (ch < 0x80) {
- /* Encode ASCII -- One Byte */
- *p++ = (char) ch;
- NumInBuff = 1;
- }
- else if (ch < 0x0800) {
- /* Encode Latin-1 -- Two Byte */
- *p++ = (char)(0xc0 | (ch >> 6));
- *p++ = (char)(0x80 | (ch & 0x3f));
- NumInBuff = 2;
- }
- else {
- /* Encode UCS2 Unicode ordinals -- Three Byte */
- /* Special case: check for surrogate -- Shouldn't happen in UEFI */
- if (0xD800 <= ch && ch < 0xE000) {
- errno = EILSEQ;
- return -1;
- }
- else {
- *p++ = (char)(0xe0 | (ch >> 12));
- *p++ = (char)(0x80 | ((ch >> 6) & 0x3f));
- *p++ = (char)(0x80 | (ch & 0x3f));
- NumInBuff = 3;
- }
- }
- /* At this point, Buff holds the converted character which is NumInBuff bytes long.
- NumInBuff is the value 1, 2, 3, or 4
- */
- if(Dest != NULL) { // Save character if Dest is not NULL
- memcpy(Dest, Buff, NumInBuff);
- }
- return NumInBuff; // Tell the caller
-}
-
-// ######################## Narrow to Wide Conversions #######################
-
-/** If ps is not a null pointer, the mbsinit function determines whether the
- pointed-to mbstate_t object describes an initial conversion state.
-
- @param[in] ps Pointer to the conversion state object to test.
-
- @return The mbsinit function returns nonzero if ps is a null pointer
- or if the pointed-to object describes an initial conversion
- state; otherwise, it returns zero.
-
- Declared in: wchar.h
-**/
-int
-mbsinit(const mbstate_t *ps)
-{
- if((ps == NULL) || (ps->A == 0)) {
- return 1;
- }
- return 0;
-}
-
-/** The mbrlen function is equivalent to the call:<BR>
-@verbatim
- mbrtowc(NULL, s, n, ps != NULL ? ps : &internal)
-@endverbatim
- where internal is the mbstate_t object for the mbrlen function, except that
- the expression designated by ps is evaluated only once.
-
- @param[in] s Pointer to a multibyte character sequence.
- @param[in] n Maximum number of bytes to examine.
- @param[in] pS Pointer to the conversion state object.
-
- @retval 0 The next n or fewer characters complete a NUL.
- @retval 1..n The number of bytes that complete the multibyte character.
- @retval -2 The next n bytes contribute to an incomplete (but potentially valid) multibyte character.
- @retval -1 An encoding error occurred.
-
- Declared in: wchar.h
-**/
-size_t
-mbrlen(
- const char *s,
- size_t n,
- mbstate_t *pS
- )
-{
- return mbrtowc(NULL, s, n, pS);
-}
-
-/** Determine the number of bytes comprising a multibyte character.
-
- If S is not a null pointer, the mblen function determines the number of bytes
- contained in the multibyte character pointed to by S. Except that the
- conversion state of the mbtowc function is not affected, it is equivalent to
- mbtowc((wchar_t *)0, S, N);
-
- @param[in] S NULL to query whether multibyte characters have
- state-dependent encodings. Otherwise, points to a
- multibyte character.
- @param[in] N The maximum number of bytes in a multibyte character.
-
- @return If S is a null pointer, the mblen function returns a nonzero or
- zero value, if multibyte character encodings, respectively, do
- or do not have state-dependent encodings. If S is not a null
- pointer, the mblen function either returns 0 (if S points to the
- null character), or returns the number of bytes that are contained
- in the multibyte character (if the next N or fewer bytes form a
- valid multibyte character), or returns -1 (if they do not form a
- valid multibyte character).
-
- Declared in: stdlib.h
-**/
-int
-mblen(
- const char *s,
- size_t n
- )
-{
- return (int)mbrlen(s, n, NULL);
-}
-
-/**
-If S is a null pointer, the mbrtowc function is equivalent to the call:<BR>
-@verbatim
- mbrtowc(NULL, "", 1, ps)
-@endverbatim
-
-In this case, the values of the parameters pwc and n are ignored.
-
-If S is not a null pointer, the mbrtowc function inspects at most n bytes beginning with
-the byte pointed to by S to determine the number of bytes needed to complete the next
-multibyte character (including any shift sequences). If the function determines that the
-next multibyte character is complete and valid, it determines the value of the
-corresponding wide character and then, if pwc is not a null pointer, stores that value in
-the object pointed to by pwc. If the corresponding wide character is the null wide
-character, the resulting state described is the initial conversion state.
-
- @param[out] pwc Pointer to where the resulting wide character is to be stored.
- @param[in] s Pointer to a multibyte character "string".
- @param[in] n The maximum number of bytes to inspect.
- @param[in] ps Pointer to a conversion state object.
-
- @retval 0 if the next n or fewer bytes complete the multibyte
- character that corresponds to the null wide
- character (which is the value stored).
- @retval between_1_and_n_inclusive if the next n or fewer bytes complete
- a valid multibyte character (which is the value
- stored); the value returned is the number of bytes
- that complete the multibyte character.
- @retval (size_t)(-2) if the next n bytes contribute to an incomplete
- (but potentially valid) multibyte character, and
- all n bytes have been processed (no value is stored).
- @retval (size_t)(-1) if an encoding error occurs, in which case the next
- n or fewer bytes do not contribute to a complete and
- valid multibyte character (no value is stored); the
- value of the macro EILSEQ is stored in errno, and
- the conversion state is unspecified.
-
- Declared in: wchar.h
-**/
-size_t
-mbrtowc(
- wchar_t *pwc,
- const char *s,
- size_t n,
- mbstate_t *ps
- )
-{
- int RetVal;
-
- RetVal = DecodeOneStateful(pwc, s, (ssize_t)n, ps);
- return (size_t)RetVal;
-}
-
-/** Convert a multibyte character into a wide character.
-
- If S is not a null pointer, the mbtowc function inspects at most N bytes
- beginning with the byte pointed to by S to determine the number of bytes
- needed to complete the next multibyte character (including any shift
- sequences). If the function determines that the next multibyte character
- is complete and valid, it determines the value of the corresponding wide
- character and then, if Pwc is not a null pointer, stores that value in
- the object pointed to by Pwc. If the corresponding wide character is the
- null wide character, the function is left in the initial conversion state.
-
- @param[out] Pwc Pointer to a wide-character object to receive the converted character.
- @param[in] S Pointer to a multibyte character to convert.
- @param[in] N Maximum number of bytes in a multibyte character.
-
- @return If S is a null pointer, the mbtowc function returns a nonzero or
- zero value, if multibyte character encodings, respectively, do
- or do not have state-dependent encodings. If S is not a null
- pointer, the mbtowc function either returns 0 (if S points to
- the null character), or returns the number of bytes that are
- contained in the converted multibyte character (if the next N or
- fewer bytes form a valid multibyte character), or returns -1
- (if they do not form a valid multibyte character).
-
- In no case will the value returned be greater than N or the value
- of the MB_CUR_MAX macro.
-
- Declared in: stdlib.h
-**/
-int
-mbtowc(
- wchar_t *pwc,
- const char *s,
- size_t n
- )
-{
- return (int)mbrtowc(pwc, s, n, NULL);
-}
-
-/**
-The mbsrtowcs function converts a sequence of multibyte characters that begins in the
-conversion state described by the object pointed to by ps, from the array indirectly
-pointed to by src into a sequence of corresponding wide characters. If dst is not a null
-pointer, the converted characters are stored into the array pointed to by dst. Conversion
-continues up to and including a terminating null character, which is also stored.
-Conversion stops earlier in two cases: when a sequence of bytes is encountered that does
-not form a valid multibyte character, or (if dst is not a null pointer) when len wide
-characters have been stored into the array pointed to by dst. Each conversion takes
-place as if by a call to the mbrtowc function.
-
-If dst is not a null pointer, the pointer object pointed to by src is assigned either a null
-pointer (if conversion stopped due to reaching a terminating null character) or the address
-just past the last multibyte character converted (if any). If conversion stopped due to
-reaching a terminating null character and if dst is not a null pointer, the resulting state
-described is the initial conversion state.
-
- @param[out] dst Pointer to where the resulting wide character sequence is stored.
- @param[in] src Pointer to a pointer to the multibyte character sequence to convert.
- @param[in] len Maximum number of wide characters to be stored into dst.
- @param[in] ps Pointer to a conversion state object.
-
- @return If the input conversion encounters a sequence of bytes that do
- not form a valid multibyte character, an encoding error occurs:
- the mbsrtowcs function stores the value of the macro EILSEQ in
- errno and returns (size_t)(-1); the conversion state is
- unspecified. Otherwise, it returns the number of multibyte
- characters successfully converted, not including the terminating
- null character (if any).
-
- Declared in: wchar.h
-**/
-size_t
-mbsrtowcs(
- wchar_t *dst,
- const char **src,
- size_t len,
- mbstate_t *ps
- )
-{
- int x;
- size_t RetVal = 0;
- const char *MySrc;
-
- if((src == NULL) || (*src == NULL)) {
- return 0;
- }
-
- MySrc = *src;
- for(x = 1 ; (len != 0) && (x > 0); --len) {
- x = DecodeOneStateful(dst, MySrc, MB_LEN_MAX, ps);
- switch(x) {
- case -2: // Incomplete character
- case -1: // Encoding error
- RetVal = (size_t)x;
- break;
- case 0: // Encountered NUL character: done.
- if(dst != NULL) {
- *dst = 0;
- *src = NULL;
- }
- break;
- default: // Successfully decoded a character, continue with next
- MySrc += x;
- if(dst != NULL) {
- ++dst;
- if(x == 4) {
- ++dst;
- }
- *src = MySrc;
- }
- ++RetVal;
- break;
- }
- }
- return RetVal;
-}
-
-/** Convert a multibyte character string into a wide-character string.
-
- The mbstowcs function converts a sequence of multibyte characters that
- begins in the initial shift state from the array pointed to by Src into
- a sequence of corresponding wide characters and stores not more than limit
- wide characters into the array pointed to by Dest. No multibyte
- characters that follow a null character (which is converted into a null
- wide character) will be examined or converted. Each multibyte character
- is converted as if by a call to the mbtowc function, except that the
- conversion state of the mbtowc function is not affected.
-
- No more than Limit elements will be modified in the array pointed to by Dest.
- If copying takes place between objects that overlap,
- the behavior is undefined.
-
- @param[out] Dest Pointer to the array to receive the converted string.
- @param[in] Src Pointer to the string to be converted.
- @param[in] Limit Maximum number of elements to be written to Dest.
-
- @return If an invalid multibyte character is encountered, the mbstowcs
- function returns (size_t)(-1). Otherwise, the mbstowcs function
- returns the number of array elements modified, not including a
- terminating null wide character, if any.
-
- Declared in: stdlib.h
-**/
-size_t
-mbstowcs(
- wchar_t *Dest,
- const char *Src,
- size_t Limit
- )
-{
-
- /* Dest may be NULL */
- /* Src may be NULL */
-
- return mbsrtowcs(Dest, &Src, Limit, NULL);
-}
-
-/** The btowc function determines whether C constitutes a valid single-byte
- character in the initial shift state.
-
- @param[in] C A narrow character to test or convert to wide.
-
- @return The btowc function returns WEOF if c has the value EOF or if
- (unsigned char)C does not constitute a valid single-byte
- character in the initial shift state. Otherwise, it returns the
- wide character representation of that character.
-
- Declared in: wchar.h
-**/
-wint_t
-btowc(int c)
-{
- int x;
- wchar_t Dest;
- wint_t RetVal = WEOF;
-
- if (c == EOF)
- return WEOF;
- x = DecodeOneStateful(&Dest, (const char *)&c, 1, NULL);
- if(x == 0) {
- RetVal = 0;
- }
- else if(x == 1) {
- RetVal = (wint_t)Dest;
- }
- return RetVal;
-}
-
-// ######################## Wide to Narrow Conversions #######################
-
-/**
-If S is a null pointer, the wcrtomb function is equivalent to the call:<BR>
-@verbatim
- wcrtomb(buf, L'\0', ps)
-@endverbatim
-where buf is an internal buffer.
-
-If S is not a null pointer, the wcrtomb function determines the number of bytes needed
-to represent the multibyte character that corresponds to the wide character given by wc
-(including any shift sequences), and stores the multibyte character representation in the
-array whose first element is pointed to by S. At most MB_CUR_MAX bytes are stored. If
-wc is a null wide character, a null byte is stored, preceded by any shift sequence needed
-to restore the initial shift state; the resulting state described is the initial conversion state.
-
- @param[out] Dest Pointer to the location in which to store the resulting
- multibyte character. Otherwise, NULL to reset the
- conversion state.
- @param[in] wchar The wide character to convert.
- @param[in,out] pS Pointer to a conversion state object, or NULL.
-
- @return The wcrtomb function returns the number of bytes stored in the
- array object (including any shift sequences). When wc is not a
- valid wide character, an encoding error occurs: the function
- stores the value of the macro EILSEQ in errno and
- returns (size_t)(-1); the conversion state is unspecified.
-
- Declared in: wchar.h
-**/
-size_t
-wcrtomb(
- char *Dest,
- wchar_t wchar,
- mbstate_t *pS
- )
-{
- size_t RetVal;
-
- /* Dest may be NULL */
- if (Dest == NULL) {
- RetVal = 1;
- }
- else {
- if (wchar == L'\0') {
- *Dest = '\0';
- RetVal = 1;
- }
- else {
- RetVal = EncodeUtf8(Dest, wchar);
- }
- }
- if(pS == NULL) {
- pS = &LocalConvState;
- }
- pS->A = 0; // Set ps to the initial conversion state
-
- return RetVal;
-}
-
-/** Convert a wide character into a multibyte character.
-
- The wctomb function determines the number of bytes needed to represent the
- multibyte character corresponding to the wide character given by WC
- (including any shift sequences), and stores the multibyte character
- representation in the array whose first element is pointed to by S (if S is
- not a null pointer). At most MB_CUR_MAX characters are stored. If WC is a
- null wide character, a null byte is stored, preceded by any shift sequence
- needed to restore the initial shift state, and the function is left in the
- initial conversion state.
-
- @param[out] S Pointer to the object to receive the converted multibyte character.
- @param[in] WC Wide character to be converted.
-
- @return If S is a null pointer, the wctomb function returns a nonzero or
- zero value, if multibyte character encodings, respectively, do or
- do not have state-dependent encodings. If S is not a null pointer,
- the wctomb function returns -1 if the value of WC does not
- correspond to a valid multibyte character, or returns the number
- of bytes that are contained in the multibyte character
- corresponding to the value of WC.
-
- In no case will the value returned be greater than the value of
- the MB_CUR_MAX macro.
-
- Declared in: stdlib.h
-**/
-int
-wctomb(
- char *s,
- wchar_t wchar
- )
-{
- /*
- If s is NULL just return whether MB Characters have state
- dependent encodings -- they don't.
- */
- if (s == NULL)
- return 0;
-
- return (int)wcrtomb(s, wchar, NULL);
-}
-
-/** The wcsrtombs function converts a sequence of wide characters from the array
- indirectly pointed to by Src into a sequence of corresponding multibyte
- characters that begins in the conversion state described by the object
- pointed to by ps.
-
- If Dest is not a null pointer, the converted characters are stored into the
- array pointed to by Dest. Conversion continues up to and including a
- terminating null wide character, which is also stored. Conversion stops
- earlier in two cases: when a wide character is reached that does not
- correspond to a valid multibyte character, or (if Dest is not a null
- pointer) when the next multibyte character would exceed the limit of Limit
- total bytes to be stored into the array pointed to by Dest. Each conversion
- takes place as if by a call to the wcrtomb function.)
-
- If Dest is not a null pointer, the pointer object pointed to by Src is
- assigned either a null pointer (if conversion stopped due to reaching
- a terminating null wide character) or the address just past the last wide
- character converted (if any). If conversion stopped due to reaching a
- terminating null wide character, the resulting state described is the
- initial conversion state.
-
- @param[in] Dest
- @param[in,out] Src
- @param[in] Limit Max number of bytes to store in Dest.
- @param[in,out] ps
-
- @return If conversion stops because a wide character is reached that
- does not correspond to a valid multibyte character, an
- encoding error occurs: the wcsrtombs function stores the
- value of the macro EILSEQ in errno and returns (size_t)(-1);
- the conversion state is unspecified. Otherwise, it returns
- the number of bytes in the resulting multibyte character
- sequence, not including the terminating null character (if any).
-
- Declared in: wchar.h
-**/
-size_t
-wcsrtombs(
- char *Dest,
- const wchar_t **Src,
- size_t Limit,
- mbstate_t *ps
-)
-{
- size_t NumStored;
- ssize_t MaxBytes;
- int count;
- wchar_t InCh;
-
- NumStored = 0;
- MaxBytes = (ssize_t)Limit;
-
- /* Dest may be NULL */
- /* Src may be NULL */
- /* ps appears to be unused */
-
- if (Src == NULL || *Src == NULL)
- return (0);
-
- if (Dest == NULL) {
- NumStored = EstimateWtoM(*Src, ASCII_STRING_MAX, NULL);
- }
- else {
- if((MaxBytes < 0) || (MaxBytes > ASCII_STRING_MAX)) {
- MaxBytes = ASCII_STRING_MAX;
- }
- while ((MaxBytes > 0) && (OneWcToMcLen(InCh = *(*Src)++) <= MaxBytes)) {
- if(InCh == 0) {
- *Src = NULL;
- *Dest = 0; // NUL terminate Dest string, but don't count the NUL
- break;
- }
- count = (int)wcrtomb(Dest, InCh, NULL);
- if(count >= 0) {
- Dest += count;
- MaxBytes -= count;
- NumStored += count;
- }
- else {
- NumStored = (size_t)(-1);
- }
- }
- }
-
-
- return NumStored;
-}
-
-/** Convert a wide-character string into a multibyte character string.
-
- The wcstombs function converts a sequence of wide characters from the
- array pointed to by Src into a sequence of corresponding multibyte
- characters that begins in the initial shift state, and stores these
- multibyte characters into the array pointed to by Dest, stopping if a
- multibyte character would exceed the limit of Limit total bytes or if a
- null character is stored. Each wide character is converted as if by
- a call to the wctomb function, except that the conversion state of
- the wctomb function is not affected.
-
- No more than Limit bytes will be modified in the array pointed to by Dest.
- If copying takes place between objects that overlap,
- the behavior is undefined.
-
- @param[out] Dest Pointer to the array to receive the converted string.
- @param[in] Src Pointer to the string to be converted.
- @param[in] Limit Maximum number of elements to be written to Dest.
-
- @return If a wide character is encountered that does not correspond to a
- valid multibyte character, the wcstombs function returns
- (size_t)(-1). Otherwise, the wcstombs function returns the number
- of bytes modified, not including a terminating null character,
- if any.
-
- Declared in: stdlib.h
-**/
-size_t
-wcstombs(
- char *Dest,
- const wchar_t *Src,
- size_t Limit
-)
-{
- /* Dest may be NULL */
- return wcsrtombs(Dest, &Src, Limit, NULL);
-}
-
-/** The wctob function determines whether C corresponds to a member of the extended
- character set whose multibyte character representation is a single byte when in the initial
- shift state.
-
- wctob needs to be consistent with wcrtomb.
- If wcrtomb says that a character is representable in 1 byte,
- then wctob needs to also represent the character as 1 byte.
-
- @return The wctob function returns EOF if C does not correspond to a multibyte
- character with length one in the initial shift state. Otherwise, it
- returns the single-byte representation of that character as an
- unsigned char converted to an int.
-
- Declared in: wchar.h
-**/
-int
-wctob(wint_t c)
-{
- int RetVal;
-
- RetVal = EOF;
- if(c == 0) {
- RetVal = 0;
- }
- else if (OneWcToMcLen((const wchar_t)c) == 1) {
- RetVal = (int)(c & 0xFF);
- }
- return RetVal;
-}
diff --git a/StdLib/LibC/Locale/multibyte_sb.c b/StdLib/LibC/Locale/multibyte_sb.c
deleted file mode 100644
index 0a73898e61..0000000000
--- a/StdLib/LibC/Locale/multibyte_sb.c
+++ /dev/null
@@ -1,287 +0,0 @@
-/* $NetBSD: multibyte_sb.c,v 1.5 2004/07/21 20:27:46 tshiozak Exp $ */
-
-/*
- * Copyright (c) 1991 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. 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.
- */
-#include <LibConfig.h>
-#include <sys/EfiCdefs.h>
-#if defined(LIBC_SCCS) && !defined(lint)
-#if 0
-static char *sccsid = "from: @(#)multibyte.c 5.1 (Berkeley) 2/18/91";
-#else
-__RCSID("$NetBSD: multibyte_sb.c,v 1.5 2004/07/21 20:27:46 tshiozak Exp $");
-#endif
-#endif /* LIBC_SCCS and not lint */
-
-#include <assert.h>
-#include <errno.h>
-#include <stdlib.h>
-#include <wchar.h>
-
-/*
- * Stub multibyte character functions.
- * This cheezy implementation is fixed to the native single-byte
- * character set.
- */
-
-/*ARGSUSED*/
-int
-mbsinit(const mbstate_t *ps)
-{
-
- return 1;
-}
-
-/*ARGSUSED*/
-size_t
-mbrlen(
- const char *s,
- size_t n,
- mbstate_t *ps
- )
-{
-
- /* ps appears to be unused */
-
- if (s == NULL || *s == '\0')
- return 0;
- if (n == 0)
- return (size_t)-1;
- return 1;
-}
-
-int
-mblen(
- const char *s,
- size_t n
- )
-{
-
- /* s may be NULL */
-
- return (int)mbrlen(s, n, NULL);
-}
-
-/*ARGSUSED*/
-size_t
-mbrtowc(
- wchar_t *pwc,
- const char *s,
- size_t n,
- mbstate_t *ps
- )
-{
-
- /* pwc may be NULL */
- /* s may be NULL */
- /* ps appears to be unused */
-
- if (s == NULL)
- return 0;
- if (n == 0)
- return (size_t)-1;
- if (pwc)
- *pwc = (wchar_t) *s;
- return (*s != '\0');
-}
-
-int
-mbtowc(
- wchar_t *pwc,
- const char *s,
- size_t n
- )
-{
-
- /* pwc may be NULL */
- /* s may be NULL */
-
- return (int)mbrtowc(pwc, s, n, NULL);
-}
-
-/*ARGSUSED*/
-size_t
-wcrtomb(
- char *s,
- wchar_t wchar,
- mbstate_t *ps
- )
-{
-
- /* s may be NULL */
- /* ps appears to be unused */
-
- if (s == NULL)
- return 1; /* Spec. says this should be 1. */
-
- *s = (char) wchar;
- return 1;
-}
-
-int
-wctomb(
- char *s,
- wchar_t wchar
- )
-{
-
- /*
- If s is NULL just return if MB Characters have state
- dependent encodings.
- */
- if (s == NULL)
- return 0;
-
- return (int)wcrtomb(s, wchar, NULL);
-}
-
-/*ARGSUSED*/
-size_t
-mbsrtowcs(
- wchar_t *pwcs,
- const char **s,
- size_t n,
- mbstate_t *ps
- )
-{
- int count = 0;
-
- /* pwcs may be NULL */
- /* s may be NULL */
- /* ps appears to be unused */
-
- if (!s || !*s)
- return 0;
-
- if (n != 0) {
- if (pwcs != NULL) {
- do {
- if ((*pwcs++ = (wchar_t) *(*s)++) == 0) {
- *s = NULL;
- break;
- }
- count++;
- } while (--n != 0);
- } else {
- do {
- if (((wchar_t)*(*s)++) == 0)
- break;
- count++;
- } while (--n != 0);
- }
- }
-
- return count;
-}
-
-size_t
-mbstowcs(
- wchar_t *pwcs,
- const char *s,
- size_t n
- )
-{
-
- /* pwcs may be NULL */
- /* s may be NULL */
-
- return mbsrtowcs(pwcs, &s, n, NULL);
-}
-
-/*ARGSUSED*/
-size_t
-wcsrtombs(
- char *s,
- const wchar_t **pwcs,
- size_t n,
- mbstate_t *ps
- )
-{
- int count = 0;
-
- /* s may be NULL */
- /* pwcs may be NULL */
- /* ps appears to be unused */
-
- if (pwcs == NULL || *pwcs == NULL)
- return (0);
-
- if (s == NULL) {
- while (*(*pwcs)++ != 0)
- count++;
- return(count);
- }
-
- if (n != 0) {
- do {
- if ((*s++ = (char) *(*pwcs)++) == 0) {
- *pwcs = NULL;
- break;
- }
- count++;
- } while (--n != 0);
- }
-
- return count;
-}
-
-size_t
-wcstombs(
- char *s,
- const wchar_t *pwcs,
- size_t n
- )
-{
-
- /* s may be NULL */
- /* pwcs may be NULL */
-
- return wcsrtombs(s, &pwcs, n, NULL);
-}
-
-wint_t
-btowc(int c)
-{
- if (c == EOF || c & ~0xFF)
- return WEOF;
- return (wint_t)c;
-}
-
-int
-wctob(wint_t c)
-{
- /* wctob needs to be consistent with wcrtomb.
- if wcrtomb says that a character is representable in 1 byte,
- which this implementation always says, then wctob needs to
- also represent the character as 1 byte.
- */
- if (c == WEOF) {
- return EOF;
- }
- return (int)(c & 0xFF);
-}
diff --git a/StdLib/LibC/Locale/nl_langinfo.c b/StdLib/LibC/Locale/nl_langinfo.c
deleted file mode 100644
index cd283df380..0000000000
--- a/StdLib/LibC/Locale/nl_langinfo.c
+++ /dev/null
@@ -1,125 +0,0 @@
-/* $NetBSD: nl_langinfo.c,v 1.11 2005/11/29 03:11:59 christos Exp $ */
-
-/*
- * Written by J.T. Conklin <jtc@NetBSD.org>.
- * Public domain.
- */
-#include <LibConfig.h>
-#include <sys/EfiCdefs.h>
-#if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: nl_langinfo.c,v 1.11 2005/11/29 03:11:59 christos Exp $");
-#endif /* LIBC_SCCS and not lint */
-
-#include <sys/localedef.h>
-#include <locale.h>
-#include <nl_types.h>
-#include <langinfo.h>
-#include "rune.h"
-#include "runetype.h"
-
-char *
-nl_langinfo(nl_item item)
-{
- const char *s;
-
- switch (item) {
- case D_T_FMT:
- s = _CurrentTimeLocale->d_t_fmt;
- break;
- case D_FMT:
- s = _CurrentTimeLocale->d_fmt;
- break;
- case T_FMT:
- s = _CurrentTimeLocale->t_fmt;
- break;
- case T_FMT_AMPM:
- s = _CurrentTimeLocale->t_fmt_ampm;
- break;
- case AM_STR:
- case PM_STR:
- s = _CurrentTimeLocale->am_pm[(size_t)(item - AM_STR)];
- break;
- case DAY_1:
- case DAY_2:
- case DAY_3:
- case DAY_4:
- case DAY_5:
- case DAY_6:
- case DAY_7:
- s = _CurrentTimeLocale->day[(size_t)(item - DAY_1)];
- break;
- case ABDAY_1:
- case ABDAY_2:
- case ABDAY_3:
- case ABDAY_4:
- case ABDAY_5:
- case ABDAY_6:
- case ABDAY_7:
- s = _CurrentTimeLocale->abday[(size_t)(item - ABDAY_1)];
- break;
- case MON_1:
- case MON_2:
- case MON_3:
- case MON_4:
- case MON_5:
- case MON_6:
- case MON_7:
- case MON_8:
- case MON_9:
- case MON_10:
- case MON_11:
- case MON_12:
- s = _CurrentTimeLocale->mon[(size_t)(item - MON_1)];
- break;
- case ABMON_1:
- case ABMON_2:
- case ABMON_3:
- case ABMON_4:
- case ABMON_5:
- case ABMON_6:
- case ABMON_7:
- case ABMON_8:
- case ABMON_9:
- case ABMON_10:
- case ABMON_11:
- case ABMON_12:
- s = _CurrentTimeLocale->abmon[(size_t)(item - ABMON_1)];
- break;
- case RADIXCHAR:
- s = _CurrentNumericLocale->decimal_point;
- break;
- case THOUSEP:
- s = _CurrentNumericLocale->thousands_sep;
- break;
- case YESSTR:
- s = _CurrentMessagesLocale->yesstr;
- break;
- case YESEXPR:
- s = _CurrentMessagesLocale->yesexpr;
- break;
- case NOSTR:
- s = _CurrentMessagesLocale->nostr;
- break;
- case NOEXPR:
- s = _CurrentMessagesLocale->noexpr;
- break;
- case CRNCYSTR: /* XXX */
- s = "";
- break;
- case CODESET:
-#ifdef WITH_RUNE
- s = _CurrentRuneLocale->rl_codeset;
-#else
- s = NULL;
-#endif
- if (!s)
- s = "";
- break;
- default:
- s = "";
- break;
- }
-
- /* The return value should be really const, but the interface says OW */
- return __UNCONST(s);
-}
diff --git a/StdLib/LibC/Locale/rune.h b/StdLib/LibC/Locale/rune.h
deleted file mode 100644
index 93829e56ea..0000000000
--- a/StdLib/LibC/Locale/rune.h
+++ /dev/null
@@ -1,100 +0,0 @@
-/* $NetBSD: rune.h,v 1.11 2006/02/16 19:19:49 tnozaki Exp $ */
-
-/*-
- * Copyright (c) 1993
- * The Regents of the University of California. All rights reserved.
- *
- * 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. 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.
- *
- * @(#)rune.h 8.1 (Berkeley) 6/27/93
- */
-#ifndef _RUNE_H_
-#define _RUNE_H_
-
-#include <LibConfig.h>
-
-#include <stdio.h>
-#include <wchar.h>
-#include "runetype.h"
-
-/*
- * map _RTYPE_x to _CTYPE_x
- *
- * XXX: these should be defined in ctype.h and used in isxxx macros.
- * (note: current isxxx macros use "old" NetBSD masks and
- * _CTYPE_x are not public.)
- */
-#define _CTYPE_A _RUNETYPE_A
-#define _CTYPE_C _RUNETYPE_C
-#define _CTYPE_D _RUNETYPE_D
-#define _CTYPE_G _RUNETYPE_G
-#define _CTYPE_L _RUNETYPE_L
-#define _CTYPE_P _RUNETYPE_P
-#define _CTYPE_S _RUNETYPE_S
-#define _CTYPE_U _RUNETYPE_U
-#define _CTYPE_X _RUNETYPE_X
-#define _CTYPE_B _RUNETYPE_B
-#define _CTYPE_R _RUNETYPE_R
-#define _CTYPE_I _RUNETYPE_I
-#define _CTYPE_T _RUNETYPE_T
-#define _CTYPE_Q _RUNETYPE_Q
-#define _CTYPE_SWM _RUNETYPE_SWM
-#define _CTYPE_SWS _RUNETYPE_SWS
-#define _CTYPE_SW0 _RUNETYPE_SW0
-#define _CTYPE_SW1 _RUNETYPE_SW1
-#define _CTYPE_SW2 _RUNETYPE_SW2
-#define _CTYPE_SW3 _RUNETYPE_SW3
-
-/*
- * Other namespace conversion.
- */
-
-#define rune_t __nbrune_t
-#define _RUNE_ISCACHED _NB_RUNE_ISCACHED
-#define _CACHED_RUNES _NB_CACHED_RUNES
-#define _DEFAULT_INVALID_RUNE _NB_DEFAULT_INVALID_RUNE
-#define _RuneEntry _NBRuneEntry
-#define _RuneRange _NBRuneRange
-#define _RuneLocale _NBRuneLocale
-#define _RUNE_MAGIC_1 _NB_RUNE_MAGIC_1
-#define _RUNE_MODULE_1 _NB_RUNE_MODULE_1
-#define _RUNE_CODESET _NB_RUNE_CODESET
-
-/*
- * global variables
- */
-extern size_t __mb_len_max_runtime;
-#define __MB_LEN_MAX_RUNTIME __mb_len_max_runtime
-
-extern _RuneLocale _DefaultRuneLocale;
-extern _RuneLocale *_CurrentRuneLocale;
-extern const char *_PathLocale;
-
-#define _LOCALE_ALIAS_NAME "locale.alias"
-
-#endif /*! _RUNE_H_ */
diff --git a/StdLib/LibC/Locale/runetype.h b/StdLib/LibC/Locale/runetype.h
deleted file mode 100644
index 2cd563e103..0000000000
--- a/StdLib/LibC/Locale/runetype.h
+++ /dev/null
@@ -1,221 +0,0 @@
-/* $NetBSD: runetype.h,v 1.19 2005/11/29 03:11:59 christos Exp $ */
-
-/*-
- * Copyright (c) 1993
- * The Regents of the University of California. All rights reserved.
- *
- * 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. 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.
- *
- * @(#)runetype.h 8.1 (Berkeley) 6/2/93
- */
-#ifndef _NB_RUNETYPE_H_
-#define _NB_RUNETYPE_H_
-
-#include <sys/EfiCdefs.h>
-#include <sys/types.h>
-
-/* for cross host tools on older systems */
-#ifndef UINT32_C
-/* assumes sizeof(unsigned int)>=4 */
-#define UINT32_C(c) ((uint32_t)(c##U))
-#endif
-
-typedef uint32_t __nbrune_t;
-typedef uint64_t __runepad_t;
-
-#define _NB_CACHED_RUNES (1 << 8) /* Must be a power of 2 */
-#define _NB_RUNE_ISCACHED(c) ((c)>=0 && (c)<_CACHED_RUNES)
-
-#define _NB_DEFAULT_INVALID_RUNE ((__nbrune_t)-3)
-
-/*
- * The lower 8 bits of runetype[] contain the digit value of the rune.
- */
-typedef uint32_t _RuneType;
-#define _RUNETYPE_A UINT32_C(0x00000100) /* Alpha */
-#define _RUNETYPE_C UINT32_C(0x00000200) /* Control */
-#define _RUNETYPE_D UINT32_C(0x00000400) /* Digit */
-#define _RUNETYPE_G UINT32_C(0x00000800) /* Graph */
-#define _RUNETYPE_L UINT32_C(0x00001000) /* Lower */
-#define _RUNETYPE_P UINT32_C(0x00002000) /* Punct */
-#define _RUNETYPE_S UINT32_C(0x00004000) /* Space */
-#define _RUNETYPE_U UINT32_C(0x00008000) /* Upper */
-#define _RUNETYPE_X UINT32_C(0x00010000) /* X digit */
-#define _RUNETYPE_B UINT32_C(0x00020000) /* Blank */
-#define _RUNETYPE_R UINT32_C(0x00040000) /* Print */
-#define _RUNETYPE_I UINT32_C(0x00080000) /* Ideogram */
-#define _RUNETYPE_T UINT32_C(0x00100000) /* Special */
-#define _RUNETYPE_Q UINT32_C(0x00200000) /* Phonogram */
-#define _RUNETYPE_SWM UINT32_C(0xc0000000)/* Mask to get screen width data */
-#define _RUNETYPE_SWS 30 /* Bits to shift to get width */
-#define _RUNETYPE_SW0 UINT32_C(0x00000000) /* 0 width character */
-#define _RUNETYPE_SW1 UINT32_C(0x40000000) /* 1 width character */
-#define _RUNETYPE_SW2 UINT32_C(0x80000000) /* 2 width character */
-#define _RUNETYPE_SW3 UINT32_C(0xc0000000) /* 3 width character */
-
-
-/*
- * rune file format. network endian.
- */
-typedef struct {
- int32_t fre_min; /* First rune of the range */
- int32_t fre_max; /* Last rune (inclusive) of the range */
- int32_t fre_map; /* What first maps to in maps */
- uint32_t fre_pad1; /* backward compatibility */
- __runepad_t fre_pad2; /* backward compatibility */
-} __attribute__((__packed__)) _FileRuneEntry;
-
-
-typedef struct {
- uint32_t frr_nranges; /* Number of ranges stored */
- uint32_t frr_pad1; /* backward compatibility */
- __runepad_t frr_pad2; /* backward compatibility */
-} __attribute__((__packed__)) _FileRuneRange;
-
-
-typedef struct {
- char frl_magic[8]; /* Magic saying what version we are */
- char frl_encoding[32];/* ASCII name of this encoding */
-
- __runepad_t frl_pad1; /* backward compatibility */
- __runepad_t frl_pad2; /* backward compatibility */
- int32_t frl_invalid_rune;
- uint32_t frl_pad3; /* backward compatibility */
-
- _RuneType frl_runetype[_NB_CACHED_RUNES];
- int32_t frl_maplower[_NB_CACHED_RUNES];
- int32_t frl_mapupper[_NB_CACHED_RUNES];
-
- /*
- * The following are to deal with Runes larger than _CACHED_RUNES - 1.
- * Their data is actually contiguous with this structure so as to make
- * it easier to read/write from/to disk.
- */
- _FileRuneRange frl_runetype_ext;
- _FileRuneRange frl_maplower_ext;
- _FileRuneRange frl_mapupper_ext;
-
- __runepad_t frl_pad4; /* backward compatibility */
- int32_t frl_variable_len;/* how long that data is */
- uint32_t frl_pad5; /* backward compatibility */
-
- /* variable size data follows */
-} __attribute__((__packed__)) _FileRuneLocale;
-
-
-/*
- * expanded rune locale declaration. local to the host. host endian.
- */
-typedef struct {
- __nbrune_t re_min; /* First rune of the range */
- __nbrune_t re_max; /* Last rune (inclusive) of the range */
- __nbrune_t re_map; /* What first maps to in maps */
- _RuneType *re_rune_types; /* Array of types in range */
-} _NBRuneEntry;
-
-
-typedef struct {
- uint32_t rr_nranges; /* Number of ranges stored */
- _NBRuneEntry *rr_rune_ranges;
-} _NBRuneRange;
-
-
-/*
- * wctrans stuffs.
- */
-typedef struct _WCTransEntry {
- const char *te_name;
- __nbrune_t *te_cached;
- _NBRuneRange *te_extmap;
-} _WCTransEntry;
-#define _WCTRANS_INDEX_LOWER 0
-#define _WCTRANS_INDEX_UPPER 1
-#define _WCTRANS_NINDEXES 2
-
-/*
- * wctype stuffs.
- */
-typedef struct _WCTypeEntry {
- const char *te_name;
- _RuneType te_mask;
-} _WCTypeEntry;
-#define _WCTYPE_INDEX_ALNUM 0
-#define _WCTYPE_INDEX_ALPHA 1
-#define _WCTYPE_INDEX_BLANK 2
-#define _WCTYPE_INDEX_CNTRL 3
-#define _WCTYPE_INDEX_DIGIT 4
-#define _WCTYPE_INDEX_GRAPH 5
-#define _WCTYPE_INDEX_LOWER 6
-#define _WCTYPE_INDEX_PRINT 7
-#define _WCTYPE_INDEX_PUNCT 8
-#define _WCTYPE_INDEX_SPACE 9
-#define _WCTYPE_INDEX_UPPER 10
-#define _WCTYPE_INDEX_XDIGIT 11
-#define _WCTYPE_NINDEXES 12
-
-/*
- * ctype stuffs
- */
-
-typedef struct _NBRuneLocale {
- /*
- * copied from _FileRuneLocale
- */
- char rl_magic[8]; /* Magic saying what version we are */
- char rl_encoding[32];/* ASCII name of this encoding */
- __nbrune_t rl_invalid_rune;
- _RuneType rl_runetype[_NB_CACHED_RUNES];
- __nbrune_t rl_maplower[_NB_CACHED_RUNES];
- __nbrune_t rl_mapupper[_NB_CACHED_RUNES];
- _NBRuneRange rl_runetype_ext;
- _NBRuneRange rl_maplower_ext;
- _NBRuneRange rl_mapupper_ext;
-
- void *rl_variable;
- size_t rl_variable_len;
-
- /*
- * the following portion is generated on the fly
- */
- const char *rl_codeset;
- struct _citrus_ctype_rec *rl_citrus_ctype;
- _WCTransEntry rl_wctrans[_WCTRANS_NINDEXES];
- _WCTypeEntry rl_wctype[_WCTYPE_NINDEXES];
-} _NBRuneLocale;
-
-
-/* magic number for LC_CTYPE (rune)locale declaration */
-#define _NB_RUNE_MAGIC_1 "RuneCT10" /* Indicates version 0 of RuneLocale */
-
-/* magic string for dynamic link module - type should be like "LC_CTYPE" */
-#define _NB_RUNE_MODULE_1(type) "RuneModule10." type
-
-/* codeset tag */
-#define _NB_RUNE_CODESET "CODESET="
-
-#endif /* !_NB_RUNETYPE_H_ */
diff --git a/StdLib/LibC/Locale/setlocale.c b/StdLib/LibC/Locale/setlocale.c
deleted file mode 100644
index 2012f3c564..0000000000
--- a/StdLib/LibC/Locale/setlocale.c
+++ /dev/null
@@ -1,424 +0,0 @@
-/** @file
- Worker functions for the setlocale function.
-
- Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>
- This program and the accompanying materials are licensed and made available under
- the terms and conditions of the BSD License that accompanies this distribution.
- The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- * Copyright (c) 1991, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * 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. 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.
-
- setlocale.c 8.1 (Berkeley) 7/4/93
- * NetBSD: setlocale.c,v 1.50 2006/02/16 19:19:49 tnozaki Exp
-**/
-#include <LibConfig.h>
-#include <sys/EfiCdefs.h>
-
-#if defined(_MSC_VER)
- // Disable warnings about assignment within conditional expressions.
- #pragma warning ( disable : 4706 )
-#endif
-
-#define _CTYPE_PRIVATE
-
-#include "namespace.h"
-#include <sys/localedef.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <assert.h>
-#include <limits.h>
-#include <ctype.h>
-#define __SETLOCALE_SOURCE__
-#include <locale.h>
-#include <paths.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include "rune.h"
-#ifdef WITH_RUNE
- #include "rune_local.h"
-#else
- #include "ctypeio.h"
-#endif
-
-#ifdef CITRUS
- #include <citrus/citrus_namespace.h>
- #include <citrus/citrus_region.h>
- #include <citrus/citrus_lookup.h>
- #include <citrus/citrus_bcs.h>
-#else
- #include "aliasname_local.h"
- #define _lookup_alias(p, a, b, s, c) __unaliasname((p), (a), (b), (s))
- #define _bcs_strcasecmp(a, b) strcasecmp((a), (b))
-#endif
-
-#define _LOCALE_SYM_FORCE "/force"
-
-#ifndef WITH_RUNE
- const char *_PathLocale = NULL;
-#endif
-
-/** Category names for getenv(). **/
-static const char *const categories[_LC_LAST] = {
- "LC_ALL",
- "LC_COLLATE",
- "LC_CTYPE",
- "LC_MONETARY",
- "LC_NUMERIC",
- "LC_TIME",
- "LC_MESSAGES"
-};
-
-/** Current locales for each category. **/
-static char current_categories[_LC_LAST][32] = {
- "C",
- "C",
- "C",
- "C",
- "C",
- "C",
- "C"
-};
-
-/*
- * The locales we are going to try and load
- */
-static char new_categories[_LC_LAST][32];
-
-static char current_locale_string[_LC_LAST * 33];
-
-static char *currentlocale(void);
-static void revert_to_default(int);
-static int force_locale_enable(int);
-static int load_locale_sub(int, const char *, int);
-static char *loadlocale(int);
-static const char *__get_locale_env(int);
-
-char *
-__setlocale(int category, const char *locale)
-{
- int i, loadlocale_success;
- size_t len;
- const char *env, *r;
-
- //if (issetugid() ||
- // (!_PathLocale && !(_PathLocale = getenv("PATH_LOCALE"))))
- // _PathLocale = _PATH_LOCALE;
-
- if (category < 0 || category >= _LC_LAST)
- return (NULL);
-
- if (!locale)
- return (category ?
- current_categories[category] : currentlocale());
-
- /*
- * Default to the current locale for everything.
- */
- for (i = 1; i < _LC_LAST; ++i)
- (void)strncpyX(new_categories[i], current_categories[i],
- sizeof(new_categories[i]));
-
- /*
- * Now go fill up new_categories from the locale argument
- */
- if (!*locale) {
- if (category == LC_ALL) {
- for (i = 1; i < _LC_LAST; ++i) {
- env = __get_locale_env(i);
- (void)strncpyX(new_categories[i], env,
- sizeof(new_categories[i]));
- }
- }
- else {
- env = __get_locale_env(category);
- (void)strncpyX(new_categories[category], env,
- sizeof(new_categories[category]));
- }
- } else if (category) {
- (void)strncpyX(new_categories[category], locale,
- sizeof(new_categories[category]));
- } else {
- if ((r = strchr(locale, '/')) == 0) {
- for (i = 1; i < _LC_LAST; ++i) {
- (void)strncpyX(new_categories[i], locale,
- sizeof(new_categories[i]));
- }
- } else {
- for (i = 1;;) {
- _DIAGASSERT(*r == '/' || *r == 0);
- _DIAGASSERT(*locale != 0);
- if (*locale == '/')
- return (NULL); /* invalid format. */
- len = r - locale;
- if (len + 1 > sizeof(new_categories[i]))
- return (NULL); /* too long */
- (void)memcpy(new_categories[i], locale, len);
- new_categories[i][len] = '\0';
- if (*r == 0)
- break;
- _DIAGASSERT(*r == '/');
- if (*(locale = ++r) == 0)
- /* slash followed by NUL */
- return (NULL);
- /* skip until NUL or '/' */
- while (*r && *r != '/')
- r++;
- if (++i == _LC_LAST)
- return (NULL); /* too many slashes. */
- }
- if (i + 1 != _LC_LAST)
- return (NULL); /* too few slashes. */
- }
- }
-
- if (category)
- return (loadlocale(category));
-
- loadlocale_success = 0;
- for (i = 1; i < _LC_LAST; ++i) {
- if (loadlocale(i) != NULL)
- loadlocale_success = 1;
- }
-
- /*
- * If all categories failed, return NULL; we don't need to back
- * changes off, since none happened.
- */
- if (!loadlocale_success)
- return NULL;
-
- return (currentlocale());
-}
-
-static char *
-currentlocale()
-{
- int i;
-
- (void)strncpyX(current_locale_string, current_categories[1],
- sizeof(current_locale_string));
-
- for (i = 2; i < _LC_LAST; ++i)
- if (strcmp(current_categories[1], current_categories[i])) {
- (void)snprintf(current_locale_string,
- sizeof(current_locale_string), "%s/%s/%s/%s/%s/%s",
- current_categories[1], current_categories[2],
- current_categories[3], current_categories[4],
- current_categories[5], current_categories[6]);
- break;
- }
- return (current_locale_string);
-}
-
-static void
-revert_to_default(int category)
-{
- switch (category) {
- case LC_CTYPE:
-#ifdef WITH_RUNE
- (void)_xpg4_setrunelocale("C");
- (void)__runetable_to_netbsd_ctype("C");
-#else
- if (_cClass != _C_CharClassTable) {
- /* LINTED const castaway */
- free((void *)_cClass);
- _cClass = _C_CharClassTable;
- }
- if (_uConvT != _C_ToUpperTable) {
- /* LINTED const castaway */
- free((void *)_uConvT);
- _uConvT = _C_ToUpperTable;
- }
- if (_lConvT != _C_ToLowerTable) {
- /* LINTED const castaway */
- free((void *)_lConvT);
- _lConvT = _C_ToLowerTable;
- }
-#endif
- break;
- case LC_MESSAGES:
- case LC_COLLATE:
- case LC_MONETARY:
- case LC_NUMERIC:
- case LC_TIME:
- break;
- }
-}
-
-static int
-force_locale_enable(int category)
-{
- revert_to_default(category);
-
- return 0;
-}
-
-static int
-load_locale_sub(
- int category,
- const char *locname,
- int isspecial
- )
-{
- char name[PATH_MAX];
-
- /* check for the default locales */
- if (!strcmp(new_categories[category], "C") ||
- !strcmp(new_categories[category], "POSIX")) {
- revert_to_default(category);
- return 0;
- }
-
- /* check whether special symbol */
- if (isspecial && _bcs_strcasecmp(locname, _LOCALE_SYM_FORCE) == 0)
- return force_locale_enable(category);
-
- /* sanity check */
- if (strchr(locname, '/') != NULL)
- return -1;
-
- (void)snprintf(name, sizeof(name), "%s/%s/%s",
- _PathLocale, locname, categories[category]);
-
- switch (category) {
- case LC_CTYPE:
-#ifdef WITH_RUNE
- if (_xpg4_setrunelocale(__UNCONST(locname)))
- return -1;
- if (__runetable_to_netbsd_ctype(locname)) {
- /* very unfortunate, but need to go to "C" locale */
- revert_to_default(category);
- return -1;
- }
-#else
- if (!__loadctype(name))
- return -1;
-#endif
- break;
-
- case LC_MESSAGES:
- /*
- * XXX we don't have LC_MESSAGES support yet,
- * but catopen may use the value of LC_MESSAGES category.
- * so return successfully if locale directory is present.
- */
- (void)snprintf(name, sizeof(name), "%s/%s",
- _PathLocale, locname);
- /* local */
- {
- struct stat st;
- if (stat(name, &st) < 0)
- return -1;
- if (!S_ISDIR(st.st_mode))
- return -1;
- }
- break;
-
- case LC_COLLATE:
- case LC_MONETARY:
- case LC_NUMERIC:
- case LC_TIME:
- return -1;
- }
-
- return 0;
-}
-
-static char *
-loadlocale(int category)
-{
- //char aliaspath[PATH_MAX], loccat[PATH_MAX], buf[PATH_MAX];
- //const char *alias;
-
- _DIAGASSERT(0 < category && category < _LC_LAST);
-
- if (strcmp(new_categories[category], current_categories[category]) == 0)
- return (current_categories[category]);
-
- /* (1) non-aliased file */
- if (!load_locale_sub(category, new_categories[category], 0))
- goto success;
-
- ///* (2) lookup locname/catname type alias */
- //(void)snprintf(aliaspath, sizeof(aliaspath),
- // "%s/" _LOCALE_ALIAS_NAME, _PathLocale);
- //(void)snprintf(loccat, sizeof(loccat), "%s/%s",
- // new_categories[category], categories[category]);
- //alias = _lookup_alias(aliaspath, loccat, buf, sizeof(buf),
- // _LOOKUP_CASE_SENSITIVE);
- //if (!load_locale_sub(category, alias, 1))
- // goto success;
-
- ///* (3) lookup locname type alias */
- //alias = _lookup_alias(aliaspath, new_categories[category],
- // buf, sizeof(buf), _LOOKUP_CASE_SENSITIVE);
- //if (!load_locale_sub(category, alias, 1))
- // goto success;
-
- return NULL;
-
-success:
- (void)strncpyX(current_categories[category],
- new_categories[category],
- sizeof(current_categories[category]));
- return current_categories[category];
-}
-
-static const char *
-__get_locale_env(int category)
-{
- const char *env;
-
- //_DIAGASSERT(category != LC_ALL);
-
- ///* 1. check LC_ALL. */
- //env = getenv(categories[0]);
-
- ///* 2. check LC_* */
- //if (!env || !*env)
- // env = getenv(categories[category]);
-
- ///* 3. check LANG */
- //if (!env || !*env)
- // env = getenv("LANG");
-
- ///* 4. if none is set, fall to "C" */
- //if (!env || !*env || strchr(env, '/'))
- env = "C";
-
- return env;
-}
diff --git a/StdLib/LibC/Locale/setlocale1.c b/StdLib/LibC/Locale/setlocale1.c
deleted file mode 100644
index e315ec8ab0..0000000000
--- a/StdLib/LibC/Locale/setlocale1.c
+++ /dev/null
@@ -1,61 +0,0 @@
-/** @file
- Single-byte character version of the setlocale function.
-
- Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>
- This program and the accompanying materials are licensed and made available under
- the terms and conditions of the BSD License that accompanies this distribution.
- The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- * Copyright (c)1999 Citrus Project,
- * 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.
-
- * NetBSD: setlocale1.c,v 1.2 2003/03/11 17:23:07 tshiozak Exp
-**/
-#include <LibConfig.h>
-#include <sys/EfiCdefs.h>
-
-#include "namespace.h"
-#define __SETLOCALE_SOURCE__
-#include <locale.h>
-#include "rune.h"
-
-__warn_references(setlocale,
- "warning: reference to compatibility setlocale(); include <locale.h> for correct reference")
-
-/*
- * Preparation for the future import of multibyte locale.
- * This function will ensure binary compatibility for old executables.
- */
-char *
-setlocale(int category, const char *locale)
-{
- /* locale may be NULL */
-
- __mb_len_max_runtime = 1;
- return __setlocale(category, locale);
-}
diff --git a/StdLib/LibC/Locale/setlocale32.c b/StdLib/LibC/Locale/setlocale32.c
deleted file mode 100644
index 68c43bba0d..0000000000
--- a/StdLib/LibC/Locale/setlocale32.c
+++ /dev/null
@@ -1,46 +0,0 @@
-/* $NetBSD: setlocale32.c,v 1.2 2003/03/11 17:23:07 tshiozak Exp $ */
-
-/*-
- * Copyright (c)1999 Citrus Project,
- * 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.
- */
-#include <LibConfig.h>
-#include <sys/EfiCdefs.h>
-#if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: setlocale32.c,v 1.2 2003/03/11 17:23:07 tshiozak Exp $");
-#endif /* LIBC_SCCS and not lint */
-
-#include "namespace.h"
-#define __SETLOCALE_SOURCE__
-#include <locale.h>
-#include "rune.h"
-
-char *
-__setlocale_mb_len_max_32(int category, const char *locale)
-{
- /* locale may be NULL */
-
- __mb_len_max_runtime = 32;
- return __setlocale(category, locale);
-}
diff --git a/StdLib/LibC/Locale/wcscoll.c b/StdLib/LibC/Locale/wcscoll.c
deleted file mode 100644
index 5bc72fae1d..0000000000
--- a/StdLib/LibC/Locale/wcscoll.c
+++ /dev/null
@@ -1,47 +0,0 @@
-/* $NetBSD: wcscoll.c,v 1.1 2003/03/02 22:18:16 tshiozak Exp $ */
-
-/*-
- * Copyright (c)2003 Citrus Project,
- * 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.
- */
-#include <LibConfig.h>
-#include <sys/EfiCdefs.h>
-#if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: wcscoll.c,v 1.1 2003/03/02 22:18:16 tshiozak Exp $");
-#endif /* LIBC_SCCS and not lint */
-
-#include "namespace.h"
-
-#include <assert.h>
-#include <wchar.h>
-
-/*
- * Compare strings with using collating information.
- */
-int
-wcscoll(const wchar_t *s1, const wchar_t *s2)
-{
- /* XXX: LC_COLLATE should be implemented. */
- return (wcscmp(s1, s2));
-}
diff --git a/StdLib/LibC/Locale/wcsftime.c b/StdLib/LibC/Locale/wcsftime.c
deleted file mode 100644
index 2eb19ca5ad..0000000000
--- a/StdLib/LibC/Locale/wcsftime.c
+++ /dev/null
@@ -1,109 +0,0 @@
-/* $NetBSD: wcsftime.c,v 1.2 2006/10/04 14:19:16 tnozaki Exp $ */
-/*-
- * Copyright (c) 2002 Tim J. Robbins
- * 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.
- */
-#include <LibConfig.h>
-#include <sys/EfiCdefs.h>
-#if defined(LIBC_SCCS) && !defined(lint)
-#if 0
-__FBSDID("$FreeBSD: src/lib/libc/locale/wcsftime.c,v 1.4 2004/04/07 09:47:56 tjr Exp $");
-#else
-__RCSID("$NetBSD: wcsftime.c,v 1.2 2006/10/04 14:19:16 tnozaki Exp $");
-#endif
-#endif /* LIBC_SCCS and not lint */
-
-#include <errno.h>
-#include <limits.h>
-#include <stdlib.h>
-#include <time.h>
-#include <wchar.h>
-#include <machine/int_limits.h>
-
-/*
- * Convert date and time to a wide-character string.
- *
- * This is the wide-character counterpart of strftime(). So that we do not
- * have to duplicate the code of strftime(), we convert the format string to
- * multibyte, call strftime(), then convert the result back into wide
- * characters.
- *
- * This technique loses in the presence of stateful multibyte encoding if any
- * of the conversions in the format string change conversion state. When
- * stateful encoding is implemented, we will need to reset the state between
- * format specifications in the format string.
- */
-size_t
-wcsftime(wchar_t *wcs, size_t maxsize,
- const wchar_t *format, const struct tm *timeptr)
-{
- char *dst, *dstp, *sformat;
- size_t n, sflen;
- int sverrno;
-
- sformat = dst = NULL;
-
- /*
- * Convert the supplied format string to a multibyte representation
- * for strftime(), which only handles single-byte characters.
- */
- sflen = wcstombs(NULL, format, 0);
- if (sflen == (size_t)-1)
- goto error;
- if ((sformat = malloc(sflen + 1)) == NULL)
- goto error;
- wcstombs(sformat, format, sflen + 1);
-
- /*
- * Allocate memory for longest multibyte sequence that will fit
- * into the caller's buffer and call strftime() to fill it.
- * Then, copy and convert the result back into wide characters in
- * the caller's buffer.
- */
- if (SIZE_T_MAX / MB_CUR_MAX <= maxsize) {
- /* maxsize is preposturously large - avoid int. overflow. */
- errno = EINVAL;
- goto error;
- }
- dst = malloc(maxsize * MB_CUR_MAX);
- if (dst == NULL)
- goto error;
- if (strftime(dst, maxsize, sformat, timeptr) == 0)
- goto error;
- dstp = dst;
- n = mbstowcs(wcs, dstp, maxsize);
- if (n == (size_t)-2 || n == (size_t)-1)
- goto error;
-
- free(sformat);
- free(dst);
- return n;
-
-error:
- sverrno = errno;
- free(sformat);
- free(dst);
- errno = sverrno;
- return 0;
-}
diff --git a/StdLib/LibC/Locale/wcstod.c b/StdLib/LibC/Locale/wcstod.c
deleted file mode 100644
index 0ee06bd86f..0000000000
--- a/StdLib/LibC/Locale/wcstod.c
+++ /dev/null
@@ -1,51 +0,0 @@
-/* $NetBSD: wcstod.c,v 1.12 2006/04/16 17:03:32 christos Exp $ */
-
-/*-
- * Copyright (c)2006 Citrus Project,
- * 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.
- */
-#include <LibConfig.h>
-#include <sys/EfiCdefs.h>
-#if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: wcstod.c,v 1.12 2006/04/16 17:03:32 christos Exp $");
-#endif /* LIBC_SCCS and not lint */
-
-#include <assert.h>
-#include <errno.h>
-#include <math.h>
-#include <stdlib.h>
-#include <string.h>
-#include <wchar.h>
-#include <wctype.h>
-
-//#ifdef __weak_alias
-//__strong_alias(_wcstod,wcstod)
-//__weak_alias(wcstod,_wcstod)
-//#endif
-
-#define _FUNCNAME wcstod
-#define _RETURN_TYPE double
-#define _STRTOD_FUNC strtod
-
-#include "_wcstod.h"
diff --git a/StdLib/LibC/Locale/wcstof.c b/StdLib/LibC/Locale/wcstof.c
deleted file mode 100644
index 36b06a566d..0000000000
--- a/StdLib/LibC/Locale/wcstof.c
+++ /dev/null
@@ -1,53 +0,0 @@
-/* $NetBSD: wcstof.c,v 1.2 2006/04/16 17:03:32 christos Exp $ */
-
-/*-
- * Copyright (c)2006 Citrus Project,
- * 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.
- */
-#include <LibConfig.h>
-#include <sys/EfiCdefs.h>
-#if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: wcstof.c,v 1.2 2006/04/16 17:03:32 christos Exp $");
-#endif /* LIBC_SCCS and not lint */
-
-#include "namespace.h"
-
-#include <assert.h>
-#include <errno.h>
-#include <math.h>
-#include <stdlib.h>
-#include <string.h>
-#include <wchar.h>
-#include <wctype.h>
-
-#ifdef __weak_alias
-__strong_alias(_wcstof,wcstof)
-__weak_alias(wcstof,_wcstof)
-#endif
-
-#define _FUNCNAME wcstof
-#define _RETURN_TYPE float
-#define _STRTOD_FUNC strtof
-
-#include "_wcstod.h"
diff --git a/StdLib/LibC/Locale/wcstoimax.c b/StdLib/LibC/Locale/wcstoimax.c
deleted file mode 100644
index 078b10b764..0000000000
--- a/StdLib/LibC/Locale/wcstoimax.c
+++ /dev/null
@@ -1,59 +0,0 @@
-/** @file
- Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>
- This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- Copyright (c)2003 Citrus Project,
- 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.
-
- NetBSD: wcstoimax.c,v 1.2 2004/06/21 21:20:43 itojun Exp
-**/
-#include <LibConfig.h>
-#include <sys/EfiCdefs.h>
-#if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: wcstoimax.c,v 1.2 2004/06/21 21:20:43 itojun Exp $");
-#endif /* LIBC_SCCS and not lint */
-
-#include <assert.h>
-#include <ctype.h>
-#include <errno.h>
-#include <inttypes.h>
-#include <limits.h>
-#include <stdlib.h>
-#include <wchar.h>
-#include <wctype.h>
-
-#include "__wctoint.h"
-
-#define _FUNCNAME wcstoimax
-#define __wINT intmax_t
-#define __wINT_MIN INTMAX_MIN
-#define __wINT_MAX INTMAX_MAX
-
-#include "_wcstol.h"
diff --git a/StdLib/LibC/Locale/wcstol.c b/StdLib/LibC/Locale/wcstol.c
deleted file mode 100644
index f7d92ae077..0000000000
--- a/StdLib/LibC/Locale/wcstol.c
+++ /dev/null
@@ -1,58 +0,0 @@
-/** @file
- Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>
- This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- Copyright (c)2003 Citrus Project,
- 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.
-
- NetBSD: wcstol.c,v 1.3 2004/06/21 21:20:43 itojun Exp
- */
-#include <LibConfig.h>
-#include <sys/EfiCdefs.h>
-#if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: wcstol.c,v 1.3 2004/06/21 21:20:43 itojun Exp $");
-#endif /* LIBC_SCCS and not lint */
-
-#include <assert.h>
-#include <ctype.h>
-#include <errno.h>
-#include <limits.h>
-#include <stdlib.h>
-#include <wchar.h>
-#include <wctype.h>
-
-#include "__wctoint.h"
-
-#define _FUNCNAME wcstol
-#define __wINT long int
-#define __wINT_MIN LONG_MIN
-#define __wINT_MAX LONG_MAX
-
-#include "_wcstol.h"
diff --git a/StdLib/LibC/Locale/wcstold.c b/StdLib/LibC/Locale/wcstold.c
deleted file mode 100644
index 4e557be13f..0000000000
--- a/StdLib/LibC/Locale/wcstold.c
+++ /dev/null
@@ -1,53 +0,0 @@
-/* $NetBSD: wcstold.c,v 1.2 2006/04/16 17:03:32 christos Exp $ */
-
-/*-
- * Copyright (c)2006 Citrus Project,
- * 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.
- */
-#include <LibConfig.h>
-#include <sys/EfiCdefs.h>
-#if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: wcstold.c,v 1.2 2006/04/16 17:03:32 christos Exp $");
-#endif /* LIBC_SCCS and not lint */
-
-#include "namespace.h"
-
-#include <assert.h>
-#include <errno.h>
-#include <math.h>
-#include <stdlib.h>
-#include <string.h>
-#include <wchar.h>
-#include <wctype.h>
-
-#ifdef __weak_alias
-__strong_alias(_wcstold,wcstold)
-__weak_alias(wcstold,_wcstold)
-#endif
-
-#define _FUNCNAME wcstold
-#define _RETURN_TYPE long double
-#define _STRTOD_FUNC strtold
-
-#include "_wcstod.h"
diff --git a/StdLib/LibC/Locale/wcstoll.c b/StdLib/LibC/Locale/wcstoll.c
deleted file mode 100644
index ea0e646c19..0000000000
--- a/StdLib/LibC/Locale/wcstoll.c
+++ /dev/null
@@ -1,58 +0,0 @@
-/** @file
- Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>
- This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- Copyright (c)2003 Citrus Project,
- 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.
-
- NetBSD: wcstoll.c,v 1.2 2004/06/21 21:20:43 itojun Exp
- */
-#include <LibConfig.h>
-#include <sys/EfiCdefs.h>
-#if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: wcstoll.c,v 1.2 2004/06/21 21:20:43 itojun Exp $");
-#endif /* LIBC_SCCS and not lint */
-
-#include <assert.h>
-#include <ctype.h>
-#include <errno.h>
-#include <limits.h>
-#include <stdlib.h>
-#include <wchar.h>
-#include <wctype.h>
-
-#include "__wctoint.h"
-
-#define _FUNCNAME wcstoll
-#define __wINT /* LONGLONG */ long long int
-#define __wINT_MIN LLONG_MIN
-#define __wINT_MAX LLONG_MAX
-
-#include "_wcstol.h"
diff --git a/StdLib/LibC/Locale/wcstoul.c b/StdLib/LibC/Locale/wcstoul.c
deleted file mode 100644
index fd7059fdb5..0000000000
--- a/StdLib/LibC/Locale/wcstoul.c
+++ /dev/null
@@ -1,58 +0,0 @@
-/** @file
- Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>
- This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- Copyright (c)2003 Citrus Project,
- 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.
-
- NetBSD: wcstoul.c,v 1.3 2004/06/21 21:20:43 itojun Exp
- */
-#include <LibConfig.h>
-#include <sys/EfiCdefs.h>
-#if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: wcstoul.c,v 1.3 2004/06/21 21:20:43 itojun Exp $");
-#endif /* LIBC_SCCS and not lint */
-
-#include <assert.h>
-#include <ctype.h>
-#include <errno.h>
-#include <limits.h>
-#include <stdlib.h>
-#include <wchar.h>
-#include <wctype.h>
-
-#include "__wctoint.h"
-
-#define _FUNCNAME wcstoul
-#define __wINT long int
-#define __wUINT unsigned long int
-#define __wUINT_MAX ULONG_MAX
-
-#include "_wcstoul.h"
diff --git a/StdLib/LibC/Locale/wcstoull.c b/StdLib/LibC/Locale/wcstoull.c
deleted file mode 100644
index f257104b2c..0000000000
--- a/StdLib/LibC/Locale/wcstoull.c
+++ /dev/null
@@ -1,58 +0,0 @@
-/** @file
- Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>
- This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- Copyright (c)2003 Citrus Project,
- 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.
-
- NetBSD: wcstoull.c,v 1.2 2004/06/21 21:20:43 itojun Exp
- */
-#include <LibConfig.h>
-#include <sys/EfiCdefs.h>
-#if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: wcstoull.c,v 1.2 2004/06/21 21:20:43 itojun Exp $");
-#endif /* LIBC_SCCS and not lint */
-
-#include <assert.h>
-#include <ctype.h>
-#include <errno.h>
-#include <limits.h>
-#include <stdlib.h>
-#include <wchar.h>
-#include <wctype.h>
-
-#include "__wctoint.h"
-
-#define _FUNCNAME wcstoull
-#define __wINT long long int
-#define __wUINT /* LONGLONG */ unsigned long long int
-#define __wUINT_MAX ULLONG_MAX
-
-#include "_wcstoul.h"
diff --git a/StdLib/LibC/Locale/wcstoumax.c b/StdLib/LibC/Locale/wcstoumax.c
deleted file mode 100644
index 53a0de0f9e..0000000000
--- a/StdLib/LibC/Locale/wcstoumax.c
+++ /dev/null
@@ -1,59 +0,0 @@
-/** @file
- Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>
- This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- Copyright (c)2003 Citrus Project,
- 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.
-
- NetBSD: wcstoumax.c,v 1.2 2004/06/21 21:20:43 itojun Exp
- */
-#include <LibConfig.h>
-#include <sys/EfiCdefs.h>
-#if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: wcstoumax.c,v 1.2 2004/06/21 21:20:43 itojun Exp $");
-#endif /* LIBC_SCCS and not lint */
-
-#include <assert.h>
-#include <ctype.h>
-#include <errno.h>
-#include <inttypes.h>
-#include <limits.h>
-#include <stdlib.h>
-#include <wchar.h>
-#include <wctype.h>
-
-#include "__wctoint.h"
-
-#define _FUNCNAME wcstoumax
-#define __wINT intmax_t
-#define __wUINT uintmax_t
-#define __wUINT_MAX UINTMAX_MAX
-
-#include "_wcstoul.h"
diff --git a/StdLib/LibC/Locale/wcsxfrm.c b/StdLib/LibC/Locale/wcsxfrm.c
deleted file mode 100644
index 288a5f9a46..0000000000
--- a/StdLib/LibC/Locale/wcsxfrm.c
+++ /dev/null
@@ -1,66 +0,0 @@
-/* $NetBSD: wcsxfrm.c,v 1.2 2006/10/15 16:14:08 christos Exp $ */
-
-/*-
- * Copyright (c)2003 Citrus Project,
- * 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.
- */
-#include <LibConfig.h>
-#include <sys/EfiCdefs.h>
-#if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: wcsxfrm.c,v 1.2 2006/10/15 16:14:08 christos Exp $");
-#endif /* LIBC_SCCS and not lint */
-
-#include "namespace.h"
-
-#include <assert.h>
-#include <wchar.h>
-
-/*
- * Compare strings with using collating information.
- */
-size_t
-wcsxfrm(
- wchar_t *s1,
- const wchar_t *s2,
- size_t n
- )
-{
- size_t len;
-
- /* XXX: LC_COLLATE should be implemented. */
-
- len = wcslen(s2);
- if (len<n)
- wcscpy(s1, s2);
- else {
- /*
- * SUSv3 says:
- * If the value returned is n or more, the contents
- * of the array pointed to by ws1 are unspecified.
- */
- /* thus, do nothing */
- }
-
- return (len);
-}