🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.postscript
Article #3532

awk scripts was: PostScript page reverser?

#3532
From: Peter Kriens
Date: Fri, 02 Nov 1990 10:43
46 lines
2508 bytes
The problem was that many collaters work different. For these 
problems, Postscript gives you all the information to do the
reverseal. C programs that handle this, tend to become 
dirty and difficult to maintain. We are currently using many
small AWK filters to handle these probems. The requested
reverse program took 15 minutes to build & test and we made
filters for automatic page fitting, scaling, splitting a file
into multiple pages (if it does not fit on 1 page) etc.

I show the reverse program, and I am very interested in how
other people solve these problems. If there are already
many awk scripts build, are people willing to share those? I
know about pshalf which puts 2 A4 on one. Please send them
to me and I will put them into one file and repost them

Peter Kriens
Mediasystemen
hp4nl!media01!pkr
pkr@media01.uucp

------ cut here
# PS REVERSE
# print a postscript in reverse sequence
# ALGORITHM: read until a %%Page: comment, output 
# text between pages to temporary files, sequentially numbered.
# When a %%Trailer is found, output temp files in revers
# order to stdout. After all is done, it deletes 
# the temp files. Temp files start with pag*.tmp
# 
# o     = output file name, when "" output is stdout
# list  = list with temp files.
# p     = page number (starts at 1)
# i     = walks backward through temp files
# x     = line of temp file
#
# %%Page        close prev output (if present), open new, save name
# %%Trailer     output temp files in reverse order
# //            catch all, copy complete input to output or temp file
# END           delete all temp files
#
/%%Page:/       { if (o != "") { close(o);} o = "pag" p ".tmp";list[++p]=o;}
/%%Trailer/     { if (o != "") { close(o);} o = ""; 
                  for ( i=p; i > 0; i--)
                    { while ( getline x < list[i] > 0 ) print x; } }
//              { if (o != "") print > o ; else  print }
END             { system( "del pag*.tmp" ); }
Technical Details
Message-ID: <1483@media01.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!decwrl!ucbvax!bloom-beacon!eru!hagbard!sunic!mcsun!hp4nl!media01!pkr
References: <BOB.90Oct30100901@volitans.MorningStar.Com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!decwrl!ucbvax!bloom-beacon!eru!hagbard!sunic!mcsun!hp4nl!media01!pkr
From: pkr@media01.UUCP (Peter Kriens)
Newsgroups: comp.lang.postscript
Subject: awk scripts was: PostScript page reverser?
Keywords: awk postscript filter
Message-ID: <1483@media01.UUCP>
Date: 2 Nov 90 10:43:34 GMT
References: <BOB.90Oct30100901@volitans.MorningStar.Com>
Reply-To: pkr@media01.UUCP (Peter Kriens)
Organization: Mediasystemen, Netherlands
Lines: 46