Ugrind manual


ugrind - troff preprocessor which highlight source code


@BINDIR@/ugrind [-d file] [-h header] [-l language] [-t size] name ...


Ugrind insert string definition in files to highlight the source code they contain. Ugrind runs in two basic modes : regular mode or whole file mode.

The options are :

Currently, known languages are C (-lc), C++ (-lc++), CSH (-lcsh), FORTRAN (-lfortran), ICON (-lI,) ISP (-lisp), LDL (-ldl), LISP LIKE (-ml), MODEL (-lm), MODULA2 (-lmod2), PASCAL (-lp), POSTXML (-lpostxml), RATFOR (-lr), RUSSEL (lrussell), SHELL (-lsh), TROFF (-ltr), XML (-lxml), and YACC (-lyacc),

Programming style

Ugrind assumes that a certain programming style is followed :

More generally, arbitrary formatting styles for programs mostly look bad. The use of spaces to align source code fails miserably; if you plan to ugrind your program you should use tabs. This is somewhat inevitable since the font used by ugrind is variable width.

Macros and strings

To highlight code, ugrind insert strings in the file, and use some macros, so, to format the output of ugrind with troff, the following strings and macros must be defined by your macro file.




Ugrind is a hack of vfontedpr (that probably means visual-font-edit-print), which is the preprocesor used by the mostly forgotten vgrind script, which aims to visually "grind nice listing of programms" with troff. The code that vfontedpr use to read the language description file is "stolen almost totally from termcap". Vgrind and vfontedpr have been written by Dave Presotto and William Joy, for 4.3BSD-Tahoe. They have been modified by Gunnar Ritter as part of the Heirloom documentation tools.


Ugrind and its man page are distributed under the originalBSD license. The code which highlight troff language, written from scratch, is distributed under a BSDtwoclause license. The language description file (@LIBDIR@/ugrindefs) is distributed under the CDDL1.0 License.


@BINDIR@/ugrind preprocessor @LIBDIR@/ugrindefs language descriptions

See also


Help and bugs

You can send questions, bugs and patches at help at utroff dot org.


Written by Dave Presotto and William Joy. Modified by Gunnar Ritter for the Heirloom Project and later Pierre-Jean Fichet for Utroff.