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