[comp.lang.postscript] Wanted: a PostScript pretty-printer

day@grand.UUCP (Dave Yost) (01/27/89)

Anyone know of a PostScript pretty-printer?

Anyone want to start a discussion of PS indenting style? (heh, heh)

 --dave yost

mh@wlbr.EATON.COM (Mike Hoegeman) (01/29/89)

In article <477@grand.UUCP> day@grand.UUCP (Dave Yost) writes:
>Anyone know of a PostScript pretty-printer?
>
>Anyone want to start a discussion of PS indenting style? (heh, heh)
>
> --dave yost

......well, maybe a little , i prefer
indentation similar to the original K&R book C indentation style.

/procname {
% i ususally just use the same indent level for the scope dict of a procedure
% as the procedure itself, otherwise the indent level just gets too deep..
% within the procedure body.
10 dict begin 
    bool_val {
	% stuff here
    } {
	% more stuff here
    } ifelse

    % if i have a big array defn i usually do it like this..
    /my_array [
	1 2 3 4 5 6 7 8 9 0
	1 2 3 4 5 6 7 8 9 0
    ] def

    % if it smaller it's just 
    /small_array [ 1 2 3 4 5] def
end
} def

% even if the procedure is pretty small i'll still indent it like a big one

/dummy_proc {
    0 pop
} def

% one thing i don't particularly like is putting comments on the same line
% as code like...

/lame { %  a lot of people put a short proc description here, i hate this
    %% proc body here....
} def

it's to hard to scan thru comments if you are trying figure out the general
workings of a procedure

anyway in response to your query, Josh Seigel  (siegel@hc.dspo.gov) has
made a good postscript pretty printer. it's on the SEX
(software exchange) tape from the miami sun user's group conference
held last december. i would'nt be surprised if it was on titan.rice.edu
in the sun-spots archive either.

if you have trouble finding it I'll post it.

mike.

greid@adobe.com (Glenn Reid) (01/31/89)

In article <477@grand.UUCP> day@grand.UUCP (Dave Yost) writes:
>Anyone know of a PostScript pretty-printer?
>
>Anyone want to start a discussion of PS indenting style? (heh, heh)
>
> --dave yost


I have written a PostScript pretty-printer, sort of.  It doesn't
actually print the output, it returns it to you as a file.  This is
useful for reformatting a program that has been compressed or written
to fill a very small amount of bytes, if you have to work on it or
understand it.  My program was written with the Unix "lex" utility,
although I think the resulting C program should work elsewhere.  You
can get a copy from our file server as follows:

	To: ps-file-server@adobe.COM
	From: you
	Subject: please
	--------

	send Programs psformat.shar

It is in "shar" format, which means it needs to get fed to /bin/sh.
Oh, and it roughly enforces my idea of PS indenting style, for whatever
it's worth (heh, heh).

Cheers,
Glenn Reid
Adobe Systems