]>
Commit | Line | Data |
---|---|---|
2aa62f2b | 1 | /** @file\r |
2 | Comparison Functions for <wchar.h>.\r | |
3 | \r | |
4 | Unless explicitly stated otherwise, the functions defined in this file order\r | |
5 | two wide characters the same way as two integers of the underlying integer\r | |
6 | type designated by wchar_t.\r | |
7 | \r | |
8 | Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>\r | |
9 | This program and the accompanying materials are licensed and made available under\r | |
10 | the terms and conditions of the BSD License that accompanies this distribution.\r | |
11 | The full text of the license may be found at\r | |
12 | http://opensource.org/licenses/bsd-license.php.\r | |
13 | \r | |
14 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
15 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
16 | **/\r | |
17 | #include <Uefi.h>\r | |
18 | #include <Library/BaseLib.h>\r | |
19 | #include <Library/BaseMemoryLib.h>\r | |
20 | \r | |
21 | #include <LibConfig.h>\r | |
22 | \r | |
23 | #include <wchar.h>\r | |
24 | \r | |
25 | /** The wcscmp function compares the wide string pointed to by s1 to the wide\r | |
26 | string pointed to by s2.\r | |
27 | \r | |
28 | @return The wcscmp function returns an integer greater than, equal to, or\r | |
29 | less than zero, accordingly as the wide string pointed to by s1\r | |
30 | is greater than, equal to, or less than the wide string\r | |
31 | pointed to by s2.\r | |
32 | **/\r | |
33 | int wcscmp(const wchar_t *s1, const wchar_t *s2)\r | |
34 | {\r | |
35 | return (int)StrCmp( (CONST CHAR16 *)s1, (CONST CHAR16 *)s2);\r | |
36 | }\r | |
37 | \r | |
38 | /** The wcscoll function compares the wide string pointed to by s1 to the wide\r | |
39 | string pointed to by s2, both interpreted as appropriate to the LC_COLLATE\r | |
40 | category of the current locale.\r | |
41 | \r | |
42 | @return The wcscoll function returns an integer greater than, equal to,\r | |
43 | or less than zero, accordingly as the wide string pointed to by\r | |
44 | s1 is greater than, equal to, or less than the wide string\r | |
45 | pointed to by s2 when both are interpreted as appropriate to\r | |
46 | the current locale.\r | |
47 | **/\r | |
48 | //int wcscoll(const wchar_t *s1, const wchar_t *s2)\r | |
49 | //{\r | |
50 | // return -1; // STUBB\r | |
51 | //}\r | |
52 | \r | |
53 | /** The wcsncmp function compares not more than n wide characters (those that\r | |
54 | follow a null wide character are not compared) from the array pointed to by\r | |
55 | s1 to the array pointed to by s2.\r | |
56 | \r | |
57 | @return The wcsncmp function returns an integer greater than, equal to,\r | |
58 | or less than zero, accordingly as the possibly null-terminated\r | |
59 | array pointed to by s1 is greater than, equal to, or less than\r | |
60 | the possibly null-terminated array pointed to by s2.\r | |
61 | **/\r | |
62 | int wcsncmp(const wchar_t *s1, const wchar_t *s2, size_t n)\r | |
63 | {\r | |
64 | return (int)StrnCmp( (CONST CHAR16 *)s1, (CONST CHAR16 *)s2, (UINTN)n);\r | |
65 | }\r | |
66 | \r | |
67 | /** The wcsxfrm function transforms the wide string pointed to by s2 and places\r | |
68 | the resulting wide string into the array pointed to by s1. The\r | |
69 | transformation is such that if the wcscmp function is applied to two\r | |
70 | transformed wide strings, it returns a value greater than, equal to, or\r | |
71 | less than zero, corresponding to the result of the wcscoll function applied\r | |
72 | to the same two original wide strings. No more than n wide characters are\r | |
73 | placed into the resulting array pointed to by s1, including the terminating\r | |
74 | null wide character. If n is zero, s1 is permitted to be a null pointer.\r | |
75 | \r | |
76 | @return The wcsxfrm function returns the length of the transformed wide\r | |
77 | string (not including the terminating null wide character). If\r | |
78 | the value returned is n or greater, the contents of the array\r | |
79 | pointed to by s1 are indeterminate.\r | |
80 | **/\r | |
81 | //size_t wcsxfrm(wchar_t * __restrict s1, const wchar_t * __restrict s2, size_t n)\r | |
82 | //{\r | |
83 | // return n; // STUBB\r | |
84 | //}\r | |
85 | \r | |
86 | /** The wmemcmp function compares the first n wide characters of the object\r | |
87 | pointed to by s1 to the first n wide characters of the object pointed to\r | |
88 | by s2.\r | |
89 | \r | |
90 | @return The wmemcmp function returns an integer greater than, equal to,\r | |
91 | or less than zero, accordingly as the object pointed to by s1 is\r | |
92 | greater than, equal to, or less than the object pointed to by s2.\r | |
93 | **/\r | |
94 | int wmemcmp(const wchar_t *s1, const wchar_t *s2, size_t n)\r | |
95 | {\r | |
96 | return (int)CompareMem( s1, s2, (UINTN)(n * sizeof(wchar_t)));\r | |
97 | }\r |