+++ /dev/null
-/** @file\r
- Character classification function implementations for <ctype.h>.\r
-\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.\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
-#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(\r
- IN int _c,\r
- unsigned int mask\r
- )\r
-{\r
- return ((_c < 0 || _c > 127) ? 0 : (_cClass[_c] & mask));\r
-}\r
-\r
-/** The isalnum function tests for any character for which isalpha or isdigit\r
- is true.\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
-isalnum(\r
- IN int c\r
- )\r
-{\r
- return (__isCClass( c, (_CD | _CU | _CL | _XA)));\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
- @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
-isalpha(\r
- IN int c\r
- )\r
-{\r
- return (__isCClass( c, (_CU | _CL | _XA)));\r
-}\r
-\r
-/** The iscntrl function tests for any control character.\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
-iscntrl(\r
- IN int c\r
- )\r
-{\r
- return (__isCClass( c, (_CC)));\r
-}\r
-\r
-/** The isdigit function tests for any decimal-digit character.\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
-isdigit(\r
- IN int c\r
- )\r
-{\r
- return (__isCClass( c, (_CD)));\r
-}\r
-\r
-/** The isgraph function tests for any printing character except space (' ').\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
-isgraph(\r
- IN int c\r
- )\r
-{\r
- return (__isCClass( c, (_CG)));\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
- @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
-islower(\r
- IN int c\r
- )\r
-{\r
- return (__isCClass( c, (_CL)));\r
-}\r
-\r
-/** The isprint function tests for any printing character including space (' ').\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
-isprint(\r
- IN int c\r
- )\r
-{\r
- return (__isCClass( c, (_CS | _CG)));\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
- @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
-ispunct(\r
- IN int c\r
- )\r
-{\r
- return (__isCClass( c, (_CP)));\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
- @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
-isspace(\r
- IN int c\r
- )\r
-{\r
- return (__isCClass( c, (_CW)));\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
- @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
-isupper(\r
- IN int c\r
- )\r
-{\r
- return (__isCClass( c, (_CU)));\r
-}\r
-\r
-/** The isxdigit function tests for any hexadecimal-digit character.\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
-isxdigit(\r
- IN int c\r
- )\r
-{\r
- return (__isCClass( c, (_CD | _CX)));\r
-}\r
-\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(\r
- IN int c\r
- )\r
-{\r
- return (__isCClass( c, (_CB)));\r
-}\r
-\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\r
-isascii(\r
- IN int c\r
- )\r
-{\r
- return ((c >= 0) && (c < 128));\r
-}\r
-\r
-/** Test whether a character is one of the characters used as a separator\r
- between directory elements in a path.\r
-\r
- Characters are '/', '\\'\r
-\r
- This non-standard function is unique to this implementation.\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
-isDirSep(int c)\r
-{\r
- return (__isCClass( c, (_C0)));\r
-}\r