xref: /freebsd/usr.bin/vgrind/vgrind.1 (revision 5773cccf19ef7b97e56c1101aa481c43149224da)
1.\" Copyright (c) 1980, 1990, 1993
2.\"	The Regents of the University of California.  All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\"    notice, this list of conditions and the following disclaimer.
9.\" 2. Redistributions in binary form must reproduce the above copyright
10.\"    notice, this list of conditions and the following disclaimer in the
11.\"    documentation and/or other materials provided with the distribution.
12.\" 3. All advertising materials mentioning features or use of this software
13.\"    must display the following acknowledgement:
14.\"	This product includes software developed by the University of
15.\"	California, Berkeley and its contributors.
16.\" 4. Neither the name of the University nor the names of its contributors
17.\"    may be used to endorse or promote products derived from this software
18.\"    without specific prior written permission.
19.\"
20.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30.\" SUCH DAMAGE.
31.\"
32.\"     @(#)vgrind.1	8.1 (Berkeley) 6/6/93
33.\" $FreeBSD$
34.\"
35.Dd June 6, 1993
36.Dt VGRIND 1
37.Os
38.Sh NAME
39.Nm vgrind
40.Nd grind nice listings of programs
41.Sh SYNOPSIS
42.Nm
43.Op Fl
44.Op Fl W
45.Op Fl d Ar file
46.Op Fl f
47.Op Fl h Ar header
48.Op Fl l Ns Ar language
49.Op Fl n
50.Op Fl p Ar postproc
51.Op Fl sn
52.Op Fl t
53.Op Fl x
54.Ar name Ar ...
55.Sh DESCRIPTION
56The
57.Nm
58utility formats the program sources which are arguments
59in a nice style using
60.Xr troff 1
61Comments are placed in italics, keywords in bold face,
62and the name of the current function is listed down the margin of each
63page as it is encountered.
64.Pp
65The
66.Nm
67utility runs in two basic modes, filter mode (see the
68.Fl f
69option) or regular mode.  In filter mode
70.Nm
71acts as a filter in a manner similar to
72.Xr tbl 1 .
73The standard input is passed directly to the standard output except
74for lines bracketed by the
75.Em troff-like
76macros:
77.Bl -tag -width Ds
78.It \&.vS
79starts processing
80.It \&.vE
81ends processing
82.El
83.Pp
84These lines are formatted as described above.  The output from this
85filter can be passed to
86.Xr troff
87for output.  There need be no particular ordering with
88.Xr eqn 1
89or
90.Xr tbl 1 .
91.Pp
92In regular mode
93.Nm
94accepts input files, processes them, and passes them to the postprocessor
95for output,
96.Xr psroff 1
97by default.
98.Pp
99In both modes
100.Nm
101passes any lines beginning with a decimal point without conversion.
102.Pp
103The options are:
104.Bl -tag -width Ar
105.It Fl
106forces input to be taken from standard input (default if
107.Fl f
108is specified)
109.It Fl W
110forces output to the (wide) Versatec printer rather than the (narrow)
111Varian
112.It Fl d Ar file
113specifies an alternate language definitions
114file (default is
115.Pa /usr/share/misc/vgrindefs )
116.It Fl f
117forces filter mode
118.It Fl h Ar header
119specifies a particular header to put on every output page (default is
120the file name)
121.It Fl l
122specifies the language to use.  Currently known are
123.Tn PASCAL
124.Pq Fl l Ns Ar p ,
125.Tn MODEL
126.Pq Fl l Ns Ar m ,
127C
128.Pf ( Fl l Ns Ar c
129or the default),
130.Tn C++
131.Pq Fl l Ns Ar c++ ,
132.Tn CSH
133.Pq Fl l Ns Ar csh ,
134.Tn SHELL
135.Pq Fl l Ns Ar sh ,
136.Tn RATFOR
137.Pq Fl l Ns Ar r ,
138.Tn MODULA2
139.Pq Fl l Ns Ar mod2 ,
140.Tn YACC
141.Pq Fl l Ns Ar yacc ,
142.Tn LISP
143.Pq Fl l Ns Ar isp ,
144.Tn ICON
145.Pq Fl l Ns Ar I ,
146and
147.Tn PERL
148.Pq Fl l Ns Ar perl .
149.It Fl n
150forces no keyword bolding
151.It Fl p Ar postproc
152use
153.Ar postproc
154to post-process the output,
155.Xr psroff 1
156by default.
157.It Fl s
158specifies a point size to use on output (exactly the same as the argument
159of a .ps)
160.It Fl t
161similar to the same option in
162.Xr troff
163causing formatted text to go to the standard output
164.It Fl x
165outputs the index file in a ``pretty'' format.
166The index file itself is produced whenever
167.Nm
168is run with a file called
169.Pa index
170in the current directory.
171The index of function
172definitions can then be run off by giving
173.Nm
174the
175.Fl x
176option and the file
177.Pa index
178as argument.
179.El
180.Sh FILES
181.Bl -tag -width /usr/share/misc/vgrindefsxx -compact
182.It Pa index
183file where source for index is created
184.It Pa /usr/share/tmac/tmac.vgrind
185macro package
186.It Pa /usr/libexec/vfontedpr
187preprocessor
188.It Pa /usr/share/misc/vgrindefs
189language descriptions
190.El
191.Sh SEE ALSO
192.Xr getcap 3 ,
193.Xr vgrindefs 5
194.Sh BUGS
195Vfontedpr assumes that a certain programming style is followed:
196.Pp
197For
198.Tn C
199\- function names can be preceded on a line only by spaces, tabs, or an
200asterisk.  The parenthesized arguments must also be on the same line.
201.Pp
202For
203.Tn PASCAL
204\- function names need to appear on the same line as the keywords
205.Em function
206or
207.Em procedure .
208.Pp
209For
210.Tn MODEL
211\- function names need to appear on the same line as the keywords
212.Em is beginproc .
213.Pp
214If these conventions are not followed, the indexing and marginal function
215name comment mechanisms will fail.
216.Pp
217More generally, arbitrary formatting styles for programs mostly look bad.
218The use of spaces to align source code fails miserably; if you plan to
219.Nm
220your program you should use tabs.  This is somewhat inevitable since the
221font used by
222.Nm
223is variable width.
224.Pp
225The mechanism of
226.Xr ctags 1
227in recognizing functions should be used here.
228.Pp
229Filter mode does not work in documents using the
230.Fl me
231or
232.Fl ms
233macros.
234(So what use is it anyway?)
235.Sh HISTORY
236The
237.Nm
238command appeared in
239.Bx 3.0 .
240