home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / lang / postscri / 6478 < prev    next >
Encoding:
Text File  |  1993-01-28  |  3.6 KB  |  145 lines

  1. Path: sparky!uunet!mcsun!uknet!turing!coulin!arthur
  2. From: arthur@turing.ac.uk (Arthur van Hoff)
  3. Newsgroups: comp.lang.postscript
  4. Subject: PDB 2.1.1 -- ANSI-C to PostScript compiler
  5. Message-ID: <ARTHUR.93Jan26184437@lurch.turing.ac.uk>
  6. Date: 26 Jan 93 18:50:49 GMT
  7. Sender: usenet@turing.ac.uk (Usenet for nntp)
  8. Organization: The Turing Institute Ltd., Glasgow, Scotland
  9. Lines: 134
  10.  
  11.  
  12. Hi PostScript Hackers,
  13.  
  14. PdB version 2.1.1 (ANSI-C to PostScript compiler) is now available
  15. via anonymous ftp from the following sites:
  16.     src.doc.ic.ac.uk (146.169.2.1)    in computing/vendor/turing.com
  17.     ftp.uu.net (192.48.96.9)    in graphics/NeWS
  18.     turing.com (192.133.90.28)     in pub (very slow link)
  19.  
  20. The following files:
  21.     pdb2.1.1-README        -- this message
  22.     pdb2.1.1-sun4.tar.Z    -- SPARC binaries and NeWS headers
  23.     pdb2.1.1-rs6000.tar.Z    -- RS6000 binaries
  24.  
  25. There is no more need to write PostScript! Start using PdB right now!
  26. PdB is an optimizing compiler to compile ANSI-C (like) code into Adobe
  27. compatible PostScript. It includes executables, examples and many 
  28. useful header files.
  29.  
  30. New features since version 2.1 are:
  31. - GhostScript compatible
  32. - NeWS support is now optional
  33.  
  34. The release of version 2.1.1 includes:
  35. - Binaries for Sun SPARC station and IBM RS6000
  36. - Produces PostScript level I
  37. - Include files for Abobe PostScript level I
  38. - Plenty of examples
  39. - Compiler test suite
  40. - Reference manual (PostScript)
  41. - UNIX manual pages (nroff)
  42.  
  43. NeWS support in version 2.1.1 for SPARC stations:
  44. - Include files for NeWS upto version 3.1
  45. - Include files for TNT upto version 3.1
  46. - Support NeWS classing in a C++ manner
  47. - Support for CPS OpenWindows upto version 3.1
  48. - NeWS/OpenWindows test suite
  49.  
  50. Below are some examples of PdB code together with the
  51. PostScript produced by the compiler.
  52.  
  53. Have fun,
  54.  
  55.     Arthur van Hoff
  56.     pdb@turing.com
  57.  
  58. ################################
  59. Code to draw a star shape in PdB
  60. ################################
  61.  
  62. #include <graphics.h>
  63.  
  64. void starpath(int ang)
  65. {
  66.         int i;
  67.  
  68.         newpath();
  69.         moveto(100,100);
  70.         for (i = 1 ; i <= (int)(360 / ang) ; i++) {
  71.                 rotate(180 + ang);
  72.                 rlineto(100,0);
  73.         }
  74.         setgray(0);
  75.         stroke();
  76. }
  77.  
  78. ########################
  79. Verbatim Compiler output
  80. ########################
  81.  
  82. /starpath {
  83.   % int --
  84.   newpath 100 100 moveto 1 360 2 index div cvi exch sub 1 add 0 max {
  85.     dup 180 add rotate 100 0 rlineto
  86.   } repeat
  87.   pop 0 setgray stroke
  88. } def
  89.  
  90. ###########################
  91. Code for bubble-sort in PdB
  92. ###########################
  93.  
  94. #include <postscript.h>
  95.  
  96. /******************************************************
  97.  * Bubble sort (page 66)
  98.  * From: Algorithms + Data Structures = Programs
  99.  *       Nicklaus Wirth
  100.  */
  101.  
  102. void bubblesort(int *a)
  103. {
  104.         int i, j;
  105.  
  106.         for (i = length(a)-1 ; i > 1 ; i--)
  107.                 for (j = 0 ; j < i ; j++)
  108.                         if (a[j] > a[j+1]) {
  109.                                 int x = a[j+1];
  110.                                 a[j+1] = a[j];
  111.                                 a[j] = x;
  112.                         }
  113. }
  114.  
  115. ########################
  116. Verbatim Compiler output
  117. ########################
  118.  
  119. /bubblesort {
  120.   % int * --
  121.   dup length 1 sub -1 2 {
  122.     0 1 3 -1 roll 1 sub {
  123.       2 copy get 2 index 2 index 1 add get gt {
  124.         2 copy 1 add get 2 index 2 index 1 add 4 index 4 index get put
  125.         2 index 3 1 roll put
  126.       } {pop} ifelse
  127.     } for
  128.   } for
  129.   pop
  130. } def
  131.  
  132. --
  133.  
  134.     Arthur van Hoff 
  135.     The Turing Institute Limited
  136.     36 North Hanover Street, 
  137.     G1 2AD Glasgow, Scotland
  138.  
  139.     Tel: +44 41 552 8858 or +44 41 552 6400
  140.     Fax: +44 41 552 2985
  141.     Email: arthur@turing.com
  142.  
  143.     The opinions expressed in this message are not 
  144.     necessarily those of The Turing Institute Limited.
  145.