Pretty Printer for VHDL 
Author Message
 Pretty Printer for VHDL

T> I have looked in the FAQ and remember sometime back some mention of a pretty
T> printer for VHDL.

T> I need a simple tool that will bold-face the VHDL keywords.

T> Any suggestions or tools?
Yea, use this!  Works great.  The vgrind stuff has been floating
around awahile, this has a few extra bindings in it.  In addition,
the frontend makes it a polyglot file so you don't need a sysadmin
to add it to the vgrind defs.

Use it, copy it about, but *don't* charge for it.  Rumors are that
certain vendors include this in their software distribution.  As
long as it's a service and not a feature, that's acceptable.

#!/bin/csh -f
# vgrind a vhdl file
#
#    Usage: vhdlgrind [vgrind args] [filename]
#
# This file is protected under the GNU copyleft
#
# This is the polyglot that is self contained.  If you use vgrind a lot
# and want the VHDL installed at a system level, just cut out the
# vhdl|vhd: lines to put in your vgrindefs directory.
#
# This version also assumes transcript (licensed, commercial software).
# If you do not have this, you will most likely have to modify your TROFF
# bindings.
#
# 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.
##############################################################################
# set TROFF variable
if (! $?TROFF) then # if TROFF isn't set, assume local/ptroff with Courier
       setenv TROFF "/usr/local/bin/ptroff -F Courier"
else if ("$TROFF" =~ /usr/local/bin/ptroff) then # if ptroff & no font, use Courier
       setenv TROFF "/usr/local/bin/ptroff -F Courier"
endif
# handle input arguments
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

(if ($argv[$#argv] =~ */*) cd $argv[$#argv]:h;\
 /usr/ucb/vgrind -s7 -lvhdl -d $n $argv[$num] $argv[$#argv]:t &)
exit
# end of what csh reads, beginning of what vgrind reads

vhdl|vhd:\
        :pb=(^\d?(entity|architecture|configuration|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:



Sat, 08 Mar 1997 22:25:09 GMT  
 Pretty Printer for VHDL
I have looked in the FAQ and remember sometime back some mention of a pretty
printer for VHDL.

I need a simple tool that will bold-face the VHDL keywords.

Any suggestions or tools?

Tom Tessier
Ball Real Time Imaging.

Please post.



Sun, 09 Mar 1997 02:44:42 GMT  
 Pretty Printer for VHDL

Quote:
>#!/usr/local/bin/perl
>#

># Mentor Graphics Corp.
># Distribute freely
>#
>require "shellwords.pl";
>#

We couldn't find shellwords.pl .  Is it supposed to be included or is it a file
that comes with the perl software?

Thanks

---
============================================       \         /
Russ W. De Hoedt        Phone:  319-395-3059        \   _   /        
Rockwell International  Fax:    319-395-4068 ________\_( )_/_________

============  ASICS - R - US  ==============           \_/          



Tue, 11 Mar 1997 03:24:26 GMT  
 Pretty Printer for VHDL
I copied this file, vhdl.vgrind ,  off of the news some time back:

---cut here---
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:
---cut here---

and use the following script to run it on machines (SunOS 4.1.3, man vgrind):

---cut here---
#! /bin/csh -f
# PRETTY_VHDL
setenv TROFF groff
if -e $1.vhd then
  vgrind -t -lvhdl -d vhdl.vgrind $1.vhd | lpr
else if -e $1 then
  vgrind -t -lvhdl -d vhdl.vgrind $1 | lpr
else
  echo ERROR: Cannot find $1.vhd or $1
endif
---cut here---

JLR
--
Julie Reilly            | Disclaimer:   The statements made here do not

                        |-----------------------------------------------------



Tue, 11 Mar 1997 08:17:31 GMT  
 Pretty Printer for VHDL

|> I have looked in the FAQ and remember sometime back some mention of a pretty
|> printer for VHDL.
|>
|> I need a simple tool that will bold-face the VHDL keywords.
|>
|> Any suggestions or tools?
|>
|> Tom Tessier
|> Ball Real Time Imaging.
|>
|> Please post.

I've had several requests for a repost, so here it is.

--
Thomas Rock

Mentor Graphics Corp.
Chicago ASIC Design Center


======================================== DESCRIPTION =======================================================

pprt - ASCII to postscript converter

syntax: pprt [switches] [files] [switches] [files] ...

        switches are:
        -c <#>            number of copies (default: 1)
        -i <filename>     include file
        -L <text> label string (default: filename)
        -l <text> sub-label string (default: time/date stamp)
        -s <#>            font size (default: landscape -> 7, portrait -> 10)
        -t <#>            tab size (default: 8)
        -help           print this message

        +/-b            enable/disable border printing (default: -)
        +/-f            enable/diable footer printing (default: -)
        +/-h            enable/diable header printing (default: +)
        +/-n            enable/disable line numbering (default: -)
        +/-P            enable/disable portrait orienatation (default: -)
        +/-p            enable/disable page numbering (default: +)
        +/-r            enable/disable number restarting between files (default: +)
        +/-w            enable/disable wide page (default: +)


        #<text>           bold any occurance of <text> (case sensitive)
        %<text>           italicize any occurance of <text> (case insensitive)
        ^<text>           italicize any occurance of <text> (case sensitive)

pprt converts the ASCII text in the specified files to postscript using the previously
defined switches and pipes the output to the default printer (using lp). Upon invocation,
pprt reads the default switches from the file ~/.pprt, if it exists, then applies all
command line switches.

Switches stay active for all files to be processed unless explicitly changed. For example:

     pprt +b -h file1 file2 -b file3

will print file1 and file2 with a border and without a header and file3 without both the
border and header.

The enable/disable switches (b,f,h,n,P,p,r,w) may be globbed
(i.e. -bf, +nP) since they do not require parameters. A description of all the command
line options follows:

-c <#>            --> Defines the number (#) of copies of each file to be printed

-i <filename>     --> specifies an options file to include. An options file contains
                    additional switches to be applied. One example use of the -i switch is
                    to automatically include directory specific switches. For example, if
                    have on directory of VHDL code and one of perl code, the default options
                    file (~/.pprt) could include: -i pprt_opts. Then, the VHDL and perl
                    directories could each have specifiec pprt_opts files for the language
                    specifiec options (such as keyword bolding). If <filename> does not
                    exist, pprt ignores the switch.

-L <text> --> Define a label for the printout. The label appears centered at the top of
                    each page. If <text> contains whitespace, it must be enclosed in quotes.
                    The default label is the filename.

-l <text> --> Define a sublabel for the printou. The sublabel appears in the upper-left
                    corner of each page. If <text> contains whitespace, it must be enclosed
                    in quotes. The default sublabel is a time/data stamp.

-s <#>            --> Define the font size. The default is 7 for landscape and 10 for portrait.

-t <#>            --> Define the tab spacing. The default is 8.

-help           --> Print the usage message.

+/-b            --> Enable/disable border printing. When in landscape mode (-p) and not
                    wide pages (-w), a separate border is placed around each half of the
                    page. The default is border disabled.

+/-f            --> Enable/diable footer printing. The footer shows the label in the lower
                    left corner. The default is footer printing disabled.

+/-h            --> Enable/diable header printing. The header shows the label and sublabel.
                    The default is header printing enabled.

+/-n            --> Enable/disable line numbering. When enabled, each line will be numbered
                    consecutively. The default is line numbering disabled.

+/-P            --> Enable/disable portrait orienatation. When disabled, files are printed
                    in landscape orientation. The default is portrait orientation disabled.

+/-p            --> Enable/disable page numbering. When enabled, the page number is printed
                    in the lower right corner of the page. The default is page numbering
                    enabled.

+/-r            --> Enable/disable number restarting between files. When disabled, page numbers
                    will not revert to 1 at the beginning of each file. The default is number
                    restarting enabled.

+/-w            --> Enable/disable wide page. When disabled and in landscape mode, files will be
                    printed in 2 columns on the page, effectively putting two pages of text on
                    one piece of paper. Switch is ignored in portrait mode (+P). The default is
                    wide page enabled.

                    it must be enclosed in quotes. Additionally, if specified on the command line,
                    some special character need to be enclosed in quotes such as the VHDL

#<text>           --> Bold any occurance of <text> matching the case exactly. If <text> contains
                    whitespace it must be enclosed in quotes. Additionally, if specified on the
                    command line, some special character need to be enclosed in quotes such as

                    % and ^.

%<text>           --> Italicize any occurance of <text> ignoring the case. If <text> contains whitespace,
                    it must be enclosed in quotes. Additionally, if specified on the command line,
                    some special character need to be enclosed in quotes such as the VHDL

^<text>           --> Italicize any occurance of <text> matching the case exactly. If <text> contains
                    whitespace it must be enclosed in quotes. Additionally, if specified on the
                    command line, some special character need to be enclosed in quotes such as

                    % and ^.

============================================== PERL SCRIPT ====================================================
#!/usr/local/bin/perl
#

# Mentor Graphics Corp.
# Distribute freely
#
require "shellwords.pl";

($width, $height, $lmargin, $smargin, $fontsize_l, $fontsize_p, $portrait_header, $landscape_header, $paper_adjust) = (8.50, 11.06, 0.65, 1.2, 6.85, 9.5, 0.29, 0.22, 0.12);
$pixels_inch = 72;
$numbering = 0;        
$restart_num = 1;
$copies = 1;
$landscape = 1;
$wide_page = 1;
$border = 0;            
$hdr = 1;
$footer = 0;
$page_numbering = 1;
$tab_size = 8;
$skip_column = 1;      
$numformat = '%-5d ';
$oblique = 1;          
$bold = 1;
undef($label);

$opts_file = $ENV{'HOME'} . "/.pprt";
if (open(OPTS_FILE, "< $opts_file")) {

        close(OPTS_FILE);


                $i = 0;

        }

Quote:
}

$i = 0;


        $twinpage = ($landscape && !$wide_page);
        $font_size = $landscape ? $fontsize_l : $fontsize_p unless ($font_size);
        $font_size *= $font_mag if ($font_mag);
        $sheet_height = ($height - $lmargin) * $pixels_inch;
        $sheet_width = ($width - $smargin) * $pixels_inch;
        $char_width = 0.6 * $font_size;
        $skip_column = 0 if ($numbering);
        ($header, $page_width, $page_height) =  $landscape ? ($landscape_header, $sheet_height, $sheet_width)
                                                                                                                   : ($portrait_header, $sheet_width, $sheet_height);
        $header_size = $hdr ? $header * $pixels_inch : 0;
        $linesperpage = (int(($page_height-$header_size)/($font_size * 1.1))) - 1;

        if (!$landscape || $wide_page) {
                $columnsperline = (int($page_width / $char_width)) - 1;
        } else {
                $page_height = ($height - ($lmargin * 5 / 3)) * $pixels_inch;
                $columnsperline = (int((int($page_height / 2)) / $char_width)) - 1;
        }

        if ($linesperpage <= 0 || $columnsperline <= 0) {
                die "Font %g too big !!\n", $font_size;
        }

        $arg = $ARGV[$i++];
        while ($file = <${arg}>) {
                unless (open(INFILE, "<$file")) {
                        print "Can't open $file, skipping it\n";
                        next arg_loop;
                }
                open (OUTFILE, "| lp");
# for file output, comment out previous line and uncomment next line
#               open (OUTFILE, "> temp.ps");
                select(OUTFILE);
                unless (defined($label)) {
                        $label = $file;
                }
                &print_file($file, $label);
                close(INFILE);
                print "\n%%Trailer\ncleanup\ndocsave restore end\n" if $header_is_printed;
                close(OUTFILE);
                select(STDOUT);
        }
        undef($header_is_printed);
        $sublabel = q#%month %mday 19%year %hour:%min#;

Quote:
}

############################################################

sub proc_opts {

                $switch = $_[$i++];
                if ($switch =~ /^-L/) {
                        $label = $_[$i++];
                        if ($label eq "") {
                                undef($label);
                        }
                } elsif ($switch =~/^-l/) {
                        $sublabel = $_[$i++];
                } elsif ($switch =~ /^-c/) {
                        $copies = $_[$i++];
                } elsif ($switch =~/^-s/) {
                        $font_size = $_[$i++];
                } elsif ($switch =~
...

read more »



Wed, 12 Mar 1997 02:16:26 GMT  
 Pretty Printer for VHDL

Quote:

>>#!/usr/local/bin/perl
>>#

>># Mentor Graphics Corp.
>># Distribute freely
>>#
>>require "shellwords.pl";
>>#
>We couldn't find shellwords.pl .  Is it supposed to be included or is it a file
>that comes with the perl software?
>Thanks
>---
>============================================       \         /
>Russ W. De Hoedt        Phone:  319-395-3059        \   _   /        
>Rockwell International  Fax:    319-395-4068 ________\_( )_/_________

>============  ASICS - R - US  ==============           \_/          

It's part of perl.
I'm using perl 4.0 and had no problems to get the pretty printer running.

Ciao, Hanjo
--
 Hansjoerg Toepfer               |     Tel.: +49-203-3792583
 University of Duisburg, FB9/DV  |     FAX : +49-203-370439
 Bismarckstr. 81                 |



Tue, 11 Mar 1997 19:59:34 GMT  
 Pretty Printer for VHDL

|>
|> Yes, please!! I'd love a copy!
|>
|> It might be easier for all concerned, in fact, if you posted the perl script,
|> unless Mentor has some policy against it, etc etc.
|>
|> Tnx,
|> dave
|>
|> --
|>

I posted the script 2 days ago (9/21). If you need a repost, let me know.

--

Thomas Rock

Mentor Graphics Corp.
Chicago ASIC Design Center




Tue, 11 Mar 1997 20:18:09 GMT  
 Pretty Printer for VHDL

Quote:

>>I have looked in the FAQ and remember sometime back some mention of a pretty
>>printer for VHDL.

>>I need a simple tool that will bold-face the VHDL keywords.

>>Any suggestions or tools?

>>Tom Tessier
>>Ball Real Time Imaging.
>>Please post.

>If you want bold-face and italics output in Postscript format,
>I've used the VHDL pretty printer available at:

>   ftp: VHDL.ORG
>   dir: /vi/vug_bbs/bbs/vhdl_sta.sha

I've received several inquiries about this tool for DOS (the above
source uses some UNIX shell scripts). I have a ported DOS executable
with a batch file that I can e-mail to anyone that needs it.

--

DAINA Engineering 612/781-7600      
4111 Central AVE NE, Suite 212      
Minneapolis, MN  55421-2953          



Thu, 13 Mar 1997 20:23:46 GMT  
 Pretty Printer for VHDL
Hi again,

   After some users tried out my pprt program, a suggestion was made (hi George!) to
give the program the capability to italicize or bold ranges of text such as VHDL
comments, rather than just keywords or symbols such as PROCESS. After much brain
cell burning over the weekend, I decided to use the perl regular expression syntax
to specify the ranges of text. Perl regular expressions are used for text pattern
matching.

   I then looked into the pprt code to determine the difficulty of this change. Well,
it turns out the code is like Campbell's soup - it's already in there. I use
regular expressions to determine if a line of code contains a user specified keyword.
These keywords, therefore, are actually simple regular expressions. So, to bold all VDHL
comments, you only need to specify the following:


This says to bold all text starting from the VHDL comment indicator (--) to the end
of the line ($). The .* indicates 0 or more of any character except a newline. These
same regular expressions can be used to bold or italicize virtually any pattern of
text you desire.

The following is an excerpt from "Programming Perl" which does a fair job of
explaining regular expressions.

Happy Hacking,

--
Thomas Rock

Mentor Graphics Corp.
Chicago ASIC Design Center


-----------------------------------------------------------------------------------------------------------
Perl regular expressions: (from "Programming Perl" - a.k.a. The Camel Book)

The patterns used in the pattern matching and substitution operators are
regular expressions similar to those used by the UNIX egrep program. They
work like this:

   - A regular expression matches a string if any of the alternatives of the
     regular expression match. Alternatives are separated by the |
     character, and are always evaluated left-to-right, stopping on the
     first complete match.

   - An alternative matches if every item in the alternative matches in the
     order the items occur.

   - An item consists of either an assertion or a quantified atom.
     Assertions are:

       ^   - matches the beginning of the line
       $   - matches the end of the line
       \b  - matches on a word boundary
       \B  - matches on a non-word boundary

   - A quantified atom consists of one of the atoms listed below followed
     by a quantifier, which indicates how many times the atom must or may
     occur. If there is no quantifier, the atom must occur exactly once.
     Quantifiers are:

       {n,m}  - must occur at least n times but no more than m times
       {n,}   - must occur at least n times
       {n}    - must occur exactly n times
       *      - must occur 0 or more times
       +      - must occur 1 or more times
       ?      - must occur 0 or 1 time

Legal atoms are:

   - A regualr expression in parenthesis matches whatever the regular
     expression matches

   - A . (dot) matches any character except \n

   - A list of characters in square brackets matches one of a class of
     characters. A caret at the front of the list negates the class.
     Character ranges may be indicated using a-z notation.

   - A backslashed letter matches a special character or character class:

        \n   - newline
        \r   - carriage return
        \t   - tab
        \f   - form feed
        \d   - a digit (same as [0-9])
        \D   - a non-digit
        \w   - a word character (alphanumeric), same as [0-9a-z_A-Z]
        \W   - a non-word character
        \s   - a whitespace character, same as [\t\n\r\f]
        \S   - a non-whitespace character

   - A backslashed single digit number matches whatever the corresponding
     parenthesis actually matched (except \0 matches a null character). This
     is called a backreference to a substring. (example ab(cd)\1 matches
     the string abcdcd).

   - A backslashed 2 or 3 digit octal number such as \033 matches the
     character with the specified value.

   - A backslashed x followed by 2 hexadecimal digits, such as \x7f, matches
     the character having that hexadecimal value.

   - A backslashed c followed by a single character, such as \cD, matches
     the corresponding control character.

   - Any other backslashed character matches that character.

   - Any character not mentioned above matches itself.

Examples:

   \/\*.*\*\/     - matches C-type comments: /* (text) */
   .*=.*          - matches any line with an equals (=) in it
   \b.*[qxz].*\b  - matches any word with a q, x, or z in it
   ^\s.*$         - matches any line that starts with whitespace



Fri, 14 Mar 1997 21:18:24 GMT  
 Pretty Printer for VHDL
Although this does not classify as a pretty-printer, you may find it
useful: it imports source code into FrameMaker while preserving
the layout and putting keywords in bold and comments in italics.

Handles not only VHDL but also Verilog, ADA, C, C++, LISP, sh, etc...
Easily extendable to other languages (see comments).

Isn't PERL wonderful ? The hacker's dictionary rightly defines it as
"The Swiss Army Chainsaw for UNIX".

#! /bin/sh
# This is a shell archive.  Remove anything before this line, then feed it
# into a shell via "sh file" or similar.  To overwrite existing files,
# type "sh file -c".
# The tool that generated this appeared in the comp.sources.unix newsgroup;

# If this archive is complete, you will see the following message at the end:
#               "End of shell archive."
# Contents:  prog2mif.1 prog2mif.pl

PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'prog2mif.1' -a "${1}" != "-c" ; then
  echo shar: Will not clobber existing file \"'prog2mif.1'\"
else
echo shar: Extracting \"'prog2mif.1'\" \(2471 characters\)
sed "s/^X//" >'prog2mif.1' <<'END_OF_FILE'
X.\"        ************************************************
X.\"        *DO NOT FORGET TO REMOVE DEFINITIONS FOR PROTEL*
X.\"        ************************************************
X.\"
X.TH prog2mif 1
X.SH NAME
Xprog2mif \- Process source files for insertion in FrameMaker
X.SH SYNOPSIS
X.nf
X\fIprog2mif\fP [options] [filename]
X.fi
X.SH DESCRIPTION
X\fIprog2mif\fP reads a file containing source code and produces
Xa MIF file suitable for insertion (import) in FrameMaker.
XAll reserved keywords of the source language are highlighted and line-comments
Xare italicized (but not block comments).
X.LP
XThe list of known filename extension and associated languages are:
X.nf
X.sp
X       ada, a                          ADA
X       c, h                            C
X       C, H, cxx, hxx, cpp, hpp        C++
X       l, el                           Lisp
X       m                               Objective C
X       pl, perl                        PERL
X       protdms                         PROTEL
X       sh                              Bourne Shell
X       v                               VERILOG
X       vhdl, vhd                       VHDL
X.fi
X.SH OPTIONS
X.IP -h
XPrint a short usage message.
X.IP -l language
XDo not select language based on the filename extension.
XUse the specified language instead.
XThe language `none' can be specified if not textual enhancing
X(like bold or italic characters) are to be used,
Xonly the layout maintained.
XIf the specified language is not known, a list of all known language
Xis printed.
XThis option is required when processing from stdin.
X.IP -n digits
XPrefix each line with a line number.
XThe line number is prefixed with '0's to occupy the specified
Xminimum number of digits.
XA fixed-width numbering is required to keep the original layout
Xof the source code.
XUse "-n 1" if a variable-width numbering is prefered.
X.SH WISHLIST
X.IP o
XHave a user-specified configuration to easily add new languages and
Xfilename extensions without having to modify the source.
X.IP o
XHandling of start/end and multi-line comments (a la /*.. */)
X.IP o
XHandling of quoted text
X.SH BUGS
X.IP o
XReserved keywords are highlighted inside C-style comments,
Xpre-processor directives and strings.
X.IP o
XThe definitions for PROTEL are omitted from the public distribution.
X.SH "AUTHOR"
X.nf

X
XBased on prog2mif.c written by:

X
XIdeas, enhancements and bug fixes contributed by many helpful users.
XSee the source code for proper attribution.
X.fi

END_OF_FILE
echo shar: NEWLINE appended to \"'prog2mif.1'\"
if test 2472 -ne `wc -c <'prog2mif.1'`; then
    echo shar: \"'prog2mif.1'\" unpacked with wrong size!
fi
chmod +x 'prog2mif.1'
# end of 'prog2mif.1'
fi
if test -f 'prog2mif.pl' -a "${1}" != "-c" ; then
  echo shar: Will not clobber existing file \"'prog2mif.pl'\"
else
echo shar: Extracting \"'prog2mif.pl'\" \(13994 characters\)
sed "s/^X//" >'prog2mif.pl' <<'END_OF_FILE'
X#! /bnr/contrib/bin/perl
X#
X# CHANGE THE PATH ABOVE TO MATCH PATH TO YOUR PERL BINARY
X#
X
X#
X# Preprocess program source for inclusion in FrameMaker documents
X#
X#                          Version 1.7.6
X#

X#
X# Author: Janick Bergeron
X#         Bell-Northern Research, Ottawa, Canada

X#
X# Revision History:
X#
X# 1.6 -> 1.7
X#





X#        [Not included in public distribution]
X# (.5) + Fixed problem with empty line comments

X#
X# 1.5 -> 1.6
X#

X# + Changed order of languages to alphabetical order
X# + More editorial changes on long lines

X# (.2) + Added definitions for Bourne shell (Thanks to

X#
X# 1.4 -> 1.5
X#
X# + Definitions for C++
X# + (.1) Fixed small syntax error in keyword array
X# + (.1) Editorial changes to avoid long lines wrapping around when
X#        posting the shar file
X# + (.2) Fixed typo on escape sequences in comments (Thanks to

X#
X# 1.3 -> 1.4
X#
X# + Fixed problem with keywords not being emboldened when preceeded

X# + Allow input to come from stdin
X# + Argument to '-l' option is case insensitive
X# + Keywords in language can be case-sensitive

X# + Definitions for PERL

X#
X# Wishlist:
X#
X# + Handling of multi-line and block comments (e.g. /* ... */)
X# + Handling of quoted text (has to specify escape and continuation
X#   mechanism for each language... yuk!)
X# + A 32ft sailboat
X#
X
Xrequire "getopts.pl";
X
X#
X# Beginning of language definition section
X#
X# To define a new language, please add all the relevant information
X# in each section.
X#
X
X# Map filename extension to programming language
X#
X%language = (
X
X  "a",       "ADA",
X  "ada",     "ADA",
X  "c",       "C",
X  "h",       "C",
X  "C",       "C++",
X  "H",       "C++",
X  "cxx",     "C++",
X  "hxx",     "C++",
X  "cpp",     "C++",
X  "hpp",     "C++",
X  "l",       "LISP",
X  "el",      "LISP",
X  "m",       "OBJC",
X  "pl",      "PERL",
X  "perl",    "PERL",
X  "sh",      "SH",
X  "v",       "VERILOG",
X  "vhd",     "VHDL",
X  "vhdl",    "VHDL");
X
X# Reserved words for certain languages
X#
X# Format:  Key   ::= Language name
X#          Value ::= keyword{:keyword}
X#
X%keywords = (
X
X  "ADA", "abort:abs:accept:access:all:and:array:at:begin:body:".
X         "case:constant:declare:delay:delta:digits:do:else:elsif:".
X         "end:entry:exception:exit:for:function:generic:goto:if:".
X         "in:is:limited:loop:mod:new:not:null:of:or:others:out:".
X         "package:pragma:private:procedure:raise:range:record:rem:".
X         "renames:return:reverse:select:separate:subtype:task:".
X         "terminate:then:type:use:when:while:with:xor",
X
X  "C", "key word:auto:break:case:char:const:continue:default:do:double:else:".
X       "enum:entry:extern:for:float:goto:if:int:long:register:".
X       "return:short:signed:sizeof:static:struct:switch:typedef:".
X       "union:unsigned:void:volatile:while:".
X       "define:else:endif:if:ifdef:ifndef:import:include:undef:",
X
X  "C++", "asm:auto:break:case:catch:char:class:const:continue:".
X         "default:delete:do:double:else:enum:extern:for:float:".
X         "friend:goto:if:inline:int:long:new:operator:private:".
X         "protected:public:register:return:short:signed:sizeof:".
X         "static:struct:switch:template:this:throw:try:typedef:".
X         "union:unsigned:virtual:void:volatile:while:".
X         "define:else:endif:if:ifdef:ifndef:import:include:undef:",
X
X "LISP", "append:ascii:assoc:defun:setq:cond:while:foreach:t:nil:".
X         "car:cdr:caar:cadr:cdar:cddr:character-index:concat:cons:".
X         "explode:exploden:get_pname:implode:last:list:member:nth:".
X         "nthcdr:nthchar:quote:reverse:strcomp:stringp:strlen:strpad:".
X         "strtrim:subst:substring:toupper:tolower:type:remove:remq:".
X         "abs:acos:asin:atan:cos:exp:expt:fact:fix:float:log:log10:".
X         "lsh:max:min:mod:random:sin:sqrt:times:product:add:sum:plus:".
X         "diff:difference:quotient:alphalessp:arrayp:atom:and:set:".
X         "boundp:eq:equal:evenp:fixp:floatp:greaterp:hunkp:lessp:".
X         "listp:minusp:not:null:numberp:numbp:or:oddp:plusp:portp:".
X         "fileopen:close:readln:readc:read:print:princ:get:plist:".
X         "putprop:setplist",
X
X "OBJC",  "asm:auto:break:case:char:const:continue:default:do:".
X          "double:else:enum:extern:float:for:fortran:goto:if:int:".
X          "long:register:return:short:signed:sizeof:static:struct:".
X          "switch:typedef:union:unsigned:void:volatile:while".
X          "define:else:endif:if:ifdef:ifndef:import:include:undef:".
X         "defs:encode:end:implementation:interface:public:selector:".
X         "id:self:super",
X
X  "PERL", "accept:alarm:atan2:bind:binmode:caller:chdir:chmod:".
X          "chop:chown:chroot:close:closedir:cmp:connect:continue:".
X          "cos:crypt:dbmclose:dbmopen:defined:delete:die:do:dump:".
X          "each:else:elsif:endgrent:endhostent:endnetent:endpent:".
X        
...

read more »



Sat, 15 Mar 1997 02:47:54 GMT  
 
 [ 11 post ] 

 Relevant Pages 

1. Pretty Printer for VHDL

2. Pretty-printer for VHDL ?

3. vhdl pretty printer for win NT/95/ msdos

4. VHDL Pretty printer update

5. VHDL Pretty Printer

6. the final VHDL pretty printer

7. More VHDL Pretty Printer

8. Help with VHDL pretty printer

9. Anyone know of a VHDL Pretty-Printer?

10. MVP - Make VHDL Pretty - VHDL Prettifier

11. SQL pretty printer in Smalltalk

12. help: code-generation / pretty-printer

 

 
Powered by phpBB® Forum Software