comp.lang.ada
 help / color / mirror / Atom feed
* Ada PostScript Pretty printer?
@ 1994-12-01 19:47 Tony Leavitt
  1994-12-02  0:09 ` David Weller
       [not found] ` <3bn9f6$8hl@cliffy.lfwc.lockheed.com>
  0 siblings, 2 replies; 5+ messages in thread
From: Tony Leavitt @ 1994-12-01 19:47 UTC (permalink / raw)


Does anybody know of a publicly available piece of software that will generate
a PostScript file of pretty Ada code.  What I mean pretty Ada code is that
resevred words are in bold and comments are in italics.  I do NOT want a
reformatter and autoindenter or anything like that.

TIA,

-- 

Tony Leavitt

Lockheed Aeronautical Systems Company
Marietta,  GA 30063-0670

Voice: 404-494-7648
Fax:   404-494-6989
Email: tony@gelac.lasc.lockheed.com



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Ada PostScript Pretty printer?
  1994-12-01 19:47 Ada PostScript Pretty printer? Tony Leavitt
@ 1994-12-02  0:09 ` David Weller
  1994-12-02 10:05   ` Rolf Ebert
       [not found] ` <3bn9f6$8hl@cliffy.lfwc.lockheed.com>
  1 sibling, 1 reply; 5+ messages in thread
From: David Weller @ 1994-12-02  0:09 UTC (permalink / raw)


In article <3bl980$jvs@pong.lasc.lockheed.com>,
Tony Leavitt <tony@deepthought.Sgi.COM> wrote:
>Does anybody know of a publicly available piece of software that will generate
>a PostScript file of pretty Ada code.  What I mean pretty Ada code is that
>resevred words are in bold and comments are in italics.  I do NOT want a
>reformatter and autoindenter or anything like that.
>

Why not just jam the source through vgrind, then pipe it through
psprint (or some other wild script, like mine here):

	vgrind -d <vgrind_defs_file> -lada -o1- -t -w $* | thack | lpr

Oh, here's the vgrind_defs_file I use:
# Originally submitted from Fraser Wilson
# Ada!
ada|Ada:\
	:cb=--:ce=$:bb=if|case|begin|loop:be=end:lb=':le=':oc:\
	:pb=(^\d?(procedure|function|package|package body))\d\p:\
	:sb=":se=":id=_.:\
	:kw=abort abs abstract accept access aliased all and array at\
	begin body case constant declare delay delta digits do else\
	elsif end entry exception exit for function generic goto if in is\
	limited loop mod new not null of or others out package pragma\
	private procedure protected raise range record rem renames requeue\
	return reverse select separate subtype tagged task terminate then\
	type until use when while with xor:



-- 
Proud (and vocal) member of Team Ada! (and Team OS/2)        ||This is not your
   	      Ada -- Very Cool.  Doesn't Suck.               ||  father's Ada 
For all sorts of interesting Ada tidbits, run the command:   ||________________
"finger dweller@starbase.neosoft.com | more" (or e-mail with "finger" as subj.)
	|"Quitting C++ isn't so difficult, provided you show as much |
	|	persistence stopping as you did starting." dweller   |



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Ada PostScript Pretty printer?
  1994-12-02  0:09 ` David Weller
@ 1994-12-02 10:05   ` Rolf Ebert
  1994-12-03  4:27     ` David Weller
  0 siblings, 1 reply; 5+ messages in thread
From: Rolf Ebert @ 1994-12-02 10:05 UTC (permalink / raw)




David> In article <3bl980$jvs@pong.lasc.lockheed.com>, Tony Leavitt
David> <tony@deepthought.Sgi.COM> wrote:
>> Does anybody know of a publicly available piece of software that
>> will generate a PostScript file of pretty Ada code.  What I mean
>> pretty Ada code is that resevred words are in bold and comments
>> are in italics.  I do NOT want a reformatter and autoindenter or
>> anything like that.
>> 

David> Why not just jam the source through vgrind, then pipe it
David> through psprint (or some other wild script, like mine here):

[David's vgrind script and famous signature deleted]

Here is another commercial for Emacs:

If you use the new Ada Mode for GNU Emacs (available at
ftp://cs.nyu.edu/pub/gnat; soon to be updated), go and get the package
ps-print.el from any emacs archive
(e.g. ftp://archive.cis.ohio-state.edu/pub/gnu/emacs/elisp-archive/) 

With this package you can print your code as you see it on the screen,
say with bold keywords and italic comments.

	Rolf

--
Rolf Ebert			Beratung fuer Energiesysteme und Informatik
Erich Kaestner Str. 17               Conseil en Energetique et Informatique
D - 80797 Muenchen        (Team Ada)               Tel.: +49-89-30.77.88.00
Germany                                            Fax.: +49-89-30.77.91.00
-- 
Rolf Ebert			Beratung fuer Energiesysteme und Informatik
Erich Kaestner Str. 17               Conseil en Energetique et Informatique
D - 80797 Muenchen        (Team Ada)               Tel.: +49-89-30.77.88.00
Germany                                            Fax.: +49-89-30.77.91.00



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Ada formatter for MS-Word
       [not found] ` <3bn9f6$8hl@cliffy.lfwc.lockheed.com>
@ 1994-12-02 14:55   ` David Emery
  0 siblings, 0 replies; 5+ messages in thread
From: David Emery @ 1994-12-02 14:55 UTC (permalink / raw)


Here are two files for C and Lex.  Run the second through Lex, and
then compile with the first.  Pipe Ada code into the result, and out
comes marked-up Ada in RTF format.  Then you can run this through your
favorite RTF translator (we use MS-Word), and print away...  Reserved
words are in lower-case, bold font.  Comments are in italics.  The
default font is Courier.  It's important to use a fixed-width font.
If you want to modify this, see hilite() and OTHERCMT.  

VERY IMPORTANT:  To get the newsreader to accept this, the header
string was 'broken' into multiple lines.  This should be a single
string, with no line feeds.  Make this change BEFORE compiling!

No warranty, express or implied...

				dave

p.s. The derivation history on this:  The 'root' is Herm Fisher's
Ada Lex/Yacc grammar.  Next came a tool Steve Rosen and I developed at
Siemens to do Scribe mark-up, which I subsequently adapted for RTF.  
------------------------------------------------------------------------
main()
{
char *header = "{\\rtf1\\mac\\deff2 {\\fonttbl{\\f0\\fswiss
Chicago;}{\\f3\\fswiss Geneva;}{\\f4\\fmodern Monaco;}{\\f16\\fnil
Palatino;}{\\f20\\froman Times;}{\\f21\\fswiss
Helvetica;}{\\f22\\fmodern Courier;}{\\f23\\ftech Symbol;}{\\f33\\fnil
Avant Garde;}{\\f200\\fnil MitreLogo;}\\015{\\f201\\fnil
MitreSymbol;}}{\\colortbl\\red0\\green0\\blue0;\\red0\\green0\\blue255;\\red0\\green255\\blue255;\\red0\\green255\\blue0;\\red255\\green0\\blue255;\\red255\\green0\\blue0;\\red255\\green255\\blue0;\\red255\\green255\\blue255;}{\\stylesheet{\\s224\\tx360
\\b\\v\\f20\\fs20 \\015\\sbasedon0\\snext0
PostScript;}{\\s225\\li5760\\ri720\\tldot\\tx8280\\tqr\\tx8640 \\f20
\\sbasedon0\\snext0 toc 9;}{\\s226\\tx540\\tqr\\tx9000 \\f20
\\sbasedon228\\snext0 toc 8;}{\\s227\\sa240\\tx540\\tqr\\tx9000 \\f20
\\sbasedon229\\snext0 toc 7;}{\\s228\\sl260\\tx540\\tqr\\tx9000
\\015\\f20 \\sbasedon0\\snext0 toc
6;}{\\s229\\sa240\\tx540\\tqr\\tx9000 \\f20 \\sbasedon0\\snext0 toc
5;}{\\s230\\li1800\\tx2520\\tqr\\tx8820\\tqr\\tx9000 \\f20
\\sbasedon231\\snext0 toc
4;}{\\s231\\li1080\\sl260\\tx1800\\tqr\\tx8820\\tqr\\tx9000 \\f20
\\sbasedon232\\snext0 toc
3;}{\\015\\s232\\li360\\sl260\\tx1080\\tqr\\tx8820\\tqr\\tx9000 \\f20
\\sbasedon233\\snext0 toc
2;}{\\s233\\sa240\\sl260\\tqr\\tx8820\\tqr\\tx9000 \\f20
\\sbasedon0\\snext0 toc 1;}{\\s234\\li2160\\tx360 \\f20
\\sbasedon0\\snext0 index 7;}{\\s235\\li1800\\tx360 \\f20
\\sbasedon0\\snext0 index 6;}{\\015\\s236\\li1440\\tx360 \\f20
\\sbasedon0\\snext0 index 5;}{\\s237\\li1080\\tx360 \\f20
\\sbasedon0\\snext0 index 4;}{\\s238\\li720\\tx360 \\f20
\\sbasedon0\\snext0 index 3;}{\\s239\\li360\\tx360 \\f20
\\sbasedon0\\snext0 index 2;}{\\s240\\tx360 \\f20 \\sbasedon0\\snext0
index 1;}{\\015\\s241\\tx360 \\f20 \\sbasedon0\\snext0 line
number;}{\\s242\\tx360 \\f20 \\sbasedon0\\snext0 page
number;}{\\s243\\qc\\tx360 \\f20 \\sbasedon0\\snext243
footer;}{\\s244\\tqc\\tx4320\\tqr\\tx8640 \\f20 \\sbasedon0\\snext0
header;}{\\s245\\tx360 \\f20\\fs18\\up6 \\sbasedon0\\snext0
\\015footnote reference;}{\\s246\\fi-360\\li360\\sa240\\sl260\\tx360
\\f20 \\sbasedon0\\snext246 footnote text;}{\\s247\\li720\\tx360
\\i\\f20\\fs20 \\sbasedon0\\snext0 heading 9;}{\\s248\\qc\\tx360 \\f20
\\sbasedon0\\snext0 heading 8,Two Line Table
Caption;}{\\s249\\qc\\sa480\\tx360 \\015\\f20 \\sbasedon0\\snext0
heading 7,Table Caption;}{\\s250\\qc\\sl260\\tx360 \\f20
\\sbasedon251\\snext0 heading 6,Two Line Figure
Caption;}{\\s251\\qc\\sb480\\sl260\\tx360 \\f20 \\sbasedon0\\snext0
heading 5,Figure Caption;}{\\s252\\li360\\sa240\\keepn\\tx360 \\b\\f20
\\015\\sbasedon0\\snext0 heading 4,Level 3
Heading;}{\\s253\\sa240\\keepn\\tx360 \\b\\f20 \\sbasedon0\\snext0
heading 3,Level 2 Heading;}{\\s254\\sa240\\keepn\\tx360 \\b\\caps\\f20
\\sbasedon0\\snext0 heading 2,Level 1
Heading;}{\\s255\\qc\\sa480\\keepn\\tx360 \\b\\caps\\f20
\\015\\sbasedon0\\snext0 heading 1,Section Title;}{\\tx360 \\f20
\\sbasedon222\\snext0 Normal,Font: Times 12 Point,Flush
left;}{\\s1\\sa240\\keepn\\tx360 \\b\\caps\\f20 \\sbasedon0\\snext0
Appendix Level 1 Heading;}{\\s2\\sa240\\keepn\\tx360 \\b\\f20
\\sbasedon0\\snext0 \\015Appendix Level 2
Heading;}{\\s3\\li360\\sa240\\keepn\\tx360 \\b\\f20
\\sbasedon0\\snext0 Appendix Level 3 Heading;}{\\s4\\tx360 \\f20
\\sbasedon0\\snext4 Distribution List ;}{\\s5\\sa240\\keepn\\tx360
\\b\\caps\\f20 \\sbasedon0\\snext0 Executive Summary Level 1
Heading;}{\\015\\s6\\sa240\\keepn\\tx360 \\b\\f20 \\sbasedon0\\snext0
Executive Summary Level 2 Heading;}{\\s7\\li360\\sa240\\keepn\\tx360
\\b\\f20 \\sbasedon0\\snext0 Executive Summary Level 3
Heading;}{\\s8\\sa240\\sl260\\tx360\\tqr\\tx9000 \\b\\caps\\f20
\\sbasedon0\\snext0 \\015Figure/Table/TOC
Headings;}{\\s9\\qc\\ri29\\sa480\\sl260\\tx360 \\b\\caps\\f20
\\sbasedon0\\snext0 Front Matter
Headings;}{\\s10\\fi-1080\\li1080\\tx360 \\f20 \\sbasedon0\\snext10
Glossary ;}{\\s11\\fi-360\\li360\\tx360 \\f20 \\sbasedon0\\snext11
Glossary (Long Terms);}{\\015\\s12\\fi-540\\li900\\tx360 \\f20
\\sbasedon0\\snext12 List - First Level;}{\\s13\\fi-540\\li1440\\tx360
\\f20 \\sbasedon0\\snext13 List - Second Level;}{\\s14\\tx360 \\f20
\\sbasedon0\\snext14 Name/Date Reference
;}{\\s15\\fi-360\\li360\\tx360 \\f20 \\sbasedon0\\snext15
\\015Numbered Reference ;}{\\s16\\li360 \\f20 \\sbasedon0\\snext16
Quotation;}{\\s17\\qc\\ri29\\sa240\\sl260\\keepn\\tx360 \\b\\caps\\f20
\\sbasedon0\\snext0 Section Number
Heading;}}\\margl1620\\margr1620\\margt2160\\margb2160\\ftnbj \\sectd
\\015\\pgnrestart\\linemod0\\linex0\\footery1080\\cols1\\endnhere
\\pard\\plain \\tx360 \\f20 ";

        printf("%s", header);
	yylex();
	printf("}");
}
yywrap()
{
  return (1);
}
------------------------------------------------------------------------
/*  modified from:  */
/*------------------------------------------------------------------------*/
/* Lexical input for LEX for LALR(1) Grammar for ANSI Ada                 */
/*                                                                        */
/*              Herman Fischer                                            */
/*            Litton Data Systems                                         */
/*              March 26, 1984                                            */
/*                                                                        */
/*------------------------------------------------------------------------*/
	int	my_start   = 0; /* indicates that it's startup time       */
	int	ignore_next_subprog = 0;  /* when in a generic parameter  */
					  /* declaration, indicates that  */
					  /* the next subprogram is a     */
					  /* formal parameter, and not    */
					  /* the actual generic thing.    */
	int	funct_defn = 0;  /* indicates that this return is part    */
				 /* of a function declaration, and should */
				 /* not be capitalized			  */ 
	char	class[20];
	int	do_index = 1;	/* 1 if indexing wanted, 0 otherwise	  */
#include "stdio.h"
#include "ctype.h"
%}

%e      3500  /* tree nodes array size    */
%p      9500  /* positions                */
%a      10000  /* transitions array size   */
%k      500   /* packed character classes */
%o      10000  /* output array size        */
%n	2000   /* states ?!		  */

%START IDENT Z COMMENT OTHERCMT PRAGMA KEEPNAME GENERICSPEC

%%
 	{BEGIN Z;}
<Z,IDENT>(ABORT|abort)|(ABS|abs)|(ACCEPT|accept)|(ACCESS|access)	|
<Z,IDENT>(ALL|all)|(AND|and)|(ARRAY|array)|(AT|at)			|
<Z,IDENT>(BEGIN|begin)|(BODY|body)|(CASE|case)|(CONSTANT|constant)	|
<Z,IDENT>(DECLARE|declare)|(DELAY|delay)|(DELTA|delta)|(DIGITS|digits)	|
<Z,IDENT>(DO|do)|(ELSE|else)|(ELSIF|elsif)|(END|end)|(ENTRY|entry)	|
<Z,IDENT>(EXCEPTION|exception)|(FOR|for)				|
<Z,IDENT>(IF|if)|(IN|in)|(IS|is)|(LIMITED|limited)|(LOOP|loop)		|
<Z,IDENT>(MOD|mod)|(NEW|new)|(NOT|not)|(NULL|null)|(OF|of)|(OR|or)	|
<Z,IDENT>(OTHERS|others)|(OUT|out)|(PRIVATE|private)			|
<Z,IDENT>(RANGE|range)|(RECORD|record)|(REM|rem)			|
<Z,IDENT>(RENAMES|renames)|(REVERSE|reverse)				|
<Z,IDENT>(SELECT|select)|(SEPARATE|separate)				|
<Z,IDENT>(TERMINATE|terminate)|(THEN|then)|(USE|use)			|
<Z,IDENT>(WHEN|when)|(WHILE|while)|(XOR|xor)				{
			MAKELOWER(yytext); hilite(yytext); BEGIN Z;	}

<Z,IDENT>(WITH|with)							{
			MAKELOWER(yytext); hilite(yytext);
			BEGIN Z;					}


<Z,IDENT>(GOTO|goto)|(EXIT|exit)|(RAISE|raise)				{
			MAKELOWER(yytext); hilite(yytext); BEGIN Z;	}

<Z,IDENT>(RETURN|return)						{
			MAKELOWER(yytext); hilite(yytext); BEGIN Z;	}

<Z,IDENT>("=>")|("..")|("**")|(":=")|("/=")|(">=")|("<=")|("<<")	|
<Z,IDENT>(">>")|("<>")|("&")|("(")|("*")|("+")|(",")|("-")|(".")	|
<Z,IDENT>("/")|(":")|(";")|("<")|("=")|(">")|("|")			{
						ECHO; BEGIN Z;		}

<Z,IDENT>")"     		{ECHO; BEGIN IDENT;}

<Z,IDENT>(PRAGMA|pragma)	{
				MAKELOWER(yytext);
				hilite(yytext);
				BEGIN PRAGMA;
				}


<PRAGMA>.			{
				unput(yytext[0]);
				BEGIN Z;
				}

<Z,IDENT>TYPE|type		|
<Z,IDENT>SUBTYPE|subtype	|
<Z,IDENT>TASK|task		|
<Z,IDENT>(PROCEDURE|procedure)	|
<Z,IDENT>(PACKAGE|package) 	{
				MAKELOWER(yytext);
				hilite(yytext); 
				BEGIN Z;}


<Z,IDENT>(FUNCTION|function)	{
				MAKELOWER(yytext);
				hilite(yytext); 
				BEGIN Z;}


<KEEPNAME>[a-zA-Z][a-z_A-Z0-9]*       {ECHO;BEGIN Z;}


<Z,IDENT>(GENERIC|generic)	{
				MAKELOWER(yytext); hilite(yytext); 
				BEGIN GENERICSPEC;}

<GENERICSPEC>(WITH|with)						{
				MAKELOWER(yytext); hilite(yytext);
				}

<GENERICSPEC>(PROCEDURE|procedure)|(FUNCTION|function)			{
				MAKELOWER(yytext); hilite(yytext);
									}

<GENERICSPEC>(PACKAGE|package)						{
				MAKELOWER(yytext); hilite(yytext);
				BEGIN Z;}


<GENERICSPEC>(ACCESS|access)|(ARRAY|array)|(CONSTANT|constant)		|
<GENERICSPEC>(DELTA|delta)|(DIGITS|digits)|(IN|in)|(IS|is)		|
<GENERICSPEC>(LIMITED|limited)|(OF|of)|(OTHERS|others)|(OUT|out)	|
<GENERICSPEC>(PRIVATE|private)|(RANGE|range)|(RETURN|return)		|
<GENERICSPEC>(SUBTYPE|subtype)|(TYPE|type)				{
				MAKELOWER(yytext); hilite(yytext);	}

<GENERICSPEC>[a-zA-Z][a-z_A-Z0-9]*	{ECHO;}

<GENERICSPEC>.				{ECHO;}


<IDENT>\'  {ECHO; BEGIN Z;}   /* type mark only */

<Z,IDENT>[a-zA-Z][a-z_A-Z0-9]*       {ECHO; BEGIN IDENT; }

<Z,IDENT>[0-9][0-9_]*([.][0-9_]+)?([Ee][-+]?[0-9_]+)?  {
						         ECHO; BEGIN Z; }

<Z,IDENT>[0-9][0-9_]*#[0-9a-fA-F_]+([.][0-9a-fA-F_]+)?#([Ee][-+]?[0-9_]+)? {
			      ECHO; BEGIN Z; }

<Z,IDENT>\"([^\"]*(\"\")*)*\" {ECHO; BEGIN Z; }

<Z>\'([^\']|\'\')\'    {ECHO; BEGIN Z; }

<Z,IDENT,PRAGMA,KEEPNAME,GENERICSPEC>[" "|"\t"]		{ECHO;}    /* ignore spaces and tabs */

<Z,IDENT>.       {ECHO; printf("?? lexical error [%s] ??\n(@\\)", yytext);}

<Z,IDENT,PRAGMA,KEEPNAME,GENERICSPEC>"--"([" "|"\t"]*)	{ECHO; BEGIN COMMENT;}

<Z,IDENT,PRAGMA,KEEPNAME,GENERICSPEC>[\n]	{printf("\\par \015"); BEGIN Z;}

<COMMENT,OTHERCMT>"-"+	{ECHO;}
<COMMENT,OTHERCMT>[\n]	{printf("\\par \015"); BEGIN Z;}


<COMMENT>.	{
		 unput(yytext[0]); 
		 BEGIN OTHERCMT;
		}

<OTHERCMT>.*	{
		 printf("{\\i %s}", yytext);
		 BEGIN Z;
		}

%%
hilite(it)	
	char 	*it;
{printf("{\\b %s}", it);}

MAKEUPPER(s)
	char	*s;
{
	for (; *s != NULL; ++s)
		*s = (islower(*s) ? toupper(*s) : *s);
}
MAKELOWER(s)
	char	*s;
{
	for (; *s != NULL; ++s)
		*s = (isupper(*s) ? tolower(*s) : *s);
}

--
--The preceeding opinions do not necessarily reflect the opinions of
--The MITRE Corporation or its sponsors. 
-- "A good plan violently executed -NOW- is better than a perfect plan
--  next week"                                      George Patton
-- "Any damn fool can write a plan.  It's the execution that gets you
--  all screwed up"                              James Hollingsworth
-------------------------------------------------------------------------



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Ada PostScript Pretty printer?
  1994-12-02 10:05   ` Rolf Ebert
@ 1994-12-03  4:27     ` David Weller
  0 siblings, 0 replies; 5+ messages in thread
From: David Weller @ 1994-12-03  4:27 UTC (permalink / raw)


In article <RE.94Dec2110519@waporo.muc.de>,
Rolf Ebert <re@waporo.muc.de> wrote:
>[David's vgrind script and famous signature deleted]
>
*Blush*

>Here is another commercial for Emacs:
>
>If you use the new Ada Mode for GNU Emacs (available at
>ftp://cs.nyu.edu/pub/gnat; soon to be updated), go and get the package
>ps-print.el from any emacs archive
>(e.g. ftp://archive.cis.ohio-state.edu/pub/gnu/emacs/elisp-archive/) 
>
>With this package you can print your code as you see it on the screen,
>say with bold keywords and italic comments.
>

Agreed!  ROlf deserves a pat on the back for this one!  I'm just now
trying to get my head around emacs, and the new Ada mode (plus the
new&improved, very cool Presentation Manager (OS/2) interface for the
new version of emacs makes things VERY easy!) is quite a wonderful
addition.



-- 
Proud (and vocal) member of Team Ada! (and Team OS/2)        ||This is not your
   	      Ada -- Very Cool.  Doesn't Suck.               ||  father's Ada 
For all sorts of interesting Ada tidbits, run the command:   ||________________
"finger dweller@starbase.neosoft.com | more" (or e-mail with "finger" as subj.)
	|"Quitting C++ isn't so difficult, provided you show as much |
	|	persistence stopping as you did starting." dweller   |



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~1994-12-03  4:27 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1994-12-01 19:47 Ada PostScript Pretty printer? Tony Leavitt
1994-12-02  0:09 ` David Weller
1994-12-02 10:05   ` Rolf Ebert
1994-12-03  4:27     ` David Weller
     [not found] ` <3bn9f6$8hl@cliffy.lfwc.lockheed.com>
1994-12-02 14:55   ` Ada formatter for MS-Word David Emery

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox