1 /*-------------------------------------------------------------------------
2 ctype.h - ANSI functions forward declarations
4 Modified for pic16 port by Vangelis Rokas, 2004, vrokas@otenet.gr
6 Written By - Sandeep Dutta . sandeep.dutta@usa.net (1998)
9 1.0 - June.1.2000 1.0 - Bela Torok / bela.torok@kssg.ch
10 order: function definitions -> macros
11 corretced macro: isalpha(c)
12 added macros: _tolower(c), _toupper(c), tolower(c), toupper(c) toascii(c)
15 This program is free software; you can redistribute it and/or modify it
16 under the terms of the GNU General Public License as published by the
17 Free Software Foundation; either version 2, or (at your option) any
20 This program is distributed in the hope that it will be useful,
21 but WITHOUT ANY WARRANTY; without even the implied warranty of
22 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 GNU General Public License for more details.
25 You should have received a copy of the GNU General Public License
26 along with this program; if not, write to the Free Software
27 Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
29 In other words, you are welcome to use, share and improve this program.
30 You are forbidden to forbid anyone else to use, share and improve
31 what you give them. Help stamp out software-hoarding!
32 -------------------------------------------------------------------------*/
44 extern char iscntrl (unsigned char ) ;
45 extern char isdigit (unsigned char ) ;
46 extern char isgraph (unsigned char ) ;
47 extern char islower (unsigned char ) ;
48 extern char isupper (unsigned char ) ;
49 extern char isprint (unsigned char ) ;
50 extern char ispunct (unsigned char ) ;
51 extern char isspace (unsigned char ) ;
52 extern char isxdigit (unsigned char ) ;
54 #define isalnum(c) (isalpha(c) || isdigit(c))
55 #define isalpha(c) (isupper(c) || islower(c))
57 /* ANSI versions of _tolower & _toupper
58 #define _tolower(c) ((c) - ('a' - 'A'))
59 #define _toupper(c) ((c) + ('a' - 'A'))
62 // The _tolower & _toupper functions below can applied to any
63 // alpha characters regardless of the case (upper or lower)
64 #define _tolower(c) ((c) | ('a' - 'A'))
65 #define _toupper(c) ((c) & ~('a' - 'A'))
67 #define tolower(c) ((isupper(c)) ? _tolower(c) : (c))
68 #define toupper(c) ((islower(c)) ? _toupper(c) : (c))
69 #define toascii(c) ((c) & 0x7F)