cencode.h -> vis.h , re-implementation
[unix-history] / usr / src / include / vis.h
CommitLineData
f8b55f57
MT
1/*
2 * Copyright (c) 1989 The 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 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
16 *
11ac2e1d 17 * @(#)vis.h 5.2 (Berkeley) %G%
f8b55f57
MT
18 */
19
11ac2e1d 20
f8b55f57 21/*
11ac2e1d 22 * vis flags
f8b55f57 23 */
f8b55f57
MT
24
25/*
11ac2e1d
MT
26 * to select alternate encoding format
27 */
28#define VIS_OCTAL 0x01 /* use octal \ddd format */
29#define VIS_CSTYLE 0x02 /* use \[nrft...] where appropiate */
30/*
31 * to alter set of characters encoded
32 * (default is to encode all non-graphic except space, tab, and newline)
33 */
34#define VIS_TAB 0x04 /* also encode tab */
35#define VIS_WHITE 0x08 /* also encode space, tab, and newline */
36#define VIS_SAFE 0x10 /* only encode "unsafe" characters */
37/*
38 * other
f8b55f57 39 */
11ac2e1d
MT
40#define VIS_NOSLASH 0x20 /* inhibit printing '\' */
41#define VIS_NEXTC 0x40 /* nextc character is valid */
42
43extern char *cvis();
f8b55f57
MT
44
45/*
11ac2e1d 46 * unvis flags
f8b55f57 47 */
f8b55f57 48
11ac2e1d
MT
49#define UNVIS_HAT 0x01 /* treat ^ as special */
50#define UNVIS_END 0x02 /* reset decode machine */
51
52/*
53 * return codes
54 */
55#define UNVIS_NEEDMORE 0 /* not done, feed another char */
56#define UNVIS_OK 1 /* done, character ready */
57#define UNVIS_OKPUSH 2 /* done, push back passed char */
58#define UNVIS_NOCHAR 3 /* done, no character ready (hidden newline) */
59#define UNVIS_SYNBAD -1 /* unrecognized escape sequence */