Back to index

glibc  2.9
ctype.c
Go to the documentation of this file.
00001 /* Copyright (C) 1991,92,97,99,2002 Free Software Foundation, Inc.
00002    This file is part of the GNU C Library.
00003 
00004    The GNU C Library is free software; you can redistribute it and/or
00005    modify it under the terms of the GNU Lesser General Public
00006    License as published by the Free Software Foundation; either
00007    version 2.1 of the License, or (at your option) any later version.
00008 
00009    The GNU C Library is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012    Lesser General Public License for more details.
00013 
00014    You should have received a copy of the GNU Lesser General Public
00015    License along with the GNU C Library; if not, write to the Free
00016    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
00017    02111-1307 USA.  */
00018 
00019 #define       __NO_CTYPE
00020 #include <ctype.h>
00021 
00022 /* Provide real-function versions of all the ctype macros.  */
00023 
00024 #define       func(name, type) \
00025   int name (int c) { return __isctype (c, type); }
00026 
00027 func (isalnum, _ISalnum)
00028 func (isalpha, _ISalpha)
00029 func (iscntrl, _IScntrl)
00030 func (isdigit, _ISdigit)
00031 func (islower, _ISlower)
00032 func (isgraph, _ISgraph)
00033 func (isprint, _ISprint)
00034 func (ispunct, _ISpunct)
00035 func (isspace, _ISspace)
00036 func (isupper, _ISupper)
00037 func (isxdigit, _ISxdigit)
00038 
00039 #define __ctype_tolower \
00040   ((int32_t *) _NL_CURRENT (LC_CTYPE, _NL_CTYPE_TOLOWER) + 128)
00041 #define __ctype_toupper \
00042   ((int32_t *) _NL_CURRENT (LC_CTYPE, _NL_CTYPE_TOUPPER) + 128)
00043 
00044 int
00045 tolower (int c)
00046 {
00047   return c >= -128 && c < 256 ? __ctype_tolower[c] : c;
00048 }
00049 
00050 int
00051 toupper (int c)
00052 {
00053   return c >= -128 && c < 256 ? __ctype_toupper[c] : c;
00054 }