_ctype.h (7655) | _ctype.h (12028) |
---|---|
1/* 2 * Copyright (c) 1989, 1993 3 * The Regents of the University of California. All rights reserved. 4 * (c) UNIX System Laboratories, Inc. 5 * All or some portions of this file are derived from material licensed 6 * to the University of California by American Telephone and Telegraph 7 * Co. or Unix System Laboratories, Inc. and are reproduced herein with 8 * the permission of UNIX System Laboratories, Inc. --- 97 unchanged lines hidden (view full) --- 106#define isblank(c) __istype((c), _B) 107#define toascii(c) ((c) & 0x7F) 108 109/* XXX the following macros are not backed up by functions. */ 110#define digittoint(c) __istype((c), 0xFF) 111#define ishexnumber(c) __istype((c), _X) 112#define isideogram(c) __istype((c), _I) 113#define isnumber(c) __istype((c), _D) | 1/* 2 * Copyright (c) 1989, 1993 3 * The Regents of the University of California. All rights reserved. 4 * (c) UNIX System Laboratories, Inc. 5 * All or some portions of this file are derived from material licensed 6 * to the University of California by American Telephone and Telegraph 7 * Co. or Unix System Laboratories, Inc. and are reproduced herein with 8 * the permission of UNIX System Laboratories, Inc. --- 97 unchanged lines hidden (view full) --- 106#define isblank(c) __istype((c), _B) 107#define toascii(c) ((c) & 0x7F) 108 109/* XXX the following macros are not backed up by functions. */ 110#define digittoint(c) __istype((c), 0xFF) 111#define ishexnumber(c) __istype((c), _X) 112#define isideogram(c) __istype((c), _I) 113#define isnumber(c) __istype((c), _D) |
114#define isphonogram(c) __istype((c), _T) | 114#define isphonogram(c) __istype((c), _Q) |
115#define isrune(c) __istype((c), 0xFFFFFF00L) | 115#define isrune(c) __istype((c), 0xFFFFFF00L) |
116#define isspecial(c) __istype((c), _Q) | 116#define isspecial(c) __istype((c), _T) |
117#endif 118 119/* See comments in <machine/ansi.h> about _BSD_RUNE_T_. */ 120__BEGIN_DECLS 121unsigned long ___runetype __P((_BSD_RUNE_T_)); 122_BSD_RUNE_T_ ___tolower __P((_BSD_RUNE_T_)); 123_BSD_RUNE_T_ ___toupper __P((_BSD_RUNE_T_)); 124__END_DECLS --- 11 unchanged lines hidden (view full) --- 136/* 137 * Use inline functions if we are allowed to and the compiler supports them. 138 */ 139#if !defined(_DONT_USE_CTYPE_INLINE_) && \ 140 (defined(_USE_CTYPE_INLINE_) || defined(__GNUC__) || defined(__cplusplus)) 141static __inline int 142__istype(_BSD_RUNE_T_ _c, unsigned long _f) 143{ | 117#endif 118 119/* See comments in <machine/ansi.h> about _BSD_RUNE_T_. */ 120__BEGIN_DECLS 121unsigned long ___runetype __P((_BSD_RUNE_T_)); 122_BSD_RUNE_T_ ___tolower __P((_BSD_RUNE_T_)); 123_BSD_RUNE_T_ ___toupper __P((_BSD_RUNE_T_)); 124__END_DECLS --- 11 unchanged lines hidden (view full) --- 136/* 137 * Use inline functions if we are allowed to and the compiler supports them. 138 */ 139#if !defined(_DONT_USE_CTYPE_INLINE_) && \ 140 (defined(_USE_CTYPE_INLINE_) || defined(__GNUC__) || defined(__cplusplus)) 141static __inline int 142__istype(_BSD_RUNE_T_ _c, unsigned long _f) 143{ |
144 if (_c < 0) 145 _c = (unsigned char) _c; 146 return((((_c & _CRMASK) ? ___runetype(_c) : 147 _CurrentRuneLocale->runetype[_c]) & _f) ? 1 : 0); | 144 return (_c < 0 || _c & _CRMASK) ? !!(___runetype(_c) & _f) : 145 (_c >= _CACHED_RUNES) ? 0 : 146 !!(_CurrentRuneLocale->runetype[_c] & _f); |
148} 149 150static __inline int 151__isctype(_BSD_RUNE_T_ _c, unsigned long _f) 152{ | 147} 148 149static __inline int 150__isctype(_BSD_RUNE_T_ _c, unsigned long _f) 151{ |
153 if (_c < 0) 154 _c = (unsigned char) _c; 155 return((((_c & _CRMASK) ? 0 : 156 _DefaultRuneLocale.runetype[_c]) & _f) ? 1 : 0); | 152 return (_c < 0 || _c >= _CACHED_RUNES) ? 0 : 153 !!(_DefaultRuneLocale.runetype[_c] & _f); |
157} 158 159static __inline _BSD_RUNE_T_ 160__toupper(_BSD_RUNE_T_ _c) 161{ | 154} 155 156static __inline _BSD_RUNE_T_ 157__toupper(_BSD_RUNE_T_ _c) 158{ |
162 if (_c < 0) 163 _c = (unsigned char) _c; 164 return((_c & _CRMASK) ? 165 ___toupper(_c) : _CurrentRuneLocale->mapupper[_c]); | 159 return (_c < 0 || _c & _CRMASK) ? ___toupper(_c) : 160 (_c >= _CACHED_RUNES) ? _c : 161 _CurrentRuneLocale->mapupper[_c]; |
166} 167 168static __inline _BSD_RUNE_T_ 169__tolower(_BSD_RUNE_T_ _c) 170{ | 162} 163 164static __inline _BSD_RUNE_T_ 165__tolower(_BSD_RUNE_T_ _c) 166{ |
171 if (_c < 0) 172 _c = (unsigned char) _c; 173 return((_c & _CRMASK) ? 174 ___tolower(_c) : _CurrentRuneLocale->maplower[_c]); | 167 return (_c < 0 || _c & _CRMASK) ? ___tolower(_c) : 168 (_c >= _CACHED_RUNES) ? _c : 169 _CurrentRuneLocale->maplower[_c]; |
175} 176 177#else /* not using inlines */ 178 179__BEGIN_DECLS 180int __istype __P((_BSD_RUNE_T_, unsigned long)); 181int __isctype __P((_BSD_RUNE_T_, unsigned long)); 182_BSD_RUNE_T_ __toupper __P((_BSD_RUNE_T_)); 183_BSD_RUNE_T_ __tolower __P((_BSD_RUNE_T_)); 184__END_DECLS 185#endif /* using inlines */ 186 187#endif /* !_CTYPE_H_ */ | 170} 171 172#else /* not using inlines */ 173 174__BEGIN_DECLS 175int __istype __P((_BSD_RUNE_T_, unsigned long)); 176int __isctype __P((_BSD_RUNE_T_, unsigned long)); 177_BSD_RUNE_T_ __toupper __P((_BSD_RUNE_T_)); 178_BSD_RUNE_T_ __tolower __P((_BSD_RUNE_T_)); 179__END_DECLS 180#endif /* using inlines */ 181 182#endif /* !_CTYPE_H_ */ |