# This is a shell archive. Remove anything before this line, # then unpack it by saving it in a file and typing "sh file". # # Wrapped by im4u!brian on Tue Jul 8 15:53:36 CDT 1986 # Contents: README README.SPOOL paintps.c paintps.1 Makefile maclaser.csh # maclaser.1 laser-prep.pro macfilter.c psfilter.csh psmac.csh echo x - README sed 's/^@//' > "README" <<'@//E*O*F README//' This shell archive contains a program called paintps which will convert a MacPaint file (uploaded from a Mac) to PostScript for printing on a LaserWriter. It reads a plain MacPaint document as input and produces postscript output in the same style as that produced by the 1.1 version of the Mac LaserWriter driver. Paintps runs on unix and will automatically spool its output for printing if no output redirection has been done. The advantage of paintps is that MacPaint pictures are usually less than 25K, while the resulting PostScript often exceeds 100K. This obviously reduces the file transfer time. Also included is the version 1.1 laser-prep file, which is needed by paintps, and a shell script called maclaser, which is called by paintps to spool its output. Maclaser is simply a front end to lpr, and depends on the spooler setup described in the file README.SPOOL. This code has been used with 4.2 and 4.3BSD; vaxen, Sun and Sequent hardware. We use the TranScript package from Adobe to drive the LaserWriter. If you're using some other set of PostScript drivers, the spooler hacks are basically the same, since there are no changes to the drivers themselves. Paintps is distantly related to a program called paintimp, originally written by Dave Johnson at Brown University. It converted MacPaint pictures to Impress for printing on Imagens. Ron Hitchens at the University of Texas hacked on it a bit and added some features. When we got a LW, Brian Powell at UT was inspired to do something similar for PostScript. The resulting paintps is very different from paintimp, but paintimp did provide the structure and a few subroutines. Maclaser and the spooler hacks were conceived by Ron Hitchens' twisted mind. There are several different critters in this distribution. They probably won't all want to live in the same place. A makefile is included for paintps, mainly because it was already there. Use your local customs for determining where things should go. NOTE: Maclaser can print PostScript generated by any Macintosh program, not just MacPaint. (See the man page for maclaser for details.) For now, you must use version 1.1 of the LaserWriter driver to generate the PostScript on the Macintosh. You do not have to have the LaserWriter printer driver on the Macintosh to use paintps. When Apple settles down on their Printer Drivers, I will modify this code to support the latest 3.* LaserWriter driver. The latest driver I have seen is version 3.1, and I don't think it will be hard to modify paintps to produce that driver's new format. And by the way, the "Chooser" desk accessory won't install the version 1.1 LaserWriter driver. To use LaserWriter 1.1 with the new systems, simply install and use "Choose Printer" (from Finder 4.1 days). I have noticed no problems using the old driver with the new ROMS or new system. ------------------------- Brian Powell brian@sally.utexas.edu Ron Hitchens hitchens@sally.utexas.edu @//E*O*F README// chmod u=rw,g=rw,o=r README echo x - README.SPOOL sed 's/^@//' > "README.SPOOL" <<'@//E*O*F README.SPOOL//' Paintps depends on the "Mac environment" being present in the LaserWriter at the time its Postscript output is processed. This environment is setup by the laser-prep prolog file which is prepended by the Mac print drivers when a Mac prints directly to a LaserWriter. Since paintps basically mimics what MacPaint does when it prints a file on a LW, something needs to be done to provide the Mac environment in the LW with the Unix system. The same applies to any "Mac PostScript" file produced on a Mac and captured with the Command-F sequence and then uploaded to a Unix machine. The remaining discussion concerns printing Mac files to a LaserWriter being driven by a Unix (4.2 or 4.3 BSD) spooler and which is primarily used for general text processing, not for Mac output. The output of paintps is considered a "Mac file", even though it's produced on a Unix system, and is included in the general discussion below. The first step is to get the laser-prep prolog file, so that it can be sent to the LW via the spooler. The laser-prep file must be modified for use with the spooler. There are two reasons why. 1) The standard laser-prep installs itself permanently, on the assumption that the LW is living in a Mac-only universe. The amount of memory it consumes is substantial and we aren't willing to give it away to accomodate the occasional Mac job sent via the Unix spooler. Removing the few lines at the beginning which escape from the server loop is sufficient to prevent permanent residency. 2) The encrypted smoothing function in the laser-prep is fed as stdin to an eexec command which will read until eof. Since what we're trying to accomplish is to have the laser-prep only live for the duration of a single job, this presents a problem. Luckily the eexec command will also accept a string argument on the stack, so by placing hex quotes (<>) around the smoothing code and calling eexec after it has been placed on the stack, we get the same effect plus the ability to continue sending PostScript code afterwards. Hence, we can simply concatenate the modified laser-prep and the Mac PostScript file and send it to the printer, the Mac environment will be there for the job and will be flushed afterwards. This will also allow us to support more than one version of the LaserWriter driver in the future (which we intend to do.) Since the laser-prep won't be in the LW RAM, we can prepend any laser-prep without causing a conflict. Now, there are a couple of ways to handle a Mac PostScript job via the Unix spooler. 1) On the front end of the spooler thru lpr, such as: paintps foo.mp > foo.ps cat /usr/local/lib/laser-prep.pro foo.ps | lpr -Plw This is the most generic and doesn't require anything special be done on the unix system. The drawbacks are that a current copy of the laser-prep must be present on every system that might spool a job, that users know where it is, and that they know the proper incantations. A shell script could be written to hide the above commands, but that still requires multiple copies of the laser-prep file. 2) In the back end of the spooler, by having a filter automatically prepend the laser-prep to all Mac PostScript jobs. This is the most elegant way to handle it, since only one copy of the laser-prep need exist on the system where the printer is, and the details of handling Mac specific files are hidden from the user. This method requires selecting a "file type" for spooling Mac jobs and specifying the proper handlers on the system where the printer is. At UT we chose the "Fortran" file type, since it was unused. Others could be used but there aren't many candidates, especially if you already support ditroff and/or TeX. We handle spooling of Mac files with a shell script which simply calls lpr and adds the -f file type flag. The discussion below assumes the reader is familiar with how the Berkeley spooler works and knows how to setup filters. The person who does this must have super-user access anyway. Once again there are two ways to go about setting up your spooler to handle Mac PostScript files: 1) If you're using the standard Transcript setup, use the psmac shell script included. Put it in /usr/local/lib, or where you keep the rest of your filters, and put its name in the printcap slot for whichever file type you use (the rf field is for the Fortran type, go figure). 2) If you're using an Imagen-style shell script which is called by several different names, use our psfilter (included) as a guide and include a case for handling Mac files as shown. This approach is kind of odd, and can lead to various problems, but allows more flexibility and enables you to do things like complex pipelines and problem notification. Psfilter is what we use at UT, you may or may not find it useful. In any case you can ignore the local hacks for dealing with LaserWriters on Bridges (unless you have some, I might be able to help). The program macfilter, named in both psmac and psfilter, does nothing more than convert any non-printable characters in the data stream to the octal equivalent. Apple broke the rules and used non-printable characters (specifically non-ascii > 128) for certain symbols. These don't survice the unix device driver (they lose the high bit) and raw mode is not possible because the LW needs to use flow control. Here is the /etc/printcap we use here at UT: # # # Apple LaserWriter # sb MUST be specified, psof depends on it. psof prints job header page. # rw must be specified, printer talks back to psif lw-generic|Apple Laserwriter:\ :rw:br#9600:ff=:tr=^D:sc:sb:\ :of=/usr/local/lib/psof:\ :df=/usr/local/lib/psdvi:\ :nf=/usr/local/lib/psditroff:\ :tf=/usr/local/lib/pscat:\ :if=/usr/local/lib/psasc:\ :cf=/usr/local/lib/psbad:\ :gf=/usr/local/lib/psbad:\ :vf=/usr/local/lib/psbad:\ :rf=/usr/local/lib/psmac: Lazarus|lw1|lw|lazarus|LW connected to im4u:\ :lp=/dev/lw:sd=/usr/spool/lw1:\ :xs#040400:fc#070:fs#00302:\ :lf=/usr/adm/log-lw1:\ :af=/usr/adm/lw.acct/lw1:\ :tc=lw-generic: ------------------- Ron Hitchens University of Texas at Austin, Computer Science hitchens@uo.cs.utexas.edu hitchens@sally.UUCP @//E*O*F README.SPOOL// chmod u=rw,g=rw,o=r README.SPOOL echo x - paintps.c sed 's/^@//' > "paintps.c" <<'@//E*O*F paintps.c//' #ifndef lint static char sccsid[] = "@(#)paintps.c 1.7 6/11/86 (UT)"; #endif /* * paintps -- Convert MacPaint document to PostScript document * * Brian H. Powell, University of Texas at Austin * brian@sally.UTEXAS.EDU * brian@ut-sally.UUCP * CS.Powell@r20.UTEXAS.EDU * * This program may be used but not sold without permission. * * Modification History * BHP 7/25/85 Created. * BHP 7/31/85 Optimized output routines for execution speed. * BHP 4/22/86 Added -P option, extracted spool command to Makefile. * BHP 6/ 3/86 Fixed bug causing (rare) small white gaps between * bitmaps. */ #include #include #define FALSE 0 #define TRUE (-1) #define MACPAINT_HDRSIZE 512 #define MACRASTER_BITWIDTH 576 #define MACPAINT_BITHEIGHT 720 /* DEFAULT OPTIONS */ int smooth = TRUE; /* smoothing enabled */ int copies = 1; /* one copy of the painting */ char *printername = NULL; /* default printer */ char hexbuffer[MACPAINT_BITHEIGHT][MACRASTER_BITWIDTH/8]; int blank[MACPAINT_BITHEIGHT + 4]; /* we need the four extra blank */ /* lines as filler for output */ char usage[] = "paintps [-d] [-#] [-P] file"; main(ac, av) char **av; { ac--; av++; while (ac && (av[0][0] == '-') && av[0][1]) { switch (av[0][1]) { case 'd': /* "draft" option */ smooth = FALSE; break; case '#': /* number of copies */ copies = atoi (&av[0][2]); break; case 'P': /* printer name */ printername = av[0]; break; default: goto bad_usage; } ac--; av++; } open_output(); /* also starts spooling to the spool cmd. */ paintfilter(av[0]); exit(0); bad_usage: fprintf(stderr, "usage: %s\n", usage); exit(1); } /* convert from MacPaint to PostScript */ paintfilter(name) char *name; { register int x, y; FILE *fp; register int c; int blankline; fp = fopen(name, "r"); /* open the MacPaint file. */ if (fp == NULL) { perror(name); return; } (void) fseek(fp, (long)MACPAINT_HDRSIZE, 0); /* skip the MacPaint patterns */ begin_image(); /* print postscript header */ /* We skip horizontal whitespace. "blankline" is used to diagnose this for the current line. The boolean array "blank[y]" shows which lines in the entire painting are blank. */ for (y = 0; y < MACPAINT_BITHEIGHT; y++) { /* for each pixel row... */ blankline = TRUE; for (x = 0; x < MACRASTER_BITWIDTH/8; x++) { if ((c = getbits(fp)) == EOF) { fprintf(stderr, "Unexpected EOF, stopped.\n"); for ( ; y < MACPAINT_BITHEIGHT; y++) /* Mark the */ blank[y] = TRUE; /* rest of the page */ blankline = TRUE; /* blank, print it and quit. */ break; } else { hexbuffer[y][x] = (char) c; /* else record the character and */ if (c) /* mark the line as non-blank. */ blankline = FALSE; } } blank[y] = blankline; } blank[y++] = TRUE; /* put four blank lines at end */ blank[y++] = TRUE; /* (I think this is needed for smoothing.) */ blank[y++] = TRUE; blank[y] = TRUE; dump_buffer(hexbuffer, blank); /* print the buffer (entire page) */ end_imag(copies); /* print the postscript trailer. */ (void) fclose(fp); /* close the file. */ } /* macpaint input routines */ getbits(fp) /* this routine scarfed from paintimp. */ FILE *fp; { /* This routine expands the PackBits encoded MacPaint file, delivering one byte per call. */ static int count, rep, chr; int c; if (rep) { /* if we are repeating a previous character, */ rep--; /* reduce the repeat count and return the char. */ return chr; } if (count) { /* if we are in an unrepeated section, reduce */ count--; /* the count and return next char from the file. */ return getc(fp); } c = getc(fp); /* otherwise, get the next repeat count. */ if (c & 0x80) { /* if negative, repeat the next */ rep = 0x100 - c; /* byte (2's comp(c)+1) times. */ chr = getc(fp); /* the character to repeat */ return chr; } else { /* if repeat count is positive, next "count" bytes */ count = c; /* are unencoded. */ return getc(fp); } } /* PostScript output routines */ open_output() { char lpr [64]; FILE *popen(); /* if stdout is going to the terminal, call the spool command to spool the output, otherwise assume it's being piped somewhere else or directed into a file. */ if (isatty (fileno (stdout))) { (void) sprintf (lpr, "%s %s", SPOOLCMD, printername ? printername : ""); /* include printer name if it was specified. */ /* disconnect stdout from the tty and pipe it to lpr */ (void) fclose (stdout); if (popen (lpr, "w") == NULL) { fprintf(stderr, "%s failed, giving up.\n", lpr); exit(2); } fprintf(stderr, "Spooling to '%s'.\n", lpr); } } begin_image() /* print the postscript header. */ { printf("%%!\n"); /* TranScript PostScript flag "%!" */ printf("md begin\n"); /* standard apple header */ printf("1320 od\n"); printf("(; user: )jn\n"); printf("%%%%EndProlog\n"); printf("%%%%Page: ? ?\n"); printf("op\n"); printf("0 0 moveto\n"); } /* The reason the following routine isn't called "end_image" is because */ /* of a bug in the Sequent C compiler. */ end_imag(copies) /* print the postscript trailer. */ int copies; /* copies == number of copies to print */ { printf("%d page\n", copies - 1); /* "page" takes # of pages to */ printf("cp\n"); /* print minus 1 */ printf("%%%%Trailer\n"); printf("end\n"); } #define OUTBUF_SIZE 28 #define XSCALE 578 #define XLOC 0 #define ROWBYTES 74 #define SRCMODE 1 /* Modular code purists can close their eyes for the following */ /* routine. */ dump_buffer(hexbuffer, blank) char hexbuffer[MACPAINT_BITHEIGHT][MACRASTER_BITWIDTH/8]; int blank[MACPAINT_BITHEIGHT]; /* hexbuffer contains the entire unencoded MacPaint file. */ /* blank is a boolean array for each row. TRUE means the horizontal line is blank. */ { int xscale, yscale, xloc, yloc, xactual, yactual; char smoothing; int i, j; int curline, top_of_sect, begin_line, numblanks, lines_used; char outstring[MACRASTER_BITWIDTH/4]; xscale = XSCALE; /* Postscript parameters describing the */ xloc = XLOC; /* size of the image area. */ xactual = XSCALE; smoothing = smooth ? 'T' : 'F'; /* The postscript output consists of calls to "dobits" for each group of */ /* non-blank horizontal lines. Due to LaserWriter memory limitations, */ /* only about 28 lines at a time can be sent per command. Also, lines */ /* adjacent to the current section must be included (presumably for the */ /* smoothing function to work.) */ curline = 0; top_of_sect = TRUE; /* begin a "dobits" call. */ while (curline < MACPAINT_BITHEIGHT) { /* for the entire picture... */ /* If a previous section terminated because of white space, skip the */ /* blank lines that precede the next section. */ if (top_of_sect) while ((curline < MACPAINT_BITHEIGHT) && blank[curline]) curline++; /* check for end of page. */ if (curline >= MACPAINT_BITHEIGHT) break; if (top_of_sect) { /* At top of non-white section, include */ begin_line = curline - 2; /* previous two lines; */ lines_used = 2; top_of_sect = FALSE; } else { /* if continuing a non-white section, don't. */ begin_line = curline; lines_used = 0; } numblanks = 0; /* compute height of non-white area. */ for (i = lines_used; i < (OUTBUF_SIZE - 1); i++) { if (blank[curline++]) numblanks++; else numblanks = 0; /* reset counter */ if (numblanks >= 4) { /* Too much white space: break and print it. */ /* The four blanks at the end of the */ /* page will stop us at the bottom */ curline--; /* We want curline to point */ /* to the fourth blank line. */ break; } } if (numblanks > 0) /* If the bitmap ended in any whitespace, */ top_of_sect = TRUE; /* we skip it the next time around. */ curline++; yactual = i - 3; /* Height of current bitmap section. */ yscale = yactual; /* Scale it 1 to 1. */ yloc = begin_line + 2; /* print the "dobits" call. */ printf("%d %d %d %d %d %d %d %c %d dobits\n", xscale, yscale, xloc, yloc, ROWBYTES, xactual, yactual, smoothing, SRCMODE); /* print the corresponding horizontal lines. */ for (i = begin_line; i < curline; i++) { if ((i < 0) || blank[i]) /* if blank, print all zeros. */ for (j = 0; j< MACRASTER_BITWIDTH/4; j++) putchar('0'); else { /* else convert to a hex string and print it. */ tohex(hexbuffer[i], MACRASTER_BITWIDTH/8, outstring); printf("%s", outstring); } /* Put four extra nibbles at the ends of lines. I think */ /* are for smoothing. */ if ((i == (-2)) || blank[i+1]) /* Include the first four nibbles of */ printf("0000\n"); /* the next line. */ else { tohex(hexbuffer[i+1], 2, outstring); printf("%s\n", outstring); } } if (!top_of_sect) curline -= 4; /* we'll have to overlap the next section */ } /* with this one, so back up four lines. */ } tohex(hexline, size, outstring) /* convert binary bytes to a hex string. */ char hexline[]; int size; /* number of bytes to convert. */ char outstring[]; { int i, j; register char c, c1; j = 0; for (i = 0 ; i < size ; i++) { c = hexline[i]; c1 = (c >> 4) & 0x0F; c1 = (c1 <= 9) ? (c1 + '0') : (c1 - 10 + 'A'); outstring[j++] = c1; c1 = c & 0x0F; c1 = (c1 <= 9) ? (c1 + '0') : (c1 - 10 + 'A'); outstring[j++] = c1; } outstring[j] = NULL; } @//E*O*F paintps.c// chmod u=rw,g=rw,o=r paintps.c echo x - paintps.1 sed 's/^@//' > "paintps.1" <<'@//E*O*F paintps.1//' @.TH PAINTPS local "23 April 1986" @.UC 4 @.SH NAME paintps - Convert MacPaint document into PostScript @.SH SYNOPSIS @.B paintps file @.br @.B paintps [ @.B \-d ] [ @.BI \-# ] [ @.BI \-P ] file @.SH DESCRIPTION @.I Paintps translates a MacPaint document, uploaded from a Macintosh via macget (local), into the PostScript language. It can also spool output to maclaser (local) for printing on a LaserWriter or other PostScript device. @.PP If the output of paintps hasn't been redirected or piped, then paintps automatically spools the output to the LaserWriter. @.PP Note that the resulting PostScript file requires certain function definitions that aren't normally present on the LaserWriter. Therefore, the output of paintps must eventually be printed using "maclaser" instead of, for example, "lpr -Plw". @.PP The order of command line arguments is not important, except that the options must precede the filename. The available command line options are: @.TP @.B -d Specifies Draft Mode. This turns off the smoothing function for graphics. This option is of dubious usefulness since the smoothing overhead is small. @.TP @.BI -# Specifies n copies should be printed. @.TP @.BI -P Specifies the printer to be used as the output device. @.SH UPLOADING\ MACPAINT\ FILES\ TO\ UNIX You may use the command @.PP % macget -d @.PP to upload MacPaint files from the Macintosh to UNIX. See macget(local) for more information. @.SH DIAGNOSTICS If the LaserWriter produces an error page saying "/md undefined", this probably means you spooled the output with lpr instead of maclaser. @.SH AUTHOR Brian H. Powell, The University of Texas at Austin @.SH SEE\ ALSO maclaser(local), macget(local) @//E*O*F paintps.1// chmod u=rw,g=rw,o=r paintps.1 echo x - Makefile sed 's/^@//' > "Makefile" <<'@//E*O*F Makefile//' SRCS= paintps.c OBJS= paintps.o COMMANDS= paintps CFLAGS= -O BIN= /usr/local MAN= /usr/man/manl SPOOLCMD= "maclaser" all: $(COMMANDS) paintps: paintps.c $(CC) $(CFLAGS) paintps.c -o paintps '-DSPOOLCMD=$(SPOOLCMD)' install: $(COMMANDS) install -s -m 0775 paintps ${DESTDIR}/${BIN} install -c -m 0444 paintps.1 ${DESTDIR}/${MAN} clean: rm -f *.o a.out core $(COMMANDS) @//E*O*F Makefile// chmod u=rw,g=rw,o=r Makefile echo x - maclaser.csh sed 's/^@//' > "maclaser.csh" <<'@//E*O*F maclaser.csh//' #! /bin/csh -f # A simple script to spool files prepared on a Macintosh for printing on # the LaserWriter. It expilictly spools to the lw printer and flags the # file as "Fortran" type. This file type is redefined locally to mean # a mac Postscript file, causing the Apple laser-prep file to be prepended # to provide the standard Mac environment in the printer when the file # is processed. # Files spooled with maclaser should have been created on the Mac with # the COMMAND-F sequence and the resulting PostScript file uploaded [RH] # # April 1986 Generalized to handle arbitrary option args and accept # multiple file names. This is now a general filter for # calling lpr. Options and file names can be mixed up in # the "wrong" order and they will be given to lpr in the # order it wants them. The 'always' variable is what makes # this a script specific to handling Mac Postscript. # Ron Hitchens (hitchens@sally), Brian Powell (brian@sally) # set lpr = /usr/ucb/lpr set lw = -Plw set always = (-f) # this means Mac PostScript (local spooler hack) set flags = () set files = () top: if ($#argv > 0) then switch ($argv[1]) case -P*: # need to look for this one specifically set lw=$argv[1] # since we've setup a default shift argv goto top case -: # pretend this means read stdin shift argv # lpr reads stdin if no files names goto top # are given anyway. Ignore it. case -*: set flags = ($flags $argv[1]) shift argv goto top default: set files = ($files $argv[1]) shift argv goto top endsw endif exec $lpr $always $lw $flags $files @//E*O*F maclaser.csh// chmod u=rwx,g=rwx,o=rx maclaser.csh echo x - maclaser.1 sed 's/^@//' > "maclaser.1" <<'@//E*O*F maclaser.1//' @.TH MACLASER local "23 April 1986" @.UC 4 @.SH NAME maclaser - Spool Macintosh PostScript files to the LaserWriter printers @.SH SYNOPSIS @.B maclaser [ @.BI \-P ] file @.SH DESCRIPTION @.I Maclaser is a program which spools Macintosh-generated PostScript files to any of the LaserWriters. It defines function definitions that the Macintosh PostScript file uses. @.PP The -P option is used to specify the output device. If the option is omitted, the default LaserWriter (-Plw) is used. @.PP For MacPaint pictures, PostScript files may be generated using paintps (local) or using the method described below. @.PP For other output, you must (currently) use the procedure described below to get the Macintosh to create the PostScript file. @.SH GENERATING\ MACINTOSH\ POSTSCRIPT\ FILES This section describes how to generate PostScript files on the Macintosh for uploading and eventual printing. @.PP Make sure the LaserWriter printer driver file is installed on your system disk. You may use the "Choose Printer" desk accessory to select the LaserWriter driver instead of the Imagewriter driver. @.PP Use the Page Setup menu item to specify whether you want the LaserWriter to substitute its built-in fonts for the Macintosh fonts, whether you want smoothing, and so forth. @.PP Open the document with the required application and choose the "Print..." menu item. In most applications (such as MacWrite) a dialog box will appear. Answer the questions and click OK. After you click OK, hold down the command key (cloverleaf) and hold down the "f" key. When a box appears saying "Creating PostScript File", you may release the cmd-F keys. If instead a box appears saying "Looking for LaserWriter", you did not press cmd-F at the right time. @.PP NOTE: MacPaint is slightly different. "Print Draft" prints without smoothing, and "Print Final" prints with smoothing. Also, no dialog box appears when you choose "Print ..", so hold down cmd-F right after you choose one of the print commands. @.PP A file called PostScript will appear on your disk. This file is a text-only file readable by MacWrite and most other editors and word processors. This file is often extremely large (> 100K), so you might make sure you have lots of room on the disk before creating it. You will not be warned if you run out of space. @.PP Now upload the PostScript file to your favorite UNIX machine. For instance, using MacTerminal connected to a UNIX machine, you can give the UNIX command @.PP % macget -u @.PP Then choose "Send File" in MacTerminal and select PostScript. This will leave a file in your current UNIX directory called PostScript.text. @.PP Now you may finally give UNIX the command: @.PP % maclaser PostScript.text @.PP to print the file on the default LaserWriter. @.SH WARNINGS This version of maclaser is intended to work only with PostScript files created by version 1.1 of the Macintosh LaserWriter driver and LaserPrep file. Versions 3.0 and later of these files will cause strange results. @.SH FILES /usr/local/lib/allfonts/postscript/laser-prep.pro @.SH SEE\ ALSO paintps(local), macget(local), lpr(1), printers(4L) @//E*O*F maclaser.1// chmod u=rw,g=rw,o=r maclaser.1 echo x - laser-prep.pro sed 's/^@//' > "laser-prep.pro" <<'@//E*O*F laser-prep.pro//' %!Laser Prep version 12. % Decompiled with rekamr and then cleaned up and slightly modified % for downloading over rs232 by Alan Crosswell, Columbia U. % Modification to eexec to work when cat'ed with a data file. This % version is not installed permanently, must precede each Mac file. % Ron Hitchens, Brian Powell - U of Texas Austin. %{appledict version #12 /md 200 dict def md begin /av 12 def /mtx matrix currentmatrix def /s30 30 string def /s1 ( ) def /pys 1 def /pxs 1 def /pyt 760 def /pxt 29.5 def /por true def /xl{translate}def /fp{pnsh 0 ne pnsv 0 ne and}def /vrb [ {fp{gsave 1 setlinewidth pnsh pnsv scale stroke grestore}if newpath} {eofill} dup {newpath} 2 index dup {initclip eoclip newpath} {} dup 2 copy ] def /xdf{exch def}def currentscreen /spf xdf /rot xdf /freq xdf /doop {vrb exch get exec} def /psu{2 index .72 mul exch div /pys xdf div .72 mul /pxs xdf /pyt xdf /pxt xdf /por xdf}def /txpose{dup 1680 eq userdict /note known{{legal}{note}ifelse}{pop}ifelse dup 1212 eq{54 32.4 xl}if 1321 eq{8.64 -.6 xl}if pxs pys scale pxt pyt xl por not{270 rotate}if 1 -1 scale}def /obl {{0.212557 mul}{pop 0} ifelse} def /sfd {[ps 0 ps 6 -1 roll obl ps neg 0 0] makefont dup setfont} def /fnt{findfont sfd}def /bt{1 index and 0 ne exch}def /sa 6 array def /fs{1 bt 2 bt 4 bt 8 bt 16 bt sa astore pop }def /mx1 matrix def /mx2 matrix def /gf{currentfont}def /tc{32768 div add 3 1 roll 32768 div add 2t astore pop}def /3a [0 0 0] def /2t 2 array def /tp{3a astore pop}def /ee{}def /tt{gsave currentpoint 2 copy 2t aload pop qa 2 copy xl 3a aload pop exch dup 0 eq {pop}{1 eq{-1 1}{1 -1}ifelse scale}ifelse rotate pop neg exch neg exch xl moveto}def /te{currentpoint currentfont grestore setfont moveto}def /tb{/tg currentgray def 3 -1 roll 3 eq{1 setgray}if /ml 0 def /al 0 def}def /am{ml add /ml xdf}def /aa{[currentgray /setgray cvx]cvx exch dup wi pop dup al add /al xdf exch}def /th{3 -1 roll div 3 1 roll exch div 2 copy mx1 scale pop scale /scaleflag true def}def /tu{1 1 mx1 itransform scale /scaleflag false def}def /ts{1 1 mx1 transform scale /scaleflag true def}def /fz{/ps xdf}def /fx{dup exec}def /st{show pop pop}def /tm{ { dup type dup /integertype eq exch /realtype eq or { dup ml mul } { dup type /stringtype eq { rs } { dup type /dicttype eq { setfont } { dup type /arraytype eq { exec } { pop }ifelse }ifelse }ifelse }ifelse }forall }def /es{3 -1 roll dup sa 5 get dup type /nulltype eq {pop4 pop} { sa 1 get {/ml ml .2 ps mul sub def}if %Italic Hack Hack Hack ne{fs}{pop}ifelse exch dup 1 eq {pop al ml gt{/tv{ll}/ml ml al dup 0 ne{div}{pop}ifelse def}{/tv{st}/ml 1 def}ifelse def tm } { dup 3 eq {pop al ml gt{/tv{ll}/ml ml al dup 0 ne{div}{pop}ifelse def}{ml al sub 0 rmoveto /tv{st}/ml 1 def}ifelse def tm } { 2 eq { al ml gt{/tv{ll}/ml ml al dup 0 ne{div}{pop}ifelse def}{ml al sub 2 div 0 rmoveto /tv{st}/ml 1 def}ifelse def tm } { /tv{ll}def /ml ml al dup 0 ne{div}{pop}ifelse def tm }ifelse}ifelse}ifelse }ifelse tg setgray }def /pop4 {pop pop pop pop} def /gm{scaleflag{mx1 itransform}if moveto}def /ly{exch pop currentpoint exch pop sub 0 exch rmoveto}def /page{1 add /#copies xdf showpage}def /sk{systemdict /statusdict known}def /jn{sk{statusdict /jobname 3 -1 roll put}{pop}ifelse}def /pen {/pnsv xdf /pnsh xdf pnsh setlinewidth} def /dlin{currentpoint newpath moveto lineto currentpoint stroke grestore moveto}def /lin {currentpoint /pnlv xdf /pnlh xdf gsave newpath /@y xdf /@x xdf fp{pnlh @x lt {pnlv @y ge {pnlh pnlv moveto @x @y lineto pnsh 0 rlineto 0 pnsv rlineto pnlh pnsh add pnlv pnsv add lineto pnsh neg 0 rlineto} {pnlh pnlv moveto pnsh 0 rlineto @x pnsh add @y lineto 0 pnsv rlineto pnsh neg 0 rlineto pnlh pnlv pnsv add lineto} ifelse} {pnlv @y gt {@x @y moveto pnsh 0 rlineto pnlh pnsh add pnlv lineto 0 pnsv rlineto pnsh neg 0 rlineto @x @y pnsv add lineto} {pnlh pnlv moveto pnsh 0 rlineto 0 pnsv rlineto @x pnsh add @y pnsv add lineto pnsh neg 0 rlineto 0 pnsv neg rlineto} ifelse} ifelse closepath fill}if @x @y grestore moveto} def /barc {/@f xdf /@op xdf /@e xdf /@s xdf /@r xdf /@b xdf /@l xdf /@t xdf gsave @@r @l add 2 div @b @t add 2 div xl 0 0 moveto @@r @l sub @b @t sub mtx currentmatrix pop scale @f {newpath} if 0 0 0.5 @s @e arc mtx setmatrix @op doop grestore} def /doarc {dup 0 eq barc} def /doval {0 exch 360 exch true barc} def /dorect {/@op xdf currentpoint 6 2 roll newpath 4 copy 4 2 roll exch moveto 6 -1 roll lineto lineto lineto closepath @@op doop moveto} def /dorrect {/@op xdf 2. div /@h xdf 2. div /@w xdf /@r xdf /@b xdf /@l xdf /@t xdf @@t @b eq @l @r eq or{@t @l @b @r @op dorect} { @r @l sub 2. div dup @w lt{/@w xdf}{pop}ifelse @b @t sub 2. div dup @w lt{/@w xdf}{pop}ifelse @op 0 eq{/@w @w pnsh 2 div sub def}if %this helps solve overlap gap for wide line widths currentpoint newpath @r @l add 2. div @t moveto @r @t @r @b @w arcto pop4 @r @b @l @b @w arcto pop4 @l @b @l @t @w arcto pop4 @l @t @r @t @w arcto pop4 closepath @op doop moveto }ifelse } def /pr{gsave newpath /pl{moveto /pl{lineto}def}def}def /pl{lineto}def /ep{dup 0 eq { {moveto}{lin}{}{}pathforall %nothing but movetos and linetos should be called pop grestore } { doop grestore }ifelse }def /bs 8 string def /bd{/bs xdf}def /bit {bs exch get exch 7 sub bitshift 1 and} def /bix {1 add 4 mul cvi} def /pp{exch bix exch bix bit}def /grlevel {64. div setgray} def /setpat {/bs xdf 9.375 0{pp}setscreen grlevel} def /setgry {freq rot {spf} setscreen grlevel} def /x4 {2 bitshift} def /d4 {-2 bitshift} def /xf {.96 mul exch 2 sub .96 mul exch} def /dobits { /bmode xdf save 9 1 roll { x4 /@dy xdf 2 sub x4 /@dx xdf /@idx xdf .96 mul exch 2 sub exch xl 0 0 moveto xf 0 2 2 index 4 index 1.759 add 10 dorect clip newpath 0 0 moveto scale bmode 0 eq bmode 4 eq or{1 setgray 1 @dy div 1 @dx div 1 1 2 dorect}if bmode 3 eq bmode 7 eq or{1}{0}ifelse setgray @idx 5 bitshift @dy bmode 4 eq bmode 5 eq bmode 7 eq or or [@dx 0 0 @dy 0 0] {(%stdin)(r) file @dy d4 4 add @idx mul string readhexstring pop dup length @idx x4 sub 4 bitshift string dup 3 1 roll @dx 8 add d4 smooth} imagemask } { /@dy xdf 2 sub /@dx xdf /@idx xdf /@xs @idx string def /@f (%stdin)(r) file def /@p{@f @xs readhexstring pop}def .96 mul xl 0 0 moveto xf scale 0 0 1 1 10 dorect clip newpath 0 0 moveto bmode 0 eq bmode 4 eq or{1 setgray .25 @dy div .25 @dx div 1 1 2 dorect}if bmode 3 eq bmode 7 eq or{1}{0}ifelse setgray @p @p @idx 3 bitshift @dy bmode 0 eq bmode 1 eq bmode 3 eq or or [@dx 0 0 @dy 0 0] {@p} imagemask @p @p pop4 }ifelse restore } bind def /mfont 14 dict def /wd 14 dict def /mdef {mfont wcheck not{/mfont 14 dict def}if mfont begin xdf end} def /dc {transform round .5 sub exch round .5 sub exch itransform} def /cf{{1 index /FID ne {tmp 3 1 roll put}{pop pop}ifelse}forall}def /mv{tmp /Encoding macvec put}def /bf{ mfont begin /FontType 3 def /FontMatrix [1 0 0 1 0 0] def /FontBBox [0 0 1 1] def /Encoding macvec def /BuildChar { wd begin /cr xdf /fd xdf fd /low get cr get 2 get -1 ne { fd begin low cr get aload pop sd low cr 1 add get 0 get sh sw end /sw xdf /sh xdf sw div /clocn xdf dup 0 ne {0 exch sh div neg dc xl}{pop}ifelse exch sw div /coff xdf exch sw div /cloc xdf /bitw clocn cloc sub def sw sh div 1 scale sw div 0 coff 0 bitw coff add 1 setcachedevice coff cloc sub 0 dc xl cloc .5 sw div add 0 dc newpath moveto bitw 0 ne {0 1 rlineto bitw .5 sw div sub 0 rlineto 0 -1 rlineto closepath clip sw sh false [sw 0 0 sh neg 0 sh]{fd /hm get}imagemask}if } if end } def end mfont definefont pop } def /wi{save exch /show{pop}def stringwidth 3 -1 roll restore}def /aps {0 get 124 eq}def /apn {s30 cvs aps} def /xc{s30 cvs dup}def /xp{put cvn}def /scs{xc 3 67 put dup 0 95 xp}def /sos{xc 3 79 xp}def /sbs{xc 1 66 xp}def /sis{xc 2 73 xp}def /sob{xc 2 79 xp}def /sss{xc 4 83 xp}def /dd{exch 1 index add 3 1 roll add exch} def /smc{moveto dup show} def /kwn{dup FontDirectory exch known{findfont exch pop}}def /fb{/ps ps 1 add def}def /mb {dup sbs kwn { exch{pop}{bbc}{} mm }ifelse sfd }def /mo {dup sos kwn { exch{pop}{boc}{} mm }ifelse sfd }def /ms {dup sss kwn { exch{pop}{bsc}{} mm }ifelse sfd }def /ao {dup sos kwn { exch dup ac pop {scs findfont /df2 xdf}{aoc}{} mm }ifelse sfd }def /as {dup sss kwn { exch dup ac pop {scs findfont /df2 xdf}{asc}{} mm }ifelse sfd }def /ac { dup scs kwn {exch /ofd exch findfont def /tmp ofd maxlength 1 add dict def ofd cf mv tmp /PaintType 1 put tmp definefont}ifelse }def /mm{ /mfont 10 dict def mfont begin /FontMatrix [1 0 0 1 0 0] def /FontType 3 def /Encoding macvec def /df 4 index findfont def /FontBBox [0 0 1 1] def /xda xdf /mbc xdf /BuildChar { wd begin /cr xdf /fd xdf /cs s1 dup 0 cr put def fd /mbc get exec end } def exec end mfont definefont} def /bbc { /da .03 def fd /df get setfont gsave cs wi exch da add exch grestore setcharwidth cs 0 0 smc da 0 smc da da smc 0 da moveto show } def /boc { /da 1 ps div def fd /df get setfont gsave cs wi exch da add exch grestore setcharwidth cs 0 0 smc da 0 smc da da smc 0 da smc 1 setgray da 2. div dup moveto show } def /bsc { /da 1 ps div def /ds .05 def %da dup .03 lt {pop .03}if def /da2 da 2. div def fd /df get setfont gsave cs wi exch ds add da2 add exch grestore setcharwidth cs ds da2 add .01 add 0 smc 0 ds da2 sub xl 0 0 smc da 0 smc da da smc 0 da smc 1 setgray da 2. div dup moveto show } def /aoc { fd /df get setfont gsave cs wi grestore setcharwidth 1 setgray cs 0 0 smc fd /df2 get setfont 0 setgray 0 0 moveto show }def /asc { /da .05 def fd /df get setfont gsave cs wi exch da add exch grestore setcharwidth cs da .01 add 0 smc 0 da xl 1 setgray 0 0 smc 0 setgray fd /df2 get setfont 0 0 moveto show }def /mf{gsave 32 760 xl 1 -1 scale 1 1 pen 128 152 moveto 27.5 27.5 693.5 522.5 0 dorect 6 6 pen 63. 63. 657. 486. 0 dorect 48 fz F /|B---1Times fnt pop (Manual Feed)show 118 275 moveto 14 fz F /|----1Times fnt pop (document: )show sk{statusdict /jobname get dup null ne{show}{pop}ifelse}if 118 362 moveto (Manual Feed Instructions)show 127 398 moveto (1. Wait until the yellow light on the front of your)show 145 416 moveto (LaserWriter comes on steadily \(not flashing\).)show 127 458 moveto (2. Insert your paper or envelope in the manual feed)show 145 478 moveto (guide on the right side of the LaserWriter.)show 127 517 moveto (3. Repeat steps 1 and 2 until your document is)show 145 537 moveto (completed.)show 0 page sk{statusdict /manualfeed true put 5 dly}if grestore}def /dly{ usertime exch 1000 mul add { dup usertime le{exit}if }loop pop }def /lsf {FontDirectory {pop dup apn{= flush}{pop}ifelse}forall /* = flush}def /dl{gsave 0 setlinewidth 0 setgray}def /T true def /F false def /6a 6 array def /2a 2 array def /5a 5 array def /qs{3 -1 roll sub exch 3 -1 roll sub exch}def /qa{3 -1 roll add exch 3 -1 roll add exch}def %multiply point: pt factor qm newpt /qm{3 -1 roll 1 index mul 3 1 roll mul}def /qn{6a exch get mul}def /qA .166667 def /qB .833333 def /qC .5 def /qx{ 6a astore pop qA 0 qn qB 2 qn add qA 1 qn qB 3 qn add qB 2 qn qA 4 qn add qB 3 qn qA 5 qn add qC 2 qn qC 4 qn add qC 3 qn qC 5 qn add }def /qp{6 copy 12 -2 roll pop pop}def /qc{qp qx curveto}def /qi{{4 copy 2a astore aload pop qa .5 qm newpath moveto}{2 copy 6 -2 roll 2 qm qs 4 2 roll}ifelse}def /qq{{qc 2a aload pop qx curveto}{4 copy qs qa qx curveto}ifelse}def /pt{gsave currentpoint newpath moveto}def /qf{gsave eofill grestore}def /tr{currentgray currentscreen bs 5a astore pop /fillflag 1 def}def /bc{/fillflag 0 def}def /ec{ 1 and 0 ne {currentgray currentscreen bs 5a aload pop bd setscreen setgray 0 doop bd setscreen setgray} {newpath}ifelse }def /bp{currentpoint newpath 2 copy moveto currentgray currentscreen bs 5a astore pop}def /eu{ fillflag 0 ne { gsave currentgray currentscreen bs 5a aload pop bd setscreen setgray 4 ep bd setscreen setgray }if fp{0 ep}{grestore newpath}ifelse }def /sm { dup 0 exch {32 eq{1 add}if}forall } def /ll { 3 1 roll exch dup .0001 lt 1 index -.0001 gt and {pop pop pop} {sub dup 0 eq { pop show } { 1 index sm dup 0 eq 3 index 0 le or { pop length div 0 3 -1 roll ashow } { 10 mul exch length add div dup 10 mul 0 32 4 -1 roll 0 6 -1 roll awidthshow }ifelse }ifelse }ifelse }def /ss { /pft currentfont def sa aload pop pop /|----2Symbol 4 1 roll {pop{as}} {{{ao}}{{fnt}}ifelse}ifelse exch pop exec exch pop }def /pf{pft dup setfont}def /rs { sa 2 get { gsave 1 index 0 currentfont dup /FontInfo known { /FontInfo get dup /UnderlinePosition known { dup /UnderlinePosition get 1000 div ps mul } { ps 10 div neg %15 makes line closer to text }ifelse exch dup /UnderlineThickness known { /UnderlineThickness get 1000 div ps mul } { pop ps 15 div %20 makes slightly narrower line }ifelse } { pop ps 10 div neg %15 makes line closer to text ps 15 div %20 makes slightly narrower line }ifelse setlinewidth 0 setgray currentpoint 3 -1 roll sub moveto sa 4 get{gsave currentlinewidth 2. div dup rmoveto currentpoint xl 2 copy rlineto stroke grestore}if sa 3 get sa 4 get or 3 1 roll 2 index{gsave 1 setgray 2 copy rlineto stroke grestore}if rlineto{strokepath 0 setlinewidth}if stroke grestore }if tv } def /macvec 256 array def macvec 0 /Times-Roman findfont /Encoding get 0 128 getinterval putinterval macvec 39 /quotesingle put /dotlessi /grave /circumflex /tilde /cedilla /registerserif /copyrightserif /trademarkserif macvec 0 8 getinterval astore pop /Adieresis /Aring /Ccedilla /Eacute /Ntilde /Odieresis /Udieresis /aacute /agrave /acircumflex /adieresis /atilde /aring /ccedilla /eacute /egrave /ecircumflex /edieresis /iacute /igrave /icircumflex /idieresis /ntilde /oacute /ograve /ocircumflex /odieresis /otilde /uacute /ugrave /ucircumflex /udieresis /dagger /ring /cent /sterling /section /bullet /paragraph /germandbls /registersans /copyrightsans /trademarksans /acute /dieresis /notequal /AE /Oslash /infinity /plusminus /lessequal /greaterequal /yen /mu /partialdiff /summation /product /pi /integral /ordfeminine /ordmasculine /Omega /ae /oslash /questiondown /exclamdown /logicalnot /radical /florin /approxequal /Delta /guillemotleft /guillemotright /ellipsis /space /Agrave /Atilde /Otilde /OE /oe /endash /emdash /quotedblleft /quotedblright /quoteleft /quoteright /divide /lozenge /ydieresis /Ydieresis /fraction /currency /guilsinglleft /guilsinglright /fi /fl /daggerdbl /periodcentered /quotesinglbase /quotedblbase /perthousand /Acircumflex /Ecircumflex /Aacute /Edieresis /Egrave /Iacute /Icircumflex /Idieresis /Igrave /Oacute /Ocircumflex /apple /Ograve /Uacute /Ucircumflex /Ugrave /dotlessi /asciicircum /asciitilde /macron /breve /dotaccent /ring /cedilla /hungarumlaut /ogonek /caron macvec 128 128 getinterval astore pop FontDirectory {exch dup s30 cvs /@s xdf @s aps {pop pop} {exch dup length dict /tmp xdf cf /Symbol ne {mv} if /@i false def /@o false def /@b false def mark @s (Italic) search {/@i true def} if (Oblique) search {/@o true def} if (Bold) search {/@b true def} if (Roman) search pop (-) search pop /@s xdf cleartomark @s cvn dup /Symbol eq{pop 50}{/Courier eq{51}{49}ifelse}ifelse s30 0 @s length 6 add getinterval dup 6 @s putinterval dup 0 (|-----) putinterval @b {dup 1 66 put} if @i @o or {dup 2 73 put} if % @o {dup 2 79 put} if dup 5 4 -1 roll put cvn tmp definefont pop }ifelse }forall /_--C-2Symbol /Symbol findfont /tmp 1 index maxlength 1 add dict def cf tmp /PaintType 1 put tmp definefont /|----4Seattle /Helvetica findfont dup length 1 add dict /tmp xdf cf mv /mxv [/zero /one /two /three /four /five /six /seven /eight /nine /comma /period /dollar /numbersign /percent /plus /hyphen /E /parenleft /parenright /space] def tmp /Metrics 21 dict dup begin mxv{600 def}forall end put tmp begin /FontBBox FontBBox [0 0 0 0] astore def end tmp definefont pop /od{txpose 10 fz 0 fs F /|----3Courier fnt pop}def /op{/scaleflag false def /pm save def}def /cp{pm restore}def end % % eexec reads the PSHX resources %currentfile eexec <652E29AE551935C9A82086907FB876D510EC4D451220E0F80D63DBC0EA379346 C055B673F7BED773F332BDE5107DC0B1322DF36267320C226DBEBD9299B29C86 5D1876ABB7E19F6A45F52C588810FD0A9FFBB1073AD1B6BDCA3D2BAE3283AC88 35259ADDA98433676B8B757B19473F2C0C3D36AF93B3DD15AFC47F4D3BECB87B ABAAB5613FCD319A712E7D4A8C5A3C0BA96A376CC93C52ABDE43A980670C1E6B 78E4D14D5CA032FE07255D5E5A084CCF4B8E23C64F574932EA53E8CD7F00F47B 4179A6DAFE3BC43B1D091902E6E4B5699C7322FC23B5FBE833E4114C4544E29E 6225A5B48E6F2A840F44E827681E1AC9F28EB8FEC32105CA4056D863BCAECE65 1AAF3B12BC38A77CA241A66FAE92939A6EFACD49711E5D7355E634041C378FFC 1F3BF8B903E5F8961E7480259EB0AA90B0C38E75D264ACE71F1307D4894BFDCF 9C9D0F3C026BA190A3F6F7E06F3ED092E8CF0D4F22AD6C55C6FED836290F9611 442BF4DEDBBA0B67D2AF782A796D474ECE7B2B788B4771D4BBCDF0E8F48A2874 D1CF78D3B1C5AA2987C6A22135B1508C7C5EC5AD86ABAE8D1E34A5314F703337 C7A2C0CF52DBBF046F0BD67BE5E65AAD9CE43FAB6E7C9F669801849C9366E5AE 76C77D8DDBF188CD18C120FEA4C1B510FC00434A2629BB82A9336EB36A5D5552 F4971ED40EF839771762E60509A2A3214DEA9C58C2E53E76CE24B99E3C472719 C66B31A38DE21135FF1390CCA7E0F6B92CEEAF9524317A427DA7CB9B4ED08BF0 9868FCD9ECAAFF2C520E0EAAB8730FD6CE85B4ACAEE82FC53C5D948C8858A8A3 CF945546556FB3DC9CE69D87BD793DAC57E3F4FB9D056C163C3EE134EDDF7B7D 186C9A0D79759CD9BF94A4B1E2A6070727DFC08806828B53799090725D4B2D6E 9BCB6C2B90AA4E47D1774F3A58868E4EB3464C7FB07854CE66E3AB03A5D515A1 69AC0EA62BAE9A2A419C9AAB14F09A864F4228A098FB288B60E87B85EB16A6D4 EF27B835BAC40E45BF48F78E6CE74AE0C1E81316F630BFE0D7661116B6A92187 9A1036437280BDA64F85CB37CA0DDBF827C3E4885F1C75E3C84CB8EBED892810 450DA08029A611AEE126FD6BEFF6830EDA28E4C54649D93C23270703B2F7FEAA A6524192A2D7F1151B2827EF4B27C823D385EA683F024299B1EFE64871AFD4CD 6C54C484AA53030CC7F8254BF9E525A00E51867660A3409BECA98DEB37A568F6 D1026ECBFCCF8C9B9BFD11CE017CB2271E7BDEE1D459FFA23062D5B42552C04B 9BC02C0D7F5CC926ABE694A185FDE2ECC76506DEF1435CBC1225475E4D98A04C 2CF1DD03915DEB659BC23DE29A6E6734CF49CE39A1BF450A55B0F14D350E79B0 5C690B84003AB669678B3A416828F376F78946C44009A14A49ED90980B6E4589 56D188D9AC3FA7F781C8670C83B403B73237B6B0C2862C51C33D559C005D6C9D D39914B79DBE81291EF8D7CE3EC844176FB7C08A6F344E26C0563C29FCC3B0CB 2CCCF9412832300CBCDE6BFF39A8804ACCB8375752EEECB1BBA0851ED8DF9E17 4A5C747E354402DE217C6A7DE35BDE29F50284F66EC5F9DC0032FE3E05842472 6F9E50555FCBEFF246264D503DCFEB5C5F3384798E5C622FD0450DC62DCE36CA 9007DBA236A7CE56A57C0B0C531AC5766684DE4BDD2DFEC3BA4D99B930B2EDB2 0C2AC0F032BB6E5C75AF97AE24DD7FF33FA0F643BBB39331E7E4A474ED5612A1 7AEF558F8281D4E9EC01AC3D04C4A4C4B8A67F7A6199BA35448298E177554A20 81DFA1E8D1BC88BDB9938CFEC498918BF3AD690924F295A03D17F28C5FF47F43 D495B74827BD54A2524F53750D4C030843986C97B59A63E08EFB9B14582088BA FC257BCEF07F2E4B8DCADCC9FAEF7388055483470D5FA4A8CE8CC118CA91FAA5 B0DCCC7F3638A2F9F40628186990C2EE0E25B0FB34DAD8521A6735485ADBE4DD 7A937036C5EF7E741FF4543FDEE19DD0CFF59A89656F80F8E5E84C10878CB651 0DD3C3C7A346AC1877FFA88E5ADDCFF95D37163A5350AA5C71BB801ACB0D0FA1 154DE2C2D039CAAB85F389554044E8F90F9992DEBCCBEACE55F69E31061FB052 A25343ECBEDE16C8999218AF370378901B36655D83D4B9BC5F4F43B361BB2134 3A88E0350E5C4342407DEFA79877B3C5DAFE15B0F58520FDBE5B8362BE3549AE 03BD77CDFEC962C539252312ECC5D841F55BEBAD9F7BB03A2D2CAC844E82A568 7CB2D8E599E356D9A23802439B056F1CC104F9F0D3F01EE2593C59483154FCCA 3973F487593C9DE94FC0863B6669100B46AFC5B261493A4B50CB9F802EBC31AB 7B7903A1957EA078A0C4D90E204E44335131C9B65F15D3E5C9A87ADAA7FE5E49 D3654F021F460E5E2AC56A69E8F50E45B0D859D8EC27333DF2AE409015973D7E ED59F45720DD271D081F3DF62032358E0D4B1D4A528FB4E96A6B2007E13E55E2 10DAED32AF76F3396D60295D116EC4EE4D42DF4BC764ED9BC11A369FE070815F FEB5662551561354788EFA98612D09BC964428767E0CBE5DC3EC5B599E9B2074 AA3D446752A4E34485C3D111034676AF67EE5345263E883CF46C8BEF1BD4D51D D2B625481880254888AB0C186E2D0549F657E59026E2A3C49FE0DFD2A2CAD076 586B6F248C11E81C41F9525A5D2F77CE5D76FD9104F39F4E4E31CF75045A9061 B16B20CDC2AFD0595F5B6ADF45CA0DC6A37C4ED090AADCFE9EA7847217777A8E 88C7FBC247EC02973EF656BF1A4A2E71ED21142EC48CC9FDBF5EAE8B46C3E477 59D9C304C6862D43AF1DE66B44B4AC18B47C6518FA5747D3D8C9A19612DAEE4E 83C141561421A1360FD847997148932568D3E6CA93BF0D5874BCD90A3A363739 1FAD35F574797D6160BD4F1AEC3A326D5D73C9BD699C41524B18BC6CDF9169E7 51FFAB19B9FD7ABE3B2F9D3E0F67ADB05CA85D484ACBC84E287DAA1EDC3BCD95 694EF05F77A59004B1C3E223AA4A5A063EC238B4A5A25D335FA51B165963621F 57B7F2C54E59CFED574370399A03E2DFB0F1E35678A6A509A912ED27AD755C67 E045CC1CFEFE41CAD8EA73DD666757D90170EF9C3F218120F38FC1D38224160E 7F5DE6BDF39665FF231079296B94A7DE674847D299C711E77C9DA408FF9CDCFA 8F7FE175BE275EB0AE21512D074DBDDCF1CDF75642EF656E2555F9F3E60A2822 F214CC81EEF0E4866387799F21B1F4B296E7F3A2206795457A33E85B397A5F20 10809D1F43B2267BD762A6CC12DF31BB0817496FE666A6955CD2BA96549B4D1F 827E54A835ABA03B1079F1F5C3C4D2F4F698D3C235BDFA829F079A0DCF788913 77B31EBACF4E61A01487ED1F80ABBF5CF000B1EAA8527EC6064AB06B921916CB 65045B86E9BB2D2E854C5124C218B6FDA0732ABF424EE1696BC86F8987E48CC5 038C8A557E9534A48E7C55F21F021AA7A370A7CC1B55E777972883433F454450 D18ABFC489D5AA518171884FB7103D92E479ECAEA449341F7C8DB1BD39ECB1ED 45AF5D9628EF37CAF8DB3C9A65856A97FB9698DD68F8BE27B3C4174F1838C7A0 674A9460333A059BF214C0690F35BC0352AF9B82CB0F46EAE63A3C0302B4118D 9E65479030F1EFE34909FA458E31A500483B68601B480D51B7FFCD004A1B5360 905B88019BC3EF0FF064AC6477442573C18EF7090E2C08EAA1A9> eexec @//E*O*F laser-prep.pro// chmod u=rw,g=rw,o=r laser-prep.pro echo x - macfilter.c sed 's/^@//' > "macfilter.c" <<'@//E*O*F macfilter.c//' /* * macfilter - Convert non-ascii characters to octal excapes for the * LaserWriter printer. This usually only happens with Postscript * files generated by the Macintosh, it isn't supposed to do that * but sometimes it does. This little guy makes it all better * again. * Author: Brian Powell, brian@ut-sally */ #include #include main() { register char c; while ((c = getchar()) != EOF) { if (!isascii(c)) printf("\\%03o", ((int)c) & 0377); else putchar(c); } exit (0); /* set explicit exit code for the spooler */ } @//E*O*F macfilter.c// chmod u=rw,g=rw,o=r macfilter.c echo x - psfilter.csh sed 's/^@//' > "psfilter.csh" <<'@//E*O*F psfilter.csh//' #! /bin/csh -f # # psfilter - filter for the Apple LaserWriter (Postscript) printer # # DON'T edit this file directly, edit the source in # /usr/src/local/prop/transcript/src/psfilter.sh, run make psfilter # and install the result. I had to retrofit changes once, please consider # the poor slob who has to change it next time. (R.H. 5/85) # # Each of these files is merely a link to the current file, and we look at # argument 0 to see which one we are being called by. Alternatively, you # may wish to modify printjob.c (/usr/src/usr.lib/lpr/printjob.c) to pass # the name of the filter you wish to use as the argument following the -f # switch. # set name host filter x y indent width length acct pid printer title setenv TERMCAP /etc/printcap umask 0 if ($?0) set filter = $0 top: if($#argv > 0) then switch ($argv[1]) case -f: # filter desired shift argv if ($#argv > 0) then set filter = $argv[1] shift argv endif goto top case -h: # host spooling file shift argv if ($#argv > 0) then set host = $argv[1] shift argv endif goto top case -i*: # indentation, ignored for now set i=$argv[1] shift argv goto top case -l*: # page length, ignored for now set l=$argv[1] shift argv goto top case -n: # uid of spooling user shift argv if ($#argv > 0) then set name = $argv[1] shift argv endif goto top case -p: # printer to be used shift argv if ($#argv > 0) then set printer = (-i $argv[1]) set pset shift argv endif goto top case -w*: # page width, ignored for now set width=$argv[1] shift argv goto top case -x*: # starting x position, ignored for now set x=$argv[1] shift argv goto top case -y*: # starting y position, ignored for now set y=$argv[1] shift argv goto top default: # currently assumed to be the accounting file # This name is defined as af in printcap # tail of name must match printer name set acct=$argv[1] set pid=(-P$argv[1]:t) set logfile=/usr/adm/log-$argv[1]:t shift argv goto top endsw endif set lockfile=lock # doubtful anything else set cffile=`cat $lockfile | grep cf | head -1` # grok the name of the cf set title=`grep N $cffile | head -1 | sed s/N//` # get job title set mtmp="/tmp/spoolmail$$" # name of temp mail file set policy=.policy # text file to be mailed if ( ! -f $policy ) set policy=/dev/null # subject will have to do set taunt="Permission to use laser printer denied" # Contrary to it's name, psif is the filter which talks to the printer. It's # intended to be specified as the if filter in the printcap. This works # fine if everything is processed to PostScript before being spooled, but in # this setup it is used as the tail of the filter chain. Psof should be # specified as the of entry in the printcap and the sh (short header) boolean # should be set. It formats a banner maker and psif sends it after EOF on # the file it is processing. # Modified June 86 to support LW's on Bridges also. The printer name in # the form -Pname (as determined above) is passed to psif. Psif does a # gethostbyname call, if the printer name is defined (in /etc/hosts or to # the nameserver as applicable) then a network socket is opened to that # address. The address for the name is actually assigned to a Bridge serial # port to which the LW is connected. Psif then treats the socket as its # stdout and does its normal processing, the output stream will flow across # the net to the remote LW. If the gethostbyname call fails then nothing # special is done and psif behaves as before, assuming its stdout is # connected to the physical printer device (as setup by lpd). # Ron Hitchens onintr intrupt # vector int's to error section # Get the filetype portion of the filter name switch ($filter:r) case /usr/local/lib/psasc: # ascii document case psasc: set filtype="ascii" if ( "$title" == "" ) set title="ascii document" # ------------------------------------- # Permission checking/accounting hacks should be hooked in here # similar entries for each case below # /usr/local/lib/laser_ok $host $name # returns 0 if valid user # if ( $status ) then # Mail -s "$taunt" $name@$host < $policy # exit 2 # spool file is discarded # endif # ------------------------------------- /usr/local/lib/psif -h $host -n $name $pid $acct if ( $status ) breaksw # go handle error exit 0 # all is well case /usr/local/lib/psdvi: # TeX document case psdvi: set filtype="TeX" if ( "$title" == "" ) set title="TeX document" /usr/local/lib/dvi2ps -i -q \ -h /usr/local/lib/allfonts/postscript/tex.ps \ | /usr/local/lib/psif -h $host -n $name $pid $acct if ( $status ) breaksw # drop down and handle error exit 0 # success case /usr/local/lib/psditroff: # ditroff document case psditroff: set filtype="Ditroff" if ( "$title" == "" ) set title="Ditroff document" /usr/local/lib/psdit | /usr/local/lib/psrev | \ /usr/local/lib/psif -h $host -n $name $pid $acct if ( $status ) breaksw # go handle error exit 0 case /usr/local/lib/psmac: # PS file made by a mac case psmac: # uses rf (fortran) type set filtype="Macintosh" if ( "$title" == "" ) set title="Mac laser document" cat /usr/local/lib/allfonts/postscript/laser-prep.pro - | \ /usr/local/lib/macfilter | \ /usr/local/lib/psif -h $host -n $name $pid $acct if ( $status ) breaksw # go handle error exit 0 case /usr/local/lib/pscat: # old troff, no no case pscat: set filtype="old style troff" if ( "$title" == "" ) set title="old troff document" echo "Old style troff is not supported on the LaserWriter" \ > $mtmp echo "Please use ditroff instead." >> $mtmp set nolog breaksw exit 0 # superstition default: set filtype="LaserWriter" if ( "$title" == "" ) set title="document" echo "No support for that file type on the LaserWriter" > $mtmp set nolog breaksw exit 0 # superstition endsw intrupt: # a place to catch interrupts, hopefully these # shell vars have been set, will be if lpd # kills a running filter, like psif if ( ! $?nolog ) then echo "Error returned by $filtype filter. Here are the last few lines from" \ > $mtmp echo "the error log, yours should be last:" >> $mtmp echo "" >> $mtmp tail -8 $logfile >> $mtmp endif Mail -s "Error spooling $title to $pid" $name@$host < $mtmp rm $mtmp echo "There was a problem with your $filtype job spooled for $pid" > $mtmp echo "A mail message was sent to you at $host with further details" >> $mtmp ( /usr/local/telegram $name@$host < $mtmp > /dev/null ; rm $mtmp ) & exit 2 # throw the file away @//E*O*F psfilter.csh// chmod u=rwx,g=rwx,o=rx psfilter.csh echo x - psmac.csh sed 's/^@//' > "psmac.csh" <<'@//E*O*F psmac.csh//' #!/bin/csh -f # PS file made by a mac, uses rf (fortran) type # This script is intended to be named in the printcap # as the "rf" filter. We chose that because it is for # files of the "Fortran" type (whatever that means) and # was unused. Any of the unused printcap filter slots will # do as well, so long as Mac postscript files are spooled # with the proper flag to lpr. We use a shell script called # maclaser to do that and hide it from the user. # The laser-prep.pro file prepended here must be modified for # non-permanent download. The standard one as extracted from # an Apple disk will not work. The mods are trivial. # Your pathname may vary, I got tired of chasing fonts all # over the filesystem so I put everything under one directory. # Ron Hitchens U of Texas CS (hitchens@sally.utexas.edu) cat /usr/local/lib/allfonts/postscript/laser-prep.pro - | \ /usr/local/lib/macfilter | \ /usr/local/lib/psif $* if ( $status ) exit 2 # An error, throw the job away exit 0 @//E*O*F psmac.csh// chmod u=rwx,g=rwx,o=rx psmac.csh exit 0