home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / misc / volume1 / 8710 / 16 / wpshalf < prev   
Encoding:
Text File  |  1990-07-13  |  1.1 KB  |  43 lines

  1. #!/bin/sh
  2. # Inspired by pshalf written by Denise Draper    denise@cwi.nl
  3. # This is wpshalf by Pell            pell@rainier.UUCP
  4.  
  5. cat >/tmp/psh.$$ # Must work with tempfile
  6. awk '
  7. BEGIN            { firsthalf = 1 } # I would like to use "pages" here :-(
  8. /^bop$/            { if (!(pages % 2)) {
  9.                 if (firsthalf) {
  10.                     print "bop"
  11.                     print "7 DPIy mul 0 translate"
  12.                 } else {
  13.                     print "-7 DPIy mul 0 translate"
  14.                 }
  15.               } else print "bop"
  16.               next
  17.             }
  18. /^eop$/            { if (pages % 2) {
  19.                 pages = 0
  20.                 print "eop"
  21.               } else {
  22.                 if (!firsthalf) print "eop"
  23.                 firsthalf = 1 - firsthalf
  24.               }
  25.               next
  26.             }
  27. /^\/stateInit/        { 
  28. print "/wpshalfInit {"
  29. print "54 DPIx div 54 DPIy div  neg scale"
  30. print "/PSpagelength 11 DPIy mul def   %default 8.5 x 11 inches"
  31. print "/PSpagewidth 8.5 DPIx mul def"
  32. print "90 rotate"
  33. print "PSpagewidth 6.5 DPIx mul add neg"
  34. print "  PSpagelength 0.5 DPIy mul add neg translate"
  35. print ".5 .5 translate         %PS lattice points are between pixels"
  36. print "} def"
  37. print "/stateInit {"
  38.               next
  39.             }
  40. /^stateInit$/        { print "wpshalfInit"; next }
  41. #/^headerpage|^logme/    { next } # remove headerpage
  42.             { print $0 } ' pages=`egrep -c '^bop$' /tmp/psh.$$` /tmp/psh.$$
  43.