4 * Open Hack'Ware BIOS POSIX like ctype definitions
6 * Copyright (c) 2004-2005 Jocelyn Mayer
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License V2
10 * as published by the Free Software Foundation
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 #if !defined (__OHW_CTYPE_H__)
23 #define __OHW_CTYPE_H__
25 /* Beware that those routines only support ASCII */
26 static inline int islower (int c)
28 return c >= 'a' && c <= 'z';
31 static inline int isupper (int c)
33 return c >= 'A' && c <= 'Z';
36 static inline int isalpha (int c)
38 return islower(c) || isupper(c);
41 static inline int isdigit (int c)
43 return c >= '0' && c <= '9';
46 static inline int isalnum (int c)
48 return isalpha(c) || isdigit(c);
51 static inline int isxdigit (int c)
53 return isdigit(c) || (c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F');
56 static inline int isspace (int c)
58 return c == ' ' || c == '\f' || c == '\n' || c == '\r' ||
59 c == '\t' || c == '\v';
62 static inline int isgraph (int c)
64 return (c >= 0x21 && c <= 0x7E) || (c >= 0xA1 && c <= 0xFF);
67 static inline int isprint (int c)
69 return isgraph(c) && c != ' ';
72 static inline int ispunct (int c)
74 return isprint(c) && !isalpha(c) && !isspace(c);
77 static inline int isblank (int c)
79 return c == ' ' || c == '\t';
82 static inline int iscntrl (int c)
87 static inline int isascii (int c)
89 return (c & 0x80) == 0;
92 static inline int tolower (int c)
100 static inline int toupper (int c)
108 static inline int toascii (int c)
113 #endif /* !defined (__OHW_CTYPE_H__) */