Home | History | Annotate | Download | only in Ctype
      1 /** @file
      2   Case conversion function implementations 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 - 2011, 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.
     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 #include  <LibConfig.h>
     28 
     29 #define NO_CTYPE_MACROS            // So that we don't define the classification macros
     30 #include  <ctype.h>
     31 
     32 /** The tolower function converts an uppercase letter to a corresponding
     33     lowercase letter.
     34 
     35     @param[in]    c   The character to be converted.
     36 
     37     @return   If the argument is a character for which isupper is true and
     38               there are one or more corresponding characters, as specified by
     39               the current locale, for which islower is true, the tolower
     40               function returns one of the corresponding characters (always the
     41               same one for any given locale); otherwise, the argument is
     42               returned unchanged.
     43 **/
     44 int
     45 tolower(
     46   IN  int _c
     47   )
     48 {
     49   return (isupper(_c) ? _lConvT[_c] : _c);
     50 }
     51 
     52 /** The toupper function converts a lowercase letter to a corresponding
     53     uppercase letter.
     54 
     55     @param[in]    c   The character to be converted.
     56 
     57     @return   If the argument is a character for which islower is true and
     58               there are one or more corresponding characters, as specified by
     59               the current locale, for which isupper is true, the toupper
     60               function returns one of the corresponding characters (always the
     61               same one for any given locale); otherwise, the argument is
     62               returned unchanged.
     63 **/
     64 int
     65 toupper(
     66   IN  int _c
     67   )
     68 {
     69   return (islower(_c) ? _uConvT[_c] : _c);
     70 }
     71