OSDN Git Service

Rev all the header files to sync things with glibc 2.2.4
[uclinux-h8/uclibc-ng.git] / include / ctype.h
1 /* vi: set sw=4 ts=4: */
2 /*
3  * ctype.h
4  * Character classification and conversion
5  *
6  * Copyright (C) 2000 by Lineo, inc.  
7  * Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org>
8  *
9  * This program is free software; you can redistribute it and/or modify it
10  * under the terms of the GNU Library General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or (at your
12  * option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful, but WITHOUT
15  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License
17  * for more details.
18  *
19  * You should have received a copy of the GNU Library General Public License
20  * along with this program; if not, write to the Free Software Foundation,
21  * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22  *
23  */
24
25 #ifndef __CTYPE_H
26 #define __CTYPE_H
27
28 #include <features.h>
29
30 __BEGIN_DECLS
31
32
33 /* function prototpes */ 
34 extern int isalnum(int c);
35 extern int isalpha(int c);
36 extern int isascii(int c);
37 extern int iscntrl(int c);
38 extern int isdigit(int c);
39 extern int isgraph(int c);
40 extern int islower(int c);
41 extern int isprint(int c);
42 extern int ispunct(int c);
43 extern int isspace(int c);
44 extern int isupper(int c);
45 extern int isxdigit(int c);
46 extern int isxlower(int c);
47 extern int isxupper(int c);
48 extern int toascii(int c);
49 extern int tolower(int c);
50 extern int toupper(int c);
51
52
53 /* Locale-compatible macros/inlines have yet to be implemented. */
54 #if defined(__USE_CTYPE_MACROS) && !defined __UCLIBC_HAS_LOCALE__
55
56 /* macro definitions */
57 #define isalnum(c)  (isalpha(c) || isdigit(c))
58 #define isalpha(c)  (isupper(c) || islower(c))
59 #define isascii(c)  (c > 0 && c <= 0x7f)
60 #define iscntrl(c)  ((c >= 0) && ((c <= 0x1F) || (c == 0x7f)))
61 #define isdigit(c)  (c >= '0' && c <= '9')
62 #define isgraph(c)  (c != ' ' && isprint(c))
63 #define islower(c)  (c >=  'a' && c <= 'z')
64 #define isprint(c)  (c >= ' ' && c <= '~')
65 #define ispunct(c)  ((c > ' ' && c <= '~') && !isalnum(c))
66 #define isspace(c)  (c == ' ' || c == '\f' || c == '\n' || c == '\r' ||\
67                         c == '\t' || c == '\v')
68 #define isupper(c)  (c >=  'A' && c <= 'Z')
69 #define isxdigit(c) (isxupper(c) || isxlower(c))
70 #define isxlower(c) (isdigit(c) || (c >= 'a' && c <= 'f'))
71 #define isxupper(c) (isdigit(c) || (c >= 'A' && c <= 'F'))
72 #define toascii(c)  (c & 0x7f)
73 #define tolower(c)  (isupper(c) ? ( c - 'A' + 'a') : (c))
74 #define toupper(c)  (islower(c) ? (c - 'a' + 'A') : (c))
75
76 #endif
77
78 __END_DECLS
79
80 #endif /* __CTYPE_H */