]>
git.proxmox.com Git - mirror_edk2.git/blob - StdLib/LibC/Locale/iswctype_sb.c
2 Wide character classification and conversion functions.
4 Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>
5 This program and the accompanying materials are licensed and made available under
6 the terms and conditions of the BSD License that accompanies this distribution.
7 The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php.
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
13 Copyright (c) 1989 The Regents of the University of California.
15 (c) UNIX System Laboratories, Inc.
16 All or some portions of this file are derived from material licensed
17 to the University of California by American Telephone and Telegraph
18 Co. or Unix System Laboratories, Inc. and are reproduced herein with
19 the permission of UNIX System Laboratories, Inc.
21 Redistribution and use in source and binary forms, with or without
22 modification, are permitted provided that the following conditions
24 1. Redistributions of source code must retain the above copyright
25 notice, this list of conditions and the following disclaimer.
26 2. Redistributions in binary form must reproduce the above copyright
27 notice, this list of conditions and the following disclaimer in the
28 documentation and/or other materials provided with the distribution.
29 3. Neither the name of the University nor the names of its contributors
30 may be used to endorse or promote products derived from this software
31 without specific prior written permission.
33 THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
34 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
35 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
36 ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
37 FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
38 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
39 OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
40 HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
41 LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
42 OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
45 NetBSD: iswctype_sb.c,v 1.4 2004/07/21 20:27:46 tshiozak Exp
47 #include <LibConfig.h>
48 #include <sys/EfiCdefs.h>
49 #if defined(LIBC_SCCS) && !defined(lint)
50 __RCSID("$NetBSD: iswctype_sb.c,v 1.4 2004/07/21 20:27:46 tshiozak Exp $");
51 #endif /* LIBC_SCCS and not lint */
62 return isalnum((int)c
);
69 return isalpha((int)c
);
76 return isblank((int)c
);
83 return iscntrl((int)c
);
90 return isdigit((int)c
);
97 return isgraph((int)c
);
104 return islower((int)c
);
111 return isprint((int)c
);
118 return ispunct((int)c
);
125 return isspace((int)c
);
132 return isupper((int)c
);
139 return isxdigit((int)c
);
146 return toupper((int)c
);
153 return tolower((int)c
);
166 iswctype(wint_t c
, wctype_t charclass
)
169 * SUSv3: If charclass is 0, iswctype() shall return 0.
171 return (__isCClass((int)c
, (unsigned int)charclass
));
174 // Additional functions in <wctype.h> but not in NetBSD _sb code.
180 { "alnum", (_CD
| _CU
| _CL
| _XA
) },
181 { "alpha", (_CU
| _CL
| _XA
) },
187 { "print", (_CS
| _CG
) },
191 { "xdigit", (_CD
| _CX
) }
194 #define NUM_PROPVAL (sizeof(typestrval) / sizeof(struct _typestrval))
201 { "tolower", towlower
},
202 { "toupper", towupper
}
205 #define NUM_TRANSVAL (sizeof(transtrval) / sizeof(struct _transtrval))
207 wctype_t wctype(const char *property
)
211 for(i
= 0; i
< NUM_PROPVAL
; ++i
) {
212 if( strcmp(typestrval
[i
].name
, property
) == 0) {
213 return typestrval
[i
].value
;
219 wint_t towctrans(wint_t p1
, wctrans_t tranfunc
)
224 wctrans_t wctrans(const char *property
)
228 for(i
= 0; i
< NUM_TRANSVAL
; ++i
) {
229 if( strcmp(transtrval
[i
].name
, property
) == 0) {
230 return transtrval
[i
].function
;