Article View: comp.lang.postscript
Article #7464Re: An Idea to Help Make Postscript Easier to Read (and Write)
From: Daniel Sears
Date: Tue, 06 Sep 1988 17:34
Date: Tue, 06 Sep 1988 17:34
46 lines
2332 bytes
2332 bytes
In the Adobe PostScript archives (ps-file-server@adobe.com) you will
find a PostScript beautifier. Here is the README from that distribution:
README
The "psformat" program parses PostScript files and rearranges them based
on reasonable syntactic and indentation rules. Its primary purpose in
life is to take miserably formatted (or compacted) PostScript files and
make them tolerable.
USAGE:
psformat < infile > outfile
"psformat" reads from stdin and writes to stdout.
"psformat" basically leaves line breaks alone, except where they affect
the indentation of { }. This means, among other things, that output
with lots of newlines (or newlines in funny places, as appear in DEC
Document output, for example) do not get fixed. It is too hard to
figure out where newlines should go heuristically.
The "psformat" program also pulls out any comments that start with
%%! %%+ or %%A-Z and writes them to the stderr channel. This is the
rudimentary beginnings of a program to check the comments and report
which of them are bogus, mal-formed, out of order, or whatever.
Unfortunately, just recognizing them syntactically is, of course, merely
the tip of the iceberg, and the issues of parsing them have not yet
been addressed.
In order to save the comments in a file, you can use a shell hack
something like this:
(psformat < infile > outfile) >& comments.out
Since the only thing that will come out of the (subshell) is the stderr
output, this will trap the comments into the file called comments.out.
In general, this isn't worth it. It is nice to see the comments go by
on stderr so you can monitor the progress of the program.
--
Daniel Sears Sun Microsystems, Inc.
Technical Publications MS 5-42
(415) 336-7435 2550 Garcia Avenue
sears@sun.com Mountain View, CA 94043
Technical Details
Message-ID:
<66945@sun.uucp>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!water!watmath!clyde!att!rutgers!mailrus!ames!oliveb!sun!searsReferences:
<940@helios.ee.lbl.gov> <6298@gryphon.CTS.COM>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!water!watmath!clyde!att!rutgers!mailrus!ames!oliveb!sun!sears From: sears@sun.uucp (Daniel Sears) Newsgroups: comp.lang.postscript Subject: Re: An Idea to Help Make Postscript Easier to Read (and Write) Summary: no need to reinvent the wheel Message-ID: <66945@sun.uucp> Date: 6 Sep 88 17:34:05 GMT References: <940@helios.ee.lbl.gov> <6298@gryphon.CTS.COM> Organization: Sun Microsystems, Inc. - Mtn View, CA Lines: 46