]> git.proxmox.com Git - mirror_edk2.git/blame - StdLib/Include/sys/_ctype.h
Standard Libraries for EDK II.
[mirror_edk2.git] / StdLib / Include / sys / _ctype.h
CommitLineData
2aa62f2b 1/** @file\r
2 Implementation specific support for Single-byte character classification and\r
3 case conversion macros and function declarations.\r
4\r
5 This file is intended to only be included by <ctype.h>.\r
6\r
7 Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>\r
8 This program and the accompanying materials are licensed and made available under\r
9 the terms and conditions of the BSD License that accompanies this distribution.\r
10 The full text of the license may be found at\r
11 http://opensource.org/licenses/bsd-license.\r
12\r
13 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
14 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
15\r
16**/\r
17#ifndef _CTYPE_H\r
18#error This file, <sys/_ctype.h>, may only be included by <ctype.h>.\r
19#endif\r
20\r
21__BEGIN_DECLS\r
22extern const UINT16 *_cClass; // Locale independent pointer to Character Classification Table\r
23extern const UINT8 *_uConvT; // Locale independent pointer to Lowercase to Uppercase Conversion Table\r
24extern const UINT8 *_lConvT; // Locale independent pointer to Uppercase to Lowercase Conversion Table\r
25\r
26extern int __isCClass( int _c, unsigned int mask); // Internal character classification function\r
27__END_DECLS\r
28\r
29\r
30// Character Class bit masks\r
31#define _CC 0x0001U // Control Characters\r
32#define _CW 0x0002U // White Space\r
33#define _CP 0x0004U // Punctuation\r
34#define _CD 0x0008U // Digits [0-9]\r
35#define _CU 0x0010U // Uppercase Letter [A-Z]\r
36#define _CL 0x0020U // Lowercase Letter [a-z]\r
37#define _CX 0x0040U // Hexadecimal Digits [A-Fa-f]\r
38#define _C0 0x0080U\r
39#define _CS 0x0100U // Space Characters, ' ' in C locale\r
40#define _CG 0x0200U // Graphic Characters\r
41#define _CB 0x0400U // Blank Characters, ' ' and '\t' in C locale\r
42#define _C4 0x0800U\r
43#define _XA 0x1000U // eXtra Alpha characters not in _CU or _CL\r
44#define _C6 0x2000U\r
45#define _C7 0x4000U\r
46#define _C8 0x8000U\r
47\r
48#ifndef NO_CTYPE_MACROS\r
49 #define __isCClass( _c, mask) (((_c) < 0 || (_c) > 127) ? 0 : (_cClass[(_c)] & (mask)))\r
50 #define __toLower( _c) ((__isCClass( ((int)_c), (_CU))) ? _lConvT[(_c)] : (_c))\r
51 #define __toUpper( _c) ((__isCClass( ((int)_c), (_CL))) ? _uConvT[(_c)] : (_c))\r
52#endif /* NO_CTYPE_MACROS */\r
53\r
54/* Macros used by implementation functions */\r
55#define __isHexLetter(_c) (__isCClass( (int)c, (_CX)))\r
56\r
57#ifdef _CTYPE_PRIVATE\r
58 #define _CTYPE_NUM_CHARS (256)\r
59\r
60 #define _CTYPE_ID "BSDCTYPE"\r
61 #define _CTYPE_REV 2\r
62\r
63 extern const UINT16 _C_CharClassTable[];\r
64 extern const UINT8 _C_ToUpperTable[];\r
65 extern const UINT8 _C_ToLowerTable[];\r
66#endif\r