]> git.proxmox.com Git - mirror_edk2.git/blob - StdLib/LibC/Ctype/CConv.c
Standard Libraries for EDK II.
[mirror_edk2.git] / StdLib / LibC / Ctype / CConv.c
1 /** @file
2 Case conversion functions for <ctype.h>
3
4 The tolower function converts an uppercase letter to a corresponding
5 lowercase letter. If the argument is a character for which isupper
6 is true and there are one or more corresponding characters, as
7 specified by the current locale, for which islower is true, the tolower
8 function returns one of the corresponding characters (always the same one
9 for any given locale); otherwise, the argument is returned unchanged.
10
11 The toupper function converts a lowercase letter to a corresponding
12 uppercase letter. If the argument is a character for which islower is true
13 and there are one or more corresponding characters, as specified by the
14 current locale, for which isupper is true, the toupper function returns one
15 of the corresponding characters (always the same one for any given locale);
16 otherwise, the argument is returned unchanged.
17
18 Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>
19 This program and the accompanying materials are licensed and made available under
20 the terms and conditions of the BSD License that accompanies this distribution.
21 The full text of the license may be found at
22 http://opensource.org/licenses/bsd-license.php.
23
24 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
25 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
26
27 **/
28 #include <LibConfig.h>
29
30 #define NO_CTYPE_MACROS // So that we don't define the classification macros
31 #include <ctype.h>
32
33 int
34 tolower(
35 int _c
36 )
37 {
38 // return ((_c < 0 || _c > 127) ? _c : _lConvT[_c]);
39 return (isupper(_c) ? _lConvT[_c] : _c);
40 }
41
42 int toupper(
43 int _c
44 )
45 {
46 // return ((_c < 0 || _c > 127) ? _c : _uConvT[_c]);
47 return (islower(_c) ? _uConvT[_c] : _c);
48 }