AVR Libc Home Page AVRs AVR Libc Development Pages
Main Page User Manual Library Reference FAQ Alphabetical Index Example Projects

ctype.h

Go to the documentation of this file.
00001 /* Copyright (c) 2002,2007 Michael Stumpf
00002    All rights reserved.
00003 
00004    Redistribution and use in source and binary forms, with or without
00005    modification, are permitted provided that the following conditions are met:
00006 
00007    * Redistributions of source code must retain the above copyright
00008      notice, this list of conditions and the following disclaimer.
00009 
00010    * Redistributions in binary form must reproduce the above copyright
00011      notice, this list of conditions and the following disclaimer in
00012      the documentation and/or other materials provided with the
00013      distribution.
00014 
00015    * Neither the name of the copyright holders nor the names of
00016      contributors may be used to endorse or promote products derived
00017      from this software without specific prior written permission.
00018 
00019   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
00020   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00021   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00022   ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
00023   LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
00024   CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
00025   SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
00026   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
00027   CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
00028   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00029   POSSIBILITY OF SUCH DAMAGE. */
00030 
00031 /* $Id: ctype.h 1504 2007-12-16 07:34:00Z dmix $ */
00032 
00033 /*
00034    ctype.h - character conversion macros and ctype macros
00035 
00036   Author : Michael Stumpf
00037            Michael.Stumpf@t-online.de
00038 */
00039 
00040 #ifndef __CTYPE_H_
00041 #define __CTYPE_H_ 1
00042 
00043 #ifndef __ATTR_CONST__
00044 #define __ATTR_CONST__ __attribute__((__const__))
00045 #endif
00046 
00047 #ifdef __cplusplus
00048 extern "C" {
00049 #endif
00050 
00051 /** \file */
00052 /** \defgroup ctype <ctype.h>: Character Operations
00053     These functions perform various operations on characters.
00054 
00055     \code #include <ctype.h>\endcode 
00056 
00057 */
00058 
00059 /** \name Character classification routines
00060 
00061     These functions perform character classification. They return true or
00062     false status depending whether the character passed to the function falls
00063     into the function's classification (i.e. isdigit() returns true if its
00064     argument is any value '0' though '9', inclusive). If the input is not
00065     an unsigned char value, all of this function return false.  */
00066 
00067  /* @{ */
00068 
00069 /** \ingroup ctype
00070 
00071     Checks for an alphanumeric character. It is equivalent to <tt>(isalpha(c)
00072     || isdigit(c))</tt>. */
00073 
00074 extern int isalnum(int __c) __ATTR_CONST__;
00075 
00076 /** \ingroup ctype
00077 
00078     Checks for an alphabetic character. It is equivalent to <tt>(isupper(c) ||
00079     islower(c))</tt>. */
00080 
00081 extern int isalpha(int __c) __ATTR_CONST__;
00082 
00083 /** \ingroup ctype
00084 
00085     Checks whether \c c is a 7-bit unsigned char value that fits into the
00086     ASCII character set. */
00087 
00088 extern int isascii(int __c) __ATTR_CONST__;
00089 
00090 /** \ingroup ctype
00091 
00092     Checks for a blank character, that is, a space or a tab. */
00093 
00094 extern int isblank(int __c) __ATTR_CONST__;
00095 
00096 /** \ingroup ctype
00097 
00098     Checks for a control character. */
00099 
00100 extern int iscntrl(int __c) __ATTR_CONST__;
00101 
00102 /** \ingroup ctype
00103 
00104     Checks for a digit (0 through 9). */
00105 
00106 extern int isdigit(int __c) __ATTR_CONST__;
00107 
00108 /** \ingroup ctype
00109 
00110     Checks for any printable character except space. */
00111 
00112 extern int isgraph(int __c) __ATTR_CONST__;
00113 
00114 /** \ingroup ctype
00115 
00116     Checks for a lower-case character. */
00117 
00118 extern int islower(int __c) __ATTR_CONST__;
00119 
00120 /** \ingroup ctype
00121 
00122     Checks for any printable character including space. */
00123 
00124 extern int isprint(int __c) __ATTR_CONST__;
00125 
00126 /** \ingroup ctype
00127 
00128     Checks for any printable character which is not a space or an alphanumeric
00129     character. */
00130 
00131 extern int ispunct(int __c) __ATTR_CONST__;
00132 
00133 /** \ingroup ctype
00134 
00135     Checks for white-space characters.  For the avr-libc library, these are:
00136     space, form-feed ('\\f'), newline ('\\n'), carriage return ('\\r'),
00137     horizontal tab ('\\t'), and vertical tab ('\\v'). */
00138 
00139 extern int isspace(int __c) __ATTR_CONST__;
00140 
00141 /** \ingroup ctype
00142 
00143     Checks for an uppercase letter. */
00144 
00145 extern int isupper(int __c) __ATTR_CONST__;
00146 
00147 /** \ingroup ctype
00148 
00149     Checks for a hexadecimal digits, i.e. one of 0 1 2 3 4 5 6 7 8 9 a b c d e
00150     f A B C D E F. */
00151 
00152 extern int isxdigit(int __c) __ATTR_CONST__;
00153 
00154 /* @} */
00155 
00156 /** \name Character convertion routines 
00157 
00158     This realization permits all possible values of integer argument.
00159     The toascii() function clears all highest bits. The tolower() and
00160     toupper() functions return an input argument as is, if it is not an
00161     unsigned char value.        */
00162 
00163 /* @{ */
00164 
00165 /** \ingroup ctype
00166 
00167     Converts \c c to a 7-bit unsigned char value that fits into the ASCII
00168     character set, by clearing the high-order bits.
00169 
00170     \warning Many people will be unhappy if you use this function. This
00171     function will convert accented letters into random characters. */
00172 
00173 extern int toascii(int __c) __ATTR_CONST__;
00174 
00175 /** \ingroup ctype
00176 
00177     Converts the letter \c c to lower case, if possible. */
00178 
00179 extern int tolower(int __c) __ATTR_CONST__;
00180 
00181 /** \ingroup ctype
00182 
00183     Converts the letter \c c to upper case, if possible. */
00184 
00185 extern int toupper(int __c) __ATTR_CONST__;
00186 
00187 /* @} */
00188 
00189 #ifdef __cplusplus
00190 }
00191 #endif
00192 
00193 #endif

Automatically generated by Doxygen 1.7.3 on Thu May 19 2011.