/* PRINTENTS.C: Produce a table of entities, with capital and lowercase forms, to test capitalization functions */ #include #define UCHAR unsigned int /* CODE TO TAKE BEGINS HERE */ /* XXX This technically should be done with data like that at ftp://ftp.unicode.org/Public/UNIDATA/ , at least for values not covered here. Also, there are nsString functions that do uppercasing/lowercasing, and it should probably be done in those if nsString stays around. */ /* This function is inclusive of bounds: */ #define CHAR_BETWEEN(_char, _low, _high) (((_char) >= (_low)) && ((_char) <= (_high))) /* These could be sped up greatly by using ?: */ #define XP_IS_UPPERCASE(_ch) \ ( CHAR_BETWEEN((_ch),'A','Z') || \ ( CHAR_BETWEEN((_ch),0x00C0,0x00DE) && ((_ch) != 0x00D7)) ) #define XP_IS_LOWERCASE(_ch) \ ( CHAR_BETWEEN((_ch),'a','z') || \ ( CHAR_BETWEEN((_ch),0x00E0,0x00FE) && ((_ch) != 0x00F7)) ) #define XP_TO_LOWER(_ch) ((_ch) | 32) #define XP_TO_UPPER(_ch) ((_ch) & ~32) /* CODE TO TAKE ENDS HERE */ void printrow(UCHAR charnum) { printf("&#%d;&#%d;&#%d;\n", charnum, ( XP_IS_LOWERCASE(charnum)?XP_TO_UPPER(charnum):charnum ), ( XP_IS_UPPERCASE(charnum)?XP_TO_LOWER(charnum):charnum ) ); } void printhead() { printf("\n\nEntities List\n\n\n"); printf("\n"); } void printtail() { printf("
EntityCapitalizedLowercased
\n"); printf("
\n

\"Valid

\n

(Back to\nI18N Testing Information,\nDavid Baron)\n

LDB,\ndbaron@fas.harvard.edu\n\n"); } main() { UCHAR i; printhead(); for ( i = 32 ; i <= 127 ; i++ ) { printrow(i); } for ( i = 161 ; i < 0x0590 ; i++ ) { printrow(i); } printtail(); return 0; }