home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 22 gnu / 22-gnu.zip / gnuplapi.zip / gnuplot-api-os2 / build / gp3708e-pm3d.diff < prev    next >
Encoding:
Text File  |  1999-07-21  |  64.9 KB  |  1,748 lines

  1. diff -uwr gnuplot-3.7.0.8/config/makefile.os2 gnuplot-pm3d/config/makefile.os2
  2. --- gnuplot-3.7.0.8/config/makefile.os2    Tue Jun 15 15:32:16 1999
  3. +++ gnuplot-pm3d/config/makefile.os2    Tue Jun 15 15:31:10 1999
  4. @@ -45,6 +45,11 @@
  5.  # MOUSE support for PM terminal
  6.  MOUSE=1
  7.  
  8. +# PM3D splot mode + colours and filled polygons
  9. +# (not yet supported in official release)
  10. +# if all around PM3D runs well, this option will be omitted from makefiles
  11. +PM3D=1
  12. +
  13.  #
  14.  # ****************** End of Configuration section ****************************
  15.  #
  16. @@ -183,6 +188,11 @@
  17.  # MOUSE support for PM terminal
  18.  ifdef MOUSE
  19.  TERMFLAGS += -DUSE_MOUSE
  20. +endif
  21. +# PM3D support
  22. +ifdef PM3D
  23. +CFLAGS += -DPM3D
  24. +CFLAGS2 += -DPM3D
  25.  endif
  26.  
  27.  #
  28. diff -uwr gnuplot-3.7.0.8/docs/gnuplot.doc gnuplot-pm3d/docs/gnuplot.doc
  29. --- gnuplot-3.7.0.8/docs/gnuplot.doc    Sun May 30 18:12:54 1999
  30. +++ gnuplot-pm3d/docs/gnuplot.doc    Tue Jun 15 14:39:18 1999
  31. @@ -4990,6 +4990,216 @@
  32.   and `set vrange`, or by specifying the range on the `plot` or `splot`
  33.   commands.  Currently the default range for these parametric variables is
  34.   [-5:5].  Setting the ranges to something more meaningful is expected.
  35. +3 pm3d
  36. +?commands set pm3d
  37. +?commands show pm3d
  38. +?set pm3d
  39. +?show pm3d
  40. +?pm3d
  41. + pm3d is a [new] type of `splot` mode for drawing colour/gray maps and
  42. + surfaces.  It can be used for plotting gridded as well as non-gridded data.
  43. + The main power of the pm3d algorithm (see also my program pm3d) is that
  44. + it can draw maps or surfaces from large data sets without preprocessing even 
  45. + when the data are non-gridded and the scans do not have same number of 
  46. + points---thus it produces no artefacts. 
  47. +
  48. + The pm3d algorithm fills the region between two neighbouring points in one scan 
  49. + with another two points in the next scan by a gray (or colour) according to the
  50. + average of the z data in these four points.  From this follows, that the
  51. + neighbouring scans should not cross and the number of points in the
  52. + neighbouring scans should not differ too much (you see---scans can have 
  53. + different number of points).  No other requirements (e.g.  the data must be
  54. + gridded) are needed.  Another advantage is that the algorithm does not draw 
  55. + anything outside of the input (measured or calculated) region.
  56. +
  57. + The gray is obtained by mapping the averaged z coordinate of the four corners
  58. + of the quadrangle into the range [min_z,max_z] providing range of grays [0:1].
  59. + This value can be used directly as the gray for gray maps. The gray value can 
  60. + be mapped into a colour. See `set palette` for the complete description. 
  61. +
  62. + The pm3d mode requires a terminal supporting filled coloured polygons and
  63. + palettes of smooth colours. See `help set palette` for the list of currently 
  64. + available terminals.
  65. +
  66. + Notes: 
  67. +    1. What I call scan, it is called iso_curve in gnuplot sources. I am 
  68. +       physicist and we measure maps taking one scan after another scan, 
  69. +       that's why 
  70. +    2. Map is obtained by `set view 180,0,1.25; set yrange [*:*] reverse`. 
  71. +       This can be easily switched on by using `set pm3d map`.
  72. +    3. If you find this help unclear, then your assistance is welcome.
  73. +       Similarly, any feedback for the code is welcome as well as the
  74. +       required terminal entries for other terminals, like X11
  75. +
  76. + pm3d mode has been developed by Petr Mikulik.  It is currently in a
  77. + development stage and distributed as a patch to the current gnuplot beta
  78. + sources.  Please read the READMEs enclosed with the pm3d patch distribution.
  79. + You may find the current version of the patch and snapshots at my web page:
  80. +         http://www.sci.muni.cz/~mikulik/gnuplot.html#pm3d
  81. +
  82. + Syntax:
  83. +       set pm3d
  84. +       set pm3d {
  85. +                  { at <bst combination> }
  86. +                  { scansforward | scansbackward }
  87. +                  { flush { begin | center | end } }
  88. +                  { clip1in | clip4in }
  89. +                  { zrange [{<z_from>|*}:{<z_to>|*}] }
  90. +                  { map }
  91. +                }
  92. +       set nopm3d
  93. +       show pm3d
  94. +
  95. + `set pm3d` (i.e. without options) sets up the default values.
  96. + Otherwise, the options can be given in any order.
  97. +
  98. + pm3d can be drawn at the base or top (colour/gray map) or as surface 
  99. + (colour/gray surface).  This is defined by the `at` option with a 
  100. + a string of up to 6 combinations of `b`, `t` and `s`.  For instance, `at b`
  101. + plots at bottom only, `at st` plots firstly surface, then top, `at bstbst`...
  102. +
  103. + Coloured quadrangles are plotted one after another.  When plotting surfaces
  104. + (`at s`), the later overlaps the previous ones.  You may try to switch
  105. + between `scansforward` and `scansbackward` to change whether the first scan
  106. + of the data is plotted first or last.
  107. +
  108. + If two subsequent scans do not have the same number of points, then it 
  109. + has to be decided whether to start taking points for quadrangles from the 
  110. + beginning of both scans (`flush begin`), from their ends (`flush end`) or to 
  111. + center them (`flush center`).
  112. +
  113. + Clipping with respect to the x,y coordinates can be done in two ways. 
  114. + `clip1in`:  all 4 points of the quadrangle must be defined and at least
  115. + 1 point of the quadrangle must be in the x and y ranges. `clip4in`: all 4
  116. + points of the quadrangle must be in the x and y ranges.
  117. +
  118. + The above clipping is OK for plotting maps.  For surfaces, clipping with
  119. + respect to the z coordinate will be necessary.  Maybe in future...  (maybe
  120. + something like "clipz1in" and "clipz4in").  Really needed?
  121. +
  122. + By default, the z range for colouring is the same as that from `set zrange`.
  123. + That's OK for maps; for surfaces, however, using separate z ranges for plotting
  124. + and colouring can be of advantage.  Then use `set pm3d zrange`.
  125. +
  126. + The `set pm3d map` is actually a macro which facilitates plotting maps.  It is
  127. + equivalent to these user commands:
  128. +    set pm3d at b; set nosurface; set nocontour
  129. +    set view 180,0,1.3
  130. +    set yrange [*:*] reverse
  131. +    ... and something on size, origin (no! gnuplot bug!)
  132. + Notice that *now* y label goes away from screen since it is not rotated as 
  133. + I would expect. Adjust it with sth like `set ylabel "hogo fogo" 12`. Or 
  134. + implement a 2D LAYOUT FOR 3D MAPS, please!!!
  135. +
  136. + The colouring setup as well as the colour box drawing are determinated by `set
  137. + palette`. Maybe in future there could be a possibility of using more palettes, 
  138. + which will add new option `set pm3d palette <n>`.
  139. +
  140. +3 palette
  141. +?commands set palette
  142. +?commands show palette
  143. +?set palette
  144. +?show palette
  145. +?palette
  146. + Palette is a colour storage for use by `pm3d`, filled colour contours or 
  147. + polygons, colour histograms, colour gradient background, and whatever it is or
  148. + it will be implemented...  Here it stays for a palette of smooth "continuous"
  149. + colours or grays, but let's call it just a palette.
  150. +
  151. + Colour palettes, or requires terminal entries for filled colour 
  152. + polygons and palettes of smooth colours, are currently available for
  153. +       `***  fig, gif, pm and postscript  ***`
  154. + terminals. You are welcome to implement other terminals, mainly X11 and png!
  155. +
  156. +
  157. + Syntax:
  158. +       set palette
  159. +       set palette {
  160. +                  { gray | color }
  161. +                  { rgbformulae <r>,<g>,<b> }
  162. +                  { positive | negative }
  163. +                  { nops_allcF | ps_allcF }
  164. +                  { maxcolors <maxcolors> }
  165. +                  { nocb | cbdefault | cbuser }
  166. +                  { cbvertical | set cbhorizontal }
  167. +                  { cbat <user position --- not implemented> }
  168. +                  { cbsize <user size --- not implemented> }
  169. +                }
  170. +       show palette
  171. +       show palette palette <n>
  172. +
  173. + `set palette` (i.e. without options) sets up the default values.
  174. + Otherwise, the options can be given in any order. `show palette` shows the 
  175. + current palette properties. `show palette palette <n>` shows RGB triplets for 
  176. + the current settings and a palette having <n> discrete colours.
  177. +
  178. + The following options determine the colouring properties.
  179. +
  180. + Figure using this palette can be `gray` or `color`.  For instance, in `pm3d`
  181. + the gray is obtained by mapping the averaged z coordinate of the 4 corners of
  182. + the quadrangle into the range [min_z,max_z] providing range of grays [0:1].
  183. + This value can be used directly as the gray for gray maps.  The colour map
  184. + requires a transformation gray->(R,G,B), i.e.  a mapping
  185. + [0:1]->([0:1],[0:1],[0:1]).  Therefore three suitable mapping functions have to 
  186. + be chosen.  This is done via `rgbformulae <r>,<g>,<b>`.  The available mapping
  187. + functions are listed by `show palette`.  Default is `7,5,15`, some other
  188. + examples are `3,11,6`, `21,23,3` or `3,23,21`.  Negative numbers, like
  189. + `3,-11,-6`, mean inverted color (i.e.  1-gray passed into the formula, see also
  190. + `positive` and `negative` options below).
  191. +
  192. + Some nice schemes:
  193. +    7,5,15   ... traditional pm3d (black-blue-red-yellow)
  194. +    3,11,6   ... green-red-violet
  195. +    23,28,3  ... ocean (green-blue-white); try also all other permutations
  196. +    21,22,23 ... hot (black-red-yellow-white)
  197. +    30,31,32 ... color printable on gray (black-blue-violet-yellow-white)
  198. +
  199. + Use `positive` and `negative` to invert the figure colours.
  200. +
  201. + In order to reduce the size of postscript files, the gray value is written
  202. + there and not all three calculated r,g,b values.  Therefore the analytical
  203. + formulae are coded in postscript in a header before the pm3d draw therein
  204. + (see /g and /cF definitions).  Usually, it makes sense to write down 
  205. + definitions of only those 3 formulae chosen.  But in the case of multiplot or
  206. + some other reasons you may want to manually edit the transformations directly
  207. + in the postscript file.  Then you may enjoy the option `ps_allcF` which
  208. + writes down definitions of all formulae.  It was like that I have got the
  209. + Rosenbrock multiplot figure on my gnuplot.html#pm3d demo page.  The default 
  210. + is `nops_allcF`.
  211. +   If a postscript file has been produced for grided (or mostly regular) data,
  212. + then it is possible to reduce the size of that postscript file up to at about
  213. + 50% by the enclosed awk script `pm3dCompress.awk`.  This you may find
  214. + interesting if you intend to keep the file for including it into your
  215. + publication or before downloading a very large file into a slow printer. Usage:
  216. + `awk -f pm3dCompress.awk thefile.ps >smallerfile.ps`.
  217. +
  218. + Other (non-postscript) terminals have discrete number of colours.  All entries
  219. + of the palette remaining after linetype colours declaration are allocated by
  220. + default.  Then multiplot will fail since no more colour positions are available
  221. + (aha, that's also because sharing same palette is not implemented!  todo?!).
  222. + Then use `set palette maxcolors <maxcolors>` with a reasonably small value.
  223. + Default is 0 for allocating all remaining entries.
  224. +  
  225. + PROPOSAL for future: list of palettes, like it is currently for labels, arrows 
  226. + etc. Proposed usage: `set pm3d palette <n>`, `set contour ... filled palette 
  227. + <n>`, etc.
  228. +
  229. +
  230. + *** Color box properties ***
  231. +
  232. + The colour scheme, i.e. the gradient of the smooth colour with min_z and max_z
  233. + values of pm3d, is drawn in a colour box unless `nocb`.  Its position can be
  234. + `cbdefault` or `cbuser`.  The latter is not implemented, see `cbat` and
  235. + `cbsize`.
  236. +
  237. + `cbvertical` and `cbhorizontal` switches the orientation of the colour
  238. + gradient.
  239. +
  240. + `cbat <position>` and `cbsize <size>` are planned for positioning and sizing 
  241. + of the colour box. Their parameters should be `coordvals` similarly to `set 
  242. + label at` or `set arrow from to`. This feature waits for someone to implement
  243. + it...
  244. +  
  245.  3 pointsize
  246.  ?commands set pointsize
  247.  ?commands show pointsize
  248. diff -uwr gnuplot-3.7.0.8/src/gnuplot.opt gnuplot-pm3d/src/gnuplot.opt
  249. --- gnuplot-3.7.0.8/src/gnuplot.opt    Sun May 30 18:10:48 1999
  250. +++ gnuplot-pm3d/src/gnuplot.opt    Mon Jun 14 09:30:38 1999
  251. @@ -1,6 +1,7 @@
  252.  alloc
  253.  binary
  254.  bitmap
  255. +color
  256.  command
  257.  contour
  258.  datafile
  259. @@ -18,6 +19,7 @@
  260.  plot
  261.  plot2d
  262.  plot3d
  263. +pm3d
  264.  scanner
  265.  set
  266.  show
  267. diff -uwr gnuplot-3.7.0.8/src/graph3d.c gnuplot-pm3d/src/graph3d.c
  268. --- gnuplot-3.7.0.8/src/graph3d.c    Fri Jun 11 19:53:14 1999
  269. +++ gnuplot-pm3d/src/graph3d.c    Wed Jul 21 17:24:08 1999
  270. @@ -52,6 +52,9 @@
  271.  
  272.  #include "plot.h"
  273.  #include "setshow.h"
  274. +#ifdef PM3D
  275. +#include "pm3d.h"
  276. +#endif
  277.  
  278.  static int p_height;
  279.  static int p_width;        /* pointsize * t->h_tic */
  280. @@ -116,7 +119,6 @@
  281.  static void key_sample_point __PROTO((int xl, int yl, int pointtype));
  282.  static void key_text __PROTO((int xl, int yl, char *text));
  283.  
  284. -
  285.  #if defined(sun386) || defined(AMIGA_SC_6_1)
  286.  static double CheckLog __PROTO((TBOOLEAN is_log, double base_log, double x));
  287.  #endif
  288. @@ -582,6 +584,49 @@
  289.  
  290.      term_apply_lp_properties(&border_lp);    /* border linetype */
  291.  
  292. +#ifdef PM3D
  293. +    /* DRAW PM3D COLOUR MAPS */
  294. +    if (pm3d.where[0] &&      /* is pm3d plot requested? */
  295. +        set_pm3d_zminmax() && /* set and test z-range */
  296. +        !make_palette()      /* (can) make palette of smooth colours */
  297. +        ) {
  298. +      int i = 0;
  299. +      extern FILE *gpoutfile;
  300. +      if (!strcmp(term->name,"postscript") || !strcmp(term->name,"pstex"))
  301. +        fprintf(gpoutfile,"%%pm3d_map_begin\n"); /* for pm3dCompress.awk */
  302. +      for ( ; pm3d.where[i]; i++ ) {
  303. +        this_plot = plots;
  304. +        for (surface = 0;
  305. +         surface < pcount;
  306. +         this_plot = this_plot->next_sp, surface++)
  307. +           pm3d_plot(this_plot,pm3d.where[i]);
  308. +         }
  309. +
  310. +     if (strchr(pm3d.where,'C') != NULL)
  311. +            /* !!!!! CONTOURS, UNDOCUMENTED
  312. +            !!!!! LATER CHANGE TO STH LIKE (if_filled_contours_requested)
  313. +            !!!!! ... */
  314. +     for (this_plot = plots; this_plot; this_plot = this_plot->next_sp) {
  315. +        if (draw_contour & CONTOUR_SRF)
  316. +          filled_color_contour_plot ( this_plot, CONTOUR_SRF );
  317. +        if (draw_contour & CONTOUR_BASE)
  318. +          filled_color_contour_plot ( this_plot, CONTOUR_BASE );
  319. +        }
  320. +
  321. +      if (!strcmp(term->name,"postscript") || !strcmp(term->name,"pstex"))
  322. +        fprintf(gpoutfile,"%%pm3d_map_end\n"); /* for pm3dCompress.awk */
  323. +
  324. +      /* draw colour box */
  325. +      draw_color_smooth_box();
  326. +
  327. +      /* release the palette we have made use of (some terminals may need this)
  328. +         ...no, remove this, also remove it from plot.h !!!!
  329. +      */
  330. +      if (term->previous_palette)
  331. +        term->previous_palette();
  332. +      }
  333. +#endif
  334. +
  335.      /* PLACE TITLE */
  336.      if (*title.text != 0) {
  337.      safe_strncpy(ss, title.text, sizeof(ss));
  338. @@ -736,6 +781,7 @@
  339.      (*t->move) (xl - key_size_left, yt - (ktitle_lines) * t->v_char);
  340.      (*t->vector) (xl + key_size_right, yt - (ktitle_lines) * t->v_char);
  341.      }
  342. +
  343.      /* DRAW SURFACES AND CONTOURS */
  344.  
  345.  #ifndef LITE
  346. @@ -1057,7 +1103,6 @@
  347.      hidden_active = FALSE;
  348.      }
  349.  #endif /* not LITE */
  350. -
  351.  }
  352.  
  353.  /* plot3d_impulses:
  354. @@ -1542,7 +1587,12 @@
  355.      if (draw_border & 8)
  356.          draw_clip_line(br_x, br_y, bb_x, bb_y);
  357.  
  358. +#ifndef PM3D
  359.      if (draw_surface || (draw_contour & CONTOUR_SRF)) {
  360. +#else
  361. +    if (draw_surface || (draw_contour & CONTOUR_SRF) ||
  362. +        strpbrk(pm3d.where,"st") != NULL) {
  363. +#endif
  364.          int save = hidden_active;
  365.          /* map the 8 corners to screen */
  366.          unsigned int fl_x, fl_y;    /* floor left */
  367. @@ -1722,7 +1772,12 @@
  368.      }
  369.      /* do z tics */
  370.  
  371. +#ifndef PM3D
  372.      if (ztics && (draw_surface || (draw_contour & CONTOUR_SRF))) {
  373. +#else
  374. +    if (ztics && (draw_surface || (draw_contour & CONTOUR_SRF) ||
  375. +          strchr(pm3d.where,'s') != NULL)) {
  376. +#endif
  377.      gen_tics(FIRST_Z_AXIS, &zticdef, work_grid.l_type & (GRID_Z | GRID_MZ),
  378.           mztics, mztfreq, ztick_callback);
  379.      }
  380. @@ -1741,7 +1796,12 @@
  381.      draw_clip_line(x, y, x1, y1);
  382.      }
  383.      /* PLACE ZLABEL - along the middle grid Z axis - eh ? */
  384. +#ifndef PM3D
  385.      if (*zlabel.text && (draw_surface || (draw_contour & CONTOUR_SRF))) {
  386. +#else
  387. +    if (*zlabel.text && (draw_surface || (draw_contour & CONTOUR_SRF) ||
  388. +             strpbrk(pm3d.where,"st") != NULL)) {
  389. +#endif
  390.      map3d_xy(zaxis_x, zaxis_y, z_max3d + (z_max3d - base_z) / 4, &x, &y);
  391.  
  392.      x += zlabel.xoffset * t->h_char;
  393. diff -uwr gnuplot-3.7.0.8/src/graphics.c gnuplot-pm3d/src/graphics.c
  394. --- gnuplot-3.7.0.8/src/graphics.c    Fri Jun 11 19:53:14 1999
  395. +++ gnuplot-pm3d/src/graphics.c    Mon Jun 14 09:43:30 1999
  396. @@ -151,8 +151,6 @@
  397.                    unsigned int *y, char *what));
  398.  static void mant_exp __PROTO((double log_base, double x, int scientific,
  399.                    double *m, int *p));
  400. -static void gprintf __PROTO((char *dest, size_t count, char *format,
  401. -                 double log_base, double x));
  402.  
  403.  #if defined(sun386) || defined(AMIGA_SC_6_1)
  404.  static double CheckLog __PROTO((TBOOLEAN is_log, double base_log, double x));
  405. @@ -4067,7 +4065,7 @@
  406.  
  407.  /*{{{  gprintf */
  408.  /* extended snprintf */
  409. -static void
  410. +void
  411.  gprintf(dest, count, format, log_base, x)
  412.  char *dest, *format;
  413.  size_t count;
  414. diff -uwr gnuplot-3.7.0.8/src/makefile.all gnuplot-pm3d/src/makefile.all
  415. --- gnuplot-3.7.0.8/src/makefile.all    Thu May 27 21:55:24 1999
  416. +++ gnuplot-pm3d/src/makefile.all    Mon Jun 14 09:30:38 1999
  417. @@ -1,10 +1,10 @@
  418.  # makefile.all generated automatically by GNU make
  419.  
  420.  # List of core object files except version.$(O)
  421. -COREOBJS = alloc.$(O) binary.$(O) bitmap.$(O) command.$(O) contour.$(O) \
  422. +COREOBJS = alloc.$(O) binary.$(O) bitmap.$(O) color.$(O) command.$(O) contour.$(O) \
  423.  datafile.$(O) eval.$(O) fit.$(O) graph3d.$(O) graphics.$(O) help.$(O) \
  424.  hidden3d.$(O) internal.$(O) interpol.$(O) matrix.$(O) misc.$(O) parse.$(O) \
  425. -plot.$(O) plot2d.$(O) plot3d.$(O) readline.$(O) scanner.$(O) set.$(O) \
  426. +plot.$(O) plot2d.$(O) plot3d.$(O) pm3d.$(O) readline.$(O) scanner.$(O) set.$(O) \
  427.  show.$(O) specfun.$(O) standard.$(O) stdfn.$(O) term.$(O) time.$(O) \
  428.  util.$(O) util3d.$(O) variable.$(O)
  429.  
  430. diff -uwr gnuplot-3.7.0.8/src/Makefile.in gnuplot-pm3d/src/Makefile.in
  431. --- gnuplot-3.7.0.8/src/Makefile.in    Sat Jun 12 17:45:58 1999
  432. +++ gnuplot-pm3d/src/Makefile.in    Mon Jun 14 09:30:38 1999
  433. @@ -95,7 +95,7 @@
  434.  XLIBS = @LIBRARIES_FOR_X@
  435.  AM_CPPFLAGS = -I../term -I$(top_srcdir)/term -DBINDIR=\"$(bindir)\" -DCONTACT=\"$(EMAIL)\" -DHELPFILE=\"$(HELPFILE)\"
  436.  
  437. -gnuplot_SOURCES = alloc.c alloc.h ansichek.h binary.c binary.h bitmap.c bitmap.h command.c command.h contour.c datafile.c eval.c fit.c fit.h graph3d.c graphics.c graphics.h help.c help.h hidden3d.c internal.c interpol.c matrix.c matrix.h misc.c national.h parse.c plot.c plot.h plot2d.c plot3d.c protos.h readline.c scanner.c set.c setshow.h show.c specfun.c standard.c stdfn.c stdfn.h syscfg.h term.c term.h time.c util.c util3d.c variable.c variable.h version.c
  438. +gnuplot_SOURCES = alloc.c alloc.h ansichek.h binary.c binary.h bitmap.c bitmap.h color.c command.c command.h contour.c datafile.c eval.c fit.c fit.h graph3d.c graphics.c graphics.h help.c help.h hidden3d.c internal.c interpol.c matrix.c matrix.h misc.c national.h parse.c plot.c plot.h plot2d.c plot3d.c pm3d.c protos.h readline.c scanner.c set.c setshow.h show.c specfun.c standard.c stdfn.c stdfn.h syscfg.h term.c term.h time.c util.c util3d.c variable.c variable.h version.c
  439.  
  440.  
  441.  EXTRA_gnuplot_SOURCES = @NEXTOBJS@
  442. @@ -120,7 +120,7 @@
  443.  O = o
  444.  T = $(top_srcdir)/term/
  445.  
  446. -COREOBJS = alloc.$(O) binary.$(O) bitmap.$(O) command.$(O) contour.$(O) datafile.$(O) eval.$(O) fit.$(O) graph3d.$(O) graphics.$(O) help.$(O) hidden3d.$(O) internal.$(O) interpol.$(O) matrix.$(O) misc.$(O) parse.$(O) plot.$(O) plot2d.$(O) plot3d.$(O) readline.$(O) scanner.$(O) set.$(O) show.$(O) specfun.$(O) standard.$(O) stdfn.$(O) term.$(O) time.$(O) util.$(O) util3d.$(O) variable.$(O)
  447. +COREOBJS = alloc.$(O) binary.$(O) bitmap.$(O) color.$(O) command.$(O) contour.$(O) datafile.$(O) eval.$(O) fit.$(O) graph3d.$(O) graphics.$(O) help.$(O) hidden3d.$(O) internal.$(O) interpol.$(O) matrix.$(O) misc.$(O) parse.$(O) plot.$(O) plot2d.$(O) plot3d.$(O) pm3d.$(O) readline.$(O) scanner.$(O) set.$(O) show.$(O) specfun.$(O) standard.$(O) stdfn.$(O) term.$(O) time.$(O) util.$(O) util3d.$(O) variable.$(O)
  448.  
  449.  
  450.  # List of terminal driver sources
  451. @@ -132,7 +132,7 @@
  452.  PROGRAMS =  $(bin_PROGRAMS)
  453.  
  454.  
  455. -DEFS = @DEFS@ -I. -I$(srcdir) -I..
  456. +DEFS = @DEFS@ -I. -I$(srcdir) -I.. -DPM3D=1
  457.  CPPFLAGS = @CPPFLAGS@
  458.  LDFLAGS = @LDFLAGS@
  459.  LIBS = @LIBS@
  460. @@ -144,10 +144,10 @@
  461.  gnuplot_x11_OBJECTS =  gplt_x11$U.o stdfn$U.o
  462.  gnuplot_x11_DEPENDENCIES = 
  463.  gnuplot_x11_LDFLAGS = 
  464. -gnuplot_OBJECTS =  alloc$U.o binary$U.o bitmap$U.o command$U.o \
  465. +gnuplot_OBJECTS =  alloc$U.o binary$U.o bitmap$U.o color$U.o command$U.o \
  466.  contour$U.o datafile$U.o eval$U.o fit$U.o graph3d$U.o graphics$U.o \
  467.  help$U.o hidden3d$U.o internal$U.o interpol$U.o matrix$U.o misc$U.o \
  468. -parse$U.o plot$U.o plot2d$U.o plot3d$U.o readline$U.o scanner$U.o \
  469. +parse$U.o plot$U.o plot2d$U.o plot3d$U.o pm3d$U.o readline$U.o scanner$U.o \
  470.  set$U.o show$U.o specfun$U.o standard$U.o stdfn$U.o term$U.o time$U.o \
  471.  util$U.o util3d$U.o variable$U.o version$U.o
  472.  gnuplot_DEPENDENCIES = 
  473. @@ -267,6 +267,8 @@
  474.      $(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/binary.c; then echo $(srcdir)/binary.c; else echo binary.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > binary_.c
  475.  bitmap_.c: bitmap.c $(ANSI2KNR)
  476.      $(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/bitmap.c; then echo $(srcdir)/bitmap.c; else echo bitmap.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > bitmap_.c
  477. +color_.c: color.c $(ANSI2KNR)
  478. +    $(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/color.c; then echo $(srcdir)/color.c; else echo color.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > color_.c
  479.  command_.c: command.c $(ANSI2KNR)
  480.      $(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/command.c; then echo $(srcdir)/command.c; else echo command.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > command_.c
  481.  contour_.c: contour.c $(ANSI2KNR)
  482. @@ -303,6 +305,8 @@
  483.      $(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/plot2d.c; then echo $(srcdir)/plot2d.c; else echo plot2d.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > plot2d_.c
  484.  plot3d_.c: plot3d.c $(ANSI2KNR)
  485.      $(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/plot3d.c; then echo $(srcdir)/plot3d.c; else echo plot3d.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > plot3d_.c
  486. +pm3d_.c: pm3d.c $(ANSI2KNR)
  487. +    $(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/pm3d.c; then echo $(srcdir)/pm3d.c; else echo pm3d.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > pm3d_.c
  488.  readline_.c: readline.c $(ANSI2KNR)
  489.      $(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/readline.c; then echo $(srcdir)/readline.c; else echo readline.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > readline_.c
  490.  scanner_.c: scanner.c $(ANSI2KNR)
  491. @@ -329,10 +333,10 @@
  492.      $(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/variable.c; then echo $(srcdir)/variable.c; else echo variable.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > variable_.c
  493.  version_.c: version.c $(ANSI2KNR)
  494.      $(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/version.c; then echo $(srcdir)/version.c; else echo version.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > version_.c
  495. -alloc_.o bf_test_.o binary_.o bitmap_.o command_.o contour_.o \
  496. +alloc_.o bf_test_.o binary_.o bitmap_.o color_o.c command_.o contour_.o \
  497.  datafile_.o eval_.o fit_.o gplt_x11_.o graph3d_.o graphics_.o help_.o \
  498.  hidden3d_.o internal_.o interpol_.o matrix_.o misc_.o parse_.o plot_.o \
  499. -plot2d_.o plot3d_.o readline_.o scanner_.o set_.o show_.o specfun_.o \
  500. +plot2d_.o plot3d_.o pm3d_.o readline_.o scanner_.o set_.o show_.o specfun_.o \
  501.  standard_.o stdfn_.o term_.o time_.o util_.o util3d_.o variable_.o \
  502.  version_.o : $(ANSI2KNR)
  503.  
  504. diff -uwr gnuplot-3.7.0.8/src/os2/gclient.c gnuplot-pm3d/src/os2/gclient.c
  505. --- gnuplot-3.7.0.8/src/os2/gclient.c    Tue Jun 15 15:32:14 1999
  506. +++ gnuplot-pm3d/src/os2/gclient.c    Mon Jun 14 09:30:38 1999
  507. @@ -1660,7 +1660,11 @@
  508.      HPS hps ;    
  509.      HAB hab ;
  510.      int linewidth = DEFLW ;
  511. -
  512. +#ifdef PM3D
  513. +    HPAL pm3d_hpal = 0;     // palette used for make_palette()
  514. +    HPAL pm3d_hpal_old = 0; // default palette used before make_palette()
  515. +    LONG pm3d_color = 0; // current colour
  516. +#endif
  517.      hab = WinInitialize( 0 ) ;
  518.      DosEnterCritSec() ;
  519.      pszPipeName = malloc( 256 ) ;
  520. @@ -2076,6 +2080,88 @@
  521.              //PM notification of being connected to a mouse-enabled terminal
  522.              mouseTerminal = 1;
  523.              break ;
  524. +
  525. +#ifdef PM3D
  526. +           case 'p': { // GR_MAKE_PALETTE
  527. +/* Implementation problems (I haven't understood that from .INF doc):
  528. +what is the difference between GpiCreateLogColorTable and
  529. +GpiCreatePalette?
  530. +
  531. +Bugs: and why
  532. +*/
  533. +            char c;
  534. +            int i;
  535. +            const int nColors = 16;
  536. +            LONG lRetCount;
  537. +              /* must be equal to that from InitScreenPS() and
  538. +             must be synchronized with:
  539. +               * the value in pm.trm: PM_make_palette (otherwise
  540. +                 this values would have to be piped there, but
  541. +                 nowadays exactly 16 is used
  542. +               * with the offset SetColor in GR_FILLED_POLYGON
  543. +              */
  544. +            ULONG rgbTable[256];
  545. +            /* read switch */
  546. +            BufRead(hRead, &c, sizeof(c), &cbR);
  547. +            if (c == 0) {
  548. +              // gnuplot asks for the number of colours in palette
  549. +              i = 256 - nColors;
  550. +              DosWrite( hRead, &i, sizeof(int), &cbR ) ;
  551. +              break;
  552. +              }
  553. +            /* retrieve the current table */
  554. +            lRetCount = GpiQueryLogColorTable(hps, 0L, 0L, nColors, alColourTable);
  555. +//{FILE *ff; ff=fopen("deb","a");
  556. +//fprintf(ff,"lret=%li  ncol=%li\n",lRetCount,nColors);fclose(ff);}
  557. +            if (lRetCount>0 && lRetCount!=nColors) // ring for developers!
  558. +              DosBeep(880,777);
  559. +            for (i=0; i<nColors; i++)
  560. +              rgbTable[i] = alColourTable[i];
  561. +            /* append new RGB table after */
  562. +            BufRead(hRead, &rgbTable[nColors], (256-nColors)*sizeof(rgbTable[0]), &cbR);
  563. +            if (pm3d_hpal != 0) GpiDeletePalette( pm3d_hpal );
  564. +            pm3d_hpal = GpiCreatePalette(hab,0L,LCOLF_CONSECRGB, 256L, rgbTable);
  565. +            pm3d_hpal_old = GpiSelectPalette( hps, pm3d_hpal );
  566. +            }
  567. +            break ;
  568. +           case 'e': // GR_RELEASE_PALETTE
  569. +#if 0 // REMOVE THIS ROUTINE COMPLETELY!
  570. +            if (pm3d_hpal) {
  571. +              GpiDeletePalette( pm3d_hpal );
  572. +              pm3d_hpal = 0;
  573. +              }
  574. +//              GpiSelectPalette( hps, pm3d_hpal_old );
  575. +#endif
  576. +            break ;
  577. +           case 'c': { // GR_SET_COLOR
  578. +            unsigned char c;
  579. +            BufRead(hRead,&c, 1, &cbR) ;
  580. +            pm3d_color = c;
  581. +            }
  582. +            break ;
  583. +           case 'f': { // GR_FILLED_POLYGON
  584. +            int points, x,y, i;
  585. +            POINTL p;
  586. +            BufRead(hRead,&points, sizeof(points), &cbR) ;
  587. +            // GpiSetPattern(hps,PATSYM_SOLID);
  588. +            // GpiSetBackMix(hps,BM_OVERPAINT);
  589. +            GpiSetColor( hps, pm3d_color);
  590. +              // using colours defined in the palette
  591. +// FILE *ff;ff=fopen("deb","a");
  592. +//fprintf(ff,"f --- GpiSetColor %li\n",pm3d_color); fclose(ff);}
  593. +            GpiBeginArea( hps, BA_BOUNDARY | BA_ALTERNATE);
  594. +            for (i = 0; i < points; i++) {
  595. +              BufRead(hRead,&x, sizeof(x), &cbR) ;
  596. +              BufRead(hRead,&y, sizeof(y), &cbR) ;
  597. +              p.x = x; p.y = y;
  598. +              if (i) GpiLine( hps, &p );
  599. +            else GpiMove( hps, &p );
  600. +              }
  601. +            GpiEndArea(hps);
  602. +            }
  603. +            break ;
  604. +
  605. +#endif //PM3D
  606.  
  607.                   default :  /* should handle error */
  608.                      break ;
  609. diff -uwr gnuplot-3.7.0.8/src/plot.h gnuplot-pm3d/src/plot.h
  610. --- gnuplot-3.7.0.8/src/plot.h    Fri Jun 11 19:53:16 1999
  611. +++ gnuplot-pm3d/src/plot.h    Mon Jun 14 17:16:14 1999
  612. @@ -615,6 +615,11 @@
  613.      struct iso_curve *iso_crvs;
  614.  };
  615.  
  616. +#ifdef PM3D
  617. +/* color.h is included here, since it requires the definition of `coordinate' */
  618. +#include "color.h"
  619. +#endif
  620. +
  621.  /* It should go without saying that additional entries may be made
  622.   * only at the end of this structure. Any fields added must be
  623.   * optional - a value of 0 (or NULL pointer) means an older driver
  624. @@ -664,6 +669,33 @@
  625.      void (*resume)  __PROTO((void)); /* called before plots of multiplot */
  626.      void (*fillbox) __PROTO((int, unsigned int, unsigned int, unsigned int, unsigned int)); /* clear in multiplot mode */
  627.     void (*linewidth) __PROTO((double linewidth));
  628. +#ifdef PM3D
  629. +    int (*make_palette) __PROTO((t_sm_palette *palette));
  630. +      /* 1. if palette==NULL, then return nice/suitable
  631. +        maximal number of colours supported by this terminal.
  632. +        Returns 0 if it can make colours without palette (like 
  633. +        postscript).
  634. +         2. if palette!=NULL, then allocate its own palette
  635. +        return value is undefined
  636. +         3. available: some negative values of max_colors for whatever 
  637. +        can be useful
  638. +      */
  639. +    void (*previous_palette) __PROTO((void));    
  640. +      /* release the palette that the above routine allocated and get 
  641. +         back the palette that was active before.
  642. +         Some terminals, like displays, may draw parts of the figure
  643. +         using their own palette. Those terminals that possess only 
  644. +         one palette for the whole plot don't need this routine.
  645. +      */
  646. +
  647. +    void (*set_color) __PROTO((double gray));
  648. +      /* gray is from [0;1], terminal uses its palette or another way
  649. +         to transform in into gray or r,g,b
  650. +         This routine (for each terminal separately) remembers or not
  651. +           this colour so that it can apply it for the subsequent drawings
  652. +      */
  653. +    void (*filled_polygon) __PROTO((int points, gpiPoint *corners));
  654. +#endif
  655.  };
  656.  
  657.  #ifdef WIN16
  658. diff -uwr gnuplot-3.7.0.8/src/protos.h gnuplot-pm3d/src/protos.h
  659. --- gnuplot-3.7.0.8/src/protos.h    Fri Jun 11 19:55:08 1999
  660. +++ gnuplot-pm3d/src/protos.h    Mon Jun 14 09:30:38 1999
  661. @@ -102,6 +102,7 @@
  662.  typedef void (*tic_callback) __PROTO((int axis, double place, char *text, struct lp_style_type grid));
  663.  void gen_tics __PROTO((int axis, struct ticdef *def, int grid, int minitic, double minifreq, tic_callback callback));
  664.  void write_multiline __PROTO((unsigned int x, unsigned int y, char *text_will_be_mangled, enum JUSTIFY hor, int vert, int angle, char *font));
  665. +void gprintf __PROTO((char *dest, size_t count, char *format, double log_base, double x));
  666.  
  667.  /* Prototypes from file "graph3d.c" */
  668.  
  669. diff -uwr gnuplot-3.7.0.8/src/set.c gnuplot-pm3d/src/set.c
  670. --- gnuplot-3.7.0.8/src/set.c    Fri Jun 11 19:53:16 1999
  671. +++ gnuplot-pm3d/src/set.c    Tue Jun 15 14:34:42 1999
  672. @@ -46,6 +46,9 @@
  673.  #include "setshow.h"
  674.  #include "national.h"
  675.  #include "alloc.h"
  676. +#ifdef PM3D
  677. +#include "pm3d.h"
  678. +#endif
  679.  
  680.  #define DEF_FORMAT   "%g"    /* default format for tic mark labels */
  681.  #define SIGNIF (0.01)        /* less than one hundredth of a tic mark */
  682. @@ -571,6 +574,10 @@
  683.      pointsize = 1.0;
  684.      encoding = ENCODING_DEFAULT;
  685.  
  686. +    #ifdef PM3D
  687. +    pm3d.where[0] = 0;
  688. +    #endif
  689. +
  690.      set_locale("C");        /* default */
  691.      clear_loadpath();
  692.  
  693. @@ -759,6 +766,220 @@
  694.          int_error(c_token, "expecting 'base', 'surface', or 'both'");
  695.          c_token++;
  696.      }
  697. +#ifdef PM3D
  698. +    } else if (equals(c_token,"nopm3d")) {
  699. +    pm3d.where[0] = 0;
  700. +    c_token++;
  701. +    } else if (equals(c_token,"pm3d")) {
  702. +    char *c = pm3d.where;
  703. +    c_token++;
  704. +    if (END_OF_COMMAND) { /* assume default settings */
  705. +      strcpy(pm3d.where,"b"); /* draw at bottom (map) */
  706. +      pm3d.direction = PM3D_SCANS_FORWARD;
  707. +      pm3d.flush = PM3D_FLUSH_BEGIN;
  708. +      pm3d.clip = PM3D_CLIP_1IN;
  709. +      pm3d.pm3d_zmin = 0; pm3d.pm3d_zmax = 0;
  710. +      pm3d.zmin = 0; pm3d.zmax = 100;
  711. +      }
  712. +    else { /* go through all options of 'set pm3d' */
  713. +      for ( ; !END_OF_COMMAND && !equals(c_token,";"); c_token++ ) {
  714. +        if (equals(c_token, "at")) {
  715. +          c_token++;
  716. +          if (token[c_token].length >= sizeof(pm3d.where)) {
  717. +        int_error(c_token,"ignoring so many redrawings");
  718. +        return (TRUE);
  719. +        }
  720. +          strncpy(pm3d.where, input_line + token[c_token].start_index, token[c_token].length);
  721. +          pm3d.where[ token[c_token].length ] = 0;
  722. +          while (*c) {
  723. +        if (*c != 'C') /* !!!!! CONTOURS, UNDOCUMENTED, THIS LINE IS TEMPORARILY HERE !!!!! */
  724. +        if (*c != PM3D_AT_BASE && *c != PM3D_AT_TOP && *c != PM3D_AT_SURFACE) {
  725. +        int_error(c_token,"parameter to pm3d requires combination of characters b,s,t\n\t(drawing at bottom, surface, top)");
  726. +        return (TRUE);
  727. +        }
  728. +          c++;
  729. +          }
  730. +        continue;
  731. +        }  /* at */
  732. +      /* forward and backward drawing direction */
  733. +      if (almost_equals(c_token, "scansfor$ward")) {
  734. +        pm3d.direction = PM3D_SCANS_FORWARD;
  735. +        continue;
  736. +        }
  737. +      if (almost_equals(c_token, "scansback$ward")) {
  738. +        pm3d.direction = PM3D_SCANS_BACKWARD;
  739. +        continue;
  740. +        }
  741. +      /* flush scans: left, right or center */
  742. +      if (almost_equals(c_token, "fl$ush")) {
  743. +        c_token++;
  744. +        if (almost_equals(c_token, "b$egin"))
  745. +          pm3d.flush = PM3D_FLUSH_BEGIN;
  746. +        else if (almost_equals(c_token, "c$enter"))
  747. +          pm3d.flush = PM3D_FLUSH_CENTER;
  748. +        else if (almost_equals(c_token, "e$nd"))
  749. +          pm3d.flush = PM3D_FLUSH_END;
  750. +        else int_error(c_token,"expecting flush 'begin', 'center' or 'end'");
  751. +        continue;
  752. +        }
  753. +      /* clipping method */
  754. +      if (almost_equals(c_token, "clip1$in")) {
  755. +        pm3d.clip = PM3D_CLIP_1IN;
  756. +        continue;
  757. +        }
  758. +      if (almost_equals(c_token, "clip4$in")) {
  759. +        pm3d.clip = PM3D_CLIP_4IN;
  760. +        continue;
  761. +        }
  762. +      /* zrange [{zmin|*}:{zmax|*}] */
  763. +      /* Note: here, we cannot use neither PROCESS_RANGE or load_range */
  764. +      if (almost_equals(c_token, "zr$ange")) {
  765. +        struct value a;
  766. +        if (!equals(++c_token,"[")) int_error(c_token,"expecting '['");
  767. +        c_token++;
  768. +        if (!equals(c_token,":")) { /* no change for zmin */
  769. +          if (equals(c_token,"*")) {
  770. +          pm3d.pm3d_zmin = 0; /* from gnuplot's set zrange */
  771. +          c_token++;
  772. +          }
  773. +        else {
  774. +          pm3d.pm3d_zmin = 1; /* use pm3d's zmin */
  775. +          pm3d.zmin = real(const_express(&a)); /* explicit value given */
  776. +          }
  777. +          }
  778. +        if (!equals(c_token,":")) int_error(c_token,"expecting ':'");
  779. +        c_token++;
  780. +        if (!equals(c_token,"]")) { /* no change for zmax */
  781. +          if (equals(c_token,"*")) {
  782. +          pm3d.pm3d_zmax = 0; /* from gnuplot's set zrange */
  783. +          c_token++;
  784. +          }
  785. +        else {
  786. +          pm3d.pm3d_zmax = 1; /* use pm3d's zmin */
  787. +          pm3d.zmax = real(const_express(&a)); /* explicit value given */
  788. +          }
  789. +           }
  790. +        if (!equals(c_token,"]")) int_error(c_token,"expecting ']'");
  791. +        continue;
  792. +        }
  793. +      /* setup everything for plotting a map */
  794. +      if (equals(c_token, "map")) {
  795. +        pm3d.where[0] = 'b'; pm3d.where[1] = 0; /* set pm3d at b */
  796. +        draw_surface = FALSE;        /* set nosurface */
  797. +        draw_contour = CONTOUR_NONE; /* set nocontour */
  798. +        surface_rot_x = 180;         /* set view 180,0,1.3 */
  799. +        surface_rot_z = 0;
  800. +        surface_scale = 1.3;
  801. +        range_flags[FIRST_Y_AXIS] |= RANGE_REVERSE; /* set yrange reverse */
  802. +        continue;
  803. +        }
  804. +      int_error(c_token,"invalid pm3d option");
  805. +      } /* end of while over pm3d options */
  806. +    }
  807. +    } else if (almost_equals(c_token,"pal$ette")) {
  808. +    c_token++;
  809. +    if (END_OF_COMMAND) { /* assume default settings */
  810. +      sm_palette.colorMode = SMPAL_COLOR_MODE_RGB;
  811. +      sm_palette.formulaR = 7; sm_palette.formulaG = 5;
  812. +      sm_palette.formulaB = 15;
  813. +      sm_palette.positive = SMPAL_POSITIVE;
  814. +      sm_palette.ps_allcF = 0;
  815. +      sm_palette.use_maxcolors = 0;
  816. +
  817. +      color_box.where = SMCOLOR_BOX_DEFAULT;
  818. +      color_box.rotation = 'v';
  819. +      }
  820. +    else { /* go through all options of 'set palette' */
  821. +      for ( ; !END_OF_COMMAND && !equals(c_token,";"); c_token++ ) {
  822. +      /* positive and negative picture */
  823. +      if (almost_equals(c_token, "pos$itive")) {
  824. +        sm_palette.positive = SMPAL_POSITIVE;
  825. +        continue;
  826. +        }
  827. +      if (almost_equals(c_token, "neg$ative")) {
  828. +        sm_palette.positive = SMPAL_NEGATIVE;
  829. +        continue;
  830. +        }
  831. +      /* Now the options that determine the palette of smooth colours */
  832. +      /* gray or rgb-coloured */
  833. +      if (equals(c_token, "gray")) {
  834. +        sm_palette.colorMode = SMPAL_COLOR_MODE_GRAY;
  835. +        continue;
  836. +        }
  837. +      if (almost_equals(c_token, "col$or")) {
  838. +        sm_palette.colorMode = SMPAL_COLOR_MODE_RGB;
  839. +        continue;
  840. +        }
  841. +      /* rgb color mapping formulae: rgb$formulae r,g,b (three integers) */
  842. +      if (almost_equals(c_token, "rgb$formulae")) {
  843. +        struct value a;
  844. +        int i;
  845. +        c_token++;
  846. +        i = (int)real(const_express(&a));
  847. +        if ( abs(i) >= sm_palette.colorFormulae )
  848. +          int_error(c_token,"color formula out of range (use `show pm3d' to display the range)");
  849. +        sm_palette.formulaR = i;
  850. +        if (!equals(c_token,",")) { c_token--; continue; }
  851. +        c_token++;
  852. +        i = (int)real(const_express(&a));
  853. +        if ( abs(i) >= sm_palette.colorFormulae )
  854. +          int_error(c_token,"color formula out of range (use `show pm3d' to display the range)");
  855. +        sm_palette.formulaG = i;
  856. +        if (!equals(c_token,",")) { c_token--; continue; }
  857. +        c_token++;
  858. +        i = (int)real(const_express(&a));
  859. +        if ( abs(i) >= sm_palette.colorFormulae )
  860. +          int_error(c_token,"color formula out of range (`show pm3d' displays the range)");
  861. +        sm_palette.formulaB = i;
  862. +        c_token--;
  863. +        continue;
  864. +        } /* rgbformulae */
  865. +      /* ps_allcF: write all rgb formulae into PS file? */
  866. +      if (equals(c_token, "nops_allcF")) {
  867. +        sm_palette.ps_allcF = 0;
  868. +        continue;
  869. +        }
  870. +      if (equals(c_token, "ps_allcF")) {
  871. +        sm_palette.ps_allcF = 1;
  872. +        continue;
  873. +        }
  874. +      /* max colors used */
  875. +      if (almost_equals(c_token, "maxc$olors")) {
  876. +        struct value a;
  877. +        int i;
  878. +        c_token++;
  879. +        i = (int)real(const_express(&a));
  880. +        if (i<0) int_error(c_token,"non-negative number required");
  881. +        sm_palette.use_maxcolors = i;
  882. +        continue;
  883. +        }
  884. +      /* Now color box properties */
  885. +      /* vertical or horizontal color gradient */
  886. +      if (almost_equals(c_token, "cbv$ertical")) {
  887. +        color_box.rotation = 'v';
  888. +        continue;
  889. +        }
  890. +      if (almost_equals(c_token, "cbh$orizontal")) {
  891. +        color_box.rotation = 'h';
  892. +        continue;
  893. +        }
  894. +      /* color box where: no box, default position, position by user */
  895. +      if (equals(c_token, "nocb")) {
  896. +        color_box.where = SMCOLOR_BOX_NO;
  897. +        continue;
  898. +        }
  899. +      if (almost_equals(c_token, "cbdef$ault")) {
  900. +        color_box.where = SMCOLOR_BOX_DEFAULT;
  901. +        continue;
  902. +        }
  903. +      if (almost_equals(c_token, "cbuser")) {
  904. +        color_box.where = SMCOLOR_BOX_USER;
  905. +        continue;
  906. +        }
  907. +      int_error(c_token,"invalid palette option");
  908. +      } /* end of while over palette options */
  909. +    }
  910. +#endif
  911.      } else if (almost_equals(c_token,"noco$ntour")) {
  912.      c_token++;
  913.      draw_contour = CONTOUR_NONE;
  914. diff -uwr gnuplot-3.7.0.8/src/setshow.h gnuplot-pm3d/src/setshow.h
  915. --- gnuplot-3.7.0.8/src/setshow.h    Fri Jun 11 19:53:16 1999
  916. +++ gnuplot-pm3d/src/setshow.h    Mon Jun 14 09:30:38 1999
  917. @@ -264,7 +264,7 @@
  918.  \t'dummy', 'encoding', 'format', 'function',  'grid',  'hidden',\n\
  919.  \t'isosamples', 'key', 'label', 'linestyle', 'loadpath', 'locale',\n\
  920.  \t'logscale', 'mapping', 'margin', 'missing', 'offsets', 'origin',\n\
  921. -\t'output', 'plot', 'parametric', 'pointsize', 'polar', '[rtuv]range',\n\
  922. +\t'output', 'plot', 'parametric', 'pm3d', 'pointsize', 'polar', '[rtuv]range',\n\
  923.  \t'samples', 'size', 'terminal', 'tics', 'timestamp', 'timefmt', 'title',\n\
  924.  \t'variables', 'version', 'view', '[xyz]{2}label', '[xyz]{2}range',\n\
  925.  \t'{m}[xyz]{2}tics', '[xyz]{2}[md]tics', '[xyz]{2}zeroaxis',\n\
  926. diff -uwr gnuplot-3.7.0.8/src/show.c gnuplot-pm3d/src/show.c
  927. --- gnuplot-3.7.0.8/src/show.c    Fri Jun 11 19:54:36 1999
  928. +++ gnuplot-pm3d/src/show.c    Tue Jun 15 14:18:02 1999
  929. @@ -44,6 +44,9 @@
  930.  #include "plot.h"
  931.  #include "command.h"
  932.  #include "setshow.h"
  933. +#ifdef PM3D
  934. +#include "pm3d.h"
  935. +#endif
  936.  
  937.  #define DEF_FORMAT   "%g"    /* default format for tic mark labels */
  938.  #define SIGNIF (0.01)        /* less than one hundredth of a tic mark */
  939. @@ -105,6 +108,10 @@
  940.  static void show_encoding __PROTO((void));
  941.  static void show_polar __PROTO((void));
  942.  static void show_parametric __PROTO((void));
  943. +#ifdef PM3D
  944. +static void show_pm3d __PROTO((void));
  945. +static void show_palette __PROTO((void));
  946. +#endif
  947.  static void show_tics __PROTO((int showx, int showy, int showz, int showx2, int showy2));
  948.  static void show_ticdef __PROTO((int tics, int axis, struct ticdef * tdef, char *text, int rotate_tics, char *ticfmt));
  949.  static void show_term __PROTO((void));
  950. @@ -401,6 +408,16 @@
  951.      (void) putc('\n', stderr);
  952.      show_parametric();
  953.      c_token++;
  954. +#ifdef PM3D
  955. +    } else if (equals(c_token, "pm3d")) {
  956. +    (void) putc('\n', stderr);
  957. +    show_pm3d();
  958. +    c_token++;
  959. +    } else if (almost_equals(c_token, "pal$ette")) {
  960. +    (void) putc('\n', stderr);
  961. +    show_palette();
  962. +    c_token++;
  963. +#endif
  964.      } else if (almost_equals(c_token, "poi$ntsize")) {
  965.      (void) putc('\n', stderr);
  966.      show_pointsize();
  967. @@ -590,6 +607,10 @@
  968.      show_margin();
  969.      show_output();
  970.      show_parametric();
  971. +#ifdef PM3D
  972. +    show_pm3d();
  973. +    show_palette();
  974. +#endif
  975.      show_pointsize();
  976.      show_encoding();
  977.      show_polar();
  978. @@ -1165,6 +1186,135 @@
  979.      fprintf(stderr, "\tparametric is %s\n", (parametric) ? "ON" : "OFF");
  980.  }
  981.  
  982. +#ifdef PM3D
  983. +static void show_pm3d()
  984. +{
  985. +    if (!pm3d.where[0]) {
  986. +      fprintf(stderr, "\tpm3d is OFF\n");
  987. +      return;
  988. +      }
  989. +    fprintf(stderr,"\tpm3d plotted at ");
  990. +    { int i=0;
  991. +    for ( ; pm3d.where[i]; i++ ) {
  992. +      if (i>0) fprintf(stderr,", then ");
  993. +      switch (pm3d.where[i]) {
  994. +    case PM3D_AT_BASE: fprintf(stderr,"BOTTOM"); break;
  995. +    case PM3D_AT_SURFACE: fprintf(stderr,"SURFACE"); break;
  996. +    case PM3D_AT_TOP: fprintf(stderr,"TOP"); break;
  997. +    }
  998. +      }
  999. +    fprintf(stderr,"\n");
  1000. +    }
  1001. +    fprintf(stderr,"\ttaking scans in %s direction\n",
  1002. +    pm3d.direction == PM3D_SCANS_FORWARD ? "FORWARD" : "BACKWARD");
  1003. +    fprintf(stderr,"\tsubsequent scans with different nb of pts are ");
  1004. +    if (pm3d.flush == PM3D_FLUSH_CENTER) fprintf(stderr,"CENTERED\n");
  1005. +      else fprintf(stderr,"flushed from %s\n",
  1006. +    pm3d.flush == PM3D_FLUSH_BEGIN ? "BEGIN" : "END");
  1007. +    fprintf(stderr,"\tclipping: ");
  1008. +    if (pm3d.clip == PM3D_CLIP_1IN)
  1009. +    fprintf(stderr,"at least 1 point of the quadrangle in x,y ranges\n");
  1010. +      else
  1011. +    fprintf(stderr, "all 4 points of the quadrangle in x,y ranges\n");
  1012. +    fprintf(stderr,"\tz-range is ");
  1013. +      if (pm3d.pm3d_zmin==0 && pm3d.pm3d_zmax==0)
  1014. +      fprintf(stderr,"the same as `set zrange`\n");
  1015. +    else {
  1016. +      fprintf(stderr,"[");
  1017. +      if (pm3d.pm3d_zmin) fprintf(stderr,"%g,",pm3d.zmin);
  1018. +        else fprintf(stderr,"*,");
  1019. +      if (pm3d.pm3d_zmax) fprintf(stderr,"%g]\n",pm3d.zmax);
  1020. +        else fprintf(stderr,"*]\n");
  1021. +      }
  1022. +}
  1023. +
  1024. +static void show_palette()
  1025. +{
  1026. +    c_token++;
  1027. +    /* no option given, i.e. "show palette" */
  1028. +    if (END_OF_COMMAND) {
  1029. +      fprintf(stderr,"\tfigure is %s\n",
  1030. +      sm_palette.colorMode == SMPAL_COLOR_MODE_GRAY ? "GRAY" : "COLOR");
  1031. +      fprintf(stderr,"\trgb color mapping formulae are %i,%i,%i\n",
  1032. +      sm_palette.formulaR, sm_palette.formulaG, sm_palette.formulaB);
  1033. +      fprintf(stderr,"\t  * there are %i available rgb color mapping formulae:",
  1034. +      sm_palette.colorFormulae);
  1035. +      /* take the description of the color formulae from the comment to their
  1036. +     PostScript definition */
  1037. +      {
  1038. +      extern char *( PostScriptColorFormulae[] );
  1039. +      char *s;
  1040. +      int i = 0;
  1041. +      while ( *(PostScriptColorFormulae[i]) ) {
  1042. +    if (i % 3 == 0) fprintf(stderr, "\n\t    ");
  1043. +    s = strchr( PostScriptColorFormulae[ i ], '%' ) + 2;
  1044. +    fprintf(stderr, "%2i: %-15s",i,s);
  1045. +    i++;
  1046. +    }
  1047. +      fprintf(stderr, "\n");
  1048. +      }
  1049. +      fprintf(stderr,"\t  * negative numbers mean inverted=negative colour component\n");
  1050. +      fprintf(stderr,"\t  * thus the ranges in `set pm3d rgbformulae' are -%i..%i\n",
  1051. +      sm_palette.colorFormulae-1,sm_palette.colorFormulae-1);
  1052. +      fprintf(stderr,"\tfigure is %s\n",
  1053. +      sm_palette.positive == SMPAL_POSITIVE ? "POSITIVE" : "NEGATIVE");
  1054. +      fprintf(stderr,"\tall color formulae ARE%s written into output postscript file\n",
  1055. +      sm_palette.ps_allcF == 0 ? "" : " NOT");
  1056. +      fprintf(stderr,"\tallocating ");
  1057. +    if (sm_palette.use_maxcolors) fprintf(stderr,"MAX %i",sm_palette.use_maxcolors);
  1058. +      else fprintf(stderr,"ALL remaining");
  1059. +    fprintf(stderr," color positions for discrete palette terminals\n");
  1060. +      fprintf(stderr,"\tcolor box is ");
  1061. +      if (color_box.where == SMCOLOR_BOX_NO )
  1062. +      fprintf(stderr,"NOT drawn\n");
  1063. +    else {
  1064. +      fprintf(stderr,"drawn at %s position\n",
  1065. +          color_box.where == SMCOLOR_BOX_DEFAULT ? "DEFAULT" : "USER");
  1066. +      }
  1067. +      fprintf(stderr,"\tuser position and size is not yet implemented (you are welcome!)\n");
  1068. +      fprintf(stderr,"\tcolor gradient is %s in the color box\n",
  1069. +       color_box.rotation == 'v' ? "VERTICAL" : "HORIZONTAL");
  1070. +      return;
  1071. +    }
  1072. +    /* option: "show palette palette <n>" */
  1073. +    if (almost_equals(c_token, "pal$ette")) {
  1074. +      int colors, i;
  1075. +      struct value a;
  1076. +      double gray, r, g, b;
  1077. +      extern double GetColorValueFromFormula (int formula, double x);
  1078. +      c_token++;
  1079. +      if (END_OF_COMMAND)
  1080. +    int_error(c_token,"palette size required");
  1081. +      colors = (int) real(const_express(&a));
  1082. +      if (colors<2) colors = 100;
  1083. +      if (sm_palette.colorMode == SMPAL_COLOR_MODE_GRAY)
  1084. +      printf("Gray palette with %i discrete colors\n", colors);
  1085. +    else
  1086. +      printf("Color palette with %i discrete colors, formulae R=%i, G=%i, B=%i\n",
  1087. +          colors, sm_palette.formulaR, sm_palette.formulaG, sm_palette.formulaB);
  1088. +      for (i = 0; i < colors; i++) {
  1089. +    gray = (double)i / (colors - 1); /* colours equidistantly from [0,1] */
  1090. +    if (sm_palette.positive == SMPAL_NEGATIVE)
  1091. +      gray = 1 - gray; /* needed, since printing without call to set_color() */
  1092. +    if (sm_palette.colorMode == SMPAL_COLOR_MODE_GRAY) /* gray scale only */
  1093. +         r = g = b = gray;
  1094. +      else { /* i.e. sm_palette.colorMode == SMPAL_COLOR_MODE_RGB */
  1095. +         r = GetColorValueFromFormula(sm_palette.formulaR, gray);
  1096. +         g = GetColorValueFromFormula(sm_palette.formulaG, gray);
  1097. +         b = GetColorValueFromFormula(sm_palette.formulaB, gray);
  1098. +         }
  1099. +    printf("%3i. gray=%0.4f, (r,g,b)=(%0.4f,%0.4f,%0.4f), #%02x%02x%02x = %3i %3i %3i\n",
  1100. +        i, gray, r,g,b,
  1101. +        (int)(colors*r),(int)(colors*g),(int)(colors*b),
  1102. +        (int)(colors*r),(int)(colors*g),(int)(colors*b));
  1103. +    }
  1104. +      return;
  1105. +      }
  1106. +    /* wrong option to "show palette" */
  1107. +    int_error(c_token,"required 'show palette' or 'show palette palette <n>'");
  1108. +}
  1109. +#endif
  1110. +
  1111.  static void
  1112.  show_pointsize()
  1113.  {
  1114. @@ -1607,6 +1757,12 @@
  1115.          p, help_email,
  1116.          p, bug_email,
  1117.          p);            /* empty line */
  1118. +#ifdef PM3D
  1119. +fprintf(fp,"\
  1120. +%s\tCompiled with the new 'pm3d' splot mode (version " PM3D_VERSION ").\n\
  1121. +%s\tSee `help set pm3d' for more details.\n\n", 
  1122. +p, p);
  1123. +#endif
  1124.  }
  1125.  
  1126.  void
  1127. diff -uwr gnuplot-3.7.0.8/term/fig.trm gnuplot-pm3d/term/fig.trm
  1128. --- gnuplot-3.7.0.8/term/fig.trm    Mon May 31 19:33:50 1999
  1129. +++ gnuplot-pm3d/term/fig.trm    Fri Jul  9 12:24:52 1999
  1130. @@ -58,6 +58,7 @@
  1131.   * Point-count option joachim.selinger@ins.uni-stuttgart.de (JFS) Feb  9 1996
  1132.   * More options (portrait/landscape, metric/inches, size, fontsize, thickness)
  1133.   * plus symbols and depth/thickness by bernlohr@eu1.mpi-hd.mpg.de (KB) Aug 15 1996
  1134. + * Added PM3D functionality Ian MacPhedran, April 15 1999
  1135.   */
  1136.  
  1137.  #include "driver.h"
  1138. @@ -82,6 +83,12 @@
  1139.  TERM_PUBLIC void FIG_linewidth __PROTO((double linewidth));
  1140.  TERM_PUBLIC void FIG_reset __PROTO((void));
  1141.  TERM_PUBLIC void FIG_lpoint __PROTO((unsigned int x, unsigned int y, int number));
  1142. +#ifdef PM3D
  1143. +TERM_PUBLIC int FIG_make_palette (t_sm_palette *);
  1144. +/* TERM_PUBLIC void FIG_previous_palette (void); */
  1145. +TERM_PUBLIC void FIG_set_color (double);
  1146. +TERM_PUBLIC void FIG_filled_polygon (int, gpiPoint *);
  1147. +#endif
  1148.  
  1149.  #define GOT_FIG_PROTO
  1150.  #endif /* TERM_PROTO */
  1151. @@ -177,6 +184,13 @@
  1152.  static int FIG_font_s = FIG_FONT_S;
  1153.  static int FIG_portrait = FALSE;
  1154.  static int FIG_inches = FALSE;
  1155. +#ifdef PM3D
  1156. +static int FIG_palette_set = FALSE;    /* PM3D Palette Set ? */
  1157. +static int FIG_palette_size = 128;    /* Number of colours in palette */
  1158. +static int FIG_palette_offst = 32;    /* Offset from zero for user colours */
  1159. +static int FIG_fill_style = 20;        /* Full saturation */
  1160. +static int FIG_fill_color;        /* Current PM3D fill colour */
  1161. +#endif /* PM3D */
  1162.  
  1163.  static void FIG_poly_clean __PROTO((enum FIG_poly_stat fig_stat));
  1164.  
  1165. @@ -410,6 +424,10 @@
  1166.      FIG_justify_text(LEFT);
  1167.      FIG_text_angle(0);
  1168.  
  1169. +#ifdef PM3D
  1170. +    FIG_palette_set = FALSE;    /* PM3D Palette Set ? */
  1171. +#endif /* PM3D */
  1172. +
  1173.      FIG_line.tagged = FIG_DEFAULT;
  1174.      FIG_line.distrib = FIG_DEFAULT;
  1175.      FIG_line.type = T_POLYLINE;
  1176. @@ -772,6 +790,100 @@
  1177.      fflush(gpoutfile);
  1178.  }
  1179.  
  1180. +#ifdef PM3D
  1181. +TERM_PUBLIC int FIG_make_palette(t_sm_palette *palette)
  1182. +{
  1183. +    int i;
  1184. +
  1185. +    /* Query to determine palette size */
  1186. +    if (palette==NULL) {
  1187. +    return(FIG_palette_size); /* How big is palette ? */
  1188. +    }
  1189. +
  1190. +    FIG_poly_clean(FIG_polyvec_stat); /* Clean up current data */
  1191. +
  1192. +    if (FIG_palette_set == FALSE) {
  1193. +    /* Create new palette */
  1194. +    FIG_palette_set = TRUE;
  1195. +    if ((FIG_use_color != TRUE) && (sm_palette.colorMode == SMPAL_COLOR_MODE_RGB)) { /* Force mono palette */
  1196. +        /* NOTE: This is a bad way of doing this, but we have no way
  1197. +           at this time of telling the main program to use grey */
  1198. +        fprintf(stderr,
  1199. +        "Attempt to set colour palette in monochrome mode\n");
  1200. +        sm_palette.colorMode = SMPAL_COLOR_MODE_GRAY;
  1201. +        for (i = 0; i < sm_palette.colors; i++) {
  1202. +        int j = i * 255 / sm_palette.colors + 0.5;
  1203. +        fprintf(gpoutfile, "%d %d #%2.2x%2.2x%2.2x\n",
  1204. +        O_COLOR_DEF, (i + FIG_palette_offst),j,j,j);
  1205. +        }
  1206. +    } else {
  1207. +        /* Create colour/normal palette */
  1208. +        for (i = 0; i < sm_palette.colors; i++) {
  1209. +        fprintf(gpoutfile, "%d %d #%2.2x%2.2x%2.2x\n",
  1210. +        O_COLOR_DEF, (i + FIG_palette_offst),
  1211. +        (int)( palette->color[i].r * 255 + 0.5 ),
  1212. +        (int)( palette->color[i].g * 255 + 0.5 ),
  1213. +        (int)( palette->color[i].b * 255 + 0.5 ) );
  1214. +        }
  1215. +    }
  1216. +    } else {
  1217. +    fprintf(stderr, "Attempt to set palette twice\n");
  1218. +    }
  1219. +    return(0);
  1220. +}
  1221. +
  1222. +/* This doesn't apply for FIG format files
  1223. +TERM_PUBLIC void FIG_previous_palette()
  1224. +{
  1225. +}
  1226. +*/
  1227. +
  1228. +TERM_PUBLIC void FIG_set_color(double gray)
  1229. +{
  1230. +    if (FIG_palette_set == FALSE) {
  1231. +    fprintf(stderr,"Palette used before set\n"); /* Error condition */
  1232. +    }
  1233. +    FIG_fill_color = (int)((gray*(FIG_palette_size-1)) + 0.5)
  1234. +    + FIG_palette_offst;
  1235. +}
  1236. +
  1237. +TERM_PUBLIC void FIG_filled_polygon(int points, gpiPoint *corners)
  1238. +{
  1239. +    int i,j;
  1240. +
  1241. +    if (FIG_palette_set == FALSE) {
  1242. +    fprintf(stderr,"Palette used before set\n"); /* Error condition */
  1243. +    }
  1244. +
  1245. +    FIG_poly_clean(FIG_polyvec_stat); /* Clean up current data */
  1246. +
  1247. +    fprintf(gpoutfile, "%d %d %d %d %d %d %d %d %d %9.3f %d %d %d %d %d %ld\n\t"
  1248. +,
  1249. +    O_POLYLINE, T_POLYGON, FIG_line.style, 0,
  1250. +    FIG_fill_color, FIG_fill_color, FIG_line.depth,
  1251. +    FIG_line.pen_style, FIG_fill_style, FIG_line.style_val,
  1252. +    FIG_line.join_style, FIG_line.cap_style, FIG_line.radius,
  1253. +    0, 0, (long)(points+1));
  1254. +/* set thickness (arg 4) to 0 */
  1255. +
  1256. +    j = 0;
  1257. +    for (i = 0; i < points; i++) {
  1258. +    fprintf(gpoutfile, " %d %d", FIG_xoff + corners[i].x,
  1259. +        term->ymax + FIG_yoff - corners[i].y);
  1260. +    if (j++ > 4 && i != points - 1) {
  1261. +        fputs("\n\t", gpoutfile);
  1262. +        j = 0;        /* JFS */
  1263. +    }
  1264. +    }
  1265. +    fprintf(gpoutfile, " %d %d", FIG_xoff + corners[0].x,
  1266. +    term->ymax + FIG_yoff - corners[0].y);
  1267. +    j++;
  1268. +    if (j != 0) {
  1269. +    putc('\n', gpoutfile);
  1270. +    }
  1271. +}
  1272. +#endif /* PM3D */
  1273. +
  1274.  #endif /* TERM_BODY */
  1275.  
  1276.  #ifdef TERM_TABLE
  1277. @@ -785,6 +897,9 @@
  1278.      FIG_lpoint, FIG_arrow, set_font_null, FIG_pointsize,
  1279.      0 /*flags */ , 0 /*suspend */ , 0 /*resume */ , 0 /*fillbox */ ,
  1280.      FIG_linewidth
  1281. +#ifdef PM3D
  1282. +    , FIG_make_palette, 0 /*previous_palette*/, FIG_set_color, FIG_filled_polygon
  1283. +#endif /* PM3D */
  1284.  TERM_TABLE_END(fig_driver)
  1285.  
  1286.  #undef LAST_TERM
  1287. diff -uwr gnuplot-3.7.0.8/term/gif.trm gnuplot-pm3d/term/gif.trm
  1288. --- gnuplot-3.7.0.8/term/gif.trm    Wed Jun  9 13:05:10 1999
  1289. +++ gnuplot-pm3d/term/gif.trm    Mon Jun 14 09:30:38 1999
  1290. @@ -87,6 +87,7 @@
  1291.   * [Update: as of version 1.3, gd does not use any more UNISYS licensed
  1292.   *  code. The gnuplot team may decide to include this version some day.]
  1293.   *
  1294. + * Petr Mikulik, Jan 1999: terminal entries for PM3D functionality
  1295.   */
  1296.  
  1297.  #include "driver.h"
  1298. @@ -106,6 +107,12 @@
  1299.  TERM_PUBLIC void GIF_put_text __PROTO((unsigned int x, unsigned int y, char str[]));
  1300.  TERM_PUBLIC int GIF_text_angle __PROTO((int ang));
  1301.  TERM_PUBLIC void GIF_reset __PROTO((void));
  1302. +#ifdef PM3D
  1303. +TERM_PUBLIC int GIF_make_palette (t_sm_palette *);
  1304. +/* TERM_PUBLIC void GIF_previous_palette (void); */
  1305. +TERM_PUBLIC void GIF_set_color (double);
  1306. +TERM_PUBLIC void GIF_filled_polygon (int, gpiPoint *);
  1307. +#endif
  1308.  
  1309.  #include "gd.h"
  1310.  extern gdFontPtr gdFontSmall;    /* 6x12 */
  1311. @@ -411,6 +418,96 @@
  1312.  {
  1313.  }
  1314.  
  1315. +#ifdef PM3D
  1316. +
  1317. +#if 1
  1318. +/* use  #if 1  that's just for debuggin */
  1319. +void GIF_show_current_palette()
  1320. +{
  1321. +int i;
  1322. +fprintf(stderr,"*****\n SHOW THE PALETTE! total=%i\n",gdImageColorsTotal(gif_state.image));
  1323. +for (i=0; i < gdImageColorsTotal(gif_state.image); i++) {
  1324. +  /* Use access macros to learn colors. */
  1325. +  fprintf(stderr,"%i\tr=%d\t g=%d\tb=%d\n", i,
  1326. +    gdImageRed(gif_state.image,i),
  1327. +    gdImageGreen(gif_state.image,i),
  1328. +    gdImageBlue(gif_state.image,i));
  1329. +  }
  1330. +}
  1331. +#endif
  1332. +
  1333. +/*
  1334. +How this works:
  1335. +Gray interval [0;1] will be mapped to interval [0;sm_palette.colors-1]
  1336. +those r,g,b components are mapped by the array below
  1337. +palette.offset equals 0 since gif_smooth_color[0..colors] are from ColorAllocate
  1338. +*/
  1339. +int gif_smooth_color[ gdMaxColors ];
  1340. +  /* chooser from the colour palette */
  1341. +  /* TODO: how to recover from a multiplot with two colour pm3d maps?
  1342. +     They must use the same palette! Or palette size must be
  1343. +     restricted to certain number of colours---a new user's option
  1344. +  */
  1345. +
  1346. +TERM_PUBLIC int GIF_make_palette (t_sm_palette *palette)
  1347. +{
  1348. +int i;
  1349. +if (palette == NULL) {
  1350. +  /* return maximal number of colours in a GIF palette */
  1351. +  i = gdMaxColors /*256*/ - gdImageColorsTotal(gif_state.image);
  1352. +  /* the latter is the number of currently allocated colours. We want
  1353. +     to allocate the rest */
  1354. +//BACK PLEASE  fprintf(stderr,"colors in GIF palette=%i\n",(int)gdMaxColors);
  1355. +  return i;
  1356. +  }
  1357. +for (i = 0; i < sm_palette.colors; i++) {
  1358. +  gif_smooth_color[i] = gdImageColorAllocate(gif_state.image,
  1359. +    (int)( palette->color[i].r * 255 + 0.5 ), /* r,g,b values for gif */
  1360. +    (int)( palette->color[i].g * 255 + 0.5 ), /* terminal are [0;255] */
  1361. +    (int)( palette->color[i].b * 255 + 0.5 ) );
  1362. +  if (gif_smooth_color[i] < 0) { /* this should never happen! take away? */
  1363. +    FPRINTF("gif_smooth_color[i]<0 cannot happen")
  1364. +    exit(1);
  1365. +    }
  1366. +#if 0
  1367. +fprintf(stderr,"ALLOCATED: i=%i\t=> pal_index=%i\tr=%g g=%g b=%g\n",
  1368. +    i, gif_smooth_color[i],
  1369. +    palette->color[i].r, palette->color[i].g, palette->color[i].b );
  1370. +#endif
  1371. +  }
  1372. +return 0;
  1373. +}
  1374. +
  1375. +int gif_color;
  1376. +  /* keep here the last set color */
  1377. +
  1378. +TERM_PUBLIC void GIF_set_color (double gray)
  1379. +{
  1380. +gif_color = (int)( gray * (sm_palette.colors-1) + 0.5 );
  1381. +  /* map [0;1] to interval [0;gif_smooth_colors-1] */
  1382. +gif_color = gif_smooth_color[ gif_color ]; /* index to the palette */
  1383. +//fprintf(stderr,"GIF terminal sets color gif_color=%i\n",gif_color);
  1384. +}
  1385. +
  1386. +
  1387. +TERM_PUBLIC void GIF_filled_polygon ( int points, gpiPoint *corners )
  1388. +{
  1389. +int i;
  1390. +for (i = 0; i < points; i++)
  1391. +  corners[i].y = gif_state.height - corners[i].y;
  1392. +gdImageFilledPolygon(gif_state.image, (gdPointPtr)corners, points, gif_color);
  1393. +  /* easy, since gdPointPtr is the same as (gdiPoint*) */
  1394. +/* if someone someday needs this routine to be NON-DESTRUCTIVE, then change
  1395. +   the following line to #if 1 */
  1396. +#if 0
  1397. +for (i = 0; i < points; i++)
  1398. +  corners[i].y = gif_state.height - corners[i].y;
  1399. +#endif
  1400. +}
  1401. +
  1402. +
  1403. +#endif
  1404. +
  1405.  /*
  1406.   * _graphics()  Called just before a plot is going to be displayed.  This
  1407.   * procedure should set the device into graphics mode.  Devices which can't
  1408. @@ -588,6 +685,14 @@
  1409.      null_justify_text, do_point, do_arrow, GIF_set_font,
  1410.      0,                /* pointsize */
  1411.      TERM_CAN_MULTIPLOT | TERM_BINARY
  1412. +#ifdef PM3D
  1413. +    , 0 /*suspend*/, 0 /*resume*/, 
  1414. +    0 /*fillbox*/,   0 /*linewidth*/,
  1415. +    GIF_make_palette,
  1416. +    0, /* previous_palette() ... no, single array of 256 colours for GIF */
  1417. +    GIF_set_color,
  1418. +    GIF_filled_polygon
  1419. +#endif
  1420.  TERM_TABLE_END(gif_driver)
  1421.  
  1422.  #undef LAST_TERM
  1423. diff -uwr gnuplot-3.7.0.8/term/pm.trm gnuplot-pm3d/term/pm.trm
  1424. --- gnuplot-3.7.0.8/term/pm.trm    Thu Jun 10 20:55:26 1999
  1425. +++ gnuplot-pm3d/term/pm.trm    Mon Jun 14 09:30:38 1999
  1426. @@ -43,6 +43,8 @@
  1427.   *     last change: 7. 4. 1998
  1428.   *     for mouse support, pm.trm has to be compiled with USE_MOUSE, e.g.
  1429.   *     gcc ... -DUSE_MOUSE ... 
  1430. + *
  1431. + *    January 1999: terminal entries for PM3D functionality by Petr Mikulik
  1432.   */
  1433.  
  1434.  #include "driver.h"
  1435. @@ -67,6 +69,12 @@
  1436.  TERM_PUBLIC void PM_suspend __PROTO((void));
  1437.  TERM_PUBLIC void PM_resume __PROTO((void));
  1438.  TERM_PUBLIC void PM_linewidth __PROTO((double linewidth));
  1439. +#ifdef PM3D
  1440. +TERM_PUBLIC int PM_make_palette (t_sm_palette *);
  1441. +TERM_PUBLIC void PM_previous_palette (void);
  1442. +TERM_PUBLIC void PM_set_color (double);
  1443. +TERM_PUBLIC void PM_filled_polygon (int, gpiPoint *);
  1444. +#endif
  1445.  
  1446.  /* define PM world coordinate limits */
  1447.  
  1448. @@ -113,6 +121,12 @@
  1449.  #define GR_PAUSE        'P'
  1450.  #define GR_HELP         'H'
  1451.  #define GR_MOUSECAPABLE 'm' //PM: say gnupmdrv we are mouseable
  1452. +#ifdef PM3D
  1453. +#define GR_MAKE_PALETTE    'p'
  1454. +#define GR_RELEASE_PALETTE 'e'
  1455. +#define GR_SET_COLOR       'c'
  1456. +#define GR_FILLED_POLYGON  'f'
  1457. +#endif
  1458.  #define PM_nopts 1
  1459.  
  1460.  /* path for pm program */
  1461. @@ -676,6 +690,82 @@
  1462.      fwrite(&lw, sizeof(int), 1, PM_pipe);
  1463.  }
  1464.  
  1465. +
  1466. +#ifdef PM3D
  1467. +
  1468. +/* note: gvpm sources have also limit 256, is it limit of PM palette?
  1469. +   I suppose yes, thus let colours passed as unsigned char through the pipe
  1470. +   But there must be 16 subtracted since nColors = 16 in gclient.c ... colours
  1471. +   of the default palette which has to be kept
  1472. +*/
  1473. +/* gray interval [0;1] will be mapped to interval [0;255]
  1474. +   those r,g,b components are mapped by the array below */
  1475. +
  1476. +TERM_PUBLIC int PM_make_palette (t_sm_palette *palette)
  1477. +{
  1478. +int i, r, g, b;
  1479. +int rc;
  1480. +ULONG cbR;
  1481. +unsigned long rgbTable[256-16];
  1482. +// unsigned long *rgbTable; // [256-16];
  1483. +putc(GR_MAKE_PALETTE, PM_pipe);
  1484. +if (palette == NULL) {
  1485. +  /* return maximal number of colours in palette */
  1486. +  putc(0, PM_pipe);
  1487. +  fflush(PM_pipe);
  1488. +  rc = DosRead(fileno(PM_pipe), &i, sizeof(int), &cbR);
  1489. +  return i; // = 256-16;
  1490. +  }
  1491. +putc(1, PM_pipe);
  1492. +for (i = 0; i < 256-16; i++) {
  1493. +  r = (int)( palette->color[i].r * 255 + 0.5 );
  1494. +  g = (int)( palette->color[i].g * 255 + 0.5 );
  1495. +  b = (int)( palette->color[i].b * 255 + 0.5 );
  1496. +  rgbTable[i] = (r<<16) + (g<<8) + b; // PM API likes this form
  1497. +  }
  1498. +fwrite(&rgbTable, sizeof(rgbTable), 1, PM_pipe);
  1499. +return 0;
  1500. +}
  1501. +
  1502. +
  1503. +/* switch back to the palette used before calling make_palette */
  1504. +TERM_PUBLIC void PM_previous_palette ()
  1505. +{
  1506. +putc(GR_RELEASE_PALETTE, PM_pipe);
  1507. +}
  1508. +
  1509. +
  1510. +int pm_color = -1;
  1511. +  /* keep here the last set color
  1512. +     it is not unsigned char since -1 says that no value has been set
  1513. +   */
  1514. +
  1515. +TERM_PUBLIC void PM_set_color (double gray)
  1516. +{
  1517. +unsigned char c = 16 + (unsigned char)( gray * (255-16) + 0.5 );
  1518. +  /* map [0;1] to interval [16;255] */
  1519. +if (c == pm_color) return;
  1520. +pm_color = c;
  1521. +putc(GR_SET_COLOR, PM_pipe);
  1522. +//{int k=c; fprintf(stderr,"pm.trm: PM_set_color c=%i\n",k);}
  1523. +putc(c, PM_pipe);
  1524. +}
  1525. +
  1526. +
  1527. +TERM_PUBLIC void PM_filled_polygon ( int points, gpiPoint *corners )
  1528. +{
  1529. +int i;
  1530. +putc(GR_FILLED_POLYGON, PM_pipe);
  1531. +fwrite(&points, sizeof(int), 1, PM_pipe); // tell him number of corners
  1532. +for (i = 0; i < points; i++) {
  1533. +  fwrite(&corners[i].x, sizeof(int), 1, PM_pipe);
  1534. +  fwrite(&corners[i].y, sizeof(int), 1, PM_pipe);
  1535. +  }
  1536. +}
  1537. +
  1538. +
  1539. +#endif
  1540. +
  1541.  #endif
  1542.  
  1543.  #ifdef TERM_TABLE
  1544. @@ -688,6 +778,12 @@
  1545.      PM_justify_text, PM_point, do_arrow, PM_set_font,
  1546.      0 /*pointsize */ , TERM_CAN_MULTIPLOT, PM_suspend, PM_resume,
  1547.      0 /*fillbox */ , PM_linewidth
  1548. +#ifdef PM3D
  1549. +    , PM_make_palette,
  1550. +    PM_previous_palette,
  1551. +    PM_set_color,
  1552. +    PM_filled_polygon
  1553. +#endif
  1554.  TERM_TABLE_END(PM_driver)
  1555.  
  1556.  #undef LAST_TERM
  1557. diff -uwr gnuplot-3.7.0.8/term/post.trm gnuplot-pm3d/term/post.trm
  1558. --- gnuplot-3.7.0.8/term/post.trm    Wed May 12 14:53:18 1999
  1559. +++ gnuplot-pm3d/term/post.trm    Mon Jun 14 09:30:38 1999
  1560. @@ -55,6 +55,7 @@
  1561.   *
  1562.   * Erik Luijten 30/5/97: added %%CreationDate, made %%DocumentFonts conform
  1563.   *                       to DSC, added version no. and patchl. to %%Creator
  1564. + * Petr Mikulik, Jan 1999: terminal entries for PM3D functionality
  1565.   */
  1566.  
  1567.  #include "driver.h"
  1568. @@ -83,6 +84,12 @@
  1569.  TERM_PUBLIC void PS_fillbox __PROTO((int style, unsigned int x1, unsigned int y1, unsigned int width, unsigned int height));
  1570.  TERM_PUBLIC void PS_linewidth __PROTO((double linewidth)); /* JFi [linewidth] */
  1571.  TERM_PUBLIC void PS_pointsize __PROTO((double ptsize)); /* JFi [pointsize] */
  1572. +#ifdef PM3D
  1573. +TERM_PUBLIC int PS_make_palette (t_sm_palette *);
  1574. +TERM_PUBLIC void PS_previous_palette (void);
  1575. +TERM_PUBLIC void PS_set_color (double);
  1576. +TERM_PUBLIC void PS_filled_polygon (int, gpiPoint *);
  1577. +#endif
  1578.  
  1579.  #define PS_POINT_TYPES 8
  1580.  #define PS_XOFF    50    /* page offset in pts */
  1581. @@ -1685,7 +1692,152 @@
  1582.  }
  1583.  
  1584.  
  1585. +#ifdef PM3D
  1586. +
  1587. +/* implementation of pm3dGetColorValue() in the postscript way.
  1588. +   Notice that the description, i.e. the part after %, is important 
  1589. +   since it is used in `show pm3d' for displaying the analytical formulae.
  1590. +*/
  1591. +char *( PostScriptColorFormulae[] ) = {
  1592. +  "/cF0 {pop 0} bind def\t% 0",
  1593. +  "/cF1 {pop 0.5} bind def\t% 0.5",
  1594. +  "/cF2 {pop 1} bind def\t% 1",
  1595. +  "/cF3 {} bind def\t% x",
  1596. +  "/cF4 {dup mul} bind def\t% x^2",
  1597. +  "/cF5 {dup dup mul mul} bind def\t% x^3",
  1598. +  "/cF6 {dup mul dup mul} bind def\t% x^4",
  1599. +  "/cF7 {sqrt} bind def\t% sqrt(x)",
  1600. +  "/cF8 {sqrt sqrt} bind def\t% sqrt(sqrt(x))",
  1601. +  "/cF9 {90 mul sin} bind def\t% sin(90x)",
  1602. +  "/cF10 {90 mul cos} bind def\t% cos(90x)",
  1603. +  "/cF11 {0.5 sub abs} bind def\t% |x-0.5|",
  1604. +  "/cF12 {2 mul 1 sub dup mul} bind def\t% (2x-1)^2",
  1605. +  "/cF13 {180 mul sin} bind def\t% sin(180x)",
  1606. +  "/cF14 {180 mul cos abs} bind def\t% |cos(180x)|",
  1607. +  "/cF15 {360 mul sin} bind def\t% sin(360x)",
  1608. +  "/cF16 {360 mul cos} bind def\t% cos(360x)",
  1609. +  "/cF17 {360 mul sin abs} bind def\t% |sin(360x)|",
  1610. +  "/cF18 {360 mul cos abs} bind def\t% |cos(360x)|",
  1611. +  "/cF19 {720 mul sin abs} bind def\t% |sin(720x)|",
  1612. +  "/cF20 {720 mul cos abs} bind def\t% |cos(720x)|",
  1613. +  "/cF21 {3 mul} bind def\t% 3x",
  1614. +  "/cF22 {3 mul 1 sub} bind def\t% 3x-1",
  1615. +  "/cF23 {3 mul 2 sub} bind def\t% 3x-2",
  1616. +  "/cF24 {3 mul 1 sub abs} bind def\t% |3x-1|",
  1617. +  "/cF25 {3 mul 2 sub abs} bind def\t% |3x-2|",
  1618. +  "/cF26 {1.5 mul .5 sub} bind def\t% (3x-1)/2",
  1619. +  "/cF27 {1.5 mul 1 sub} bind def\t% (3x-2)/2",
  1620. +  "/cF28 {1.5 mul .5 sub abs} bind def\t% |(3x-1)/2|",
  1621. +  "/cF29 {1.5 mul 1 sub abs} bind def\t% |(3x-2)/2|",
  1622. +  "/cF30 {0.32 div 0.78125 sub} def\t% x/0.32-0.78125",
  1623. +  "/cF31 {2 mul 0.84 sub} def\t% 2*x-0.84",
  1624. +  "/cF32 {dup 0.42 le {4 mul} {dup 0.92 le {-2 mul 1.84 add} {0.08 div 11.5 sub} ifelse} ifelse } def\t% 4x;1;-2x+1.84;x/0.08-11.5",
  1625. +  "" };
  1626. +
  1627. +TERM_PUBLIC int PS_make_palette (t_sm_palette *palette)
  1628. +{
  1629. +#define R sm_palette.formulaR
  1630. +#define G sm_palette.formulaG
  1631. +#define B sm_palette.formulaB
  1632. +if (palette == NULL)
  1633. +  /* postscript can do continous number of colours */
  1634. +  return 0;
  1635. +/* write header for smooth colours */
  1636. +
  1637. +fprintf(gpoutfile, "gsave %% colour palette begin\n");
  1638. +/* print the definition of R,G,B formulae */
  1639. +
  1640. +if (sm_palette.ps_allcF == 0) { /* print only those 3 used formulae */
  1641. +    fprintf(gpoutfile, "%s\n",PostScriptColorFormulae[ abs(R) ]);
  1642. +    if (abs(G) != abs(R))
  1643. +      fprintf(gpoutfile, "%s\n",PostScriptColorFormulae[ abs(G) ]);
  1644. +    if ((abs(B) != abs(R)) && (abs(B) != abs(G)))
  1645. +      fprintf(gpoutfile, "%s\n",PostScriptColorFormulae[ abs(B) ]);
  1646. +    }
  1647. +  else { /* all color formulae are written into the output PostScript file */
  1648. +    int i = 0;
  1649. +    while ( *(PostScriptColorFormulae[i]) )
  1650. +      fprintf(gpoutfile, "%s\n",PostScriptColorFormulae[ i++ ]);
  1651. +    }
  1652. +
  1653. +/* now print something like
  1654. +/g {dup cF7 exch dup cF5 exch cF15 setrgbcolor} bind def
  1655. +*/
  1656. +fprintf(gpoutfile,"Color %s and { %% COLOUR vs. GRAY map\n",
  1657. +  (sm_palette.colorMode == SMPAL_COLOR_MODE_RGB) ? "true" : "false"
  1658. +  );
  1659. +fprintf(gpoutfile,"  /g {dup ");
  1660. +if (R < 0) fprintf(gpoutfile, "1 exch sub "); /* negate */
  1661. +fprintf(gpoutfile,"cF%i exch dup ", abs(R));
  1662. +if (G < 0) fprintf(gpoutfile, "1 exch sub "); /* negate */
  1663. +fprintf(gpoutfile,"cF%i exch ", abs(G));
  1664. +if (R<0 || G<0 || B<0) fprintf(gpoutfile,"\n\t");
  1665. +if (B < 0) fprintf(gpoutfile, "1 exch sub "); /* negate */
  1666. +fprintf(gpoutfile,"cF%i ", abs(B));
  1667. +fprintf(gpoutfile,"setrgbcolor} def\n}{\n");
  1668. +fprintf(gpoutfile, "  /g {setgray} def\n");
  1669. +fprintf(gpoutfile, "} ifelse\n");
  1670. +fprintf(gpoutfile, "/N {newpath moveto} def\n");
  1671. +fprintf(gpoutfile, "/f {rlineto fill} bind def\n");
  1672. +fprintf(gpoutfile, "/h {rlineto rlineto rlineto fill} bind def\n");
  1673. +return 0;
  1674. +#undef R
  1675. +#undef G
  1676. +#undef B
  1677. +}
  1678. +
  1679. +
  1680. +double pm3d_last_color;
  1681. +  /* last choosen colour */
  1682. +
  1683. +double pm3d_ps_color;
  1684. +  /* keep here the last set color */
  1685. +
  1686. +TERM_PUBLIC void PS_set_color (double gray)
  1687. +{
  1688. +pm3d_ps_color = gray;
  1689. +  /* map [0;1] to interval [0;1] */
  1690. +pm3d_last_color = gray;
  1691. +/* printing the gray with 4 digits and without the leading 0 ... saving space */
  1692. +if (gray <= 0) fprintf(gpoutfile, "0 g "); else
  1693. +if (gray >= 1) fprintf(gpoutfile, "1 g "); else {
  1694. +   char s[15];
  1695. +   gray = 0.0001*(int)(gray*10000+0.5); /* round it to 4 digits */
  1696. +   sprintf(s,"%.4g g ",gray);
  1697. +   if (s[0] == '0' && s[1] == '.') fprintf(gpoutfile, "%s", &(s[1]));
  1698. +     else fprintf(gpoutfile, "%s", s);
  1699. +  }
  1700. +}
  1701. +
  1702. +TERM_PUBLIC void PS_filled_polygon ( int points, gpiPoint *corners )
  1703. +{
  1704. +int i;
  1705. +/* produce lines like:
  1706. +.9335 g 9055 29350 N 695 0 V 0 564 V -695 0 f
  1707. +.9335 g 9055 29350 N 695 0 V 0 564 V -695 0 f
  1708. +*/
  1709. +fprintf(gpoutfile, "%i %i N", corners[0].x, corners[0].y);
  1710. +if (points == 4) /* shorter version */
  1711. +    fprintf(gpoutfile, " %i %i %i %i %i %i h\n",
  1712. +    corners[3].x-corners[2].x, corners[3].y-corners[2].y,
  1713. +    corners[2].x-corners[1].x, corners[2].y-corners[1].y,
  1714. +    corners[1].x-corners[0].x, corners[1].y-corners[0].y
  1715. +    );
  1716. +  else {  
  1717. +    for (i = 1; i < points-1; i++)
  1718. +    fprintf(gpoutfile, " %i %i V",
  1719. +      corners[i].x-corners[i-1].x, corners[i].y-corners[i-1].y);
  1720. +    fprintf(gpoutfile, " %i %i f\n",
  1721. +    corners[i].x-corners[i-1].x, corners[i].y-corners[i-1].y);
  1722. +    }
  1723. +}
  1724. +
  1725. +TERM_PUBLIC void PS_previous_palette(void)
  1726. +{
  1727. +fprintf(gpoutfile, "grestore %% colour palette end\n");
  1728. +}
  1729.  
  1730. +#endif /* PM3D */
  1731.  
  1732.  
  1733.  #endif /* TERM_BODY */
  1734. @@ -1702,7 +1854,12 @@
  1735.         PS_linetype, PS_put_text, PS_text_angle, 
  1736.         PS_justify_text, PS_point, do_arrow, PS_set_font, PS_pointsize,
  1737.         0 /*flags*/, 0 /*suspend*/, 0 /*resume*/, PS_fillbox, PS_linewidth
  1738. -
  1739. +#ifdef PM3D
  1740. +       ,PS_make_palette,
  1741. +       PS_previous_palette, /* write grestore */
  1742. +       PS_set_color,
  1743. +       PS_filled_polygon
  1744. +#endif
  1745.  TERM_TABLE_END(post_driver)
  1746.  
  1747.  #undef LAST_TERM
  1748.