ctype.h.old


/* 
   This file is part of the AVR C Library.
   Copyright (C) 1998, 1999 by Denis Chertykov (denisc@overta.ru)
   
   The AVR C Library is free software; you can redistribute it and/or
   modify it under the terms of the GNU Library General Public License as
   published by the Free Software Foundation; either version 2 of the
   License, or (at your option) any later version.

   You should have received a copy of the GNU Library General Public
   License along with the GNU C Library; see the file COPYING.LIB.  If not,
   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
   Boston, MA 02111-1307, USA.  */

/*
 *	ISO C Standard 4.3: CHARACTER HANDLING	<ctype.h>
 */

#ifndef	_CTYPE_H

#define	_CTYPE_H	1

#define	__exctype(name)	extern int name (int)

/* The following names are all functions:
     int isCHARACTERISTIC(int c);
   which return nonzero iff C has CHARACTERISTIC.
__exctype (isdigit);
__exctype (isxdigit);
__exctype (islower);
__exctype (isupper);
__exctype (isalpha);
__exctype (isalnum);
__exctype (isascii);
__exctype (isblank);
__exctype (isspace);
__exctype (ispunct);
*/

/* Return the lowercase version of C.  */
extern int tolower (int __c);

/* Return the uppercase version of C.  */
extern int toupper (int __c);

/* Return the part of C that is in the ASCII set
   (i.e., the low-order 7 bits of C).  */
extern int toascii (int __c);


#ifndef	__NO_CTYPE

#define isdigit(c)	((c) >= '0' && (c) <= '9')
#define isxdigit(c) (isdigit (c) || ((c) >= 'a' && (c) <= 'f')	\
		     || ((c) >= 'A' && (c) <= 'F'))
#define islower(c) ((c) >= 'a' && (c) <= 'z')
#define isupper(c) ((c) >= 'A' && (c) <= 'Z')
#define isalpha(c) (islower(c) || isupper(c))
#define isalnum(c) (isalpha(c) || isdigit(c))
#define isascii(c) ((c) <= 0x7f)
#define isblank(c) ((c) == '\t' || (c) == ' ')
#define isspace(c) (isblank (c)						\
		    || (c) == '\f' || (c) == '\n' || (c) == '\r'|| (c) == '\v')
#define ispunct(c) (!(isalnum(c) || isspace (c)))


#define toupper(c) (islower (c) ? (c) + 'A' - 'a' : c)
#define tolower(c) (isupper (c) ? (c) + 'a' - 'A' : c)
#define toascii(c) ((c) & 0x7f)

#endif /* Not __NO_CTYPE.  */


/* XXX Not implemented functions
int iscntrl (int C)
    `ctype.h' (ISO):  *Note Classification of Characters::.

int isgraph (int C)
    `ctype.h' (ISO):  *Note Classification of Characters::.

int isprint (int C)
    `ctype.h' (ISO):  *Note Classification of Characters::.
*/

#endif /* ctype.h  */


Back