Imported Upstream version 2.9.0
[debian/cc1111] / device / include / pic16 / ctype.h
1 /*-------------------------------------------------------------------------
2   ctype.h - ANSI functions forward declarations
3  
4   Modified for pic16 port by Vangelis Rokas, 2004, vrokas@otenet.gr
5   
6       Written By -  Sandeep Dutta . sandeep.dutta@usa.net (1998)
7
8    Revisions:
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)
13
14
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
18    later version.
19    
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.
24    
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.
28    
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 -------------------------------------------------------------------------*/
33
34 /*
35 ** $Id: ctype.h 3648 2005-01-22 18:02:16Z vrokas $
36 */
37
38
39 #ifndef __CTYPE_H
40 #define __CTYPE_H 1
41
42 /* link the C libarary */
43 #pragma library c
44
45 #include <sdcc-lib.h>
46
47 extern char  iscntrl   (unsigned char )  ;
48 extern char  isdigit   (unsigned char )  ;
49 extern char  isgraph   (unsigned char )  ;
50 extern char  islower   (unsigned char )  ;
51 extern char  isupper   (unsigned char )  ;
52 extern char  isprint   (unsigned char )  ;
53 extern char  ispunct   (unsigned char )  ;
54 extern char  isspace   (unsigned char )  ;
55 extern char  isxdigit  (unsigned char )  ;
56
57 #define isalnum(c)   (isalpha(c) || isdigit(c))
58 #define isalpha(c)   (isupper(c) || islower(c))
59
60 /* ANSI versions of _tolower & _toupper
61 #define _tolower(c)  ((c) - ('a' - 'A'))
62 #define _toupper(c)  ((c) + ('a' - 'A'))
63 */
64
65 // The _tolower & _toupper functions below can applied to any 
66 // alpha characters regardless of the case (upper or lower)
67 #define _tolower(c)  ((c) | ('a' - 'A'))
68 #define _toupper(c)  ((c) & ~('a' - 'A'))
69
70 #define tolower(c)  ((isupper(c)) ? _tolower(c) : (c))
71 #define toupper(c)  ((islower(c)) ? _toupper(c) : (c))
72 #define toascii(c)  ((c) & 0x7F)
73
74 #endif