1 /*
2  * Copyright (C) 2006  Alan W. Irwin
3  *
4  * This file is part of PLplot.
5  *
6  * PLplot is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU Library General Public License as published
8  * by the Free Software Foundation; version 2 of the License.
9  *
10  * PLplot is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU Library General Public License for more details.
14  *
15  * You should have received a copy of the GNU Library General Public License
16  * along with the file PLplot; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
18  */
19 
20 #include <ctype.h>
21 #if ((' ' & 0x0FF) == 0x020)
22 # define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
23 # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
24 #else
25 # define ISLOWER(c) \
26      (('a' <= (c) && (c) <= 'i') \
27 	 || ('j' <= (c) && (c) <= 'r') \
28 	 || ('s' <= (c) && (c) <= 'z'))
29 # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
30 #endif
31 
32 #define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
33 int
main()34 main ()
35 {
36 	int i;
37 	for (i = 0; i < 256; i++)
38 		if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i))
39 			exit(1);
40 	exit (0);
41 }
42