4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/** @file
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync Comparison Functions for <wchar.h>.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync Unless explicitly stated otherwise, the functions defined in this file order
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync two wide characters the same way as two integers of the underlying integer
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync type designated by wchar_t.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync This program and the accompanying materials are licensed and made available under
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync the terms and conditions of the BSD License that accompanies this distribution.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync The full text of the license may be found at
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync http://opensource.org/licenses/bsd-license.php.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync**/
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#include <Uefi.h>
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#include <Library/BaseLib.h>
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#include <Library/BaseMemoryLib.h>
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#include <LibConfig.h>
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#include <wchar.h>
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/** The wcscmp function compares the wide string pointed to by s1 to the wide
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync string pointed to by s2.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @return The wcscmp function returns an integer greater than, equal to, or
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync less than zero, accordingly as the wide string pointed to by s1
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync is greater than, equal to, or less than the wide string
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync pointed to by s2.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync**/
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncint wcscmp(const wchar_t *s1, const wchar_t *s2)
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync{
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync return (int)StrCmp( (CONST CHAR16 *)s1, (CONST CHAR16 *)s2);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync}
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/** The wcscoll function compares the wide string pointed to by s1 to the wide
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync string pointed to by s2, both interpreted as appropriate to the LC_COLLATE
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync category of the current locale.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @return The wcscoll function returns an integer greater than, equal to,
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync or less than zero, accordingly as the wide string pointed to by
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync s1 is greater than, equal to, or less than the wide string
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync pointed to by s2 when both are interpreted as appropriate to
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync the current locale.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync**/
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync//int wcscoll(const wchar_t *s1, const wchar_t *s2)
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync//{
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync// return -1; // STUBB
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync//}
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/** The wcsncmp function compares not more than n wide characters (those that
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync follow a null wide character are not compared) from the array pointed to by
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync s1 to the array pointed to by s2.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @return The wcsncmp function returns an integer greater than, equal to,
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync or less than zero, accordingly as the possibly null-terminated
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync array pointed to by s1 is greater than, equal to, or less than
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync the possibly null-terminated array pointed to by s2.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync**/
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncint wcsncmp(const wchar_t *s1, const wchar_t *s2, size_t n)
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync{
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync return (int)StrnCmp( (CONST CHAR16 *)s1, (CONST CHAR16 *)s2, (UINTN)n);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync}
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/** The wcsxfrm function transforms the wide string pointed to by s2 and places
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync the resulting wide string into the array pointed to by s1. The
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync transformation is such that if the wcscmp function is applied to two
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync transformed wide strings, it returns a value greater than, equal to, or
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync less than zero, corresponding to the result of the wcscoll function applied
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync to the same two original wide strings. No more than n wide characters are
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync placed into the resulting array pointed to by s1, including the terminating
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync null wide character. If n is zero, s1 is permitted to be a null pointer.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @return The wcsxfrm function returns the length of the transformed wide
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync string (not including the terminating null wide character). If
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync the value returned is n or greater, the contents of the array
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync pointed to by s1 are indeterminate.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync**/
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync//size_t wcsxfrm(wchar_t * __restrict s1, const wchar_t * __restrict s2, size_t n)
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync//{
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync// return n; // STUBB
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync//}
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/** The wmemcmp function compares the first n wide characters of the object
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync pointed to by s1 to the first n wide characters of the object pointed to
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync by s2.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @return The wmemcmp function returns an integer greater than, equal to,
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync or less than zero, accordingly as the object pointed to by s1 is
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync greater than, equal to, or less than the object pointed to by s2.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync**/
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncint wmemcmp(const wchar_t *s1, const wchar_t *s2, size_t n)
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync{
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync return (int)CompareMem( s1, s2, (UINTN)(n * sizeof(wchar_t)));
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync}