home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / unix / volume12 / postscript / ps.diff.v3 < prev    next >
Encoding:
Text File  |  1989-02-16  |  53.2 KB  |  1,952 lines

  1. Make sure you have already applied patch 'ps.diff.v2'.
  2.  
  3. If you already have the file "source/X11.c", move it to a safe place
  4. before applying this patch.
  5.  
  6. To apply this, you need the 'patch' program which is available from
  7. the comp.sources.unix archives.
  8.  
  9. Change directories to the top-level postscript directory (the one with
  10. the file "MANIFEST" in it) and apply this patch with the command:
  11.  
  12. patch -p0 <ps.diff.v3
  13.  
  14.                 _.John G. Myers
  15.                 jm36+@andrew.cmu.edu
  16.  
  17. *** /tmp/CHANGES.JGM.v2    Thu Jul 28 14:59:27 1988
  18. --- ./CHANGES.JGM    Thu Jul 28 15:07:01 1988
  19. ***************
  20. *** 60,65 ****
  21. --- 60,80 ----
  22.   
  23.   Added operators letter, note, and legal.
  24.   
  25. +                   Version 3:
  26. + Bugs fixed:
  27. + The fourth parameter to the "framedevice" is no longer ignored.  psrc
  28. + has been modified so that if a driver defines the postscript operator
  29. + "outputpage", it will be called instead of the "beep and wait for
  30. + input" routine when the copypage or showpage command is executed.
  31. + Enhancements made:
  32. + Barry Shein's speedups have been incorporated.
  33. + A version of the X11 driver is included.
  34.                   John G. Myers
  35.                   jm36@andrew.cmu.edu
  36.                   jgm@k.gp.cs.cmu.edu
  37. diff -cr /usr/tmp/ps/postscript/psrc ./postscript/psrc
  38. *** /usr/tmp/ps/postscript/psrc    Thu Jul 28 14:00:59 1988
  39. --- ./postscript/psrc    Thu Jul 28 14:17:45 1988
  40. ***************
  41. *** 69,84 ****
  42.   %/tty (|cat -u </dev/tty) (r) file def
  43.   
  44.   /showpage {
  45. !     copypage initgraphics
  46. !     beep print flush
  47. !     false echo
  48. !     { tty read { pop } if } stopped
  49. !     true echo
  50. !     not {
  51. !         erasepage
  52. !     } if
  53.   } def
  54.   
  55.   /run { { (r) file } stopped { pop stop } if cvx exec } def
  56.   /prompt { (PS>) print } def
  57.   
  58. --- 69,87 ----
  59.   %/tty (|cat -u </dev/tty) (r) file def
  60.   
  61.   /showpage {
  62. !     copypage initgraphics erasepage
  63.   } def
  64.   
  65. + systemdict /outputpage known not {
  66. +     /outputpage {
  67. +     beep print flush
  68. +       false echo
  69. +       { tty read { pop } if } stopped
  70. +       true echo
  71. +     pop
  72. +     } def
  73. + } if
  74.   /run { { (r) file } stopped { pop stop } if cvx exec } def
  75.   /prompt { (PS>) print } def
  76.   
  77. ***************
  78. *** 423,429 ****
  79.       /h 11 72 mul f mul cvi def
  80.       /w 8.25 72 mul f mul 8 div cvi def
  81.       m 5 h put
  82. !     m w h [] framedevice
  83.       end
  84.   } def
  85.   
  86. --- 426,432 ----
  87.       /h 11 72 mul f mul cvi def
  88.       /w 8.25 72 mul f mul 8 div cvi def
  89.       m 5 h put
  90. !     m w h /outputpage load framedevice    % jgm
  91.       end
  92.   } def
  93.   
  94. ***************
  95. *** 435,441 ****
  96.       /h 11 72 mul f mul cvi def
  97.       /w 8.25 72 mul f mul 8 div cvi def
  98.       m 5 h put
  99. !     m w h [] framedevice
  100.       end
  101.   } def
  102.   
  103. --- 438,444 ----
  104.       /h 11 72 mul f mul cvi def
  105.       /w 8.25 72 mul f mul 8 div cvi def
  106.       m 5 h put
  107. !     m w h /outputpage load framedevice    % jgm
  108.       end
  109.   } def
  110.   
  111. ***************
  112. *** 446,452 ****
  113.       /h 11 72 mul f mul cvi def
  114.       /w 8.25 72 mul f mul 8 div cvi def
  115.       m 5 h put
  116. !     m w h [] framedevice
  117.       end
  118.   } def
  119.   
  120. --- 449,455 ----
  121.       /h 11 72 mul f mul cvi def
  122.       /w 8.25 72 mul f mul 8 div cvi def
  123.       m 5 h put
  124. !     m w h /outputpage load framedevice    % jgm
  125.       end
  126.   } def
  127.   
  128. ***************
  129. *** 457,463 ****
  130.       /h 8.25 72 mul f mul cvi def
  131.       /w 11.75 2 div 72 mul f mul 8 div cvi def
  132.       m 5 h put
  133. !     m w h [] framedevice
  134.       end
  135.   } def
  136.   
  137. --- 460,466 ----
  138.       /h 8.25 72 mul f mul cvi def
  139.       /w 11.75 2 div 72 mul f mul 8 div cvi def
  140.       m 5 h put
  141. !     m w h /outputpage load framedevice    % jgm
  142.       end
  143.   } def
  144.   
  145. ***************
  146. *** 467,473 ****
  147.       /f m 0 get def
  148.       /h 8.25 72 mul f mul cvi def
  149.       /w 11.75 72 mul f mul 8 div cvi def
  150. !     [ 0 f f 0 0 0] w h [] framedevice
  151.       end
  152.   } def
  153.   
  154. --- 470,476 ----
  155.       /f m 0 get def
  156.       /h 8.25 72 mul f mul cvi def
  157.       /w 11.75 72 mul f mul 8 div cvi def
  158. !     [ 0 f f 0 0 0] w h /outputpage load framedevice % jgm
  159.       end
  160.   } def
  161.   
  162. ***************
  163. *** 480,486 ****
  164.       /h 11 72 mul f mul cvi def
  165.       /w 8.5 72 mul f mul 8 div cvi def
  166.       m 5 h put
  167. !     m w h [] framedevice
  168.       end
  169.   } def
  170.   
  171. --- 483,489 ----
  172.       /h 11 72 mul f mul cvi def
  173.       /w 8.5 72 mul f mul 8 div cvi def
  174.       m 5 h put
  175. !     m w h /outputpage load framedevice
  176.       end
  177.   } def
  178.   
  179. ***************
  180. *** 493,499 ****
  181.       /h 14 72 mul f mul cvi def
  182.       /w 8.5 72 mul f mul 8 div cvi def
  183.       m 5 h put
  184. !     m w h [] framedevice
  185.       end
  186.   } def
  187.   
  188. --- 496,502 ----
  189.       /h 14 72 mul f mul cvi def
  190.       /w 8.5 72 mul f mul 8 div cvi def
  191.       m 5 h put
  192. !     m w h /outputpage load framedevice
  193.       end
  194.   } def
  195.   
  196. *** /usr/tmp/ps/source/makefile    Thu Jul 28 13:53:39 1988
  197. --- ./source/makefile    Thu Jul 28 15:36:09 1988
  198. ***************
  199. *** 2,10 ****
  200. --- 2,20 ----
  201.       integer.o main.o math.o misc.o name.o operator.o\
  202.       poly.o property.o real.o save.o stack.o string.o unix.o
  203.   LIBS=libww.a -lsuntool -lsunwindow -lpixrect -g
  204. + XLIB=/usr/lib/libX11.a
  205.   GRAPHICS=cache.o colour.o device.o fill.o font.o gsave.o image.o mat.o matrix.o\
  206.       pat.o path.o state.o stroke.o
  207.   
  208. + SOURCES=array.c boolean.c config.c control.c dictionary.c file.c\
  209. +     integer.c main.c math.c misc.c name.c operator.c\
  210. +     poly.c property.c real.c save.c stack.c string.c unix.c\
  211. +     cache.c colour.c device.c fill.c font.c gsave.c image.c mat.c matrix.c\
  212. +     pat.c path.c state.c stroke.c
  213. + LINT=lint
  214. + LFLAGS= -lm
  215.   # For SUN with 68881
  216.   #CFLAGS=-O -f68881
  217.   
  218. ***************
  219. *** 11,39 ****
  220.   # For others
  221.   CFLAGS=-O
  222.   
  223. ! #default: sunPS
  224.   
  225.   PS:    $(OBJECTS) $(GRAPHICS) hard.o canon.a
  226. !     cc $(CFLAGS)  $(OBJECTS) $(GRAPHICS) hard.o canon.a -lm `libs` -o PS
  227.   
  228.   sunPS:    $(OBJECTS) $(GRAPHICS) pixrect.o canon.a
  229. !     cc $(CFLAGS)  $(OBJECTS) $(GRAPHICS) pixrect.o canon.a -lm -lpixrect -o sunPS
  230.   
  231.   CPS:    $(OBJECTS) $(GRAPHICS) colour-ww.o trapezoid.o canon.o
  232. !     cc $(CFLAGS)  $(OBJECTS) $(GRAPHICS) colour-ww.o canon.o trapezoid.o -lm `libs` -o CPS
  233.   
  234.   postscript:    $(OBJECTS) $(GRAPHICS) adapter.o protocol.o
  235. !     cc $(CFLAGS) $(OBJECTS) $(GRAPHICS) adapter.o protocol.o -lm -o postscript
  236.   
  237.   XPS:    $(OBJECTS) $(GRAPHICS) X.o
  238. !     cc $(CFLAGS)  $(OBJECTS) $(GRAPHICS) X.o -lm -lX -o XPS
  239.   
  240.   canon.a:    canon.o screen.o trapezoid.o paint.o
  241.       ar ruv canon.a canon.o screen.o trapezoid.o paint.o
  242.       ranlib canon.a
  243.   
  244.   viewer:    protocol.o viewer.o hard.o canon.a
  245. !     cc protocol.o viewer.o hard.o canon.a `libs` -o viewer
  246.   
  247.   all:    PS postscript viewer
  248.   
  249. --- 21,56 ----
  250.   # For others
  251.   CFLAGS=-O
  252.   
  253. ! default: sunPS
  254.   
  255. + xps: $(OBJECTS) $(GRAPHICS) X11.o canon.a $(XLIB)
  256. +     rm -f xps
  257. +     $(CC) -o xps $(CFLAGS) $(OBJECTS) $(GRAPHICS) X11.o canon.a -lm $(XLIB)
  258.   PS:    $(OBJECTS) $(GRAPHICS) hard.o canon.a
  259. !     $(CC) $(CFLAGS)  $(OBJECTS) $(GRAPHICS) hard.o canon.a -lm `libs` -o PS
  260.   
  261.   sunPS:    $(OBJECTS) $(GRAPHICS) pixrect.o canon.a
  262. !     $(CC) $(CFLAGS)  $(OBJECTS) $(GRAPHICS) pixrect.o canon.a -lm -lpixrect -o sunPS
  263.   
  264.   CPS:    $(OBJECTS) $(GRAPHICS) colour-ww.o trapezoid.o canon.o
  265. !     $(CC) $(CFLAGS)  $(OBJECTS) $(GRAPHICS) colour-ww.o canon.o trapezoid.o -lm `libs` -o CPS
  266.   
  267.   postscript:    $(OBJECTS) $(GRAPHICS) adapter.o protocol.o
  268. !     $(CC) $(CFLAGS) $(OBJECTS) $(GRAPHICS) adapter.o protocol.o -lm -o postscript
  269.   
  270.   XPS:    $(OBJECTS) $(GRAPHICS) X.o
  271. !     $(CC) $(CFLAGS)  $(OBJECTS) $(GRAPHICS) X.o -lm -lX -o XPS
  272.   
  273. + lint:
  274. +     $(LINT) $(LFLAGS) $(SOURCES) $(LINTFILTER)
  275.   canon.a:    canon.o screen.o trapezoid.o paint.o
  276.       ar ruv canon.a canon.o screen.o trapezoid.o paint.o
  277.       ranlib canon.a
  278.   
  279.   viewer:    protocol.o viewer.o hard.o canon.a
  280. !     $(CC) protocol.o viewer.o hard.o canon.a `libs` -o viewer
  281.   
  282.   all:    PS postscript viewer
  283.   
  284. ***************
  285. *** 44,50 ****
  286.   orion:    orion.o installorion orionlib
  287.   
  288.   X.o:    
  289. !     cc -c X.c
  290.   
  291.   wwlib:
  292.       if [ -f libww.a ]; \
  293. --- 61,67 ----
  294.   orion:    orion.o installorion orionlib
  295.   
  296.   X.o:    
  297. !     $(CC) -c X.c
  298.   
  299.   wwlib:
  300.       if [ -f libww.a ]; \
  301. *** /dev/null    Thu Jul 28 10:26:48 1988
  302. --- ./source/X11.c    Wed Jul 27 18:15:31 1988
  303. ***************
  304. *** 0 ****
  305. --- 1,667 ----
  306. + /*
  307. +  * Copyright (C) Rutherford Appleton Laboratory 1987
  308. +  * 
  309. +  * This source may be copied, distributed, altered or used, but not sold for profit
  310. +  * or incorporated into a product except under licence from the author.
  311. +  * It is not in the public domain.
  312. +  * This notice should remain in the source unaltered, and any changes to the source
  313. +  * made by persons other than the author should be marked as such.
  314. +  * 
  315. +  *    Crispin Goswell @ Rutherford Appleton Laboratory caag@uk.ac.rl.vd
  316. +  */
  317. + #include "main.h"
  318. + #include "graphics.h"
  319. + #include <X11/Xlib.h>
  320. + #include <X11/Xutil.h>
  321. + #include <X11/Xatom.h>
  322. + #include <stdio.h>
  323. + #include "canon.h"
  324. + char *DriverType = "X11"; /* jgm */
  325. + static void Punt(str)
  326. + char *str;
  327. + {
  328. +     fprintf(stderr, "%s\n", str);
  329. +     exit(1);
  330. + }
  331. + static Display *dpy;
  332. + typedef struct _HardwareRec {
  333. +     Drawable w;
  334. + } HardwareRec, *Hardware;
  335. + #ifdef CANON
  336. + struct hardware
  337. + {
  338. +     /*
  339. +      * Each driver is expected to provide its own definition of this
  340. +      * structure.  It is only ever used as a pointer and is never dereferenced
  341. +      * outside the driver.
  342. +      */
  343. +     int pad;
  344. + };
  345. + #endif CANON
  346. + /*
  347. +  * This file describes the interface that PostScript requires to the graphics
  348. +  * system at Version 1.4.
  349. +  *     
  350. +  * ''Hardware'' in this context refers to a pointer to windows and/or bitmaps
  351. +  * and is the lowest level of access that PostScript is interested in. Any
  352. +  * Hardware parameter may be expected to be NULL.
  353. +  */
  354. + /********************* CREATION OF WINDOWS AND BITMAPS *******************/
  355. + #define SCREEN 0        /* What to use as our screen number. */
  356. + #define MIN(x, y)    (((x) < (y)) ? (x) : (y))
  357. + static GC fillgc[16];
  358. + struct hardware *InitHardware ()
  359. + {
  360. +     XGCValues values;
  361. +     int i;
  362. +     if ((dpy = XOpenDisplay(dpy)) == NULL)
  363. +     Punt("Could not open display");
  364. +     InitTransfer(DisplayHeight(dpy, SCREEN) / 11);
  365. +     /* This defines our screen as being 11 inches high, no matter what its */
  366. +     /* real size.  What a hack. */
  367. +     values.foreground = AllPlanes;
  368. +     for (i=0 ; i<16 ; i++) {
  369. +     values.function = i;
  370. +     fillgc[i] = XCreateGC(dpy, RootWindow(dpy, SCREEN),
  371. +                   GCFunction | GCForeground, &values);
  372. +     }
  373. + }
  374. + /*
  375. +  * InitHardware () returns a default device which PostScript may use
  376. +  * immediately (or NULL if not appropriate).  Its size and shape are not
  377. +  * defined. Most typically the user will want to start up another device
  378. +  * before it is used anyway. No attempt will be made by PostScript to Destroy
  379. +  * the resulting device.
  380. +  */
  381. + static struct hardware *NewHardware(width, height)
  382. + int width, height;
  383. + {
  384. +     struct hardware *to;
  385. +     Hardware hard;
  386. +     to = (struct hardware *) malloc(sizeof(struct hardware));
  387. +     hard = (Hardware) malloc(sizeof(HardwareRec));
  388. +     to->hard.addr = (char *) hard;
  389. +     to->flags = 0;
  390. +     to->aux = to->clip = NULL;
  391. +     to->extent = NewDevicePoint(width, height);
  392. +     hard->w = NULL;
  393. +     return to;
  394. + }
  395. + struct hardware *NewBitmapHardware (width, height)
  396. + int width, height;
  397. + {
  398. +     struct hardware *to = NewHardware(width, height);
  399. +     Hardware hard = (Hardware) to->hard.addr;
  400. +     to->flags = NULL;
  401. +     hard->w = XCreatePixmap(dpy, RootWindow(dpy, SCREEN), width, height,
  402. +                 DefaultDepth(dpy, SCREEN));
  403. +     XFillRectangle(dpy, hard->w, fillgc[GXclear], 0, 0, width, height);
  404. + /*    {
  405. +     static int y = 0;
  406. +     XSetWindowAttributes attributes;
  407. +     hard->w = XCreateSimpleWindow(dpy, RootWindow(dpy, SCREEN), 700, y,
  408. +                   width, height, 1, BlackPixel(dpy, SCREEN),
  409. +                   WhitePixel(dpy, SCREEN));
  410. +     attributes.override_redirect = TRUE;
  411. +     XChangeWindowAttributes(dpy, hard->w, CWOverrideRedirect, &attributes);
  412. +     XMapWindow(dpy, hard->w);
  413. +     y+=30;
  414. +     }*/
  415. +     return to;
  416. + }
  417. + struct hardware *NewWindowHardware (width, height)
  418. + int width, height;
  419. + {
  420. +     struct hardware *to = NewHardware(width, height);
  421. +     Hardware hard = (Hardware) to->hard.addr;
  422. +     XEvent event;
  423. +     unsigned long vmask;
  424. +     XSetWindowAttributes xswa;
  425. +     to->flags = ISWIN;
  426. + /*
  427. +     hard->w = XCreateSimpleWindow(dpy, RootWindow(dpy, SCREEN), 0, 0,
  428. +                   width, height, 1, BlackPixel(dpy, SCREEN),
  429. +                   0);
  430. + */
  431. +     vmask = CWBackPixel|CWBorderPixel|CWBackingStore|
  432. +       CWBackingPlanes|CWSaveUnder;
  433. +     xswa.background_pixel = WhitePixel(dpy,SCREEN);
  434. +     xswa.border_pixel = BlackPixel(dpy,SCREEN);
  435. +     xswa.backing_store = Always;
  436. +     xswa.backing_planes = AllPlanes;
  437. +     xswa.save_under = True;
  438. +     hard->w = XCreateWindow(dpy,RootWindow(dpy,SCREEN),
  439. +                 0,0,
  440. +                 width,height,
  441. +                 1,DefaultDepth(dpy,SCREEN),
  442. +                 InputOutput,DefaultVisual(dpy,SCREEN),
  443. +                 vmask,&xswa);
  444. +     XChangeProperty(dpy,hard->w,XA_WM_NAME,XA_STRING,8,
  445. +             PropModeReplace,"POSTSCRIPT",10);
  446. +     XSelectInput(dpy, hard->w, ExposureMask);
  447. +     XMapWindow(dpy, hard->w);
  448. +     XNextEvent(dpy, &event);
  449. +     XSelectInput(dpy, hard->w, 0);
  450. +     return to;
  451. + }
  452. + /*
  453. +  * NewBitmapHardware () is expected to create a new bitmap. Only one plane
  454. +  * will be needed.
  455. +  *     
  456. +  * NewWindowHardware () is expected to create a window on the screen. On a
  457. +  * colour system this will be expected to support full colour.
  458. +  */
  459. + #ifdef CANON
  460. + int IsWindowHardware (h)
  461. + struct hardware *h;
  462. + {}
  463. + #endif CANON
  464. + /*
  465. +  * IsWindowHardware () should return TRUE if the hardware is a window, FALSE
  466. +  * otherwise.  NULL is a window.
  467. +  */
  468. + void DestroyHardware (h)
  469. + struct hardware *h;
  470. + {
  471. +     if (h) {
  472. +     Hardware hard = (Hardware) h->hard.addr;
  473. +     if (IsWindowHardware(h))
  474. +         XDestroyWindow(dpy, hard->w);
  475. +     else
  476. +         XFreePixmap(dpy, hard->w);
  477. +     }
  478. + }
  479. + /*
  480. +  *     
  481. +  * DestroyHardware () should release the resources required by the hardware,
  482. +  * bitmap or window.  This should cause a window device to vanish. NULL is not
  483. +  * an error (does nothing).
  484. +  */
  485. + #ifdef CANON
  486. + Matrix DeviceMatrix (width, height)
  487. + int width, height;
  488. + {}
  489. + #endif CANON
  490. + /*
  491. +  *
  492. +  * DeviceMatrix () should return a matrix appropriate to a device of the given
  493. +  * height and width.  For a typical display with a graphics origin at the top
  494. +  * left of a window, an appropriate definition would be:
  495. +  *     
  496. +  * Matrix DeviceMatrix (width, height)
  497. +  * int width, height;
  498. +  * {
  499. +  *     return NewMatrix (PIXELS_PER_INCH / 72.0, 0.0, 0.0,
  500. +  *                  -PIXELS_PER_INCH / 72.0, 0.0, (float) height);
  501. +  * }
  502. +  */
  503. + #ifdef CANON
  504. + DevicePoint HardwareExtent (h)
  505. + struct hardware *h;
  506. + {}
  507. + #endif
  508. + /*
  509. +  * HardwareExtent () returns a DevicePoint describing the width and height of
  510. +  * the argument.  NULL has extent NewDevicePoint (0, 0).
  511. +  */
  512. + /*************************** OUTPUT PRIMITIVES ******************************/    
  513. + void BitBlt (from, to, fromPoint, toPoint, extent, rop)
  514. + struct hardware *from, *to;
  515. + DevicePoint toPoint, fromPoint, extent;
  516. + int rop;
  517. + {
  518. +     Hardware fromhard, tohard;
  519. +     static int count = 0;
  520. +     if (to == NULL) return;
  521. +     tohard = (Hardware) to->hard.addr;
  522. +     if (from == NULL) {
  523. +     XFillRectangle(dpy, tohard->w, fillgc[rop], toPoint.dx, toPoint.dy,
  524. +                extent.dx, extent.dy);
  525. +     } else {
  526. +     fromhard = (Hardware) from->hard.addr;
  527. +     XCopyArea(dpy, fromhard->w, tohard->w, fillgc[rop], fromPoint.dx,
  528. +           fromPoint.dy, extent.dx, extent.dy, toPoint.dx, toPoint.dy);
  529. +     }
  530. +     if (count++ % 50 == 0) XSync(dpy, 0);
  531. + }
  532. + #ifdef CANON
  533. + void Paint (from, to, fromPoint, toPoint, extent, colour)
  534. + struct hardware *from, *to;
  535. + DevicePoint toPoint, fromPoint, extent;
  536. + Colour colour;
  537. + {}
  538. + #endif
  539. + /*
  540. +  *     
  541. +  * BitBlt () is a full function RasterOp. The 'rop' argument will have values
  542. +  * as described in the header file hard.h. If the from argument is NULL it is
  543. +  * taken to be a bitmap full of ones the shape of the fromPoint and extent. If
  544. +  * the to argument is NULL, this is a no-op.
  545. +  *
  546. +  * Paint () is an addition to BitBlt. Bits that are set in the source are
  547. +  * Painted into the destination in the given colour with a copying rasterop so
  548. +  * that they replace pixels previously there. If the machine does not support
  549. +  * colour windows, half-toning should be performed.  Colour values have hue,
  550. +  * saturation and brightness components. on a black and white or greyscale
  551. +  * system the brightness value will be a FP value between 0.0 (black) and 1.1
  552. +  * (white), which can be used as a grey level.
  553. +  *     
  554. +  * Paint is expected to mask with the clip mask. BitBlt is not,
  555. +  */
  556. + #ifdef CANON
  557. + void BitBltTrapezoid(to, lefttop, leftbottom, righttop, rightbottom,
  558. +              top, bottom, rop)
  559. + struct hardware *to;
  560. + DevicePoint lefttop, leftbottom, righttop, rightbottom;
  561. + int top, bottom, rop;
  562. + {}
  563. + #endif CANON
  564. + #ifdef CANON
  565. + void PaintTrapezoid (to, lefttop, leftbottom, righttop, rightbottom,
  566. +              top, bottom, colour)
  567. + struct hardware *to;
  568. + DevicePoint lefttop, leftbottom, righttop, rightbottom;
  569. + int top, bottom;
  570. + Colour colour;
  571. + {}
  572. + #endif CANON
  573. + /*
  574. +  * BitBltTrapezoid () and PaintTrapezoid () render a complete trapezoidal
  575. +  * shape.  The corners of the trapezoid may lie far outside the range of
  576. +  * interesting scan-lines, but the slope of the line should be clipped by the
  577. +  * top and bottom. The coordinates are half-open.
  578. +  */
  579. + void BitBltLine (h, fromPoint, toPoint, rop)
  580. + struct hardware *h;
  581. + DevicePoint fromPoint, toPoint;
  582. + int rop;
  583. + {
  584. +     if (h) {
  585. +     Hardware hard = (Hardware) h->hard.addr;
  586. +     XDrawLine(dpy, hard->w, fillgc[rop], fromPoint.dx, fromPoint.dy,
  587. +           toPoint.dx, toPoint.dy);
  588. +     }
  589. + }
  590. + #ifdef CANON
  591. + void PaintLine (h, fromPoint, toPoint, colour)
  592. + struct hardware *h;
  593. + DevicePoint fromPoint, toPoint;
  594. + Colour colour;
  595. + {}
  596. + #endif CANON
  597. + /*
  598. +  *     
  599. +  *     BitBltLine () is expected to draw a line between the given points
  600. +  *     with the given RasterOp and colour masking.
  601. +  *     The line should be one pixel wide and half-open.
  602. +  *     [Thicker lines are done with BitBlt.]
  603. +  *     
  604. +  *     PaintLine () is expected to Paint a line by analogy with Paint
  605. +  *     and BitBlt.
  606. +  */
  607. + void BitBltBlob (to, top, height, left, right, rop)
  608. + struct hardware *to;
  609. + int top, height, *left, *right, rop;
  610. + {
  611. +     int i;
  612. +     DevicePoint p1, p2;
  613. +     for (i=0 ; i<height ; i++) {
  614. +     p1.dx = left[i];
  615. +     p2.dx = right[i];
  616. +     p1.dy = p2.dy = top + i;
  617. +     BitBltLine(to, p1, p2, rop);
  618. +     }
  619. + }
  620. +  /*
  621. +   * BitBltBlob () takes a set of pixel coordinates and fills the trapezon
  622. +   * figure half open.
  623. +   */
  624. + #ifdef SLOWANDWRONG
  625. + void RasterTile (from, to, toPoint, extent, rop)
  626. + struct hardware *from, *to;
  627. + DevicePoint toPoint, extent;
  628. + int rop;
  629. + {
  630. +     Hardware fromhard, tohard;
  631. +     DevicePoint p1, p2, p3;
  632. +     int x, y;
  633. +     if (to == NULL) return;
  634. +     if (from == NULL)
  635. +     Punt("Can only RasterTile from Hardware.");
  636. +     fromhard = (Hardware) from->hard.addr;
  637. +     tohard = (Hardware) to->hard.addr;
  638. +     p1.dx = p1.dy = 0;
  639. +     for (x=toPoint.dx ; x < toPoint.dx + extent.dx ; x+=from->extent.dx) {
  640. +     for (y=toPoint.dy ; y < toPoint.dy + extent.dy ; y+=from->extent.dy) {
  641. +         p2.dx = x;
  642. +         p2.dy = y;
  643. +         p3.dx = MIN(toPoint.dx + extent.dx - x, from->extent.dx);
  644. +         p3.dy = MIN(toPoint.dy + extent.dy - y, from->extent.dy);
  645. +         BitBlt(from, to, p1, p2, p3, rop);
  646. +     }
  647. +     }
  648. + }
  649. + #endif SLOWANDWRONG
  650. + void RasterTile (from, to, toPoint, extent, rop)
  651. + struct hardware *from, *to;
  652. + DevicePoint toPoint, extent;
  653. + int rop;
  654. + {
  655. +     Hardware fromhard, tohard;
  656. +     static GC gc = NULL;
  657. +     XGCValues values;
  658. +     int valuemask;
  659. +     if (to == NULL) return;
  660. +     if (from == NULL || IsWindowHardware(from))
  661. +     Punt("Can only RasterTile from Bitmap.");
  662. +     fromhard = (Hardware) from->hard.addr;
  663. +     tohard = (Hardware) to->hard.addr;
  664. +     values.tile = fromhard->w;
  665. +     values.fill_style = FillTiled;
  666. +     values.function = rop;
  667. +     valuemask = GCFunction | GCTile | GCFillStyle;
  668. +     if (gc == NULL)
  669. +     gc = XCreateGC(dpy, RootWindow(dpy, SCREEN), valuemask, &values);
  670. +     else
  671. +     XChangeGC(dpy, gc, valuemask, &values);
  672. +     XFillRectangle(dpy, tohard->w, gc, toPoint.dx, toPoint.dy,
  673. +            extent.dx, extent.dy);
  674. + }
  675. + /*
  676. +  * RasterTile () replicates the whole of ``from'' over ``to'', but clipped by
  677. +  * the rectangle bounded by ``toPoint'' and ``extent''.
  678. +  */
  679. + /******************* BRIGHTNESS TRANSFER FUNCTION ************************/
  680. + #ifdef CANON
  681. + int TransferSize ()
  682. + {}
  683. + #endif CANON
  684. + #ifdef CANON
  685. + void SetTransfer (vec)
  686. + float *vec;
  687. + {}
  688. + #endif CANON
  689. + /*
  690. +  *     
  691. +  * TransferSize () and SetTransfer () control the mapping function between
  692. +  * user brightnesses and device brightnesses. The interface is expected to
  693. +  * perform this mapping of brightnesses to a sufficient resolution.
  694. +  * SetTransfer takes a table of floating point numbers between 0 and 1. User
  695. +  * brightnesses are scaled to the size of this table and mapped through it.
  696. +  * The argument table given to SetTransfer () will be deleted after use.
  697. +  * TransferSize () simply enquires the required size of the table.
  698. +  *     
  699. +  * It may be appropriate to half-tone on a grayscale or colour device to
  700. +  * improve rendering if it is not too expensive. TransferSize () returns the
  701. +  * size of the pattern table.
  702. +  */
  703. + /********************** BITMAP CONVERSION ********************************/
  704. + char *StringFromHardware (h)
  705. + struct hardware *h;
  706. + {
  707. +     XImage *image;
  708. +     Hardware hard;
  709. +     unsigned char *result, *ptr, c;
  710. +     int x, y, i;
  711. +     if (h == NULL) return NULL;
  712. +     hard = (Hardware) h->hard.addr;
  713. +     image = XGetImage(dpy, hard->w, 0, 0, h->extent.dx, h->extent.dy,
  714. +               AllPlanes, ZPixmap);
  715. +     result = (unsigned char *) malloc(((h->extent.dx + 7) / 8) * h->extent.dy);
  716. +     ptr = result;
  717. +     for (y=0 ; y<h->extent.dy ; y++) {
  718. +     for (x=0 ; x<h->extent.dx ; x+=8) {
  719. +         c = 0;
  720. +         for (i=0 ; i<8 ; i++) {
  721. +         c = c << 1;
  722. +         if (x+i < h->extent.dx)
  723. +             c |= XGetPixel(image, x+i, y);
  724. +         }
  725. +     }
  726. +     *ptr++ = c;
  727. +     }
  728. +     free((char *) image);
  729. +     return (char *) result;
  730. + }
  731. + struct hardware *HardwareFromString (s, width, height)
  732. + char *s;
  733. + int width, height;
  734. + {
  735. +     struct hardware *h = NewBitmapHardware(width, height);
  736. +     Hardware hard = (Hardware) h->hard.addr;
  737. +     XImage *image;
  738. +     if (s == NULL) Punt("HardwareFromString called with NULL string!");
  739. +     image = XCreateImage(dpy, DefaultVisual(dpy, SCREEN),
  740. +              DefaultDepth(dpy, SCREEN), ZPixmap, 0, s,
  741. +              width, height, 8, 0);
  742. +     image->bitmap_bit_order = MSBFirst;
  743. +     XPutImage(dpy, hard->w, fillgc[GXcopy], image, 0, 0, 0, 0, width, height);
  744. +     free((char *) image);
  745. +     return h;
  746. + }
  747. + /*
  748. +  *     
  749. +  * StringFromHardware () produces a string from its argument which describes
  750. +  * the bitmap.  The bitmap is returned in row-major order with the leftmost
  751. +  * bit of each byte in the most significant position. Rows are padded to byte
  752. +  * boundaries. Only single plane bitmaps are used.
  753. +  *     
  754. +  * HardwareFromString () performs the inverse mapping, generating a bitmap
  755. +  * from a set of bits, given a width and height. Only single plane bitmaps are
  756. +  * used.
  757. +  */
  758. + /************************* HALF-TONE SCREEN *******************************/
  759. + #ifdef CANON
  760. + int ScreenSize (freq, rotation)
  761. + float freq, rotation;
  762. + {}
  763. + #endif CANON
  764. + #ifdef CANON
  765. + void BuildScreen (freq, rotation, x, y)
  766. + float freq, rotation, *x, *y;
  767. + {}
  768. + #endif CANON
  769. + #ifdef CANON
  770. + void SetScreen (freq, rotation, thresh)
  771. + float freq, rotation, *thresh;
  772. + {}
  773. + #endif CANON
  774. + /*
  775. +  * ScreenSize () allows PostScript to determine how large an array of sample
  776. +  * points to expect.  It should return the length of the side of the sample
  777. +  * square.
  778. +  *     
  779. +  * BuildScreen () returns a set of sampling coordinates to PostScript to hand
  780. +  * to the users spot-function
  781. +  *     
  782. +  * SetScreen () allows PostScript to set the thresholds for each sample point
  783. +  * so that half-tone bitmaps can be made.
  784. +  */
  785. + /************************* CLIPPING ******************************************/
  786. + #ifdef CANON
  787. + void SetClipHardware (h, clip)
  788. + struct hardware *h, *clip;
  789. + {}
  790. + #endif
  791. + /*
  792. +  *     
  793. +  * SetClipHardware sets hardware which is a clip mask for BitBlt. This mask
  794. +  * should be ANDed with any output operation. If clip is NULL, masking will
  795. +  * not be needed.
  796. +  */
  797. + /************************ UPDATE CONTROLS **********************************/
  798. + void HardUpdate ()
  799. + {
  800. +     XFlush(dpy, 0);
  801. + }
  802. + /*
  803. +  * HardUpdate is a hook to allow devices which do output buffering to flush
  804. +  * that buffering when appropriate.  This allows an interactive user to see
  805. +  * completed graphics between prompts (it is called as a side-effect of the
  806. +  * PostScript flush operator). Typically is is a no-op.
  807. +  */
  808. + void UpdateControl (h, on)
  809. + struct hardware *h;
  810. + int on;
  811. + {}
  812. + /*
  813. +  * This call can be used to enable batching of output operations.
  814. +  * UpdateControl (h, FALSE) means ``start of batching'' UpdateControl (h,
  815. +  * TRUE) means ``end of batching''. It is used to improve performance on
  816. +  * machines where screen updates have a high locking overhead. It may be a
  817. +  * no-op.  The operation should nest if batching is already in progress: FALSE
  818. +  * increments a counter, TRUE decrements a counter. Display changes are
  819. +  * allowed when the counter is non-zero.
  820. +  */
  821. + /********************************** CANONICAL IMPLEMENTATION LIBRARY ******************************/
  822. + /*
  823. +  * Some parts of the above interface can be supported by a canonical library.
  824. +  * This library contains:
  825. + SetClipHardware
  826. + HardUpdate
  827. + IsWindowHardware
  828. + HardwareExtent
  829. + PaintTrapezoid
  830. + BitBltTrapezoid
  831. + Paint
  832. + PaintLine
  833. + DeviceMatrix
  834. + InitTransfer
  835. + TransferSize
  836. + SetTransfer
  837. + ScreenSize
  838. + BuildScreen
  839. + SetScreen
  840. +  *
  841. +  * As the driver matures, the user may provide his own versions of the
  842. +  * canonical routines.  This leaves the following for implementation by 
  843. +  * the user.
  844. +  *
  845. + InitHardware
  846. + NewBitmapHardware
  847. + NewWindowHardware
  848. + DestroyHardware
  849. + HardwareFromString
  850. + StringFromHardware
  851. + UpdateControl
  852. + RasterTile
  853. + BitBlt
  854. + BitBltLine
  855. + BitBltBlob
  856. +  * There is a pedagogical implementation in null.c
  857. +  *    
  858. +  * There are a number of interface issues concerning the canonical driver.
  859. +  * Firstly, a canonical struct hardware is defined, which contains a union of
  860. +  * a char * and an int handle. The remainder are expected to use this to store
  861. +  * device specific information.
  862. +  *
  863. +  * InitTransfer() should be called during InitHardware with the number of 
  864. +  * pixels per inch on the display as an argument.
  865. +  */
  866. + /* I tacked this lot on the end to avoid altering canon.c - CAAG */
  867. + int pixels_per_inch;
  868. + int single_rop [] =
  869. +  {
  870. +     ROP_FALSE, ROP_DEST, ROP_NOTDEST, ROP_TRUE,
  871. +     ROP_FALSE, ROP_DEST, ROP_NOTDEST, ROP_TRUE,
  872. +     ROP_FALSE, ROP_DEST, ROP_NOTDEST, ROP_TRUE,
  873. +     ROP_FALSE, ROP_DEST, ROP_NOTDEST, ROP_TRUE
  874. +  };
  875. + /*ARGSUSED*/
  876. + Matrix DeviceMatrix (width, height) int width, height;
  877. +  {
  878. +      return NewMatrix (pixels_per_inch / 72.0, 0.0, 0.0, -pixels_per_inch / 72.0, 0.0, (float) height);
  879. +  }
  880. + int IsWindowHardware (h) struct hardware *h;
  881. +  {
  882. +      return h->flags & ISWIN;
  883. +  }
  884. + #define IsWindowHardware(h) ((h)->flags & ISWIN)
  885. + DevicePoint HardwareExtent (h) struct hardware *h;
  886. +  {
  887. +      if (h)
  888. +          return h->extent;
  889. +      else
  890. +          return NewDevicePoint (0, 0);
  891. +  }
  892. + void SetClipHardware (h, clip) struct hardware *h, *clip;
  893. +  {
  894. +      if (h)
  895. +         h->clip = clip;
  896. +  }
  897. diff -cr /usr/tmp/ps/source/array.c ./source/array.c
  898. *** /usr/tmp/ps/source/array.c    Thu Jul 28 14:01:14 1988
  899. --- ./source/array.c    Wed Jul 27 12:02:11 1988
  900. ***************
  901. *** 142,151 ****
  902. --- 142,165 ----
  903.   int ExecArray (item) Object item;
  904.    {
  905.        int l = lengthArray (item);
  906. +     Object res;
  907. +     register Object *rp = &res;
  908.        
  909.       if (l == 0)
  910.            return TRUE;
  911. +     /*
  912. +      * BZS - try some open-coding here
  913. +      *
  914.        Push (ExecStack, SameFlags (item, Make (Body (item) + 1, l - 1)));
  915. +     */
  916. +     rp->type = Array;
  917. +     rp->flags = READABLE | WRITEABLE;
  918. +     rp->u.Integer = 0;
  919. +     rp->u.Array = item.u.Array + 1;
  920. +     rp->Length = l - 1;
  921. +     rp->flags = item.flags;
  922. +     Push(ExecStack,res);
  923. +     /* end open-coding */
  924.        if (TypeOf (Body (item) [0]) == Name || TypeOf (Body (item) [0]) == Operator)
  925.            Push (ExecStack, Body (item) [0]);
  926.        else
  927. diff -cr /usr/tmp/ps/source/config.c ./source/config.c
  928. *** /usr/tmp/ps/source/config.c    Thu Jul 28 14:01:20 1988
  929. --- ./source/config.c    Thu Jul 28 14:07:25 1988
  930. ***************
  931. *** 92,98 ****
  932.       
  933.       /* Begin jgm */
  934.       strcpy(versionbuf, DriverType);
  935. !     strcat(versionbuf, " version 1.4 with jgm mods v2");
  936.       Install ("version",    StringFrom (versionbuf));
  937.       /* End jgm */
  938.    }
  939. --- 92,98 ----
  940.       
  941.       /* Begin jgm */
  942.       strcpy(versionbuf, DriverType);
  943. !     strcat(versionbuf, " version 1.4 with jgm/bzs mods v3");
  944.       Install ("version",    StringFrom (versionbuf));
  945.       /* End jgm */
  946.    }
  947. diff -cr /usr/tmp/ps/source/device.c ./source/device.c
  948. *** /usr/tmp/ps/source/device.c    Thu Jul 28 14:01:23 1988
  949. --- ./source/device.c    Sat Apr 30 17:45:35 1988
  950. ***************
  951. *** 25,31 ****
  952.        struct hardware *h;
  953.        DevicePoint extent;
  954.        
  955. !     InstallOp ("framedevice",    FrameDevice,         4, 0, 0, 0, Array, Integer, Integer, Array);
  956.       InstallOp ("nulldevice",    NullDevice,        0, 0, 0, 0);
  957.       InstallOp ("grabbits",        GrabBits,        4, 0, 0, 0, Float, Float, Float, Float);
  958.       
  959. --- 25,31 ----
  960.        struct hardware *h;
  961.        DevicePoint extent;
  962.        
  963. !     InstallOp ("framedevice",    FrameDevice,         4, 0, 0, 0, Array, Integer, Integer, Poly /* jgm */);
  964.       InstallOp ("nulldevice",    NullDevice,        0, 0, 0, 0);
  965.       InstallOp ("grabbits",        GrabBits,        4, 0, 0, 0, Float, Float, Float, Float);
  966.       
  967. ***************
  968. *** 79,94 ****
  969.        return TRUE;
  970.    }
  971.   
  972. - /*ARGSUSED*/
  973.   static int FrameDevice (mat, width, height, proc) Object mat, width, height, proc;
  974.    {
  975.        Matrix m;
  976.        
  977.        if (lengthArray (mat) != 6 || !ExtractMatrix (&m, mat))
  978.            return Error (PTypeCheck);
  979.        if (BodyInteger (width) < 0 || BodyInteger (height) < 0)
  980.            return Error (PRangeCheck);
  981. !      SetDevice (NewWindowDevice (BodyInteger (width) * 8, BodyInteger (height), m));
  982.        ErasePage ();
  983.        
  984.       return TRUE;
  985. --- 79,98 ----
  986.        return TRUE;
  987.    }
  988.   
  989.   static int FrameDevice (mat, width, height, proc) Object mat, width, height, proc;
  990.    {
  991.        Matrix m;
  992. +     struct device *d;
  993.        
  994.        if (lengthArray (mat) != 6 || !ExtractMatrix (&m, mat))
  995.            return Error (PTypeCheck);
  996.        if (BodyInteger (width) < 0 || BodyInteger (height) < 0)
  997.            return Error (PRangeCheck);
  998. !     /* Begin jgm */
  999. !      d = NewWindowDevice (BodyInteger (width) * 8, BodyInteger (height), m);
  1000. !     d->output_routine = proc;
  1001. !      SetDevice (d);
  1002. !     /* End jgm */
  1003.        ErasePage ();
  1004.        
  1005.       return TRUE;
  1006. ***************
  1007. *** 148,155 ****
  1008.        res->link_count = 0;
  1009.        res->default_clip = clip;
  1010.        res->default_matrix = m;
  1011.        res->dev = dev;
  1012. !      
  1013.        return res;
  1014.    }
  1015.   
  1016. --- 152,160 ----
  1017.        res->link_count = 0;
  1018.        res->default_clip = clip;
  1019.        res->default_matrix = m;
  1020. +     res->output_routine = Nil;
  1021.        res->dev = dev;
  1022. !     
  1023.        return res;
  1024.    }
  1025.   
  1026. diff -cr /usr/tmp/ps/source/device.h ./source/device.h
  1027. *** /usr/tmp/ps/source/device.h    Thu Jul 28 13:43:09 1988
  1028. --- ./source/device.h    Sat Apr 30 16:34:02 1988
  1029. ***************
  1030. *** 9,14 ****
  1031. --- 9,15 ----
  1032.        Matrix default_matrix;
  1033.        Path default_clip;
  1034.        int link_count;
  1035. +     Object output_routine; /* jgm */
  1036.        struct hardware *dev;
  1037.    };
  1038.   
  1039. diff -cr /usr/tmp/ps/source/dictionary.c ./source/dictionary.c
  1040. *** /usr/tmp/ps/source/dictionary.c    Thu Jul 28 13:53:28 1988
  1041. --- ./source/dictionary.c    Wed Jul 27 12:02:12 1988
  1042. ***************
  1043. *** 17,24 ****
  1044.   
  1045.   Object Absent, Nil, SysDict;
  1046.   
  1047. ! Object DictLookup (), MakeDict (), DictLoad ();
  1048.   
  1049.   static int LengthDict (), CopyDict (), forDict (), ForDict (), PutDict (), GetDict ();
  1050.   static int PDict (), PBegin (), PEnd (), PDef (), PStore (), PKnown (), PLoad ();
  1051.   static int PrCheck (), PwCheck (), PReadOnly (), EqDict (); 
  1052. --- 17,29 ----
  1053.   
  1054.   Object Absent, Nil, SysDict;
  1055.   
  1056. ! /* BZS - DictLoad open-coded */
  1057. ! #ifndef DictLoad
  1058. ! Object DictLoad();
  1059. ! #endif
  1060.   
  1061. + Object DictLookup (), MakeDict ();
  1062.   static int LengthDict (), CopyDict (), forDict (), ForDict (), PutDict (), GetDict ();
  1063.   static int PDict (), PBegin (), PEnd (), PDef (), PStore (), PKnown (), PLoad ();
  1064.   static int PrCheck (), PwCheck (), PReadOnly (), EqDict (); 
  1065. ***************
  1066. *** 166,171 ****
  1067. --- 171,182 ----
  1068.           (a.u.Integer == b.u.Integer || TypeOf (a) == Array && a.Length == 0);
  1069.    }
  1070.   
  1071. + /* BZS - open code Equal */
  1072. + #define Equal(A,B) ((TypeOf(A) == TypeOf(B)) && \
  1073. +             (A.Length == B.Length) && \
  1074. +             ((A.u.Integer == B.u.Integer)|| \
  1075. +              (TypeOf(A) == Array) && (A.Length == 0)))
  1076.   static DictReplace (hash, key, value, size, h) struct dict_entry *hash; Object key, value; int size, h;
  1077.    {
  1078.        int i;
  1079. ***************
  1080. *** 250,258 ****
  1081.       DictStore (SysDict, NameFrom (key), value);
  1082.    }
  1083.   
  1084. ! static Object DictFind (hash, key, size) struct dict_entry *hash; Object key; int size;
  1085.    {
  1086. !      int i, h;
  1087.        
  1088.        ++hash_attempts;
  1089.        
  1090. --- 261,272 ----
  1091.       DictStore (SysDict, NameFrom (key), value);
  1092.    }
  1093.   
  1094. ! /*
  1095. !  * BZS - add some register decls, make global for macrification (remove static)
  1096. !  */
  1097. ! Object DictFind (hash, key, size) struct dict_entry *hash; Object key; int size;
  1098.    {
  1099. !      register int i, h;
  1100.        
  1101.        ++hash_attempts;
  1102.        
  1103. ***************
  1104. *** 266,271 ****
  1105. --- 280,286 ----
  1106.        {
  1107.            if (TypeOf (hash[i].entry_key) == Null)
  1108.                return Absent;
  1109.            if (Equal (key, hash[i].entry_key))
  1110.             {
  1111.               ++hash_tries;
  1112. ***************
  1113. *** 279,289 ****
  1114. --- 294,308 ----
  1115.        }
  1116.       return Absent;
  1117.    }
  1118. + #undef Equal
  1119.   
  1120. + /* BZS - macro-ified */
  1121. + #ifndef DictLoad
  1122.   Object DictLoad (dict, key) Object dict, key;
  1123.    {
  1124.       return DictFind (Body (dict)->dict_body, key, Body (dict)->dict_size);
  1125.    }
  1126. + #endif
  1127.   
  1128.   Object Lookup (dict, key) Type dict; Object key;
  1129.    {
  1130. diff -cr /usr/tmp/ps/source/fill.c ./source/fill.c
  1131. *** /usr/tmp/ps/source/fill.c    Thu Jul 28 14:02:56 1988
  1132. --- ./source/fill.c    Wed Jul 27 12:02:15 1988
  1133. ***************
  1134. *** 35,41 ****
  1135.    *    pool
  1136.    */        
  1137.   
  1138. ! static struct edge
  1139.    {
  1140.       int topX, topY, bottomX, bottomY; short dir;
  1141.       struct edge *pair;
  1142. --- 35,41 ----
  1143.    *    pool
  1144.    */        
  1145.   
  1146. ! /* static (removed --jgm) */ struct edge
  1147.    {
  1148.       int topX, topY, bottomX, bottomY; short dir;
  1149.       struct edge *pair;
  1150. ***************
  1151. *** 70,75 ****
  1152. --- 70,126 ----
  1153.   static int FillIt ();
  1154.   static int EoRule (), NwRule ();
  1155.   
  1156. + /*
  1157. +  * BZS - Open Code
  1158. +  */
  1159. + #define NotThisBit(EDGE,WHERE,EMITFN) { \
  1160. +   if((EDGE)->pair != NULL) { \
  1161. +      (*EMITFN)((EDGE),(EDGE)->pair,(EDGE)->startingY,WHERE); \
  1162. +      (EDGE)->pair->startingY = WHERE; \
  1163. +      (EDGE)->pair->where = WHERE; \
  1164. +      (EDGE)->pair->pair = NULL; \
  1165. +      (EDGE)->pair = NULL; \
  1166. +    } \
  1167. +   (EDGE)->startingY = WHERE; \
  1168. +   (EDGE)->where = WHERE; \
  1169. + }
  1170. + #define ThisBit(LEFT,RIGHT,WHERE,EMITFN) { \
  1171. +    if((LEFT)->pair != (RIGHT) || (RIGHT)->up) { \
  1172. +      if((LEFT)->pair != NULL) { \
  1173. +         (*EMITFN)(LEFT,(LEFT)->pair,(LEFT)->startingY,(LEFT)->where); \
  1174. +         (LEFT)->pair->startingY = (LEFT)->pair->where; \
  1175. +       (LEFT)->pair->pair->startingY = (LEFT)->pair->pair->where; \
  1176. +       (LEFT)->pair->pair = NULL; \
  1177. +      } \
  1178. +      if ((RIGHT)->pair != NULL) { \
  1179. +         (*EMITFN) (RIGHT, (RIGHT)->pair, (RIGHT)->startingY, (RIGHT)->where); \
  1180. +     (RIGHT)->pair->startingY = (RIGHT)->pair->where; \
  1181. +       (RIGHT)->pair->pair->startingY = (RIGHT)->pair->pair->where; \
  1182. +       (RIGHT)->pair->pair = NULL; \
  1183. +      }  \
  1184. +      (LEFT)->pair = RIGHT; \
  1185. +      (RIGHT)->pair = LEFT; \
  1186. +      (LEFT)->startingY = (RIGHT)->startingY = WHERE; \
  1187. +    } \
  1188. +    (LEFT)->where = (RIGHT)->where = WHERE; \
  1189. +    (LEFT)->up = TRUE; \
  1190. +    (RIGHT)->up = FALSE; \
  1191. + }
  1192. + #define UpEdge(COUNT_A,COUNT_B,INC_A,INC_B,RULE_A,RULE_B) \
  1193. +   ((*RULE_B)(COUNT_B+INC_B) && !(*RULE_A)(COUNT_A) && \
  1194. +    (*RULE_A)(COUNT_A+INC_A)||(*RULE_A)(COUNT_A+INC_A) && \
  1195. +    !(*RULE_B)(COUNT_B) && (*RULE_B)(COUNT_B+INC_B))
  1196. + #define DownEdge(COUNT_A,COUNT_B,INC_A,INC_B,RULE_A,RULE_B) \
  1197. +   ((*RULE_B)(COUNT_B+INC_B) && (*RULE_A)(COUNT_A) && \
  1198. +    !(*RULE_A)(COUNT_A+INC_A)||(*RULE_A)(COUNT_A+INC_A) && \
  1199. +    (*RULE_B)(COUNT_B) && !(*RULE_B)(COUNT_B+INC_B))
  1200. + #define Xvalue(AX,AY,BX,BY,CY) \
  1201. +   ((BX)+((CY)-(BY))*((AX)-(BX))/(float)((AY)-(BY)))
  1202.   static void EmitTrapezoid (left, right, top, bottom) struct edge *left, *right; int top, bottom;
  1203.    {
  1204.        struct edge *temp;
  1205. ***************
  1206. *** 286,320 ****
  1207.   
  1208.   ProcessEdges (rule_a, rule_b, emitfn) int (*rule_a)(), (*rule_b)(); void (*emitfn)();
  1209.    {
  1210. !     struct edge *up_edge;
  1211. !     int i, count_a = 0, count_b = 0;
  1212. !     /* static void RemoveEdges (); (unused --jgm) */
  1213. !     
  1214. !     for (i = 0; i < ninteresting; i++)
  1215. !      {
  1216. !          /* static void Emit (); (unused --jgm) */
  1217. !          int d_a = 0, d_b = 0;
  1218. !          
  1219. !          if (interesting[i]->clip)
  1220. !              d_a = interesting[i]->dir;
  1221. !          else
  1222. !              d_b = interesting[i]->dir;
  1223.   
  1224. !          if (UpEdge (count_a, count_b, d_a, d_b, rule_a, rule_b))
  1225. !              up_edge = interesting[i];
  1226. !          else if (DownEdge (count_a, count_b, d_a, d_b, rule_a, rule_b))
  1227. !               ThisBit (up_edge, interesting[i], interestingY, emitfn);
  1228. !          else
  1229. !               NotThisBit (interesting[i], interestingY, emitfn);
  1230. !          
  1231. !          count_a += d_a;
  1232. !          count_b += d_b;
  1233. !      }
  1234. !     if (count_a || count_b)
  1235. !         fprintf (stderr, "count_a = %dcount_b = %d\n", count_a, count_b);
  1236. !     PanicIf (count_a || count_b, "something wrong in area fill");
  1237.    }
  1238.   
  1239.   ThisBit (left, right, where, emitfn) struct edge *left, *right; int where; void (*emitfn)();    
  1240.    {
  1241.        if (left->pair != right || right->up)
  1242. --- 337,379 ----
  1243.   
  1244.   ProcessEdges (rule_a, rule_b, emitfn) int (*rule_a)(), (*rule_b)(); void (*emitfn)();
  1245.    {
  1246. !     register struct edge **intp;
  1247. !         register struct edge *up_edge;
  1248. !     register int count_a = 0, count_b = 0;
  1249. !     register int i;
  1250.   
  1251. !     i = ninteresting;
  1252. !     intp = interesting;
  1253. !     while(i-- > 0) {
  1254. !       register int d_a = 0, d_b = 0;
  1255. !       if ((*intp)->clip)
  1256. !         d_a = (*intp)->dir;
  1257. !       else
  1258. !         d_b = (*intp)->dir;
  1259. !       if (UpEdge (count_a, count_b, d_a, d_b, rule_a, rule_b))
  1260. !         up_edge = *intp;
  1261. !       else if(DownEdge (count_a, count_b, d_a, d_b, rule_a, rule_b)){
  1262. !         ThisBit (up_edge,(*intp), interestingY, emitfn);
  1263. !       }
  1264. !       else {
  1265. !         NotThisBit ((*intp),interestingY,emitfn);
  1266. !       }
  1267. !       count_a += d_a;
  1268. !       count_b += d_b;
  1269. !       intp++;
  1270. !     }
  1271. !     if (count_a || count_b) {
  1272. !       fprintf (stderr, "count_a = %dcount_b = %d\n", count_a, count_b);
  1273. !       Panic("something wrong in area fill");
  1274. !     }
  1275.    }
  1276.   
  1277. + /* BZS - Open code */
  1278. + #ifndef ThisBit
  1279.   ThisBit (left, right, where, emitfn) struct edge *left, *right; int where; void (*emitfn)();    
  1280.    {
  1281.        if (left->pair != right || right->up)
  1282. ***************
  1283. *** 341,347 ****
  1284. --- 400,412 ----
  1285.        left->where = right->where = where;
  1286.        left->up = TRUE; right->up = FALSE;
  1287.    }
  1288. + #endif
  1289.   
  1290. + /*
  1291. +  * BZS - Open Code this, it can be called hundreds of thousands of times
  1292. +  * in even simple pictures. Mooreforms spend 50% of its time in this.
  1293. +  */
  1294. + #ifndef NotThisBit
  1295.   NotThisBit (edge, where, emitfn) struct edge *edge; int where; void (*emitfn)();    
  1296.    {
  1297.        if (edge->pair != NULL)
  1298. ***************
  1299. *** 355,364 ****
  1300.         edge->startingY = where;
  1301.        edge->where = where;
  1302.    }
  1303.   
  1304.   static void RemoveEdges (interestingY, emitfn) int interestingY; void (*emitfn)();
  1305.    {
  1306. !      int i, j = 0;
  1307.        
  1308.        for (i = 0; i < ninteresting; i++)
  1309.           if (interesting [i]->bottomY > interestingY)
  1310. --- 420,430 ----
  1311.         edge->startingY = where;
  1312.        edge->where = where;
  1313.    }
  1314. + #endif
  1315.   
  1316.   static void RemoveEdges (interestingY, emitfn) int interestingY; void (*emitfn)();
  1317.    {
  1318. !      register int i, j = 0;
  1319.        
  1320.        for (i = 0; i < ninteresting; i++)
  1321.           if (interesting [i]->bottomY > interestingY)
  1322. ***************
  1323. *** 368,385 ****
  1324.        ninteresting = j;
  1325.    }
  1326.   
  1327.   static int UpEdge (count_a, count_b, inc_a, inc_b, rule_a, rule_b) int count_a, count_b, inc_a, inc_b, (*rule_a) (), (*rule_b) ();
  1328.    {
  1329.        return (*rule_b)(count_b + inc_b) && !(*rule_a) (count_a) && (*rule_a) (count_a + inc_a) ||
  1330.            (*rule_a)(count_a + inc_a) && !(*rule_b) (count_b) && (*rule_b) (count_b + inc_b);
  1331.    }
  1332.   static int DownEdge (count_a, count_b, inc_a, inc_b, rule_a, rule_b) int count_a, count_b, inc_a, inc_b, (*rule_a) (), (*rule_b) ();
  1333.    {
  1334.        return (*rule_b)(count_b + inc_b) && (*rule_a) (count_a) && !(*rule_a) (count_a + inc_a) ||
  1335.            (*rule_a)(count_a + inc_a) && (*rule_b) (count_b) && !(*rule_b) (count_b + inc_b);
  1336.    }
  1337.   static int EoRule (n) int n;
  1338.    {
  1339.       return n & 1;
  1340. --- 434,453 ----
  1341.        ninteresting = j;
  1342.    }
  1343.   
  1344. + #ifndef UpEdge
  1345.   static int UpEdge (count_a, count_b, inc_a, inc_b, rule_a, rule_b) int count_a, count_b, inc_a, inc_b, (*rule_a) (), (*rule_b) ();
  1346.    {
  1347.        return (*rule_b)(count_b + inc_b) && !(*rule_a) (count_a) && (*rule_a) (count_a + inc_a) ||
  1348.            (*rule_a)(count_a + inc_a) && !(*rule_b) (count_b) && (*rule_b) (count_b + inc_b);
  1349.    }
  1350. ! #endif
  1351. ! #ifndef DownEdge
  1352.   static int DownEdge (count_a, count_b, inc_a, inc_b, rule_a, rule_b) int count_a, count_b, inc_a, inc_b, (*rule_a) (), (*rule_b) ();
  1353.    {
  1354.        return (*rule_b)(count_b + inc_b) && (*rule_a) (count_a) && !(*rule_a) (count_a + inc_a) ||
  1355.            (*rule_a)(count_a + inc_a) && (*rule_b) (count_b) && !(*rule_b) (count_b + inc_b);
  1356.    }
  1357. ! #endif
  1358.   static int EoRule (n) int n;
  1359.    {
  1360.       return n & 1;
  1361. ***************
  1362. *** 405,419 ****
  1363.       return num / denom;
  1364.    }
  1365.   
  1366.   static int Xvalue (ax, ay, bx, by, cy) int ax, ay, bx, by, cy;
  1367.    {
  1368.        return bx + (cy - by) * (ax - bx) / (float) (ay - by);
  1369.    }
  1370.   
  1371.   static int intercmp (aa, bb) char *aa, *bb;
  1372.    {
  1373. !      struct edge *a = *(struct edge **) aa, *b = *(struct edge **) bb;
  1374. !      int sign;
  1375.       
  1376.       sign = Xvalue (a->topX, a->topY, a->bottomX, a->bottomY, interestingY + 1) -
  1377.                Xvalue (b->topX, b->topY, b->bottomX, b->bottomY, interestingY + 1);
  1378. --- 473,489 ----
  1379.       return num / denom;
  1380.    }
  1381.   
  1382. + #ifndef Xvalue
  1383.   static int Xvalue (ax, ay, bx, by, cy) int ax, ay, bx, by, cy;
  1384.    {
  1385.        return bx + (cy - by) * (ax - bx) / (float) (ay - by);
  1386.    }
  1387. + #endif
  1388.   
  1389.   static int intercmp (aa, bb) char *aa, *bb;
  1390.    {
  1391. !    register struct edge *a = *(struct edge **) aa, *b = *(struct edge **) bb;
  1392. !    int sign;
  1393.       
  1394.       sign = Xvalue (a->topX, a->topY, a->bottomX, a->bottomY, interestingY + 1) -
  1395.                Xvalue (b->topX, b->topY, b->bottomX, b->bottomY, interestingY + 1);
  1396. ***************
  1397. *** 424,449 ****
  1398.   
  1399.   static void AddInteresting ()
  1400.    {
  1401. !     int i;
  1402.            
  1403.       nextY = infinity;
  1404.       for (; here < nedges && edge[here].topY <= interestingY; here++) /* look at each new interesting edge */
  1405.        {
  1406. !          int i, n;
  1407. !          
  1408. !         for (i = 0; i < ninteresting; i++) /* look at all possible intersections */
  1409.            {
  1410. !              int inter = Yintersect (&edge[here], interesting[i]);
  1411.                
  1412. !              if (inter >= interestingY && inter <= edge[here].bottomY && inter <= interesting[i]->bottomY)
  1413.                    AddLowest (inter);
  1414.            }
  1415.           n = ninteresting++;
  1416. !         interesting[n] = &edge[here];
  1417. !         interesting[n]->pair = NULL;
  1418. !         interesting[n]->up = FALSE;
  1419. !         interesting[n]->startingY = interesting[n]->where = edge[here].topY;
  1420. !         interesting[n]->name = names++;
  1421.        }
  1422.       i = NextLowest (interestingY);
  1423.       if (i)
  1424. --- 494,526 ----
  1425.   
  1426.   static void AddInteresting ()
  1427.    {
  1428. !     register int i;
  1429. !     register struct edge **intp;
  1430.            
  1431.       nextY = infinity;
  1432.       for (; here < nedges && edge[here].topY <= interestingY; here++) /* look at each new interesting edge */
  1433.        {
  1434. !          register int i, n;
  1435. !         i = ninteresting;
  1436. !         intp = interesting;
  1437. !         while(i-- > 0) /* look at all possible intersections */
  1438.            {
  1439. !              int inter = Yintersect (&edge[here], (*intp));
  1440.                
  1441. !              if (inter >= interestingY &&
  1442. !                 inter <= edge[here].bottomY &&
  1443. !                 inter <= (*intp)->bottomY)
  1444.                    AddLowest (inter);
  1445. +             intp++;
  1446.            }
  1447.           n = ninteresting++;
  1448. !         intp = &interesting[n];
  1449. !         *intp = &edge[here];
  1450. !         (*intp)->pair = NULL;
  1451. !         (*intp)->up = FALSE;
  1452. !         (*intp)->startingY = (*intp)->where = edge[here].topY;
  1453. !         (*intp)->name = names++;
  1454.        }
  1455.       i = NextLowest (interestingY);
  1456.       if (i)
  1457. ***************
  1458. *** 450,461 ****
  1459.           nextY = i;
  1460.       if (here != nedges && edge[here].topY < nextY)
  1461.           nextY = edge[here].topY;
  1462. !     for (i = 0; i < ninteresting; i++)
  1463. !      {
  1464. !         if (interesting[i]->topY > interestingY && interesting[i]->topY < nextY)
  1465. !             nextY = interesting[i]->topY;
  1466. !         if (interesting[i]->bottomY > interestingY && interesting[i]->bottomY < nextY)
  1467. !             nextY = interesting[i]->bottomY;
  1468.        }
  1469.       qsort ((char *) interesting, (unsigned) ninteresting, sizeof (struct edge *), intercmp);
  1470.    }
  1471. --- 527,541 ----
  1472.           nextY = i;
  1473.       if (here != nedges && edge[here].topY < nextY)
  1474.           nextY = edge[here].topY;
  1475. !     i = ninteresting;
  1476. !     intp = interesting;
  1477. !     while(i-- > 0)
  1478. !       {
  1479. !         if ((*intp)->topY > interestingY && (*intp)->topY < nextY)
  1480. !             nextY = (*intp)->topY;
  1481. !         if ((*intp)->bottomY > interestingY && (*intp)->bottomY < nextY)
  1482. !             nextY = (*intp)->bottomY;
  1483. !         intp++;
  1484.        }
  1485.       qsort ((char *) interesting, (unsigned) ninteresting, sizeof (struct edge *), intercmp);
  1486.    }
  1487. ***************
  1488. *** 462,468 ****
  1489.   
  1490.   static void FindInfinity ()
  1491.    {
  1492. !      int i;
  1493.        
  1494.       infinity = edge[0].topY;
  1495.       for (i = 0; i < nedges; i++)
  1496. --- 542,548 ----
  1497.   
  1498.   static void FindInfinity ()
  1499.    {
  1500. !      register int i;
  1501.        
  1502.       infinity = edge[0].topY;
  1503.       for (i = 0; i < nedges; i++)
  1504. ***************
  1505. *** 503,509 ****
  1506.   
  1507.   static void BuildEdgeList (path, clip) Path path; int clip;
  1508.    {
  1509. !      Path p;
  1510.        HardPoint move, here;
  1511.        
  1512.        for (p = path->next; p != path; p = p->next)
  1513. --- 583,589 ----
  1514.   
  1515.   static void BuildEdgeList (path, clip) Path path; int clip;
  1516.    {
  1517. !      register Path p;
  1518.        HardPoint move, here;
  1519.        
  1520.        for (p = path->next; p != path; p = p->next)
  1521. ***************
  1522. *** 533,539 ****
  1523.   static int NextLowest (y) int y;
  1524.    {
  1525.       int res;
  1526. !     struct lowest *p;
  1527.       
  1528.       for (p = lowest; p && p->e <= y; p = lowest)    /* delete any which are now irrelevent */
  1529.        {
  1530. --- 613,619 ----
  1531.   static int NextLowest (y) int y;
  1532.    {
  1533.       int res;
  1534. !     register struct lowest *p;
  1535.       
  1536.       for (p = lowest; p && p->e <= y; p = lowest)    /* delete any which are now irrelevent */
  1537.        {
  1538. ***************
  1539. *** 551,557 ****
  1540.   
  1541.   static void AddLowest (e) int e;
  1542.    {
  1543. !      struct lowest *res, *p, *q;
  1544.        
  1545.        for (p = lowest; p && p->e < e; q = p, p = p->higher)
  1546.            ;
  1547. --- 631,637 ----
  1548.   
  1549.   static void AddLowest (e) int e;
  1550.    {
  1551. !      register struct lowest *res, *p, *q;
  1552.        
  1553.        for (p = lowest; p && p->e < e; q = p, p = p->higher)
  1554.            ;
  1555. diff -cr /usr/tmp/ps/source/font.c ./source/font.c
  1556. *** /usr/tmp/ps/source/font.c    Thu Jul 28 14:02:59 1988
  1557. --- ./source/font.c    Wed Jul 27 12:02:18 1988
  1558. ***************
  1559. *** 362,372 ****
  1560.        else
  1561.            return NewVector (0.0, 0.0, 1.0);
  1562.    }
  1563.   static int BuildHershey (font, code) Object font, code;
  1564.    {
  1565.       Vector met;
  1566. !     Object *bbox, string, nm;
  1567.        unsigned char *s;
  1568.        Path p;
  1569.        int i, l;
  1570. --- 362,374 ----
  1571.        else
  1572.            return NewVector (0.0, 0.0, 1.0);
  1573.    }
  1574. ! /*
  1575. !  * BZS - some small changes to allow macrification of DictLoad()
  1576. !  */
  1577.   static int BuildHershey (font, code) Object font, code;
  1578.    {
  1579.       Vector met;
  1580. !     Object *bbox, string, nm, tmp;
  1581.        unsigned char *s;
  1582.        Path p;
  1583.        int i, l;
  1584. ***************
  1585. *** 373,381 ****
  1586. --- 375,391 ----
  1587.        
  1588.       bbox     = BodyArray (DictLoad (font, FontBBox));
  1589.       nm     = BodyArray (DictLoad (font, Encoding)) [BodyInteger (code)];
  1590. +     /*
  1591.       met     = GetMetrics (DictLoad (DictLoad (font, Metrics), nm));
  1592. +     */
  1593. +     tmp = DictLoad(font,Metrics);
  1594. +     met = GetMetrics(DictLoad(tmp,nm));
  1595.       met.vx -= 2; /* hershey bodge - they look better closer */
  1596. +     /*
  1597.       string     = DictLoad (DictLoad (font, CharStrings), nm);
  1598. +     */
  1599. +     tmp = DictLoad(font,CharStrings);
  1600. +     string = DictLoad(tmp,nm);
  1601.       
  1602.       SetCacheDevice (nm, NewPoint (met.vx, met.vy),
  1603.           BodyReal (bbox[0]), BodyReal (bbox[1]),
  1604. diff -cr /usr/tmp/ps/source/main.h ./source/main.h
  1605. *** /usr/tmp/ps/source/main.h    Thu Jul 28 13:53:36 1988
  1606. --- ./source/main.h    Wed Jul 27 12:02:21 1988
  1607. ***************
  1608. *** 166,170 ****
  1609. --- 166,176 ----
  1610.           ((getchbuf != EOF) ? getchbuf : ((BodyFile(file)->available = 0), Close (file), EOF))) \
  1611.       : GeneralGetch (file))
  1612.   
  1613. + /*
  1614. +  * BZS - macro-ify some things
  1615. +  */
  1616. + Object DictFind();
  1617. + #define DictLoad(DICT,KEY) DictFind((DICT.u.Dictionary)->dict_body,KEY,\
  1618. +                     (DICT.u.Dictionary)->dict_size)
  1619.   /* Next line --jgm */
  1620.   #define PanicIf(flag,s) do { if (flag) Panic(s); } while (0)
  1621. diff -cr /usr/tmp/ps/source/matrix.c ./source/matrix.c
  1622. *** /usr/tmp/ps/source/matrix.c    Thu Jul 28 14:03:05 1988
  1623. --- ./source/matrix.c    Wed Jul 27 12:02:22 1988
  1624. ***************
  1625. *** 393,400 ****
  1626.   HardPoint ExtToInt (p) Point p;
  1627.    {
  1628.       Vector v;
  1629. !     
  1630.       v = Transform (NewVector (p.x, p.y, 1.0), gstate->CTM);
  1631.       return NewHardPoint (v.vx, v.vy);
  1632.    }
  1633.   
  1634. --- 393,413 ----
  1635.   HardPoint ExtToInt (p) Point p;
  1636.    {
  1637.       Vector v;
  1638. !     register Vector *vp;
  1639. !     register Matrix *mp;
  1640. !     register Point *pp;
  1641. ! /*
  1642. !  * BZS - try open coding this
  1643. !  *    
  1644.       v = Transform (NewVector (p.x, p.y, 1.0), gstate->CTM);
  1645. +  */
  1646. +     mp = &gstate->CTM;
  1647. +     vp = &v;
  1648. +     pp = &p;
  1649. +     vp->vx = pp->x * mp->A + pp->y * mp->C + mp->tx;
  1650. +     vp->vy = pp->x * mp->B + pp->y * mp->D + mp->ty;
  1651.       return NewHardPoint (v.vx, v.vy);
  1652.    }
  1653.   
  1654. diff -cr /usr/tmp/ps/source/misc.c ./source/misc.c
  1655. No differences encountered
  1656. diff -cr /usr/tmp/ps/source/operator.c ./source/operator.c
  1657. *** /usr/tmp/ps/source/operator.c    Thu Jul 28 14:03:10 1988
  1658. --- ./source/operator.c    Wed Jul 27 12:02:23 1988
  1659. ***************
  1660. *** 203,212 ****
  1661.    *
  1662.    */
  1663.   
  1664.   int ExecOperator (item) Object item;
  1665.    {
  1666. !     struct op_struct *op = Body (item);
  1667. !     int i, res, (*fn)() = op->fn;
  1668.       Object arg[7];
  1669.       
  1670.       Self = NameOperator (item);
  1671. --- 203,216 ----
  1672.    *
  1673.    */
  1674.   
  1675. + /*
  1676. +  * BZS - try to speed up a little
  1677. +  */
  1678.   int ExecOperator (item) Object item;
  1679.    {
  1680. !     register struct op_struct *op = Body (item);
  1681. !     register int i, res;
  1682. !     int (*fn)() = op->fn;
  1683.       Object arg[7];
  1684.       
  1685.       Self = NameOperator (item);
  1686. ***************
  1687. *** 219,225 ****
  1688.           arg[i] = Pop (OpStack);
  1689.       for (i = op->arguments - 1; i >= 0; i--)
  1690.        {
  1691. !          Type formal = op->argtypes[i], actual = TypeOf (arg[i]);
  1692.            
  1693.            if (formal == Float && actual == Integer)
  1694.                 arg[i] = RealInteger (arg[i]);
  1695. --- 223,229 ----
  1696.           arg[i] = Pop (OpStack);
  1697.       for (i = op->arguments - 1; i >= 0; i--)
  1698.        {
  1699. !          register Type formal = op->argtypes[i], actual = TypeOf (arg[i]);
  1700.            
  1701.            if (formal == Float && actual == Integer)
  1702.                 arg[i] = RealInteger (arg[i]);
  1703. diff -cr /usr/tmp/ps/source/screen.c ./source/screen.c
  1704. *** /usr/tmp/ps/source/screen.c    Thu Jul 28 13:44:08 1988
  1705. --- ./source/screen.c    Sat Apr 30 18:44:06 1988
  1706. ***************
  1707. *** 55,61 ****
  1708.        struct hardware *shade;
  1709.    } *screen = NULL;
  1710.   
  1711. ! static int screen_size, screen_side;
  1712.   
  1713.   static int FreqSize (freq) float freq;
  1714.    {
  1715. --- 55,61 ----
  1716.        struct hardware *shade;
  1717.    } *screen = NULL;
  1718.   
  1719. ! static int screen_size /* , screen_side (unused --jgm) */;
  1720.   
  1721.   static int FreqSize (freq) float freq;
  1722.    {
  1723. ***************
  1724. *** 121,127 ****
  1725.             free ((char *) screen);
  1726.         }
  1727.        p = screen = (struct screen *) Malloc ((unsigned) (((screen_size = size * size) + 1) * sizeof (struct screen)));
  1728. !      screen_side = size;
  1729.        for (i = 0; i < size; i++)
  1730.            for (j = 0; j < size; j++)
  1731.             {
  1732. --- 121,127 ----
  1733.             free ((char *) screen);
  1734.         }
  1735.        p = screen = (struct screen *) Malloc ((unsigned) (((screen_size = size * size) + 1) * sizeof (struct screen)));
  1736. !      /* screen_side = size; (unused --jgm) */
  1737.        for (i = 0; i < size; i++)
  1738.            for (j = 0; j < size; j++)
  1739.             {
  1740. diff -cr /usr/tmp/ps/source/state.c ./source/state.c
  1741. *** /usr/tmp/ps/source/state.c    Thu Jul 28 14:03:20 1988
  1742. --- ./source/state.c    Sat Apr 30 16:47:57 1988
  1743. ***************
  1744. *** 123,128 ****
  1745. --- 123,133 ----
  1746.   
  1747.   static int CopyPage ()
  1748.    {
  1749. +         /* Begin jgm */
  1750. +         if (TypeOf(gstate->device->output_routine) != Null) {
  1751. +         Push(ExecStack, gstate->device->output_routine);
  1752. +     }
  1753. +     /* End jgm */
  1754.        return TRUE;
  1755.    }
  1756.   
  1757. diff -cr /usr/tmp/ps/source/stroke.c ./source/stroke.c
  1758. *** /usr/tmp/ps/source/stroke.c    Thu Jul 28 13:48:04 1988
  1759. --- ./source/stroke.c    Sat Apr 30 18:26:27 1988
  1760. ***************
  1761. *** 358,364 ****
  1762.   int PStrokePath ()
  1763.    {
  1764.        Path p, new = NewPath ();
  1765. !      HardPoint prev, here, move;
  1766.        enum pelem_type last_type = EHeader;
  1767.        float angle, last_angle, width = gstate->line_width;
  1768.        
  1769. --- 358,364 ----
  1770.   int PStrokePath ()
  1771.    {
  1772.        Path p, new = NewPath ();
  1773. !      HardPoint /* prev, (unused --jgm) */ here, move;
  1774.        enum pelem_type last_type = EHeader;
  1775.        float angle, last_angle, width = gstate->line_width;
  1776.        
  1777. ***************
  1778. *** 370,376 ****
  1779.            switch (p->ptype)
  1780.             {
  1781.                  case EMove:
  1782. !                  prev = here;
  1783.                    move = here = p->pe.point;
  1784.                    break;
  1785.                    
  1786. --- 370,376 ----
  1787.            switch (p->ptype)
  1788.             {
  1789.                  case EMove:
  1790. !                  /* prev = here; (unused --jgm) */
  1791.                    move = here = p->pe.point;
  1792.                    break;
  1793.                    
  1794. ***************
  1795. *** 378,384 ****
  1796.                      if (last_type == EMove)
  1797.                          break;
  1798.                   angle = LineSegment (p, new, IntToExt (here), IntToExt (move), width, last_angle, last_type);
  1799. !                  prev = here;
  1800.                    here = move;
  1801.                    last_type = EHeader;
  1802.                    break;
  1803. --- 378,384 ----
  1804.                      if (last_type == EMove)
  1805.                          break;
  1806.                   angle = LineSegment (p, new, IntToExt (here), IntToExt (move), width, last_angle, last_type);
  1807. !                  /* prev = here; (unused --jgm) */
  1808.                    here = move;
  1809.                    last_type = EHeader;
  1810.                    break;
  1811. ***************
  1812. *** 385,391 ****
  1813.                    
  1814.                  case ELine:
  1815.                   angle = LineSegment (p, new, IntToExt (here), IntToExt (p->pe.point), width, last_angle, last_type);
  1816. !                  prev = here;
  1817.                    here = p->pe.point;
  1818.                      break;
  1819.                      
  1820. --- 385,391 ----
  1821.                    
  1822.                  case ELine:
  1823.                   angle = LineSegment (p, new, IntToExt (here), IntToExt (p->pe.point), width, last_angle, last_type);
  1824. !                  /* prev = here; (unused --jgm) */
  1825.                    here = p->pe.point;
  1826.                      break;
  1827.                      
  1828. *** /dev/null    Thu Jul 28 10:26:48 1988
  1829. --- wwinfo.h    Thu Jul 28 14:36:37 1988
  1830. ***************
  1831. *** 0 ****
  1832. --- 1,14 ----
  1833. + Now that I've gotten your attention...
  1834. + If your system doesn't have the wwinfo.h file, that probably means
  1835. + that you don't have the ww window manager, which is rumored to be
  1836. + available only to academic sites in the U.K.  In that case, a version
  1837. + of the Postscript Interpreter compiled to produce output for ww
  1838. + is probably worthless to you.
  1839. + Please examine the file source/makefile and select a version that is
  1840. + appropriate for you--possible choices include "sunPS", "XPS", and
  1841. + "xps".
  1842. +                 _.John G. Myers
  1843.