]> pd.if.org Git - pd_readline/blob - mg/chrdef.h
Added mg from an OpenBSD mirror site. Many thanks to the OpenBSD team and the mg...
[pd_readline] / mg / chrdef.h
1 /*      $OpenBSD: chrdef.h,v 1.7 2005/06/14 18:14:40 kjell 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.  Override in sysdef.h if no
13  * unsigned char type.
14  */
15 #define CHARMASK(c)     ((unsigned char) (c))
16
17 /*
18  * These flags, and the macros below them,
19  * make up a do-it-yourself set of "ctype" macros that
20  * understand the DEC multinational set, and let me ask
21  * a slightly different set of questions.
22  */
23 #define _MG_W   0x01            /* Word.                         */
24 #define _MG_U   0x02            /* Upper case letter.            */
25 #define _MG_L   0x04            /* Lower case letter.            */
26 #define _MG_C   0x08            /* Control.                      */
27 #define _MG_P   0x10            /* end of sentence punctuation   */
28 #define _MG_D   0x20            /* is decimal digit              */
29
30 #define ISWORD(c)       ((cinfo[CHARMASK(c)]&_MG_W)!=0)
31 #define ISCTRL(c)       ((cinfo[CHARMASK(c)]&_MG_C)!=0)
32 #define ISUPPER(c)      ((cinfo[CHARMASK(c)]&_MG_U)!=0)
33 #define ISLOWER(c)      ((cinfo[CHARMASK(c)]&_MG_L)!=0)
34 #define ISEOSP(c)       ((cinfo[CHARMASK(c)]&_MG_P)!=0)
35 #define ISDIGIT(c)      ((cinfo[CHARMASK(c)]&_MG_D)!=0)
36 #define TOUPPER(c)      ((c)-0x20)
37 #define TOLOWER(c)      ((c)+0x20)
38
39 /*
40  * Generally useful thing for chars
41  */
42 #define CCHR(x)         ((x) ^ 0x40)    /* CCHR('?') == DEL */
43
44 #ifndef METACH
45 #define METACH          CCHR('[')
46 #endif
47
48 #ifdef XKEYS
49 #define K00             256
50 #define K01             257
51 #define K02             258
52 #define K03             259
53 #define K04             260
54 #define K05             261
55 #define K06             262
56 #define K07             263
57 #define K08             264
58 #define K09             265
59 #define K0A             266
60 #define K0B             267
61 #define K0C             268
62 #define K0D             269
63 #define K0E             270
64 #define K0F             271
65 #define K10             272
66 #define K11             273
67 #define K12             274
68 #define K13             275
69 #define K14             276
70 #define K15             277
71 #define K16             278
72 #define K17             279
73 #define K18             280
74 #define K19             281
75 #define K1A             282
76 #define K1B             283
77 #define K1C             284
78 #define K1D             285
79 #define K1E             286
80 #define K1F             287
81 #endif