| 1 |
/* This code was taken from http://www.fourmilab.ch/random/ where it states that: |
| 2 |
|
| 3 |
This software is in the public domain. Permission to use, copy, modify, and distribute |
| 4 |
this software and its documentation for any purpose and without fee is hereby granted, |
| 5 |
without any conditions or restrictions. This software is provided “as is” without |
| 6 |
express or implied warranty. */ |
| 7 |
|
| 8 |
/* ISO 8859/1 Latin-1 "ctype" macro replacements. */ |
| 9 |
|
| 10 |
extern unsigned char isoalpha[32], isoupper[32], isolower[32]; |
| 11 |
|
| 12 |
#define isISOspace(x) ((isascii(((unsigned char) (x))) && isspace(((unsigned char) (x)))) || ((x) == 0xA0)) |
| 13 |
#define isISOalpha(x) ((isoalpha[(((unsigned char) (x))) / 8] & (0x80 >> ((((unsigned char) (x))) % 8))) != 0) |
| 14 |
#define isISOupper(x) ((isoupper[(((unsigned char) (x))) / 8] & (0x80 >> ((((unsigned char) (x))) % 8))) != 0) |
| 15 |
#define isISOlower(x) ((isolower[(((unsigned char) (x))) / 8] & (0x80 >> ((((unsigned char) (x))) % 8))) != 0) |
| 16 |
#define isISOprint(x) ((((x) >= ' ') && ((x) <= '~')) || ((x) >= 0xA0)) |
| 17 |
#define toISOupper(x) (isISOlower(x) ? (isascii(((unsigned char) (x))) ? \ |
| 18 |
toupper(x) : (((((unsigned char) (x)) != 0xDF) && \ |
| 19 |
(((unsigned char) (x)) != 0xFF)) ? \ |
| 20 |
(((unsigned char) (x)) - 0x20) : (x))) : (x)) |
| 21 |
#define toISOlower(x) (isISOupper(x) ? (isascii(((unsigned char) (x))) ? \ |
| 22 |
tolower(x) : (((unsigned char) (x)) + 0x20)) \ |
| 23 |
: (x)) |