FWIW - the isxxxx functions or macros
Here is an edited part of how an old C compiler did it:
create an array called _ctype[]:
Code:
static char _ctype[256];
static char _ctype_exists=0;
void _define__ctype(void){
int i=0;
if(_ctype_exists==1)
return;
_ctype_exists=1;
for(i=129;i<256;i++)
_ctype[i]=0;
_ctype[0] = 0;
_ctype[1] = 32;
_ctype[2] = 32;
_ctype[3] = 32;
_ctype[4] = 32;
_ctype[5] = 32;
_ctype[6] = 32;
_ctype[7] = 32;
_ctype[8] = 32;
_ctype[9] = 32;
_ctype[10] = 33;
_ctype[11] = 33;
_ctype[12] = 33;
_ctype[13] = 33;
_ctype[14] = 33;
_ctype[15] = 32;
_ctype[16] = 32;
_ctype[17] = 32;
_ctype[18] = 32;
_ctype[19] = 32;
_ctype[20] = 32;
_ctype[21] = 32;
_ctype[22] = 32;
_ctype[23] = 32;
_ctype[24] = 32;
_ctype[25] = 32;
_ctype[26] = 32;
_ctype[27] = 32;
_ctype[28] = 32;
_ctype[29] = 32;
_ctype[30] = 32;
_ctype[31] = 32;
_ctype[32] = 32;
_ctype[33] = 1;
_ctype[34] = 64;
_ctype[35] = 64;
_ctype[36] = 64;
_ctype[37] = 64;
_ctype[38] = 64;
_ctype[39] = 64;
_ctype[40] = 64;
_ctype[41] = 64;
_ctype[42] = 64;
_ctype[43] = 64;
_ctype[44] = 64;
_ctype[45] = 64;
_ctype[46] = 64;
_ctype[47] = 64;
_ctype[48] = 64;
_ctype[49] = 2;
_ctype[50] = 2;
_ctype[51] = 2;
_ctype[52] = 2;
_ctype[53] = 2;
_ctype[54] = 2;
_ctype[55] = 2;
_ctype[56] = 2;
_ctype[57] = 2;
_ctype[58] = 2;
_ctype[59] = 64;
_ctype[60] = 64;
_ctype[61] = 64;
_ctype[62] = 64;
_ctype[63] = 64;
_ctype[64] = 64;
_ctype[65] = 64;
_ctype[66] = 20;
_ctype[67] = 20;
_ctype[68] = 20;
_ctype[69] = 20;
_ctype[70] = 20;
_ctype[71] = 20;
_ctype[72] = 4;
_ctype[73] = 4;
_ctype[74] = 4;
_ctype[75] = 4;
_ctype[76] = 4;
_ctype[77] = 4;
_ctype[78] = 4;
_ctype[79] = 4;
_ctype[80] = 4;
_ctype[81] = 4;
_ctype[82] = 4;
_ctype[83] = 4;
_ctype[84] = 4;
_ctype[85] = 4;
_ctype[86] = 4;
_ctype[87] = 4;
_ctype[88] = 4;
_ctype[89] = 4;
_ctype[90] = 4;
_ctype[91] = 4;
_ctype[92] = 64;
_ctype[93] = 64;
_ctype[94] = 64;
_ctype[95] = 64;
_ctype[96] = 64;
_ctype[97] = 64;
_ctype[98] = 24;
_ctype[99] = 24;
_ctype[100] = 24;
_ctype[101] = 24;
_ctype[102] = 24;
_ctype[103] = 24;
_ctype[104] = 8;
_ctype[105] = 8;
_ctype[106] = 8;
_ctype[107] = 8;
_ctype[108] = 8;
_ctype[109] = 8;
_ctype[110] = 8;
_ctype[111] = 8;
_ctype[112] = 8;
_ctype[113] = 8;
_ctype[114] = 8;
_ctype[115] = 8;
_ctype[116] = 8;
_ctype[117] = 8;
_ctype[118] = 8;
_ctype[119] = 8;
_ctype[120] = 8;
_ctype[121] = 8;
_ctype[122] = 8;
_ctype[123] = 8;
_ctype[124] = 64;
_ctype[125] = 64;
_ctype[126] = 64;
_ctype[127] = 64;
_ctype[128] = 32;
}
Then in ctype.h you have macros that use _ctype[] :
Code:
#define _IS_SP 1 /* is space */
#define _IS_DIG 2 /* is digit indicator */
#define _IS_UPP 4 /* is upper case */
#define _IS_LOW 8 /* is lower case */
#define _IS_HEX 16 /* [A-F or [a-f] */
#define _IS_CTL 32 /* Control */
#define _IS_PUN 64 /* punctuation */
extern char _Cdecl _ctype[]; /* Character type array */
#define isalnum(c) (_ctype[(c) + 1] & (_IS_DIG | _IS_UPP | _IS_LOW))
#define isalpha(c) (_ctype[(c) + 1] & (_IS_UPP | _IS_LOW))
#define isascii(c) ((unsigned)(c) < 128)
#define iscntrl(c) (_ctype[(c) + 1] & _IS_CTL)
#define isdigit(c) (_ctype[(c) + 1] & _IS_DIG)
#define isgraph(c) ((c) >= 0x21 && (c) <= 0x7e)
#define islower(c) (_ctype[(c) + 1] & _IS_LOW)
#define isprint(c) ((c) >= 0x20 && (c) <= 0x7e)
#define ispunct(c) (_ctype[(c) + 1] & _IS_PUN)
#define isspace(c) (_ctype[(c) + 1] & _IS_SP)
#define isupper(c) (_ctype[(c) + 1] & _IS_UPP)
#define isxdigit(c) (_ctype[(c) + 1] & (_IS_DIG | _IS_HEX))