| 1 | /* |
| 2 | * @(#)char.h 3.3 %G% |
| 3 | */ |
| 4 | |
| 5 | /* |
| 6 | * Copyright (c) 1983 Regents of the University of California, |
| 7 | * All rights reserved. Redistribution permitted subject to |
| 8 | * the terms of the Berkeley Software License Agreement. |
| 9 | */ |
| 10 | |
| 11 | /* |
| 12 | * Macros and things to deal with control characters. |
| 13 | * |
| 14 | * Unctrl() is just like the standard function, except we don't want |
| 15 | * to include curses. |
| 16 | * Isctrl() returns true for all characters less than space and |
| 17 | * greater than or equal to delete. |
| 18 | * Isprt() is tab and all characters not isctrl(). It's used |
| 19 | * by wwwrite(). |
| 20 | * Isunctrl() includes all characters that should be expanded |
| 21 | * using unctrl() by wwwrite() if ww_unctrl is set. |
| 22 | */ |
| 23 | |
| 24 | char *_unctrl[]; |
| 25 | char _cmap[]; |
| 26 | #define ctrl(c) ('c' & 0x1f) |
| 27 | #define unctrl(c) (_unctrl[(unsigned char) (c)]) |
| 28 | #define _C 0x01 |
| 29 | #define _P 0x02 |
| 30 | #define _U 0x04 |
| 31 | #define isctrl(c) (_cmap[(unsigned char) (c)] & _C) |
| 32 | #define isprt(c) (_cmap[(unsigned char) (c)] & _P) |
| 33 | #define isunctrl(c) (_cmap[(unsigned char) (c)] & _U) |