1 /* $OpenBSD: chrdef.h,v 1.10 2015/03/25 12:29:03 bcallah Exp $ */ 2 3 /* This file is in the public domain. */ 4 5 /* 6 * sys/default/chardef.h: character set specific #defines for Mg 2a 7 * Warning: System specific ones exist 8 */ 9 10 /* 11 * Casting should be at least as efficient as anding with 0xff, 12 * and won't have the size problems. 13 */ 14 #define CHARMASK(c) ((unsigned char) (c)) 15 16 /* 17 * These flags, and the macros below them, 18 * make up a do-it-yourself set of "ctype" macros that 19 * understand the DEC multinational set, and let me ask 20 * a slightly different set of questions. 21 */ 22 #define _MG_W 0x01 /* Word. */ 23 #define _MG_U 0x02 /* Upper case letter. */ 24 #define _MG_L 0x04 /* Lower case letter. */ 25 #define _MG_C 0x08 /* Control. */ 26 #define _MG_P 0x10 /* end of sentence punctuation */ 27 #define _MG_D 0x20 /* is decimal digit */ 28 29 #define ISWORD(c) ((cinfo[CHARMASK(c)]&_MG_W)!=0) 30 #define ISCTRL(c) ((cinfo[CHARMASK(c)]&_MG_C)!=0) 31 #define ISUPPER(c) ((cinfo[CHARMASK(c)]&_MG_U)!=0) 32 #define ISLOWER(c) ((cinfo[CHARMASK(c)]&_MG_L)!=0) 33 #define ISEOSP(c) ((cinfo[CHARMASK(c)]&_MG_P)!=0) 34 #define ISDIGIT(c) ((cinfo[CHARMASK(c)]&_MG_D)!=0) 35 #define TOUPPER(c) ((c)-0x20) 36 #define TOLOWER(c) ((c)+0x20) 37 38 /* 39 * Generally useful thing for chars 40 */ 41 #define CCHR(x) ((x) ^ 0x40) /* CCHR('?') == DEL */ 42 43 #define K00 256 44 #define K01 257 45 #define K02 258 46 #define K03 259 47 #define K04 260 48 #define K05 261 49 #define K06 262 50 #define K07 263 51 #define K08 264 52 #define K09 265 53 #define K0A 266 54 #define K0B 267 55 #define K0C 268 56 #define K0D 269 57 #define K0E 270 58 #define K0F 271 59 #define K10 272 60 #define K11 273 61 #define K12 274 62 #define K13 275 63 #define K14 276 64 #define K15 277 65 #define K16 278 66 #define K17 279 67 #define K18 280 68 #define K19 281 69 #define K1A 282 70 #define K1B 283 71 #define K1C 284 72 #define K1D 285 73 #define K1E 286 74 #define K1F 287 75