🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.postscript
Article #6523

Re: Is there a PostScript Code Beautifier?

#6523
From: Allen B
Date: Tue, 26 Jan 1993 15:01
48 lines
2369 bytes
In article <1993Jan26.030632.20615@csus.edu> eps@futon.SFSU.EDU (Eric P. Scott)  
writes:
> Gee, I always thought the standard answer was, "follow the style
> used in the Green Book."  :-)

Assuming the :-) means what I think it means, yes.  The
Green Book gives some pointers, but I don't think it goes
far enough.  If it did, I don't think I'd see as much ugly
code as I do. 

> [ pointer to Adobe's psformat ]

Again, my answer was more philosophical, I guess.  The
point of a code beautifier is not to straighten up >your<
code, it's to clean up code written by "those idiots".
It's to format inherently bad code.  You shouldn't need to
reformat code you write, right? :-)

The main things that psformat does for you are breaking up
long lines and handling {}s.  You could make emacs do that
if you were good at it.  It doesn't make sure lines end with a
"verb", which I think is important (and tough because
it's semantic).  It doesn't always indent correctly,
even within its limited rules. 

I ran a typical "block-formatted" piece of code (my
encode.ps) through it to double-check these
assertions, and found that it's far better than nothing,
but a long way from doing to PostScript what
pretty-printers for other languages do. 

Additionally, it made one of my obfuscated PostScript
entries (mm.ps) non-functional- proof enough that I
don't want to use it a lot on alien code.  Even trying hard, I
don't usually write textually ugly code (procedurally,
yes!), imagine what those professional obfuscaters
could cook up. :-) 

The problem is a lot harder than it is for languages like C
because we have so little syntax, and because >any< piece
of code could change meaning in another context (if
nothing else, it could be read from the source file as
data).

Am I just griping?  No, I'm glad things like this exist, but
I'm still looking for a >real< solution.

Allen B (Watching with interest)
Technical Details
Message-ID: <C1Gv37.6sy@mentor.cc.purdue.edu>
Path: arc1-ca.pugleaf.net!sparky!uunet!ukma!gatech!purdue!mentor.cc.purdue.edu!news
References: <1993Jan26.030632.20615@csus.edu>

Show Full Headers
Complete Article Headers
Newsgroups: comp.lang.postscript
Path: arc1-ca.pugleaf.net!sparky!uunet!ukma!gatech!purdue!mentor.cc.purdue.edu!news
From: ab@nova.cc.purdue.edu (Allen B)
Subject: Re: Is there a PostScript Code Beautifier?
Message-ID: <C1Gv37.6sy@mentor.cc.purdue.edu>
Sender: news@mentor.cc.purdue.edu (USENET News)
Organization: Purdue University
References: <1993Jan26.030632.20615@csus.edu>
Date: Tue, 26 Jan 1993 15:01:54 GMT
Lines: 48