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