200 CHARACTER SET DEFINITIONS AND TRANSLATION TABLES ANNOYANCE-FILTER §248 248. Character set definitions and translation tables. <strong>The</strong> following sections define the character set used in the program and provide translation tables among various representations used in formats we emit. 249. Define the various kinds of tokens we parse from the input stream. 〈 Master dictionary 225 〉 +≡ static tokenDefinition isoToken ; /∗ ISO-8859 token definition ∗/ static tokenDefinition asciiToken ; /∗ US-ASCII token definition ∗/
§250 ANNOYANCE-FILTER ISO 8859-1 CHARACTER TYPES 201 250. ISO 8859-1 character types. <strong>The</strong> following definitions provide equivalents for ctype.h macros which work for ISO-8859 8 bit characters. <strong>The</strong>y require that ctype.h be included before they’re used. 〈 Global variables 226 〉 +≡ #define ISOch (x) (static cast〈unsigned char〉((x) & # FF)) #define isISOspace (x) (isascii (ISOch (x)) ∧ isspace (ISOch (x))) #define isISOalpha (x) ((isoalpha [ISOch (x)/8] & ( # 80 ≫ (ISOch (x) % 8))) ≠ 0) #define isISOupper (x) ((isoupper [ISOch (x)/8] & ( # 80 ≫ (ISOch (x) % 8))) ≠ 0) #define isISOlower (x) ((isolower [ISOch (x)/8] & ( # 80 ≫ (ISOch (x) % 8))) ≠ 0) #define toISOupper (x) (isISOlower (x) ? (isascii (((unsigned char)(x))) ? toupper (x) : (((ISOch (x) ≠ # DF)∧(ISOch (x) ≠ # FF)) ? (ISOch (x)− # 20) : (x))) : (x)) #define toISOlower (x) (isISOupper (x) ? (isascii (ISOch (x)) ? tolower (x) : (ISOch (x) + # 20)) : (x)) 251. <strong>The</strong> following tables are bit vectors which define membership in the character classes tested for by the preceding macros. 〈 Global variables 226 〉 +≡ const unsigned char isoalpha [32] = {0, 0, 0, 0, 0, 0, 0, 0, 127, 255, 255, 224, 127, 255, 255, 224, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 254, 255, 255, 255, 254, 255}; const unsigned char isoupper [32] = {0, 0, 0, 0, 0, 0, 0, 0, 127, 255, 255, 224, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 254, 254, 0, 0, 0, 0}; const unsigned char isolower [32] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 127, 255, 255, 224, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 255, 255, 254, 255}; 252. To perform component tests during the development process we provide a test jig in which the component may be figuratively mounted and exercised. When compiled with Jig defined, a −−jig option (without argument) is included to activate the test. 〈 Test component in temporary jig 252 〉 ≡ #ifdef Jig #endif This code is used in section 243. 253. <strong>The</strong> component in the temporary test jig may require some items declared in global context. Here’s where you can put such declarations. 〈 Global declarations used by component in temporary jig 253 〉 ≡ #ifdef Jig #endif This code is used in section 223.