avr-libc  2.0.0
Standard C library for AVR-GCC

AVR Libc Home Page

AVRs

AVR Libc Development Pages

Main Page

User Manual

Library Reference

FAQ

Example Projects

ctype.h
Go to the documentation of this file.
1 /* Copyright (c) 2002,2007 Michael Stumpf
2  All rights reserved.
3 
4  Redistribution and use in source and binary forms, with or without
5  modification, are permitted provided that the following conditions are met:
6 
7  * Redistributions of source code must retain the above copyright
8  notice, this list of conditions and the following disclaimer.
9 
10  * Redistributions in binary form must reproduce the above copyright
11  notice, this list of conditions and the following disclaimer in
12  the documentation and/or other materials provided with the
13  distribution.
14 
15  * Neither the name of the copyright holders nor the names of
16  contributors may be used to endorse or promote products derived
17  from this software without specific prior written permission.
18 
19  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
23  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29  POSSIBILITY OF SUCH DAMAGE. */
30 
31 /* $Id: ctype.h 1504 2007-12-16 07:34:00Z dmix $ */
32 
33 /*
34  ctype.h - character conversion macros and ctype macros
35 
36  Author : Michael Stumpf
37  Michael.Stumpf@t-online.de
38 */
39 
40 #ifndef __CTYPE_H_
41 #define __CTYPE_H_ 1
42 
43 #ifndef __ATTR_CONST__
44 #define __ATTR_CONST__ __attribute__((__const__))
45 #endif
46 
47 #ifdef __cplusplus
48 extern "C" {
49 #endif
50 
51 /** \file */
52 /** \defgroup ctype <ctype.h>: Character Operations
53  These functions perform various operations on characters.
54 
55  \code #include <ctype.h>\endcode
56 
57 */
58 
59 /** \name Character classification routines
60 
61  These functions perform character classification. They return true or
62  false status depending whether the character passed to the function falls
63  into the function's classification (i.e. isdigit() returns true if its
64  argument is any value '0' though '9', inclusive). If the input is not
65  an unsigned char value, all of this function return false. */
66 
67  /* @{ */
68 
69 /** \ingroup ctype
70 
71  Checks for an alphanumeric character. It is equivalent to <tt>(isalpha(c)
72  || isdigit(c))</tt>. */
73 
74 extern int isalnum(int __c) __ATTR_CONST__;
75 
76 /** \ingroup ctype
77 
78  Checks for an alphabetic character. It is equivalent to <tt>(isupper(c) ||
79  islower(c))</tt>. */
80 
81 extern int isalpha(int __c) __ATTR_CONST__;
82 
83 /** \ingroup ctype
84 
85  Checks whether \c c is a 7-bit unsigned char value that fits into the
86  ASCII character set. */
87 
88 extern int isascii(int __c) __ATTR_CONST__;
89 
90 /** \ingroup ctype
91 
92  Checks for a blank character, that is, a space or a tab. */
93 
94 extern int isblank(int __c) __ATTR_CONST__;
95 
96 /** \ingroup ctype
97 
98  Checks for a control character. */
99 
100 extern int iscntrl(int __c) __ATTR_CONST__;
101 
102 /** \ingroup ctype
103 
104  Checks for a digit (0 through 9). */
105 
106 extern int isdigit(int __c) __ATTR_CONST__;
107 
108 /** \ingroup ctype
109 
110  Checks for any printable character except space. */
111 
112 extern int isgraph(int __c) __ATTR_CONST__;
113 
114 /** \ingroup ctype
115 
116  Checks for a lower-case character. */
117 
118 extern int islower(int __c) __ATTR_CONST__;
119 
120 /** \ingroup ctype
121 
122  Checks for any printable character including space. */
123 
124 extern int isprint(int __c) __ATTR_CONST__;
125 
126 /** \ingroup ctype
127 
128  Checks for any printable character which is not a space or an alphanumeric
129  character. */
130 
131 extern int ispunct(int __c) __ATTR_CONST__;
132 
133 /** \ingroup ctype
134 
135  Checks for white-space characters. For the avr-libc library, these are:
136  space, form-feed ('\\f'), newline ('\\n'), carriage return ('\\r'),
137  horizontal tab ('\\t'), and vertical tab ('\\v'). */
138 
139 extern int isspace(int __c) __ATTR_CONST__;
140 
141 /** \ingroup ctype
142 
143  Checks for an uppercase letter. */
144 
145 extern int isupper(int __c) __ATTR_CONST__;
146 
147 /** \ingroup ctype
148 
149  Checks for a hexadecimal digits, i.e. one of 0 1 2 3 4 5 6 7 8 9 a b c d e
150  f A B C D E F. */
151 
152 extern int isxdigit(int __c) __ATTR_CONST__;
153 
154 /* @} */
155 
156 /** \name Character convertion routines
157 
158  This realization permits all possible values of integer argument.
159  The toascii() function clears all highest bits. The tolower() and
160  toupper() functions return an input argument as is, if it is not an
161  unsigned char value. */
162 
163 /* @{ */
164 
165 /** \ingroup ctype
166 
167  Converts \c c to a 7-bit unsigned char value that fits into the ASCII
168  character set, by clearing the high-order bits.
169 
170  \warning Many people will be unhappy if you use this function. This
171  function will convert accented letters into random characters. */
172 
173 extern int toascii(int __c) __ATTR_CONST__;
174 
175 /** \ingroup ctype
176 
177  Converts the letter \c c to lower case, if possible. */
178 
179 extern int tolower(int __c) __ATTR_CONST__;
180 
181 /** \ingroup ctype
182 
183  Converts the letter \c c to upper case, if possible. */
184 
185 extern int toupper(int __c) __ATTR_CONST__;
186 
187 /* @} */
188 
189 #ifdef __cplusplus
190 }
191 #endif
192 
193 #endif
int isxdigit(int __c)
int isupper(int __c)
int isspace(int __c)
int iscntrl(int __c)
int isdigit(int __c)
int isgraph(int __c)
int isalnum(int __c)
int isalpha(int __c)
int isascii(int __c)
int tolower(int __c)
int toascii(int __c)
int ispunct(int __c)
int islower(int __c)
int isblank(int __c)
int isprint(int __c)
int toupper(int __c)