xref: /original-bsd/usr.bin/window/char.h (revision b0ceb3f2)
1 /*
2  * Copyright (c) 1983 Regents of the University of California.
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms are permitted
6  * provided that the above copyright notice and this paragraph are
7  * duplicated in all such forms and that any documentation,
8  * advertising materials, and other materials related to such
9  * distribution and use acknowledge that the software was developed
10  * by the University of California, Berkeley.  The name of the
11  * University may not be used to endorse or promote products derived
12  * from this software without specific prior written permission.
13  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
14  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
15  * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
16  *
17  *	@(#)char.h	3.7 (Berkeley) 02/16/89
18  */
19 
20 /*
21  * Macros and things to deal with control characters.
22  *
23  * Unctrl() is just like the standard function, except we don't want
24  * to include curses.
25  * Isctrl() returns true for all characters less than space and
26  * greater than or equal to delete.
27  * Isprt() is tab and all characters not isctrl().  It's used
28  * by wwwrite().
29  * Isunctrl() includes all characters that should be expanded
30  * using unctrl() by wwwrite() if ww_unctrl is set.
31  */
32 
33 extern char *_unctrl[];
34 extern char _cmap[];
35 #define ctrl(c)		(c & 0x1f)
36 #define unctrl(c)	(_unctrl[(unsigned char) (c)])
37 #define _C		0x01
38 #define _P		0x02
39 #define _U		0x04
40 #define isctrl(c)	(_cmap[(unsigned char) (c)] & _C)
41 #define isprt(c)	(_cmap[(unsigned char) (c)] & _P)
42 #define isunctrl(c)	(_cmap[(unsigned char) (c)] & _U)
43