Imported Upstream version 2.9.0
[debian/cc1111] / device / include / ctype.h
1 /*-------------------------------------------------------------------------
2   ctype.h - ANSI functions forward declarations
3
4              Written By -  Sandeep Dutta . sandeep.dutta@usa.net (1998)
5
6    Revisions:
7    1.0 - June.1.2000 1.0 - Bela Torok / bela.torok@kssg.ch
8    order: function definitions -> macros
9    corretced macro: isalpha(c)
10    added macros: _tolower(c), _toupper(c), tolower(c), toupper(c) toascii(c)
11
12
13    This program is free software; you can redistribute it and/or modify it
14    under the terms of the GNU General Public License as published by the
15    Free Software Foundation; either version 2, or (at your option) any
16    later version.
17
18    This program is distributed in the hope that it will be useful,
19    but WITHOUT ANY WARRANTY; without even the implied warranty of
20    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21    GNU General Public License for more details.
22
23    You should have received a copy of the GNU General Public License
24    along with this program; if not, write to the Free Software
25    Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26
27    In other words, you are welcome to use, share and improve this program.
28    You are forbidden to forbid anyone else to use, share and improve
29    what you give them.   Help stamp out software-hoarding!
30 -------------------------------------------------------------------------*/
31
32 #ifndef __SDC51_CTYPE_H
33 #define __SDC51_CTYPE_H 1
34
35 #include <sdcc-lib.h>
36
37 #ifdef SDCC_STACK_AUTO
38
39 extern char  iscntrl   (unsigned char ) _REENTRANT ;
40 extern char  isdigit   (unsigned char ) _REENTRANT ;
41 extern char  isgraph   (unsigned char ) _REENTRANT ;
42 extern char  islower   (unsigned char ) _REENTRANT ;
43 extern char  isupper   (unsigned char ) _REENTRANT ;
44 extern char  isprint   (unsigned char ) _REENTRANT ;
45 extern char  ispunct   (unsigned char ) _REENTRANT ;
46 extern char  isspace   (unsigned char ) _REENTRANT ;
47 extern char  isxdigit  (unsigned char ) _REENTRANT ;
48
49 #else
50
51 extern char  iscntrl   (unsigned char )  ;
52 extern char  isdigit   (unsigned char )  ;
53 extern char  isgraph   (unsigned char )  ;
54 extern char  islower   (unsigned char )  ;
55 extern char  isupper   (unsigned char )  ;
56 extern char  isprint   (unsigned char )  ;
57 extern char  ispunct   (unsigned char )  ;
58 extern char  isspace   (unsigned char )  ;
59 extern char  isxdigit  (unsigned char )  ;
60
61 #endif
62
63 #define isalnum(c)   (isalpha(c) || isdigit(c))
64 #define isalpha(c)   (isupper(c) || islower(c))
65
66 /* ANSI versions of _tolower & _toupper
67 #define _tolower(c)  ((c) - ('a' - 'A'))
68 #define _toupper(c)  ((c) + ('a' - 'A'))
69 */
70
71 /* The _tolower & _toupper functions below can applied to any
72    alpha characters regardless of the case (upper or lower) */
73 #define _tolower(c)  ((c) | ('a' - 'A'))
74 #define _toupper(c)  ((c) & ~('a' - 'A'))
75
76 #define tolower(c)  ((isupper(c)) ? _tolower(c) : (c))
77 #define toupper(c)  ((islower(c)) ? _toupper(c) : (c))
78 #define toascii(c)  ((c) & 0x7F)
79
80 #endif