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

  1. This is a patch for Crispin Goswell's postscript interpreter, which
  2. was posted to comp.sources.unix a while back.  If you don't have the
  3. interpreter, you can get it from one of the comp.sources.unix
  4. archives.
  5.  
  6. Soon after the interpreter was posted, I posted these fixes to
  7. comp.sources.bugs, but they unfortunately had lines wrapped by our
  8. mailer.  This first patch is equivalent to that posting (modulo line
  9. wrapping) and if you successfully applied that posting, you can skip
  10. to the next patch.
  11.  
  12. To install this, you need the 'patch' program which is also available
  13. from the comp.sources.unix archives.
  14.  
  15. Change directories to the top-level postscript directory (the one with
  16. the file "MANIFEST" in it) and apply this patch with the command:
  17.  
  18. patch -p0 <ps.diff.v1
  19.  
  20.                 _.John G. Myers
  21.                 jm36+@andrew.cmu.edu
  22.  
  23. *** /dev/null    Mon Jul 25 01:14:13 1988
  24. --- CHANGES.JGM    Thu Jul 28 12:24:55 1988
  25. ***************
  26. *** 0 ****
  27. --- 1,47 -----
  28. + Here is a patch that makes several bug fixes and enhancements to the Postscript
  29. + interpreter recently posted.  The changes are:
  30. + Bugs fixed:
  31. + Half-implemented the missing operator "vmstatus".  The number of savelevels is
  32. + correct (as far as the broken implementation of "save" and "restore" allow),
  33. + but the amount of memory used and free is a lie.
  34. + Implemented the missing operator "noaccess".
  35. + Fixed a bug in the operator "stopped".  Previously it only worked on arrays,
  36. + but now it works on any executable object.
  37. + Fixed the parsing bug for reals with a trailing period (e.g. "4.") which
  38. + resulted in the "undefined in operater exec" errors reported to the net.
  39. + Changed an occurance of the variable "signed" to "signedp" as the former is an
  40. + ANSI C keyword.
  41. + Added a version of the missing file postscript/demos/buildcachefont.ps
  42. + Enhancements made:
  43. + Macroized PanicIf()
  44. + Changed "undefined in operator exec" errors to instead report 
  45. + "undefined in operator foo", where "foo" is the operator that was undefined.
  46. + Fixed imagemask to deal better with images that have to be shrunk.  Bitmapped
  47. + fonts intended for 300 dpi printers look much better now.
  48. + (Change courtesy of Christopher Cox, cc4b@andrew.cmu.edu)
  49. + Tweaked makefile to deal better with sun3.
  50. + Added "getenv" operator.  The syntax is:
  51. +     <string> getenv <string> <true>
  52. + if the environment variable exists, or
  53. +     <string> getenv <false>
  54. + if it does not.
  55. +                 John G. Myers
  56. +                 jm36@andrew.cmu.edu
  57. +                 jgm@k.gp.cs.cmu.edu
  58. diff -cr orig/postscript/psrc ./postscript/psrc
  59. *** orig/postscript/psrc    Sun Jan  3 14:22:51 1988
  60. --- ./postscript/psrc    Sun Dec 13 22:58:09 1987
  61. ***************
  62. *** 10,17 ****
  63.   
  64.   /bind {} def
  65.   
  66. ! /save { gsave /save } def
  67. ! /restore { grestore pop } def
  68.   /raise { errordict exch get exec } def
  69.   
  70.   /beep ( ) dup 0 7 put def
  71. --- 10,21 ----
  72.   
  73.   /bind {} def
  74.   
  75. ! %% Start mods by jgm
  76. ! /$$SAVELEVEL 0 def
  77. ! /save { gsave /save /$$SAVELEVEL $$SAVELEVEL 1 add def } def
  78. ! /restore { grestore pop /$$SAVELEVEL $$SAVELEVEL 1 sub def } def
  79. ! /vmstatus { $$SAVELEVEL 10000 10000 } def
  80. ! %% End mods by jgm
  81.   /raise { errordict exch get exec } def
  82.   
  83.   /beep ( ) dup 0 7 put def
  84. diff -cr orig/source/array.c ./source/array.c
  85. *** orig/source/array.c    Sun Jan  3 14:21:55 1988
  86. --- ./source/array.c    Sat Dec 12 01:05:28 1987
  87. ***************
  88. *** 17,22 ****
  89. --- 17,23 ----
  90.   
  91.   static int forAll (), ForAll (), PReadOnly (), PExecOnly (), PrCheck (), PwCheck ();
  92.   static int PutInterval (), GetInterval (), Put (), Get (), Length (), Copy (), Eq ();
  93. + static int PNoAccess (); /*jgm*/
  94.   
  95.   int ExecArray ();
  96.   Object Marker;
  97. ***************
  98. *** 53,58 ****
  99. --- 54,60 ----
  100.        TypeInstallOp (Array, "length",         PLength,    1, 1, 0, 0, Array);
  101.        TypeInstallOp (Array, "copy",         Copy,        2, 0, 0, 0, Array, Array);
  102.        TypeInstallOp (Array, "forall",     ForAll,        2, 0, 0, 4, Array, Array);
  103. +      TypeInstallOp (Array, "noaccess",     PNoAccess,    1, 1, 0, 0, Array); /*jgm*/
  104.        TypeInstallOp (Array, "executeonly",     PExecOnly,    1, 1, 0, 0, Array);
  105.        TypeInstallOp (Array, "readonly",     PReadOnly,    1, 1, 0, 0, Array);
  106.        TypeInstallOp (Array, "rcheck",     PrCheck,    1, 1, 0, 0, Array);
  107. ***************
  108. *** 385,390 ****
  109. --- 387,398 ----
  110.                 body[i] = Pop (OpStack);
  111.             return Push (OpStack, array);
  112.         }
  113. +  }
  114. + /* PNoAccess by jgm */
  115. + static int PNoAccess (item) Object item;
  116. +  {
  117. +      return Push (OpStack, NoAccess (item));
  118.    }
  119.   
  120.   static int PExecOnly (item) Object item;
  121. diff -cr orig/source/cache.c ./source/cache.c
  122. *** orig/source/cache.c    Sun Jan  3 14:22:42 1988
  123. --- ./source/cache.c    Thu Dec 10 21:26:47 1987
  124. ***************
  125. *** 501,512 ****
  126.       if ((ccache = SearchCache (m, BodyFontID (DictLoad (gstate->font, Fid)))) == NULL)
  127.            return Error (PInvFont);
  128.        
  129. -       Message (disk_name);
  130.       VOID sprintf (disk_name,
  131.            "%s/cache/%.*s/%3d%3d%3d%3d",
  132.            library,
  133.            lengthName (font_name), BodyName (font_name),
  134.            (int) right.vx, (int) right.vy, (int) bottom.vx, (int) bottom.vy);
  135.        
  136.        if ((fp = fopen (disk_name, "w")) == NULL)
  137.            return Error (PInvFileAccess);
  138. --- 501,512 ----
  139.       if ((ccache = SearchCache (m, BodyFontID (DictLoad (gstate->font, Fid)))) == NULL)
  140.            return Error (PInvFont);
  141.        
  142.       VOID sprintf (disk_name,
  143.            "%s/cache/%.*s/%3d%3d%3d%3d",
  144.            library,
  145.            lengthName (font_name), BodyName (font_name),
  146.            (int) right.vx, (int) right.vy, (int) bottom.vx, (int) bottom.vy);
  147. +       Message (disk_name); /* moved from before to after prev line -- jgm */
  148.        
  149.        if ((fp = fopen (disk_name, "w")) == NULL)
  150.            return Error (PInvFileAccess);
  151. diff -cr orig/source/config.c ./source/config.c
  152. *** orig/source/config.c    Sun Jan  3 14:19:54 1988
  153. --- ./source/config.c    Fri Jan  1 13:58:10 1988
  154. ***************
  155. *** 87,91 ****
  156.        Install ("polytype",        DictFrom (Poly));
  157.       Install ("fonttype",        DictFrom (FontID));
  158.       
  159. !     Install ("version",    StringFrom ("Version 1.4"));
  160.    }
  161. --- 87,91 ----
  162.        Install ("polytype",        DictFrom (Poly));
  163.       Install ("fonttype",        DictFrom (FontID));
  164.       
  165. !     Install ("version",    StringFrom ("Version 1.4 with mods by jgm")); /* jgm */
  166.    }
  167. diff -cr orig/source/control.c ./source/control.c
  168. *** orig/source/control.c    Sun Jan  3 14:26:55 1988
  169. --- ./source/control.c    Sun Dec 13 23:13:46 1987
  170. ***************
  171. *** 65,71 ****
  172.        InstallOp ("loop",    PLoop,        1, 0, 0, 4, Array);
  173.       InstallOp ("exit",    PExit,        0, 0, 0, 0);
  174.        InstallOp ("stop",    PStop,        0, 1, 0, 0);
  175. !      InstallOp ("stopped",    PStopped,    1, 1, 0, 3, Array);
  176.        InstallOp ("quit",    PQuit,         0, 0, 0, 0);
  177.        InstallOp ("start",    PStart,     0, 0, 0, 0);
  178.        InstallOp ("countexecstack",
  179. --- 65,72 ----
  180.        InstallOp ("loop",    PLoop,        1, 0, 0, 4, Array);
  181.       InstallOp ("exit",    PExit,        0, 0, 0, 0);
  182.        InstallOp ("stop",    PStop,        0, 1, 0, 0);
  183. !     /* Changed from "Array" to "Poly" --jgm*/
  184. !      InstallOp ("stopped",    PStopped,    1, 1, 0, 3, Poly);
  185.        InstallOp ("quit",    PQuit,         0, 0, 0, 0);
  186.        InstallOp ("start",    PStart,     0, 0, 0, 0);
  187.        InstallOp ("countexecstack",
  188. diff -cr orig/source/dictionary.c ./source/dictionary.c
  189. *** orig/source/dictionary.c    Sun Jan  3 14:22:55 1988
  190. --- ./source/dictionary.c    Sat Dec 12 01:06:49 1987
  191. ***************
  192. *** 23,28 ****
  193. --- 23,29 ----
  194.   static int PDict (), PBegin (), PEnd (), PDef (), PStore (), PKnown (), PLoad ();
  195.   static int PrCheck (), PwCheck (), PReadOnly (), EqDict (); 
  196.   static int PWhere (), PMaxLength (), PCurrentDict (); 
  197. + static int PNoAccess (); /*jgm*/
  198.   
  199.   static int hash_tries = 0, hash_collisions = 0, hash_attempts = 0;
  200.   static int PHashStats (), PDictHash ();
  201. ***************
  202. *** 57,62 ****
  203. --- 58,64 ----
  204.       TypeInstallOp (Dictionary, "length",     LengthDict,    1, 1, 0, 0, Dictionary);
  205.       TypeInstallOp (Dictionary, "copy",     CopyDict,    2, 0, 0, 0, Dictionary, Dictionary);
  206.       TypeInstallOp (Dictionary, "forall",     ForDict,    2, 0, 0, 4, Dictionary, Array);
  207. +      TypeInstallOp (Dictionary, "noaccess",     PNoAccess,    1, 1, 0, 0, Dictionary); /*jgm*/
  208.        TypeInstallOp (Dictionary, "readonly",     PReadOnly,    1, 1, 0, 0, Dictionary);
  209.        TypeInstallOp (Dictionary, "rcheck",     PrCheck,    1, 1, 0, 0, Dictionary);
  210.        TypeInstallOp (Dictionary, "wcheck",     PwCheck,    1, 1, 0, 0, Dictionary);
  211. ***************
  212. *** 511,516 ****
  213. --- 513,524 ----
  214.   static int PCurrentDict ()
  215.    {
  216.         return Push (OpStack, Top (DictStack));
  217. +  }
  218. + /* PNoAccess by jgm */
  219. + static int PNoAccess (item) Object item;
  220. +  {
  221. +      return Push (OpStack, NoAccess (item));
  222.    }
  223.   
  224.   static int PReadOnly (item) Object item;
  225. diff -cr orig/source/image.c ./source/image.c
  226. *** orig/source/image.c    Sun Jan  3 14:22:32 1988
  227. --- ./source/image.c    Mon Dec 28 18:17:04 1987
  228. ***************
  229. *** 353,363 ****
  230.       else
  231.        {
  232.            middle2 = NewBitmapHardware (dwidth, h);
  233. !         for (i = 0; i < dwidth; i++)
  234. !             BitBlt (from,     middle2,
  235. !                 NewDevicePoint ((int) (i/xscale), 0), NewDevicePoint (i, 0),
  236.                   NewDevicePoint (1, h),
  237.                   ROP_OR);
  238.        }
  239.       
  240.       if (dheight > h)
  241. --- 353,365 ----
  242.       else
  243.        {
  244.            middle2 = NewBitmapHardware (dwidth, h);
  245. !         /* begin changes by cc4b --jgm */
  246. !         for (i = 0; i < w; i++)
  247. !             BitBlt( from,  middle2,
  248. !                 NewDevicePoint (i, 0), NewDevicePoint( (int) (i * xscale), 0),
  249.                   NewDevicePoint (1, h),
  250.                   ROP_OR);
  251. +         /* end changes by cc4b --jgm */
  252.        }
  253.       
  254.       if (dheight > h)
  255. ***************
  256. *** 382,392 ****
  257.       else
  258.        {
  259.           high2 = NewBitmapHardware (dwidth, dheight);
  260. !         for (i = 0; i < dheight; i++)
  261. !             BitBlt (middle2, high2,
  262. !                 NewDevicePoint (0, (int) (i/yscale)), NewDevicePoint (0, i),
  263.                   NewDevicePoint (dwidth, 1),
  264.                   ROP_OR);
  265.        }
  266.        return high2;
  267.    }
  268. --- 384,397 ----
  269.       else
  270.        {
  271.           high2 = NewBitmapHardware (dwidth, dheight);
  272. !         /* begin changes by cc4b --jgm */
  273. !         for (i = 0; i < h; i++ )
  274. !             BitBlt( middle2, high2,
  275. !                 NewDevicePoint (0, i), NewDevicePoint( 0, (int) (i * yscale)),
  276.                   NewDevicePoint (dwidth, 1),
  277.                   ROP_OR);
  278. +         /* end changes by cc4b  --jgm */
  279.        }
  280.        return high2;
  281.    }
  282. diff -cr orig/source/integer.c ./source/integer.c
  283. *** orig/source/integer.c    Sun Jan  3 14:21:32 1988
  284. --- ./source/integer.c    Thu Dec 10 20:44:17 1987
  285. ***************
  286. *** 72,80 ****
  287.   
  288.   int StrictMul (a, b) int a, b;
  289.    {
  290. !      int atop, abot, btop, bbot, sum, signed;
  291.        
  292. !      signed = (a < 0) != (b < 0);
  293.        a = a < 0 ? -a : a;
  294.        b = b < 0 ? -b : b;
  295.        abot = a & LowMask;
  296. --- 72,81 ----
  297.   
  298.   int StrictMul (a, b) int a, b;
  299.    {
  300. !     /* Variable signed changed to signedp by jgm for ANSI C */
  301. !      int atop, abot, btop, bbot, sum, signedp;
  302.        
  303. !      signedp = (a < 0) != (b < 0);
  304.        a = a < 0 ? -a : a;
  305.        b = b < 0 ? -b : b;
  306.        abot = a & LowMask;
  307. ***************
  308. *** 86,92 ****
  309.        sum = ((unsigned) sum >> Word2) + atop * btop;
  310.        if (sum != 0 || a * b < 0)
  311.            kill (getpid (), SIGFPE);
  312. !      return signed ? -a * b : a * b;
  313.    }
  314.   
  315.   int StrictAdd (a, b) int a, b;
  316. --- 87,93 ----
  317.        sum = ((unsigned) sum >> Word2) + atop * btop;
  318.        if (sum != 0 || a * b < 0)
  319.            kill (getpid (), SIGFPE);
  320. !      return signedp ? -a * b : a * b;
  321.    }
  322.   
  323.   int StrictAdd (a, b) int a, b;
  324. diff -cr orig/source/main.c ./source/main.c
  325. *** orig/source/main.c    Sun Jan  3 14:22:13 1988
  326. --- ./source/main.c    Sun Dec 13 00:40:04 1987
  327. ***************
  328. *** 187,210 ****
  329.                  Object newitem;
  330.                  
  331.                  newitem = Load (item);
  332. !                if (TypeOf (newitem) != Condition)
  333. !                     item = newitem;
  334. !                
  335. !                if (!xCheck (item))
  336. !                  res = Push (OpStack, item);
  337. !               else if (TypeOf (item) == Operator)
  338. !                   res = ExecOperator (item);
  339. !               else if (TypeOf (item) == Array)
  340. !                   res = ExecArray (item);
  341. !               else if (TypeOf (item) == File)
  342. !                   res = ExecFile (item);
  343. !             else
  344. !                {
  345. !                   res = Push (OpStack, item);
  346. !                    exop = Lookup (TypeOf (item), execName);
  347. !                    if (TypeOf (exop) != Condition)
  348. !                        VOID Push (ExecStack, exop);
  349. !                 }
  350.               }
  351.             else
  352.              {
  353. --- 187,216 ----
  354.                  Object newitem;
  355.                  
  356.                  newitem = Load (item);
  357. !             /* begin jgm */
  358. !             if (TypeOf (newitem) == Condition) {
  359. !                 VOID Push(OpStack, item);
  360. !                 res = Push(ExecStack, DictLoad(ErrorDict,PUndefined));
  361. !             } else {
  362. !                 /* end jgm */
  363. !                 item = newitem;
  364. !                 if (!xCheck (item))
  365. !                 res = Push (OpStack, item);
  366. !                 else if (TypeOf (item) == Operator)
  367. !                 res = ExecOperator (item);
  368. !                 else if (TypeOf (item) == Array)
  369. !                 res = ExecArray (item);
  370. !                 else if (TypeOf (item) == File)
  371. !                 res = ExecFile (item);
  372. !                 else
  373. !                 {
  374. !                 res = Push (OpStack, item);
  375. !                 exop = Lookup (TypeOf (item), execName);
  376. !                 if (TypeOf (exop) != Condition)
  377. !                     VOID Push (ExecStack, exop);
  378. !                 }
  379. !             } /* jgm */
  380.               }
  381.             else
  382.              {
  383. ***************
  384. *** 340,350 ****
  385.            return TRUE;
  386.    }
  387.   
  388. ! PanicIf (cond, s) int cond; char *s;
  389. !  {
  390. !      if (cond)
  391. !          Panic (s);
  392. !  }
  393.   
  394.   Panic (s) char *s;
  395.    {
  396. --- 346,358 ----
  397.            return TRUE;
  398.    }
  399.   
  400. ! #ifdef needed /* Macroized --jgm */
  401. ! XPanicIf (cond, s) int cond; char *s;
  402. ! X {
  403. ! X     if (cond)
  404. ! X         Panic (s);
  405. ! X }
  406. ! #endif
  407.   
  408.   Panic (s) char *s;
  409.    {
  410. ***************
  411. *** 392,397 ****
  412. --- 400,416 ----
  413.       return o;
  414.    }
  415.   
  416. + /* NoAccess by jgm */
  417. + Object NoAccess (o) Object o;
  418. +  {
  419. +      if (o.type == Dictionary)
  420. +          o.u.Dictionary->dict_flags &= ~(READABLE | WRITEABLE | EXECUTABLE);
  421. +      else
  422. +          o.flags &= ~(READABLE | WRITEABLE | EXECUTABLE);
  423. +      return o;
  424. +  }
  425.   Object ExecOnly (o) Object o;
  426.    {
  427.        if (o.type == Dictionary)
  428. ***************
  429. *** 398,404 ****
  430.            o.u.Dictionary->dict_flags &= ~(READABLE | WRITEABLE);
  431.        else
  432.            o.flags &= ~(READABLE | WRITEABLE);
  433. !      return ReadOnly (o);
  434.    }
  435.   
  436.   Object ReadOnly (o) Object o;
  437. --- 417,423 ----
  438.            o.u.Dictionary->dict_flags &= ~(READABLE | WRITEABLE);
  439.        else
  440.            o.flags &= ~(READABLE | WRITEABLE);
  441. !      return o;   /* Removed redundant call to ReadOnly -- jgm */
  442.    }
  443.   
  444.   Object ReadOnly (o) Object o;
  445. diff -cr orig/source/main.h ./source/main.h
  446. *** orig/source/main.h    Sun Jan  3 14:19:59 1988
  447. --- ./source/main.h    Sat Dec 12 00:58:43 1987
  448. ***************
  449. *** 74,79 ****
  450. --- 74,80 ----
  451.        Object overflow, underflow, *stack_body;
  452.    } *Stack, StackOb;
  453.    
  454. + Object NoAccess (); /* jgm */
  455.   Object SameFlags (), MakeObject (), Cvx (), Cvlit (), ReadOnly (), WriteOnly (), ExecOnly ();
  456.   int OpCheck (), min (), rCheck (), wCheck (), xCheck ();
  457.   Object MakeArray (), ParseArray (), getArray (), getIArray (), *BodyArray ();
  458. ***************
  459. *** 164,166 ****
  460. --- 165,170 ----
  461.       ((getchbuf = getc (BodyFile(file)->f.f_ptr)), \
  462.           ((getchbuf != EOF) ? getchbuf : ((BodyFile(file)->available = 0), Close (file), EOF))) \
  463.       : GeneralGetch (file))
  464. + /* Next line --jgm */
  465. + #define PanicIf(flag,s) do { if (flag) Panic(s); } while (0)
  466. diff -cr orig/source/math.c ./source/math.c
  467. *** orig/source/math.c    Sun Jan  3 14:20:43 1988
  468. --- ./source/math.c    Fri Dec 11 22:54:46 1987
  469. ***************
  470. *** 108,113 ****
  471. --- 108,115 ----
  472.         {
  473.             int olength = length, dval;
  474.             
  475. +         if (length == 0) return MakeReal (sign * (double)ival); /*jgm*/
  476.           fval = ival;
  477.            dval = ParseInteger (&s, &length, 10);
  478.            fval += dval * pow (10.0, (float)(length - olength));
  479. diff -cr orig/source/makefile ./source/makefile
  480. *** orig/source/makefile    Sun Jan  3 14:19:33 1988
  481. --- ./source/makefile    Sun Jan  3 15:37:00 1988
  482. ***************
  483. *** 4,16 ****
  484.   LIBS=libww.a -lsuntool -lsunwindow -lpixrect -g
  485.   GRAPHICS=cache.o colour.o device.o fill.o font.o gsave.o image.o mat.o matrix.o\
  486.       pat.o path.o state.o stroke.o
  487.   CFLAGS=-O
  488.   
  489.   PS:    $(OBJECTS) $(GRAPHICS) hard.o canon.a
  490.       cc $(CFLAGS)  $(OBJECTS) $(GRAPHICS) hard.o canon.a -lm `libs` -o PS
  491.   
  492. ! sunPS:    $(OBJECTS) $(GRAPHICS) hard.o canon.a pixrect
  493. !     cc $(CFLAGS)  $(OBJECTS) $(GRAPHICS) hard.o canon.a -lm -lpixrect -o sunPS
  494.   
  495.   CPS:    $(OBJECTS) $(GRAPHICS) colour-ww.o trapezoid.o canon.o
  496.       cc $(CFLAGS)  $(OBJECTS) $(GRAPHICS) colour-ww.o canon.o trapezoid.o -lm `libs` -o CPS
  497. --- 4,23 ----
  498.   LIBS=libww.a -lsuntool -lsunwindow -lpixrect -g
  499.   GRAPHICS=cache.o colour.o device.o fill.o font.o gsave.o image.o mat.o matrix.o\
  500.       pat.o path.o state.o stroke.o
  501. + # For SUN with 68881
  502. + #CFLAGS=-O -f68881
  503. + # For others
  504.   CFLAGS=-O
  505.   
  506. + #default: sunPS
  507.   PS:    $(OBJECTS) $(GRAPHICS) hard.o canon.a
  508.       cc $(CFLAGS)  $(OBJECTS) $(GRAPHICS) hard.o canon.a -lm `libs` -o PS
  509.   
  510. ! sunPS:    $(OBJECTS) $(GRAPHICS) pixrect.o canon.a
  511. !     cc $(CFLAGS)  $(OBJECTS) $(GRAPHICS) pixrect.o canon.a -lm -lpixrect -o sunPS
  512.   
  513.   CPS:    $(OBJECTS) $(GRAPHICS) colour-ww.o trapezoid.o canon.o
  514.       cc $(CFLAGS)  $(OBJECTS) $(GRAPHICS) colour-ww.o canon.o trapezoid.o -lm `libs` -o CPS
  515. ***************
  516. *** 31,39 ****
  517.   all:    PS postscript viewer
  518.   
  519.   ww:    ww.o wwlib installww
  520. - pixrect:    pixrect.o
  521. -     cp pixrect.o hard.o
  522.   
  523.   sun:    ww wwsun
  524.   
  525. --- 38,43 ----
  526. diff -cr orig/source/misc.c ./source/misc.c
  527. *** orig/source/misc.c    Sun Jan  3 14:19:36 1988
  528. --- ./source/misc.c    Sun Dec 13 22:03:56 1987
  529. ***************
  530. *** 17,27 ****
  531. --- 17,29 ----
  532.   #endif
  533.   
  534.   static int PUserTime ();
  535. + static int PGetEnv (); /*jgm*/
  536.        
  537.   InitMisc ()
  538.    {
  539.         InstallOp ("usertime",    PUserTime,    0, 1, 0, 0);
  540.        InstallOp ("==",     PolyFirst,     1, 1, 0, 0, Poly);
  541. +     InstallOp ("getenv",    PGetEnv,    1, 1, 0, 0, String); /*jgm*/
  542.     }
  543.   
  544.   static int PUserTime ()
  545. ***************
  546. *** 32,34 ****
  547. --- 34,50 ----
  548.       times (&tbuf);
  549.        return Push (OpStack, MakeInteger ((int) (tbuf.tms_utime * 1000 / HZ)));
  550.    }
  551. + /* PGetEnv by jgm */
  552. + static int PGetEnv(string) Object string;
  553. + {
  554. +     char *s, *getenv();
  555. +     s = getenv(BodyString(string));
  556. +     if (s != NULL) {
  557. +     VOID Push(OpStack, MakeString(s, strlen(s)));
  558. +     }
  559. +     return Push(OpStack, MakeBoolean(s != NULL));
  560. + }
  561. diff -cr orig/source/string.c ./source/string.c
  562. *** orig/source/string.c    Sun Jan  3 14:23:16 1988
  563. --- ./source/string.c    Sat Dec 12 01:32:44 1987
  564. ***************
  565. *** 22,27 ****
  566. --- 22,28 ----
  567.   static int Exec (), Token (), PString (), Search (), AnchorSearch (), Copy (), EqEq ();
  568.   static int Length (), ForAll (), Get (), Put (), GetInterval (), PutInterval (), Eq (), Lt (), Le (), Gt (), Ge (), PrCheck (), PwCheck ();
  569.   static int Cvi (), Cvr (), Cvs (), PReadOnly (), PExecOnly ();
  570. + static int PNoAccess (); /* jgm */
  571.   
  572.   InitString ()
  573.    {
  574. ***************
  575. *** 45,50 ****
  576. --- 46,52 ----
  577.        TypeInstallOp (String, "put",         Put,        3, 0, 0, 0, String, Integer, Integer);
  578.        TypeInstallOp (String, "getinterval",     GetInterval,    3, 1, 0, 0, String, Integer, Integer);
  579.        TypeInstallOp (String, "putinterval",     PutInterval,    3, 0, 0, 0, String, Integer, String);
  580. +      TypeInstallOp (String, "noaccess",     PNoAccess,    1, 1, 0, 0, String); /*jgm*/
  581.        TypeInstallOp (String, "executeonly",     PExecOnly,    1, 1, 0, 0, String);
  582.        TypeInstallOp (String, "readonly",     PReadOnly,    1, 1, 0, 0, String);
  583.        TypeInstallOp (String, "rcheck",     PrCheck,    1, 1, 0, 0, String);
  584. ***************
  585. *** 530,535 ****
  586. --- 532,543 ----
  587.       VOID Push (OpStack, False);
  588.       
  589.       return TRUE;
  590. +  }
  591. + /* PNoAccess by jgm */
  592. + static int PNoAccess (item) Object item;
  593. +  {
  594. +      return Push (OpStack, NoAccess (item));
  595.    }
  596.   
  597.   static int PExecOnly (item) Object item;
  598. diff -cr orig/source/viewer.c ./source/viewer.c
  599. *** orig/source/viewer.c    Sun Jan  3 14:21:58 1988
  600. --- ./source/viewer.c    Thu Dec 10 23:12:55 1987
  601. ***************
  602. *** 310,318 ****
  603.        return res;
  604.    }
  605.   
  606. ! PanicIf (flag, s) int flag; char *s;
  607.    {
  608. -      if (flag)
  609.            fprintf (stderr, "Viewer panic: %s\n", s),
  610.            exit (1);
  611.    }
  612. --- 310,318 ----
  613.        return res;
  614.    }
  615.   
  616. ! /* Removed conditional & changed PanicIf to Panic --jgm */
  617. ! Panic (s) char *s;
  618.    {
  619.            fprintf (stderr, "Viewer panic: %s\n", s),
  620.            exit (1);
  621.    }
  622. *** /dev/null    Mon Jul 25 01:14:13 1988
  623. --- postscript/demos/buildcachefont.ps    Thu Jul 28 12:25:02 1988
  624. ***************
  625. *** 0 ****
  626. --- 1,19 -----
  627. + %!
  628. + %% Build the font cache
  629. + %% By John G. Myers
  630. + % fontname pointsize cachefont --
  631. + /cachefont {
  632. +     exch findfont exch scalefont setfont
  633. +     5 5 moveto
  634. +     ( !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ) show
  635. +     ([\\]^_`abcdefghijklmnopqrstuvwxyz{|}~) show
  636. +     (\251\252\256\257\261\267\272\320) show
  637. +     savecurrentfont
  638. +     erasepage
  639. + } def
  640. + [  /Times-Roman /Helvetica /Times-Bold /Times-Italic /Helvetica-Oblique ]
  641. + { dup 10 cachefont dup 12 cachefont 14 cachefont }
  642. + forall
  643.