xref: /freebsd/lib/libc/locale/nomacros.c (revision a316b26e50bbed7cf655fbba726ab87d8ab7599d)
1 #include <ctype.h>
2 #include <rune.h>
3 
4 #if !defined(_USE_CTYPE_INLINE_) && !defined(_USE_CTYPE_MACROS_)
5 /*
6  * See comments in <machine/ansi.h>
7  */
8 int
9 __istype(c, f)
10 	_BSD_RUNE_T_ c;
11 	unsigned long f;
12 {
13 	if (c < 0)
14 		c = (unsigned char) c;
15 	return ((((c & _CRMASK) ? ___runetype(c)
16            : _CurrentRuneLocale->runetype[c]) & f) ? 1 : 0);
17 }
18 
19 int
20 __isctype(_BSD_RUNE_T_ c, unsigned long f)
21 	_BSD_RUNE_T_ c;
22 	unsigned long f;
23 {
24 	if (c < 0)
25 		c = (unsigned char) c;
26 	return ((((c & _CRMASK) ? 0
27            : _DefaultRuneLocale.runetype[c]) & f) ? 1 : 0);
28 }
29 
30 _BSD_RUNE_T_
31 toupper(c)
32 	_BSD_RUNE_T_ c;
33 {
34 	if (c < 0)
35 		c = (unsigned char) c;
36 	return ((c & _CRMASK) ?
37 	    ___toupper(c) : _CurrentRuneLocale->mapupper[c]);
38 }
39 
40 _BSD_RUNE_T_
41 tolower(c)
42 	_BSD_RUNE_T_ c;
43 {
44 	if (c < 0)
45 		c = (unsigned char) c;
46 	return ((c & _CRMASK) ?
47 	    ___tolower(c) : _CurrentRuneLocale->maplower[c]);
48 }
49 #endif
50