]> git.proxmox.com Git - mirror_edk2.git/blobdiff - StdLib/LibC/Ctype/CClass.c
Update or add comments to files and functions for use by Doxygen.
[mirror_edk2.git] / StdLib / LibC / Ctype / CClass.c
index f350063352ee3c24e8ebe622d7e2c506371bc5a1..1e1e0fdccbfb2ef53082f33d1bf31c458ceb6b27 100644 (file)
 /** @file\r
-  Character classification and case conversion functions for <ctype.h>.\r
+  Character classification function implementations for <ctype.h>.\r
 \r
-  Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>\r
   This program and the accompanying materials are licensed and made available under\r
   the terms and conditions of the BSD License that accompanies this distribution.\r
   The full text of the license may be found at\r
-  http://opensource.org/licenses/bsd-license.php.\r
+  http://opensource.org/licenses/bsd-license.\r
 \r
   THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
   WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-\r
 **/\r
 #include  <LibConfig.h>\r
 \r
 #define NO_CTYPE_MACROS            // So that we don't define the classification macros\r
 #include  <ctype.h>\r
 \r
+/** Internal worker function for character classification.\r
+\r
+    Determines if a character is a member of a set of character classes.\r
+\r
+    @param[in]    _c      The character to be tested.\r
+    @param[in]    mask    A bitmapped specification of the character classes to\r
+                          test the character against.  These bits are defined\r
+                          in _ctype.h.\r
+\r
+    @retval   0         The character, _c, is NOT a member of the character classes specified by mask.\r
+    @retval   nonZero   The character, _c, IS a member of a specified character class.\r
+**/\r
 int\r
-__isCClass( int _c, unsigned int mask)\r
+__isCClass(\r
+  IN  int _c,\r
+  unsigned int mask\r
+  )\r
 {\r
   return ((_c < 0 || _c > 127) ? 0 : (_cClass[_c] & mask));\r
 }\r
 \r
-/**\r
+/** The isalnum function tests for any character for which isalpha or isdigit\r
+    is true.\r
 \r
-    @return\r
+    @param[in]    c   The character to be tested.\r
+\r
+    @return   Returns nonzero (true) if and only if the value of the parameter c\r
+              can be classified as specified in the description of the function.\r
 **/\r
-int isalnum(int c)\r
+int\r
+isalnum(\r
+  IN  int c\r
+  )\r
 {\r
   return (__isCClass( c, (_CD | _CU | _CL | _XA)));\r
 }\r
 \r
-/**\r
+/** The isalpha function tests for any character for which isupper or islower\r
+    is true, or any character that is one of a locale-specific set of\r
+    alphabetic characters for which none of iscntrl, isdigit, ispunct, or\r
+    isspace is true. In the "C" locale, isalpha returns true only for the\r
+    characters for which isupper or islower is true.\r
 \r
-    @return\r
+    @param[in]    c   The character to be tested.\r
+\r
+    @return   Returns nonzero (true) if and only if the value of the parameter c\r
+              can be classified as specified in the description of the function.\r
 **/\r
-int isalpha(int c)\r
+int\r
+isalpha(\r
+  IN  int c\r
+  )\r
 {\r
   return (__isCClass( c, (_CU | _CL | _XA)));\r
 }\r
 \r
-/**\r
+/** The iscntrl function tests for any control character.\r
 \r
-    @return\r
+    @param[in]    c   The character to be tested.\r
+\r
+    @return   Returns nonzero (true) if and only if the value of the parameter c\r
+              can be classified as specified in the description of the function.\r
 **/\r
-int iscntrl(int c)\r
+int\r
+iscntrl(\r
+  IN  int c\r
+  )\r
 {\r
   return (__isCClass( c, (_CC)));\r
 }\r
 \r
-/**\r
+/** The isdigit function tests for any decimal-digit character.\r
 \r
-    @return\r
+    @param[in]    c   The character to be tested.\r
+\r
+    @return   Returns nonzero (true) if and only if the value of the parameter c\r
+              can be classified as specified in the description of the function.\r
 **/\r
-int isdigit(int c)\r
+int\r
+isdigit(\r
+  IN  int c\r
+  )\r
 {\r
   return (__isCClass( c, (_CD)));\r
 }\r
 \r
-/**\r
+/** The isgraph function tests for any printing character except space (' ').\r
 \r
-    @return\r
+    @param[in]    c   The character to be tested.\r
+\r
+    @return   Returns nonzero (true) if and only if the value of the parameter c\r
+              can be classified as specified in the description of the function.\r
 **/\r
-int isgraph(int c)\r
+int\r
+isgraph(\r
+  IN  int c\r
+  )\r
 {\r
   return (__isCClass( c, (_CG)));\r
 }\r
 \r
-/**\r
+/** The islower function tests for any character that is a lowercase letter or\r
+    is one of a locale-specific set of characters for which none of iscntrl,\r
+    isdigit, ispunct, or isspace is true.  In the "C" locale, islower returns\r
+    true only for the lowercase letters.\r
 \r
-    @return\r
+    @param[in]    c   The character to be tested.\r
+\r
+    @return   Returns nonzero (true) if and only if the value of the parameter c\r
+              can be classified as specified in the description of the function.\r
 **/\r
-int islower(int c)\r
+int\r
+islower(\r
+  IN  int c\r
+  )\r
 {\r
   return (__isCClass( c, (_CL)));\r
 }\r
 \r
-/**\r
+/** The isprint function tests for any printing character including space (' ').\r
 \r
-    @return\r
+    @param[in]    c   The character to be tested.\r
+\r
+    @return   Returns nonzero (true) if and only if the value of the parameter c\r
+              can be classified as specified in the description of the function.\r
 **/\r
-int isprint(int c)\r
+int\r
+isprint(\r
+  IN  int c\r
+  )\r
 {\r
   return (__isCClass( c, (_CS | _CG)));\r
 }\r
 \r
-/**\r
+/** The ispunct function tests for any printing character that is one of a\r
+    locale-specific set of punctuation characters for which neither isspace nor\r
+    isalnum is true. In the "C" locale, ispunct returns true for every printing\r
+    character for which neither isspace nor isalnum is true.\r
 \r
-    @return\r
+    @param[in]    c   The character to be tested.\r
+\r
+    @return   Returns nonzero (true) if and only if the value of the parameter c\r
+              can be classified as specified in the description of the function.\r
 **/\r
-int ispunct(int c)\r
+int\r
+ispunct(\r
+  IN  int c\r
+  )\r
 {\r
   return (__isCClass( c, (_CP)));\r
 }\r
 \r
-/**\r
+/** The isspace function tests for any character that is a standard white-space\r
+    character or is one of a locale-specific set of characters for which\r
+    isalnum is false. The standard white-space characters are the following:\r
+    space (' '), form feed ('\f'), new-line ('\n'), carriage return ('\r'),\r
+    horizontal tab ('\t'), and vertical tab ('\v'). In the "C" locale, isspace\r
+    returns true only for the standard white-space characters.\r
 \r
-    @return\r
+    @param[in]    c   The character to be tested.\r
+\r
+    @return   Returns nonzero (true) if and only if the value of the parameter c\r
+              can be classified as specified in the description of the function.\r
 **/\r
-int isspace(int c)\r
+int\r
+isspace(\r
+  IN  int c\r
+  )\r
 {\r
   return (__isCClass( c, (_CW)));\r
 }\r
 \r
-/**\r
+/** The isupper function tests for any character that is an uppercase letter or\r
+    is one of a locale-specific set of characters for which none of iscntrl,\r
+    isdigit, ispunct, or isspace is true. In the "C" locale, isupper returns\r
+    true only for the uppercase letters.\r
 \r
-    @return\r
+    @param[in]    c   The character to be tested.\r
+\r
+    @return   Returns nonzero (true) if and only if the value of the parameter c\r
+              can be classified as specified in the description of the function.\r
 **/\r
-int isupper(int c)\r
+int\r
+isupper(\r
+  IN  int c\r
+  )\r
 {\r
   return (__isCClass( c, (_CU)));\r
 }\r
 \r
-/**\r
+/** The isxdigit function tests for any hexadecimal-digit character.\r
 \r
-    @return\r
+    @param[in]    c   The character to be tested.\r
+\r
+    @return   Returns nonzero (true) if and only if the value of the parameter c\r
+              can be classified as specified in the description of the function.\r
 **/\r
-int isxdigit(int c)\r
+int\r
+isxdigit(\r
+  IN  int c\r
+  )\r
 {\r
   return (__isCClass( c, (_CD | _CX)));\r
 }\r
 \r
-#if defined(_NETBSD_SOURCE)\r
+/** The isblank function tests that a character is a white-space character that results\r
+    in a number of space (' ') characters being sent to the output device.  In the C locale\r
+    this is either ' ' or '\t'.\r
+\r
+    @param[in]    c   The character to be tested.\r
+\r
+    @return   Returns nonzero (true) if and only if the value of the parameter c\r
+              can be classified as specified in the description of the function.\r
+**/\r
 int\r
-isblank(int c)\r
+isblank(\r
+  IN  int c\r
+  )\r
 {\r
   return (__isCClass( c, _CB));\r
 }\r
-#endif\r
 \r
-/** The isascii function tests that a character is one of the 128 ASCII characters.\r
+/** The isascii function tests that a character is one of the 128 7-bit ASCII characters.\r
 \r
   @param[in]  c   The character to test.\r
+\r
   @return     Returns nonzero (true) if c is a valid ASCII character.  Otherwize,\r
               zero (false) is returned.\r
 **/\r
-int isascii(int c){\r
+int\r
+isascii(\r
+  IN  int c\r
+  )\r
+{\r
   return ((c >= 0) && (c < 128));\r
 }\r