xref: /freebsd/usr.bin/vgrind/vgrind.1 (revision 0de89efe5c443f213c7ea28773ef2dc6cf3af2ed)
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.\"
34.Dd June 6, 1993
35.Dt VGRIND 1
36.Os BSD 4
37.Sh NAME
38.Nm vgrind
39.Nd grind nice listings of programs
40.Sh SYNOPSIS
41.Nm
42.Op Fl
43.Op Fl W
44.Op Fl d Ar file
45.Op Fl f
46.Op Fl h Ar header
47.Op Fl l Ns Ar language
48.Op Fl n
49.Op Fl p Ar postproc
50.Op Fl sn
51.Op Fl t
52.Op Fl x
53.Ar name Ar ...
54.Sh DESCRIPTION
55.Nm Vgrind
56formats the program sources which are arguments
57in a nice style using
58.Xr troff 1
59Comments are placed in italics, keywords in bold face,
60and the name of the current function is listed down the margin of each
61page as it is encountered.
62.Pp
63.Nm Vgrind
64runs in two basic modes, filter mode (see the
65.Fl f
66option) or regular mode.  In filter mode
67.Nm
68acts as a filter in a manner similar to
69.Xr tbl 1 .
70The standard input is passed directly to the standard output except
71for lines bracketed by the
72.Em troff-like
73macros:
74.Bl -tag -width Ds
75.It \&.vS
76starts processing
77.It \&.vE
78ends processing
79.El
80.Pp
81These lines are formatted as described above.  The output from this
82filter can be passed to
83.Xr troff
84for output.  There need be no particular ordering with
85.Xr eqn 1
86or
87.Xr tbl 1 .
88.Pp
89In regular mode
90.Nm
91accepts input files, processes them, and passes them to the postprocessor
92for output,
93.Xr psroff 1
94by default.
95.Pp
96In both modes
97.Nm
98passes any lines beginning with a decimal point without conversion.
99.Pp
100The options are:
101.Bl -tag -width Ar
102.It Fl
103forces input to be taken from standard input (default if
104.Fl f
105is specified )
106.It Fl W
107forces output to the (wide) Versatec printer rather than the (narrow)
108Varian
109.It Fl d Ar file
110specifies an alternate language definitions
111file (default is
112.Pa /usr/share/misc/vgrindefs )
113.It Fl f
114forces filter mode
115.It Fl h Ar header
116specifies a particular header to put on every output page (default is
117the file name)
118.It Fl l
119specifies the language to use.  Currently known are
120.Tn PASCAL
121.Pq Fl l Ns Ar p ,
122.Tn MODEL
123.Pq Fl l Ns Ar m ,
124C
125.Pf ( Fl l Ns Ar c
126or the default),
127.Tn C++
128.Pq Fl l Ns Ar c++ ,
129.Tn CSH
130.Pq Fl l Ns Ar csh ,
131.Tn SHELL
132.Pq Fl l Ns Ar sh ,
133.Tn RATFOR
134.Pq Fl l Ns Ar r ,
135.Tn MODULA2
136.Pq Fl l Ns Ar mod2 ,
137.Tn YACC
138.Pq Fl l Ns Ar yacc ,
139.Tn LISP
140.Pq Fl l Ns Ar isp ,
141.Tn ICON
142.Pq Fl l Ns Ar I ,
143and
144.Tn PERL
145.Pq Fl l Ns Ar perl .
146.It Fl n
147forces no keyword bolding
148.It Fl p Ar postproc
149use
150.Ar postproc
151to post-process the output,
152.Xr psroff 1
153by default.
154.It Fl s
155specifies a point size to use on output (exactly the same as the argument
156of a .ps)
157.It Fl t
158similar to the same option in
159.Xr troff
160causing formatted text to go to the standard output
161.It Fl x
162outputs the index file in a ``pretty'' format.
163The index file itself is produced whenever
164.Nm
165is run with a file called
166.Pa index
167in the current directory.
168The index of function
169definitions can then be run off by giving
170.Nm
171the
172.Fl x
173option and the file
174.Pa index
175as argument.
176.El
177.Sh FILES
178.Bl -tag -width /usr/share/misc/vgrindefsxx -compact
179.It Pa index
180file where source for index is created
181.It Pa /usr/share/tmac/tmac.vgrind
182macro package
183.It Pa /usr/libexec/vfontedpr
184preprocessor
185.It Pa /usr/share/misc/vgrindefs
186language descriptions
187.El
188.Sh SEE ALSO
189.Xr getcap 3 ,
190.Xr vgrindefs 5
191.Sh BUGS
192Vfontedpr assumes that a certain programming style is followed:
193.Pp
194For
195.Tn C
196\- function names can be preceded on a line only by spaces, tabs, or an
197asterisk.  The parenthesized arguments must also be on the same line.
198.Pp
199For
200.Tn PASCAL
201\- function names need to appear on the same line as the keywords
202.Em function
203or
204.Em procedure .
205.Pp
206For
207.Tn MODEL
208\- function names need to appear on the same line as the keywords
209.Em is beginproc .
210.Pp
211If these conventions are not followed, the indexing and marginal function
212name comment mechanisms will fail.
213.Pp
214More generally, arbitrary formatting styles for programs mostly look bad.
215The use of spaces to align source code fails miserably; if you plan to
216.Nm
217your program you should use tabs.  This is somewhat inevitable since the
218font used by
219.Nm
220is variable width.
221.Pp
222The mechanism of
223.Xr ctags 1
224in recognizing functions should be used here.
225.Pp
226Filter mode does not work in documents using the
227.Fl me
228or
229.Fl ms
230macros.
231(So what use is it anyway?)
232.Sh HISTORY
233The
234.Nm
235command appeared in
236.Bx 3.0 .
237