1 /* Locale insensitive ctype.h functions taken from the RPM library.
2 * RPM is Copyright (c) 1998 by Red Hat Software, Inc.
4 * This library is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Library General Public License as
6 * published by the Free Software Foundation; either version 2 of
7 * the License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU Library General Public License for more details.
14 * You should have received a copy of the GNU Library General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
20 #ifndef MIKMOD_CTYPE_H
21 #define MIKMOD_CTYPE_H
23 static inline int mik_isascii(int c) {
24 return ((c & ~0x7f) == 0);
27 static inline int mik_islower(int c) {
28 return (c >= 'a' && c <= 'z');
31 static inline int mik_isupper(int c) {
32 return (c >= 'A' && c <= 'Z');
35 static inline int mik_isalpha(int c) {
36 return (mik_islower(c) || mik_isupper(c));
39 static inline int mik_isdigit(int c) {
40 return (c >= '0' && c <= '9');
43 static inline int mik_isxdigit(int c) {
44 return (mik_isdigit(c) || (c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F'));
47 static inline int mik_isalnum(int c) {
48 return (mik_isalpha(c) || mik_isdigit(c));
51 static inline int mik_isblank(int c) {
52 return (c == ' ' || c == '\t');
55 static inline int mik_isspace(int c) {
59 case '\f': case '\v': return 1;
64 static inline int mik_isgraph(int c) {
65 return (c > 0x20 && c <= 0x7e);
68 static inline int mik_isprint(int c) {
69 return (c >= 0x20 && c <= 0x7e);
72 static inline int mik_toascii(int c) {
76 static inline int mik_tolower(int c) {
77 return ((mik_isupper(c)) ? (c | ('a' - 'A')) : c);
80 static inline int mik_toupper(int c) {
81 return ((mik_islower(c)) ? (c & ~('a' - 'A')) : c);
84 #endif /* MIKMOD_CTYPE_H */