1178825Sdfr/*	$NetBSD: vis.h,v 1.11 1999/11/25 16:55:50 wennmach Exp $	*/
2178825Sdfr/*	$Id: vis.hin 19341 2006-12-15 11:53:09Z lha $	*/
3178825Sdfr
4178825Sdfr/*-
5178825Sdfr * Copyright (c) 1990, 1993
6178825Sdfr *	The Regents of the University of California.  All rights reserved.
7178825Sdfr *
8178825Sdfr * Redistribution and use in source and binary forms, with or without
9178825Sdfr * modification, are permitted provided that the following conditions
10178825Sdfr * are met:
11178825Sdfr * 1. Redistributions of source code must retain the above copyright
12178825Sdfr *    notice, this list of conditions and the following disclaimer.
13178825Sdfr * 2. Redistributions in binary form must reproduce the above copyright
14178825Sdfr *    notice, this list of conditions and the following disclaimer in the
15178825Sdfr *    documentation and/or other materials provided with the distribution.
16178825Sdfr * 3. Neither the name of the University nor the names of its contributors
17178825Sdfr *    may be used to endorse or promote products derived from this software
18178825Sdfr *    without specific prior written permission.
19178825Sdfr *
20178825Sdfr * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21178825Sdfr * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22178825Sdfr * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23178825Sdfr * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24178825Sdfr * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25178825Sdfr * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26178825Sdfr * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27178825Sdfr * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28178825Sdfr * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29178825Sdfr * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30178825Sdfr * SUCH DAMAGE.
31178825Sdfr *
32178825Sdfr *	@(#)vis.h	8.1 (Berkeley) 6/2/93
33178825Sdfr */
34178825Sdfr
35178825Sdfr#ifndef _VIS_H_
36178825Sdfr#define	_VIS_H_
37178825Sdfr
38178825Sdfr#ifndef ROKEN_LIB_FUNCTION
39178825Sdfr#ifdef _WIN32
40178825Sdfr#define ROKEN_LIB_FUNCTION _stdcall
41178825Sdfr#else
42178825Sdfr#define ROKEN_LIB_FUNCTION
43178825Sdfr#endif
44178825Sdfr#endif
45178825Sdfr
46178825Sdfr/*
47178825Sdfr * to select alternate encoding format
48178825Sdfr */
49178825Sdfr#define	VIS_OCTAL	0x01	/* use octal \ddd format */
50178825Sdfr#define	VIS_CSTYLE	0x02	/* use \[nrft0..] where appropiate */
51178825Sdfr
52178825Sdfr/*
53178825Sdfr * to alter set of characters encoded (default is to encode all
54178825Sdfr * non-graphic except space, tab, and newline).
55178825Sdfr */
56178825Sdfr#define	VIS_SP		0x04	/* also encode space */
57178825Sdfr#define	VIS_TAB		0x08	/* also encode tab */
58178825Sdfr#define	VIS_NL		0x10	/* also encode newline */
59178825Sdfr#define	VIS_WHITE	(VIS_SP | VIS_TAB | VIS_NL)
60178825Sdfr#define	VIS_SAFE	0x20	/* only encode "unsafe" characters */
61178825Sdfr
62178825Sdfr/*
63178825Sdfr * other
64178825Sdfr */
65178825Sdfr#define	VIS_NOSLASH	0x40	/* inhibit printing '\' */
66178825Sdfr
67178825Sdfr/*
68178825Sdfr * unvis return codes
69178825Sdfr */
70178825Sdfr#define	UNVIS_VALID	 1	/* character valid */
71178825Sdfr#define	UNVIS_VALIDPUSH	 2	/* character valid, push back passed char */
72178825Sdfr#define	UNVIS_NOCHAR	 3	/* valid sequence, no character produced */
73178825Sdfr#define	UNVIS_SYNBAD	-1	/* unrecognized escape sequence */
74178825Sdfr#define	UNVIS_ERROR	-2	/* decoder in unknown state (unrecoverable) */
75178825Sdfr
76178825Sdfr/*
77178825Sdfr * unvis flags
78178825Sdfr */
79178825Sdfr#define	UNVIS_END	1	/* no more characters */
80178825Sdfr
81178825Sdfrchar ROKEN_LIB_FUNCTION
82178825Sdfr	*rk_vis (char *, int, int, int);
83178825Sdfrchar ROKEN_LIB_FUNCTION
84178825Sdfr	*rk_svis (char *, int, int, int, const char *);
85178825Sdfrint ROKEN_LIB_FUNCTION
86178825Sdfr	rk_strvis (char *, const char *, int);
87178825Sdfrint ROKEN_LIB_FUNCTION
88178825Sdfr	rk_strsvis (char *, const char *, int, const char *);
89178825Sdfrint ROKEN_LIB_FUNCTION
90178825Sdfr	rk_strvisx (char *, const char *, size_t, int);
91178825Sdfrint ROKEN_LIB_FUNCTION
92178825Sdfr	rk_strsvisx (char *, const char *, size_t, int, const char *);
93178825Sdfrint ROKEN_LIB_FUNCTION
94178825Sdfr	rk_strunvis (char *, const char *);
95178825Sdfrint ROKEN_LIB_FUNCTION
96178825Sdfr	rk_unvis (char *, int, int *, int);
97178825Sdfr
98178825Sdfr#undef vis
99178825Sdfr#define vis(a,b,c,d) rk_vis(a,b,c,d)
100178825Sdfr#undef svis
101178825Sdfr#define svis(a,b,c,d,e) rk_svis(a,b,c,d,e)
102178825Sdfr#undef strvis
103178825Sdfr#define strvis(a,b,c) rk_strvis(a,b,c)
104178825Sdfr#undef strsvis
105178825Sdfr#define strsvis(a,b,c,d) rk_strsvis(a,b,c,d)
106178825Sdfr#undef strvisx
107178825Sdfr#define strvisx(a,b,c,d) rk_strvisx(a,b,c,d)
108178825Sdfr#undef strsvisx
109178825Sdfr#define strsvisx(a,b,c,d,e) rk_strsvisx(a,b,c,d,e)
110178825Sdfr#undef strunvis
111178825Sdfr#define strunvis(a,b) rk_strunvis(a,b)
112178825Sdfr#undef unvis
113178825Sdfr#define unvis(a,b,c,d) rk_unvis(a,b,c,d)
114178825Sdfr
115178825Sdfr#endif /* !_VIS_H_ */
116