Subject: VHDLGrind update
From: [email-masked] (Todd Carpenter)
Date: 17 Jun 92 13:54:52 GMT
Newsgroups: comp.lang.vhdl

Some of you are using vhdlgrind to pretty print vhdl listings.  The nice thing
is that it is all self contained, and you don't need to have the def file
stored elsewhere.

One problem with vgrind (the actual pretty printer) is that it uses the default
font which is Times.  While Times is a favorite font for text, it is lousy for
program listings because it is a proportional font which screws up column
alignment.  One of the local Gurus has changed vhdlgrind to use the Courier
fixed pitch font as the default.  The listing of the new vhdlgrind is attached
below.  You may need to change the string /usr/local/ptroff to point to
wherever ptroff lives on your system.  To use a font other than Courier, setenv
TROFF to what you see below with "Courier" changed to the font you want to use.
On the suns you have a choice of Times, Helvetica, and Courier.  Courier is the
only fixed pitch font.  Note that underscore and dash have their widths screwed
up, but this is still better than the proportional fonts.

Note also that the vgrind invocation also has a size option, "-s7," on it.
This chooses a much smaller font than the normal default, so you don't waste
nearly as much paper. (the next trick is getting it to twist it sideways and
put two pages per sheet of paper) If you like the big fonts, you can of course
remove that option.

please email comments to [email-masked]

------------------------------------------------------------------------------
#!/bin/csh -f
# vgrind a vhdl file,  Usage: vhdlgrind [vgrind args] [filename]
# This is a polyglot file, read by both csh and vgrind.
# The environment variable TROFF should be set to your favorite *roff,
# e.g. "/usr/ucb/ptroff" for postscript.  Add " -F font" if you want a font
# other than Courier.  Set environment variable PRINTER to your local printer.

if (! $?TROFF) then # if TROFF isn't set, assume local/ptroff with Courier
       setenv TROFF "/usr/local/ptroff -F Courier"
else if ("$TROFF" =~ /usr/local/ptroff) then # if ptroff & no font, use Courier
       setenv TROFF "/usr/local/ptroff -F Courier"
endif
set n=$0; if ($0 !~ /*) set n=$cwd/$0 # absolute path to this file
if ($#argv == 0) then # echo above header for naive users
  head -5 $n; exit
endif
@ num = $#argv - 1
(if ($argv[$#argv] =~ */*) cd $argv[$#argv]:h;\
 /usr/ucb/vgrind -lvhdl -s7 -d $n $argv[$num] $argv[$#argv]:t &)
exit
# end of what csh reads, beginning of what vgrind reads

vhdl|vhd:\
	:pb=(^\d?(procedure|function)\d\p\d|\(|;|\:):\
	:bb=\d(begin|block|body|case|component|configuration\
	|entity|for|if|loop|package|process|while|with)\d:\
	:be=\dend:\
	:cb=--:ce=$:\
	:oc:\
	:kw=abs access after alias all and architecture array assert attribute\
	begin block body buffer bus\
	case component configuration constant\
	disconnect downto\
	else elsif end entity exit\
	file for function\
	generate generic guarded\
	if in inout is\
	label library linkage loop\
	map mod\
	nand new next nor not null\
	of on open or others out\
	package port procedure process\
	range record register rem report return reverse_range\
	select severity signal subtype\
	then to transport type\
	units until use\
	variable\
	wait when while with\
	xor: