home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / misc / volume16 / gnuplot2.02 / patch2 / patch2a
Encoding:
Text File  |  1991-01-05  |  49.4 KB  |  1,716 lines

  1. diff -cr ./README ../gnuplot2.02/README
  2. *** ./README    Tue Sep 18 14:56:36 1990
  3. --- ../gnuplot2.02/README    Tue Dec 11 16:40:48 1990
  4. ***************
  5. *** 208,213
  6.      AED         AED 512 and AED 767
  7.      ATT6300     PC with AT&T 6300 graphics
  8.      BITGRAPH    BBN BitGraph
  9.      CORONA      PC with Corona graphics 325
  10.      DXY800A     Roland DXY800A plotter
  11.      EEPIC       EEPIC-extended LaTeX driver, for EEPIC users
  12.  
  13. --- 208,214 -----
  14.      AED         AED 512 and AED 767
  15.      ATT6300     PC with AT&T 6300 graphics
  16.      BITGRAPH    BBN BitGraph
  17. +    CGI         SCO CGI
  18.      CORONA      PC with Corona graphics 325
  19.      DXY800A     Roland DXY800A plotter
  20.      EEPIC       EEPIC-extended LaTeX driver, for EEPIC users
  21. ***************
  22. *** 220,226
  23.      HP26        HP2623A and maybe others
  24.      HP75        HP7580, and probably other HPs
  25.      HPGL        HP7475 and (hopefully) lots of others
  26. !    HPLJET      HP Laserjet
  27.      IMAGEN      Imagen laser printers (300dpi) (requires -Iterm also)
  28.      IRIS4D      IRIS4D series computer
  29.      KERMIT      MS-Kermit Tektronix 4010 emulator
  30.  
  31. --- 221,227 -----
  32.      HP26        HP2623A and maybe others
  33.      HP75        HP7580, and probably other HPs
  34.      HPGL        HP7475 and (hopefully) lots of others
  35. !    HPLJII      HP Laserjet II
  36.      IMAGEN      Imagen laser printers (300dpi) (requires -Iterm also)
  37.      IRIS4D      IRIS4D series computer
  38.      KERMIT      MS-Kermit Tektronix 4010 emulator
  39. ***************
  40. *** 227,233
  41.      LATEX       LATEX picture environment
  42.      NEC         NEC CP6 pinwriter printer
  43.      POSTSCRIPT  Postscript
  44. !    PROPRINTER  IBM Proprinter
  45.      QMS         QMS/QUIC laserprinter (Talaris 1200 and others)
  46.      REGIS       ReGis graphics (vt125, vt220, vt240, Gigis...)
  47.      SELANAR     Selanar
  48.  
  49. --- 228,234 -----
  50.      LATEX       LATEX picture environment
  51.      NEC         NEC CP6 pinwriter printer
  52.      POSTSCRIPT  Postscript
  53. !    PRESCRIBE   Kyocera Laser printer
  54.      QMS         QMS/QUIC laserprinter (Talaris 1200 and others)
  55.      REGIS       ReGis graphics (vt125, vt220, vt240, Gigis...)
  56.      SELANAR     Selanar
  57. ***************
  58. *** 239,244
  59.      UNIXPC      unixpc (ATT 3b1 or ATT 7300)
  60.      UNIXPLOT    unixplot
  61.      V384        Vectrix 384 and tandy color printer
  62.      X11         X11R4 window system
  63.   
  64.   
  65.  
  66. --- 240,246 -----
  67.      UNIXPC      unixpc (ATT 3b1 or ATT 7300)
  68.      UNIXPLOT    unixplot
  69.      V384        Vectrix 384 and tandy color printer
  70. +    VTTEK       VT like Tektronix 4010 emulator
  71.      X11         X11R4 window system
  72.   
  73.   
  74. ***************
  75. *** 279,285
  76.   
  77.   under MSDOS:
  78.   Using Microsoft C 5.10.
  79. !     make makefile.msc
  80.   
  81.   Using Turbo C 2.0.
  82.       make -fmakefile.tc
  83.  
  84. --- 281,288 -----
  85.   
  86.   under MSDOS:
  87.   Using Microsoft C 5.10.
  88. !       copy makefile.msc
  89. !       make makefile
  90.   
  91.   Using Turbo C 2.0.
  92.         copy makefile.tc
  93. ***************
  94. *** 282,288
  95.       make makefile.msc
  96.   
  97.   Using Turbo C 2.0.
  98. !     make -fmakefile.tc
  99.   
  100.   The file gnuplot.gih is needed for help on the PC.
  101.   If the file gnuplot.gih is not in the default directory, then use:
  102.  
  103. --- 285,293 -----
  104.         make makefile
  105.   
  106.   Using Turbo C 2.0.
  107. !       copy makefile.tc
  108. !   Edit makefile to change TC, BIN, BGI.
  109. !       make
  110.   
  111.   The file gnuplot.gih is needed for help on the PC.
  112.   If the file gnuplot.gih is not in the default directory, then use:
  113. diff -cr ./README.x11 ../gnuplot2.02/README.x11
  114. *** ./README.x11    Tue Sep 18 14:56:39 1990
  115. --- ../gnuplot2.02/README.x11    Mon Nov 26 02:31:27 1990
  116. ***************
  117. *** 1,4
  118. ! Gnuplot Support for X11
  119.   -----------------------
  120.   31 August 1990
  121.   
  122.  
  123. --- 1,4 -----
  124. ! Gnuplot (patch 2) Support for X11
  125.   -----------------------
  126.   24 November 1990
  127.   
  128. ***************
  129. *** 1,6
  130.   Gnuplot Support for X11
  131.   -----------------------
  132. ! 31 August 1990
  133.   
  134.   Installing gnuplot X11 support requires:
  135.   
  136.  
  137. --- 1,6 -----
  138.   Gnuplot (patch 2) Support for X11
  139.   -----------------------
  140. ! 24 November 1990
  141.   
  142.   Installing gnuplot X11 support requires:
  143.   
  144. ***************
  145. *** 10,19
  146.   
  147.      o compilation of the outboard X11 terminal driver gnuplot_x11
  148.   
  149. -    o additions to the gnuplot(1) man page to describe command line
  150. -      options and tailorable resources available when gnuplot terminal
  151. -      types x11 or X11 are used.
  152.   makefile.x11 (a modified version of makefile.unx) provides these additional
  153.   functions. The X11LIBS and X11INCLUDES parameters should be set to point to
  154.   the X11 libraries and include files on your system. Comments give settings
  155.  
  156. --- 10,15 -----
  157.   
  158.      o compilation of the outboard X11 terminal driver gnuplot_x11
  159.   
  160.   makefile.x11 (a modified version of makefile.unx) provides these additional
  161.   functions. The X11LIBS and X11INCLUDES parameters should be set to point to
  162.   the X11 libraries and include files on your system. Comments give settings
  163. ***************
  164. *** 17,23
  165.   makefile.x11 (a modified version of makefile.unx) provides these additional
  166.   functions. The X11LIBS and X11INCLUDES parameters should be set to point to
  167.   the X11 libraries and include files on your system. Comments give settings
  168. ! for several systems.
  169.   
  170.   Sorry, as of this writing no support is available for systems without the 
  171.   Athena widget library (libXaw.a), or platforms other than unix.
  172.  
  173. --- 13,20 -----
  174.   makefile.x11 (a modified version of makefile.unx) provides these additional
  175.   functions. The X11LIBS and X11INCLUDES parameters should be set to point to
  176.   the X11 libraries and include files on your system. Comments give settings
  177. ! for several systems. The X11FLAGS parameter should be set to "-DMOTIF" to
  178. ! compile for the Motif (libXm.a) rather than Athena (libXaw.a) widget library.
  179.   
  180.   The gnuplot man page describes command line options and tailorable resources 
  181.   available when gnuplot terminal types x11 or X11 are used.
  182. ***************
  183. *** 19,26
  184.   the X11 libraries and include files on your system. Comments give settings
  185.   for several systems.
  186.   
  187. ! Sorry, as of this writing no support is available for systems without the 
  188. ! Athena widget library (libXaw.a), or platforms other than unix.
  189.   
  190.   Differences from "xgnuplot"
  191.   ---------------------------
  192.  
  193. --- 16,23 -----
  194.   for several systems. The X11FLAGS parameter should be set to "-DMOTIF" to
  195.   compile for the Motif (libXm.a) rather than Athena (libXaw.a) widget library.
  196.   
  197. ! The gnuplot man page describes command line options and tailorable resources 
  198. ! available when gnuplot terminal types x11 or X11 are used.
  199.   
  200.   Sorry, as of this writing no support is available for platforms other than unix.
  201.   
  202. ***************
  203. *** 22,27
  204.   Sorry, as of this writing no support is available for systems without the 
  205.   Athena widget library (libXaw.a), or platforms other than unix.
  206.   
  207.   Differences from "xgnuplot"
  208.   ---------------------------
  209.   
  210.  
  211. --- 19,26 -----
  212.   The gnuplot man page describes command line options and tailorable resources 
  213.   available when gnuplot terminal types x11 or X11 are used.
  214.   
  215. + Sorry, as of this writing no support is available for platforms other than unix.
  216.   Differences from "xgnuplot"
  217.   ---------------------------
  218.   This X11 support is based on the xgnuplot wrapper/terminal driver distributed 
  219. ***************
  220. *** 24,29
  221.   
  222.   Differences from "xgnuplot"
  223.   ---------------------------
  224.   
  225.   This X11 support is based on (and replaces) the xgnuplot wrapper/terminal 
  226.   driver which was distributed separately from gnuplot. Differences:
  227.  
  228. --- 23,30 -----
  229.   
  230.   Differences from "xgnuplot"
  231.   ---------------------------
  232. + This X11 support is based on the xgnuplot wrapper/terminal driver distributed 
  233. + separately from gnuplot. Differences:
  234.   
  235.      o Gnuplot silently invokes the outboard driver, rather than vice versa.
  236.        Thus resource names in .Xdefaults begin with "gnuplot" rather than
  237. ***************
  238. *** 25,33
  239.   Differences from "xgnuplot"
  240.   ---------------------------
  241.   
  242. - This X11 support is based on (and replaces) the xgnuplot wrapper/terminal 
  243. - driver which was distributed separately from gnuplot. Differences:
  244.      o Gnuplot silently invokes the outboard driver, rather than vice versa.
  245.        Thus resource names in .Xdefaults begin with "gnuplot" rather than
  246.        "xgnuplot". En passant, this change fixed the bug where xgnuplot would
  247.  
  248. --- 26,31 -----
  249.   This X11 support is based on the xgnuplot wrapper/terminal driver distributed 
  250.   separately from gnuplot. Differences:
  251.   
  252.      o Gnuplot silently invokes the outboard driver, rather than vice versa.
  253.        Thus resource names in .Xdefaults begin with "gnuplot" rather than
  254.        "xgnuplot".
  255. ***************
  256. *** 30,38
  257.   
  258.      o Gnuplot silently invokes the outboard driver, rather than vice versa.
  259.        Thus resource names in .Xdefaults begin with "gnuplot" rather than
  260. !      "xgnuplot". En passant, this change fixed the bug where xgnuplot would
  261. !      hang until Ctrl-C when gnuplot was exited without plotting at least
  262. !      one x11/X11 plot.
  263.   
  264.      o When the window is resized, the currently displayed plot is automatically
  265.        rescaled and replotted.
  266.  
  267. --- 28,34 -----
  268.   
  269.      o Gnuplot silently invokes the outboard driver, rather than vice versa.
  270.        Thus resource names in .Xdefaults begin with "gnuplot" rather than
  271. !      "xgnuplot".
  272.   
  273.      o When the window is resized, the currently displayed plot is automatically
  274.        rescaled and replotted.
  275. ***************
  276. *** 37,48
  277.      o When the window is resized, the currently displayed plot is automatically
  278.        rescaled and replotted.
  279.   
  280. !    o Compiles under X11 R3 as well as R4. This required using XtInitialize
  281. !      instead of XtAppInitialize, (char *) instead of XtPointer for callback
  282. !      client data declarations, removing a reference to XGetGCValues, and 
  283. !      parameterizing (X11INCLUDES in makefile.x11) the location of the needed 
  284. !      Athena include files.
  285.   
  286.   ---------------------------------
  287.   Ed Kubaitis, ejk@uxh.cso.uiuc.edu
  288.  
  289. --- 33,40 -----
  290.      o When the window is resized, the currently displayed plot is automatically
  291.        rescaled and replotted.
  292.   
  293. !    o Compiles under X11 R3 as well as R4 and with either the Athena or Motif 
  294. !      widget libraries.
  295.   
  296.   ---------------------------------
  297.   Ed Kubaitis, ejk@uxh.cso.uiuc.edu
  298. Common subdirectories: ./bugtest and ../gnuplot2.02/bugtest
  299. diff -cr ./buildvms.com ../gnuplot2.02/buildvms.com
  300. *** ./buildvms.com    Tue Sep 18 14:56:40 1990
  301. --- ../gnuplot2.02/buildvms.com    Tue Dec  4 11:43:40 1990
  302. ***************
  303. *** 3,8
  304.   $ !TERMFLAGS = "/define=()"
  305.   $ TERMFLAGS = ""
  306.   $ set verify
  307.   $ cc 'CFLAGS' command.c
  308.   $ cc 'CFLAGS' eval.c
  309.   $ cc 'CFLAGS' graphics.c
  310.  
  311. --- 3,9 -----
  312.   $ !TERMFLAGS = "/define=()"
  313.   $ TERMFLAGS = ""
  314.   $ set verify
  315. + $ cc 'CFLAGS' bitmap.c
  316.   $ cc 'CFLAGS' command.c
  317.   $ cc 'CFLAGS' eval.c
  318.   $ cc 'CFLAGS' graphics.c
  319. ***************
  320. *** 17,23
  321.   $ cc 'CFLAGS' util.c
  322.   $ cc 'CFLAGS' version.c
  323.   $ link /exe=gnuplot -
  324. !    command.obj,eval.obj,graphics.obj,internal.obj, -
  325.      misc.obj,parse.obj,plot.obj,scanner.obj,setshow.obj, -
  326.      standard.obj,term.obj,util.obj,version.obj ,linkopt.vms/opt
  327.   $ cc [.docs]doc2hlp.c
  328.  
  329. --- 18,24 -----
  330.   $ cc 'CFLAGS' util.c
  331.   $ cc 'CFLAGS' version.c
  332.   $ link /exe=gnuplot -
  333. !    bitmap.obj,command.obj,eval.obj,graphics.obj,internal.obj, -
  334.      misc.obj,parse.obj,plot.obj,scanner.obj,setshow.obj, -
  335.      standard.obj,term.obj,util.obj,version.obj ,linkopt.vms/opt
  336.   $ cc [.docs]doc2hlp.c
  337. diff -cr ./command.c ../gnuplot2.02/command.c
  338. *** ./command.c    Tue Sep 18 14:56:42 1990
  339. --- ../gnuplot2.02/command.c    Thu Nov 29 10:13:34 1990
  340. ***************
  341. *** 75,81
  342.   extern int strlen(), strcmp();
  343.   
  344.   #ifdef unix
  345. ! extern char *getwd();
  346.   #else
  347.   extern char *getcwd();
  348.   #endif
  349.  
  350. --- 75,82 -----
  351.   extern int strlen(), strcmp();
  352.   
  353.   #ifdef unix
  354. ! #ifdef GETCWD
  355. ! extern char *getcwd();    /* some Unix's use getcwd */
  356.   #else
  357.   extern char *getwd();    /* most Unix's use getwd */
  358.   #endif
  359. ***************
  360. *** 77,83
  361.   #ifdef unix
  362.   extern char *getwd();
  363.   #else
  364. ! extern char *getcwd();
  365.   #endif
  366.   extern int chdir();
  367.   
  368.  
  369. --- 78,84 -----
  370.   #ifdef GETCWD
  371.   extern char *getcwd();    /* some Unix's use getcwd */
  372.   #else
  373. ! extern char *getwd();    /* most Unix's use getwd */
  374.   #endif
  375.   #else
  376.   extern char *getcwd();    /* Turbo C, MSC and VMS use getcwd */
  377. ***************
  378. *** 79,84
  379.   #else
  380.   extern char *getcwd();
  381.   #endif
  382.   extern int chdir();
  383.   
  384.   extern double magnitude(),angle(),real(),imag();
  385.  
  386. --- 80,88 -----
  387.   #else
  388.   extern char *getwd();    /* most Unix's use getwd */
  389.   #endif
  390. + #else
  391. + extern char *getcwd();    /* Turbo C, MSC and VMS use getcwd */
  392. + #endif
  393.   extern int chdir();
  394.   
  395.   extern double magnitude(),angle(),real(),imag();
  396. ***************
  397. *** 287,294
  398.       }
  399.       else if (almost_equals(c_token,"pwd")) {
  400.   #ifdef unix
  401. ! /* unix has getwd() */
  402. !       (void) getwd(sv_file);
  403.   #else
  404.   /* Turbo C and VMS have getcwd() */
  405.         (void) getcwd(sv_file,MAX_ID_LEN);
  406.  
  407. --- 291,298 -----
  408.       }
  409.       else if (almost_equals(c_token,"pwd")) {
  410.   #ifdef unix
  411. ! #ifdef GETCWD
  412. !       (void) getcwd(sv_file,MAX_ID_LEN); /* some Unix's use getcwd */
  413.   #else
  414.         (void) getwd(sv_file); /* most Unix's use getwd */
  415.   #endif
  416. ***************
  417. *** 290,295
  418.   /* unix has getwd() */
  419.         (void) getwd(sv_file);
  420.   #else
  421.   /* Turbo C and VMS have getcwd() */
  422.         (void) getcwd(sv_file,MAX_ID_LEN);
  423.   #endif
  424.  
  425. --- 294,302 -----
  426.   #ifdef GETCWD
  427.         (void) getcwd(sv_file,MAX_ID_LEN); /* some Unix's use getcwd */
  428.   #else
  429. +       (void) getwd(sv_file); /* most Unix's use getwd */
  430. + #endif
  431. + #else
  432.   /* Turbo C and VMS have getcwd() */
  433.         (void) getcwd(sv_file,MAX_ID_LEN);
  434.   #endif
  435. ***************
  436. *** 328,333
  437.   
  438.   
  439.   plotrequest()
  440.   {
  441.        BOOLEAN changed;
  442.       int dummy_token = -1;
  443.  
  444. --- 335,346 -----
  445.   
  446.   
  447.   plotrequest()
  448. + /*
  449. +    In the parametric case we can say 
  450. +       plot [a= -4:4] [-2:2] [-1:1] sin(a),a**2
  451. +    while in the non-parametric case we would say only
  452. +       plot [b= -2:2] [-1:1] sin(b)
  453. + */
  454.   {
  455.        BOOLEAN changed;
  456.       int dummy_token = -1;
  457. ***************
  458. *** 332,337
  459.        BOOLEAN changed;
  460.       int dummy_token = -1;
  461.   
  462.        autoscale_lx = autoscale_x;
  463.        autoscale_ly = autoscale_y;
  464.       
  465.  
  466. --- 345,351 -----
  467.        BOOLEAN changed;
  468.       int dummy_token = -1;
  469.   
  470. +     autoscale_lt = autoscale_t;
  471.        autoscale_lx = autoscale_x;
  472.        autoscale_ly = autoscale_y;
  473.       
  474. ***************
  475. *** 350,355
  476.                  /* used to be: int_error("'=' expected",c_token); */
  477.               }
  478.           }
  479.           changed = load_range(&xmin,&xmax);
  480.           if (!equals(c_token,"]"))
  481.               int_error("']' expected",c_token);
  482.  
  483. --- 364,383 -----
  484.                  /* used to be: int_error("'=' expected",c_token); */
  485.               }
  486.           }
  487. +         changed = parametric ? load_range(&tmin,&tmax):load_range(&xmin,&xmax);
  488. +         if (!equals(c_token,"]"))
  489. +             int_error("']' expected",c_token);
  490. +         c_token++;
  491. +         if (changed) {
  492. +             if (parametric)
  493. +                 autoscale_lt = FALSE;
  494. +             else
  495. +                 autoscale_lx = FALSE;
  496. +         }
  497. +     }
  498. +     if (parametric && equals(c_token,"[")) { /* set optional x ranges */
  499. +         c_token++;
  500.           changed = load_range(&xmin,&xmax);
  501.           if (!equals(c_token,"]"))
  502.               int_error("']' expected",c_token);
  503. ***************
  504. *** 417,422
  505.   register FILE *fp;
  506.   float x, y;
  507.   int npoints;                /* number of points and breaks read */
  508.   
  509.       quote_str(data_file, c_token);
  510.       this_plot->plot_type = DATA;
  511.  
  512. --- 445,453 -----
  513.   register FILE *fp;
  514.   float x, y;
  515.   int npoints;                /* number of points and breaks read */
  516. + float temp;
  517. + BOOLEAN yfirst;
  518. + char format[MAX_LINE_LEN+1];
  519.   
  520.       quote_str(data_file, c_token);
  521.       this_plot->plot_type = DATA;
  522. ***************
  523. *** 423,428
  524.       if ((fp = fopen(data_file, "r")) == (FILE *)NULL)
  525.           os_error("can't open data file", c_token);
  526.   
  527.       l_num = 0;
  528.        datum = 0;
  529.       i = 0;
  530.  
  531. --- 454,483 -----
  532.       if ((fp = fopen(data_file, "r")) == (FILE *)NULL)
  533.           os_error("can't open data file", c_token);
  534.   
  535. +     format[0] = '\0';
  536. +     yfirst = FALSE;
  537. +     c_token++;    /* skip data file name */
  538. +     if (almost_equals(c_token,"u$sing")) {
  539. +         c_token++;      /* skip "using" */
  540. +         if (!isstring(c_token)) {
  541. +             if ( equals(c_token,"xy") || equals(c_token,"y") )
  542. +                 yfirst = FALSE;
  543. +             else if (equals(c_token,"yx"))
  544. +                 yfirst = TRUE;
  545. +             else 
  546. +                 int_error("expecting xy, yx, y or format (scanf) string",c_token);
  547. +             c_token++;    /* skip "xy", "yx" or "y" */
  548. +         }
  549. +         if (isstring(c_token)) {
  550. +             quotel_str(format, c_token);
  551. +             c_token++;    /* skip format */
  552. +         }
  553. +         else
  554. +             int_error("expecting format (scanf) string",c_token);
  555. +     }
  556. +     if (strlen(format) == 0)
  557. +         strcpy(format,"%f %f");
  558.       l_num = 0;
  559.        datum = 0;
  560.       i = 0;
  561. ***************
  562. *** 441,447
  563.               continue;
  564.           }
  565.   
  566. !         switch (sscanf(line, "%f %f", &x, &y)) {
  567.               case 1: {        /* only one number on the line */
  568.                  y = x;        /* assign that number to y */
  569.                  x = datum;    /* and make the index into x */
  570.  
  571. --- 496,502 -----
  572.               continue;
  573.           }
  574.   
  575. !         switch (sscanf(line, format, &x, &y)) {
  576.               case 1: {        /* only one number on the line */
  577.                  y = x;        /* assign that number to y */
  578.                  x = datum;    /* and make the index into x */
  579. ***************
  580. *** 448,453
  581.                  /* no break; !!! */
  582.               }
  583.               case 2: {
  584.                  datum++;
  585.                  this_plot->points[i].type = INRANGE;
  586.   
  587.  
  588. --- 503,513 -----
  589.                  /* no break; !!! */
  590.               }
  591.               case 2: {
  592. +                if (yfirst) { /* exchange x and y */
  593. +                   temp = y;
  594. +                   y = x;
  595. +                   x = temp;
  596. +                }
  597.                  datum++;
  598.                  this_plot->points[i].type = INRANGE;
  599.   
  600. ***************
  601. *** 517,523
  602.   {
  603.   register int i;
  604.   register struct curve_points *this_plot, **tp_ptr;
  605. ! register int start_token, mysamples;
  606.   register int begin_token;
  607.   register double x_min, x_max, y_min, y_max, x;
  608.   register double xdiff, temp;
  609.  
  610. --- 577,583 -----
  611.   {
  612.   register int i;
  613.   register struct curve_points *this_plot, **tp_ptr;
  614. ! register int start_token, end_token, mysamples;
  615.   register int begin_token;
  616.   double x_min, x_max, y_min, y_max;
  617.   register double x, xdiff, temp;
  618. ***************
  619. *** 519,526
  620.   register struct curve_points *this_plot, **tp_ptr;
  621.   register int start_token, mysamples;
  622.   register int begin_token;
  623. ! register double x_min, x_max, y_min, y_max, x;
  624. ! register double xdiff, temp;
  625.   static struct value a;
  626.   BOOLEAN some_data_files = FALSE;
  627.   int plot_num, line_num, point_num;
  628.  
  629. --- 579,586 -----
  630.   register struct curve_points *this_plot, **tp_ptr;
  631.   register int start_token, end_token, mysamples;
  632.   register int begin_token;
  633. ! double x_min, x_max, y_min, y_max;
  634. ! register double x, xdiff, temp;
  635.   static struct value a;
  636.   BOOLEAN ltmp, some_data_files = FALSE;
  637.   int plot_num, line_num, point_num, xparam=0;
  638. ***************
  639. *** 522,529
  640.   register double x_min, x_max, y_min, y_max, x;
  641.   register double xdiff, temp;
  642.   static struct value a;
  643. ! BOOLEAN some_data_files = FALSE;
  644. ! int plot_num, line_num, point_num;
  645.   
  646.       mysamples = samples;
  647.   
  648.  
  649. --- 582,591 -----
  650.   double x_min, x_max, y_min, y_max;
  651.   register double x, xdiff, temp;
  652.   static struct value a;
  653. ! BOOLEAN ltmp, some_data_files = FALSE;
  654. ! int plot_num, line_num, point_num, xparam=0;
  655. ! char *xtitle;
  656. ! void parametric_fixup();
  657.   
  658.       mysamples = samples;
  659.   
  660. ***************
  661. *** 569,574
  662.               }
  663.   
  664.               if (isstring(c_token)) {            /* data file to plot */
  665.                   if (!some_data_files && autoscale_lx) {
  666.                       xmin = VERYLARGE;
  667.                       xmax = -VERYLARGE;
  668.  
  669. --- 631,640 -----
  670.               }
  671.   
  672.               if (isstring(c_token)) {            /* data file to plot */
  673. +                 if (parametric && xparam) 
  674. +                     int_error("previous parametric function not fully specified",
  675. +                                                                     c_token);
  676.                   if (!some_data_files && autoscale_lx) {
  677.                       xmin = VERYLARGE;
  678.                       xmax = -VERYLARGE;
  679. ***************
  680. *** 577,584
  681.   
  682.                   this_plot->plot_type = DATA;
  683.                   this_plot->plot_style = data_style;
  684. !                 get_data(this_plot);
  685. !                 c_token++;
  686.               } 
  687.               else {                            /* function to plot */
  688.                   this_plot->plot_type = FUNC;
  689.  
  690. --- 643,650 -----
  691.   
  692.                   this_plot->plot_type = DATA;
  693.                   this_plot->plot_style = data_style;
  694. !                 end_token = c_token;
  695. !                 get_data(this_plot); /* this also parses the using option */
  696.               } 
  697.               else {                            /* function to plot */
  698.                   if (parametric)            /* working on x parametric function */
  699. ***************
  700. *** 581,586
  701.                   c_token++;
  702.               } 
  703.               else {                            /* function to plot */
  704.                   this_plot->plot_type = FUNC;
  705.                   this_plot->plot_style = func_style;
  706.                   dummy_func = &plot_func;
  707.  
  708. --- 647,654 -----
  709.                   get_data(this_plot); /* this also parses the using option */
  710.               } 
  711.               else {                            /* function to plot */
  712. +                 if (parametric)            /* working on x parametric function */
  713. +                     xparam = 1 - xparam;
  714.                   this_plot->plot_type = FUNC;
  715.                   this_plot->plot_style = func_style;
  716.                   dummy_func = &plot_func;
  717. ***************
  718. *** 586,591
  719.                   dummy_func = &plot_func;
  720.                   plot_func.at = temp_at();
  721.                   /* ignore it for now */
  722.               }
  723.   
  724.               if (almost_equals(c_token,"t$itle")) {
  725.  
  726. --- 654,660 -----
  727.                   dummy_func = &plot_func;
  728.                   plot_func.at = temp_at();
  729.                   /* ignore it for now */
  730. +                 end_token = c_token-1;
  731.               }
  732.   
  733.               if (almost_equals(c_token,"t$itle")) {
  734. ***************
  735. *** 589,594
  736.               }
  737.   
  738.               if (almost_equals(c_token,"t$itle")) {
  739.                   c_token++;
  740.                   if ( (input_line[token[c_token].start_index]=='\'')
  741.                      ||(input_line[token[c_token].start_index]=='"') ) {
  742.  
  743. --- 658,671 -----
  744.               }
  745.   
  746.               if (almost_equals(c_token,"t$itle")) {
  747. +                 if (parametric) {
  748. +                     if (xparam) 
  749. +                         int_error(
  750. +         "\"title\" allowed only after parametric function fully specified",
  751. +                                                                     c_token);
  752. +                     else if (xtitle != NULL)
  753. +                         xtitle[0] = '\0';  /* Remove default title .*/
  754. +                 }
  755.                   c_token++;
  756.                   if ( (input_line[token[c_token].start_index]=='\'')
  757.                      ||(input_line[token[c_token].start_index]=='"') ) {
  758. ***************
  759. *** 599,609
  760.                   }
  761.                   c_token++;
  762.               }
  763. !             else {
  764. !                 m_capture(&(this_plot->title),start_token,c_token-1);
  765. !             }
  766. !             this_plot->line_type = line_num;
  767.               this_plot->point_type = point_num;
  768.   
  769.               if (almost_equals(c_token,"w$ith")) {
  770.  
  771. --- 676,687 -----
  772.                   }
  773.                   c_token++;
  774.               }
  775. !               else {
  776. !                   m_capture(&(this_plot->title),start_token,end_token);
  777. !                  if (xparam) xtitle = this_plot->title;
  778. !               }
  779. !   
  780. !               this_plot->line_type = line_num;
  781.               this_plot->point_type = point_num;
  782.   
  783.               if (almost_equals(c_token,"w$ith")) {
  784. ***************
  785. *** 607,612
  786.               this_plot->point_type = point_num;
  787.   
  788.               if (almost_equals(c_token,"w$ith")) {
  789.                   this_plot->plot_style = get_style();
  790.               }
  791.   
  792.  
  793. --- 685,693 -----
  794.               this_plot->point_type = point_num;
  795.   
  796.               if (almost_equals(c_token,"w$ith")) {
  797. +                 if (parametric && xparam) 
  798. +                     int_error("\"with\" allowed only after parametric function fully specified",
  799. +                                                                     c_token);
  800.                   this_plot->plot_style = get_style();
  801.               }
  802.   
  803. ***************
  804. *** 620,627
  805.               }
  806.               if ( (this_plot->plot_style == POINTS) ||
  807.                    (this_plot->plot_style == LINESPOINTS) )
  808. !                     point_num++;
  809. !             line_num++;
  810.   
  811.               tp_ptr = &(this_plot->next_cp);
  812.           }
  813.  
  814. --- 701,708 -----
  815.               }
  816.               if ( (this_plot->plot_style == POINTS) ||
  817.                    (this_plot->plot_style == LINESPOINTS) )
  818. !                     if (!xparam) point_num++;
  819. !             if (!xparam) line_num++;
  820.   
  821.               tp_ptr = &(this_plot->next_cp);
  822.           }
  823. ***************
  824. *** 632,637
  825.               break;
  826.       }
  827.   
  828.   /*** Second Pass: Evaluate the functions ***/
  829.   /* Everything is defined now, except the function data. We expect
  830.    * no syntax errors, etc, since the above parsed it all. This makes 
  831.  
  832. --- 713,728 -----
  833.               break;
  834.       }
  835.   
  836. +     if (parametric && xparam) 
  837. +         int_error("parametric function not fully specified", NO_CARET);
  838. +     if (parametric) {
  839. +     /* Swap t and x ranges for duration of these eval_plot computations. */
  840. +         ltmp = autoscale_lx; autoscale_lx = autoscale_lt; autoscale_lt = ltmp;
  841. +         temp = xmin; xmin = tmin; tmin = temp;
  842. +         temp = xmax; xmax = tmax; tmax = temp;
  843. +     }
  844.   /*** Second Pass: Evaluate the functions ***/
  845.   /* Everything is defined now, except the function data. We expect
  846.    * no syntax errors, etc, since the above parsed it all. This makes 
  847. ***************
  848. *** 639,645
  849.    */
  850.        if (xmin == xmax)
  851.         if (autoscale_lx) {
  852. !          fprintf(stderr, "Warning: empty x range [%g:%g], ", xmin,xmax);
  853.            if (xmin == 0.0) {
  854.               /* completely arbitary */
  855.               xmin = -1.;
  856.  
  857. --- 730,737 -----
  858.    */
  859.        if (xmin == xmax)
  860.         if (autoscale_lx) {
  861. !          fprintf(stderr, "Warning: empty %c range [%g:%g], ", 
  862. !             parametric ? 't' : 'x', xmin,xmax);
  863.            if (xmin == 0.0) {
  864.               /* completely arbitary */
  865.               xmin = -1.;
  866. ***************
  867. *** 654,659
  868.            int_error("x range is empty", c_token);
  869.         }
  870.   
  871.       if (log_x) {
  872.          if (xmin <= 0.0 || xmax <= 0.0)
  873.           int_error("x range must be greater than 0 for log scale!",NO_CARET);
  874.  
  875. --- 746,756 -----
  876.            int_error("x range is empty", c_token);
  877.         }
  878.   
  879. +     /* give error if xrange badly set from missing datafile error */
  880. +     if (xmin == VERYLARGE || xmax == -VERYLARGE) {
  881. +         int_error("x range is invalid", c_token);
  882. +     }
  883.       if (log_x) {
  884.          if (xmin <= 0.0 || xmax <= 0.0)
  885.           int_error("x range must be greater than 0 for log scale!",NO_CARET);
  886. ***************
  887. *** 679,684
  888.               if (isstring(c_token)) {            /* data file to plot */
  889.                   /* ignore this now */
  890.                   c_token++;
  891.               } 
  892.               else {                            /* function to plot */
  893.                   dummy_func = &plot_func;
  894.  
  895. --- 776,787 -----
  896.               if (isstring(c_token)) {            /* data file to plot */
  897.                   /* ignore this now */
  898.                   c_token++;
  899. +                 if (almost_equals(c_token,"u$sing")) {
  900. +                     c_token++;      /* skip "using" */
  901. +                     if (!isstring(c_token))
  902. +                         c_token++;    /* skip "xy", "yx" or "y" */
  903. +                     c_token++;        /* skip format string */
  904. +                 }
  905.               } 
  906.               else {                            /* function to plot */
  907.                   if (parametric)            /* working on x parametric function */
  908. ***************
  909. *** 681,686
  910.                   c_token++;
  911.               } 
  912.               else {                            /* function to plot */
  913.                   dummy_func = &plot_func;
  914.                   plot_func.at = temp_at(); /* reparse function */
  915.       
  916.  
  917. --- 784,791 -----
  918.                   }
  919.               } 
  920.               else {                            /* function to plot */
  921. +                 if (parametric)            /* working on x parametric function */
  922. +                     xparam = 1 - xparam;
  923.                   dummy_func = &plot_func;
  924.                   plot_func.at = temp_at(); /* reparse function */
  925.       
  926. ***************
  927. *** 724,731
  928.                       if (autoscale_ly || polar
  929.                          || inrange(temp, ymin, ymax)) {
  930.                          this_plot->points[i].type = INRANGE;
  931. !                        if (autoscale_ly && temp < ymin) ymin = temp;
  932. !                        if (autoscale_ly && temp > ymax) ymax = temp;
  933.                       } else
  934.                        this_plot->points[i].type = OUTRANGE;
  935.                   }
  936.  
  937. --- 829,839 -----
  938.                       if (autoscale_ly || polar
  939.                          || inrange(temp, ymin, ymax)) {
  940.                          this_plot->points[i].type = INRANGE;
  941. !                     /* When xparam is 1 we are not really computing y's! */
  942. !                         if (!xparam && autoscale_ly) {
  943. !                            if (temp < ymin) ymin = temp;
  944. !                            if (temp > ymax) ymax = temp;
  945. !                         }
  946.                       } else
  947.                        this_plot->points[i].type = OUTRANGE;
  948.                   }
  949. ***************
  950. *** 789,794
  951.           y_max = ymax;
  952.       }
  953.       capture(replot_line,plot_token,c_token);    
  954.       do_plot(first_plot,plot_num,x_min,x_max,y_min,y_max);
  955.   }
  956.   
  957.  
  958. --- 897,918 -----
  959.           y_max = ymax;
  960.       }
  961.       capture(replot_line,plot_token,c_token);    
  962. +     if (parametric) {
  963. +     /* Now put t and x ranges back before we actually plot anything. */
  964. +         ltmp = autoscale_lx; autoscale_lx = autoscale_lt; autoscale_lt = ltmp;
  965. +         temp = xmin; xmin = tmin; tmin = temp;
  966. +         temp = xmax; xmax = tmax; tmax = temp;
  967. +         if (some_data_files && autoscale_lx) {
  968. +         /* 
  969. +             Stop any further autoscaling in this case (may be a mistake, have
  970. +               to consider what is really wanted some day in the future--jdc). 
  971. +         */
  972. +             autoscale_lx = 0;
  973. +         }
  974. +     /* Now actually fix the plot pairs to be single plots. */
  975. +         parametric_fixup (first_plot, &plot_num, &x_min, &x_max);
  976. +     }
  977.       do_plot(first_plot,plot_num,x_min,x_max,y_min,y_max);
  978.   }
  979.   
  980. ***************
  981. *** 804,809
  982.   #endif
  983.       exit(status);
  984.   }
  985.   
  986.   #ifdef MSDOS
  987.   #ifndef __TURBOC__    /* Turbo C already has sleep() */
  988.  
  989. --- 928,1074 -----
  990.   #endif
  991.       exit(status);
  992.   }
  993. + void parametric_fixup (start_plot, plot_num, x_min, x_max)
  994. + struct curve_points *start_plot;
  995. + int *plot_num;
  996. + double *x_min, *x_max;
  997. + /*
  998. +     The hardest part of this routine is collapsing the FUNC plot types
  999. +    in the list (which are gauranteed to occur in (x,y) pairs while 
  1000. +     preserving the non-FUNC type plots intact.  This means we have to
  1001. +     work our way through various lists.  Examples (hand checked):
  1002. +         start_plot:F1->F2->NULL ==> F2->NULL
  1003. +         start_plot:F1->F2->F3->F4->F5->F6->NULL ==> F2->F4->F6->NULL
  1004. +         start_plot:F1->F2->D1->D2->F3->F4->D3->NULL ==> F2->D1->D2->F4->D3->NULL
  1005. +     
  1006. +     Of course, the more interesting work is to move the y values of
  1007. +     the x function to become the x values of the y function (checking
  1008. +     the mins and maxs as we go along).
  1009. + */
  1010. + {
  1011. +     struct curve_points *xp, *new_list, *yp = start_plot, *tmp, 
  1012. +             *free_list, *free_head=NULL;
  1013. +     int i, tlen, curve; 
  1014. +     char *new_title;
  1015. +     double lxmin, lxmax, temp;
  1016. +     if (autoscale_lx) {
  1017. +         lxmin = VERYLARGE;
  1018. +         lxmax = -VERYLARGE;
  1019. +     } else {
  1020. +         lxmin = xmin;
  1021. +         lxmax = xmax;
  1022. +     }
  1023. + /* 
  1024. +     Ok, go through all the plots and move FUNC types together.  Note: this
  1025. +     originally was written to look for a NULL next pointer, but gnuplot 
  1026. +     wants to be sticky in grabbing memory and the right number of items
  1027. +     in the plot list is controlled by the plot_num variable.
  1028. +     Since gnuplot wants to do this sticky business, a free_list of 
  1029. +     curve_points is kept and then tagged onto the end of the plot list as
  1030. +     this seems more in the spirit of the original memory behavior than
  1031. +     simply freeing the memory.  I'm personally not convinced this sort
  1032. +     of concern is worth it since the time spent computing points seems
  1033. +     to dominate any garbage collecting that might be saved here...
  1034. + */
  1035. +     new_list = xp = start_plot; 
  1036. +     yp = xp->next_cp;
  1037. +    curve = 0;
  1038. +     for (; curve < *plot_num; xp = xp->next_cp,yp = yp->next_cp,curve++) {
  1039. +         if (xp->plot_type != FUNC) {
  1040. +             continue;
  1041. +         }
  1042. +     /* Here's a FUNC parametric function defined as two parts. */
  1043. +         --(*plot_num);
  1044. +     /* 
  1045. +         Go through all the points assigning the y's from xp to be the
  1046. +         x's for yp.  Check max's and min's as you go.
  1047. +     */
  1048. +         for (i = 0; i < yp->p_count; ++i) {
  1049. +         /* 
  1050. +             Throw away excess xp points, mark excess yp points as OUTRANGE.
  1051. +         */
  1052. +             if (i > xp->p_count) {
  1053. +                 yp->points[i].type == OUTRANGE;
  1054. +                 continue;
  1055. +             }
  1056. +         /* 
  1057. +             Just as we had to do when we computed y values--now check that
  1058. +             x's (computed parametrically) are in the permitted ranges as well.
  1059. +         */
  1060. +             temp = xp->points[i].y;   /* New x value for yp function. */
  1061. +             yp->points[i].x = temp;
  1062. +         /* For legitimate y values, let the x values decide if they plot. */
  1063. +             if (yp->points[i].type == INRANGE)
  1064. +                 yp->points[i].type = xp->points[i].type;  
  1065. +             if (autoscale_lx || polar
  1066. +                        || inrange(temp, lxmin, lxmax)) {
  1067. +                if (autoscale_lx && temp < lxmin) lxmin = temp;
  1068. +                 if (autoscale_lx && temp > lxmax) lxmax = temp;
  1069. +             } else
  1070. +             yp->points[i].type = OUTRANGE;  /* Due to x value. */
  1071. +         }
  1072. +    /* Ok, fix up the title to include both the xp and yp plots. */
  1073. +         if (xp->title && xp->title[0] != '\0') {
  1074. +             tlen = strlen (yp->title) + strlen (xp->title) + 3;
  1075. +           new_title = alloc ((unsigned int) tlen, "string");
  1076. +             strcpy (new_title, xp->title);  
  1077. +             strcat (new_title, ", ");       /* + 2 */
  1078. +             strcat (new_title, yp->title);  /* + 1 = + 3 */
  1079. +             free (yp->title);
  1080. +             yp->title = new_title;
  1081. +         }
  1082. +     /* Eliminate the first curve (xparam) and just use the second. */
  1083. +         if (xp == start_plot) {
  1084. +         /* Simply nip off the first element of the list. */
  1085. +             new_list = first_plot = yp;
  1086. +             xp = xp->next_cp;
  1087. +             if (yp->next_cp != NULL)
  1088. +                 yp = yp->next_cp;
  1089. +         /* Add start_plot to the free_list. */
  1090. +             if (free_head == NULL) {
  1091. +                 free_list = free_head = start_plot;
  1092. +                 free_head->next_cp = NULL;
  1093. +             } else {
  1094. +                 free_list->next_cp = start_plot;
  1095. +                 start_plot->next_cp = NULL;
  1096. +                 free_list = start_plot;
  1097. +             }
  1098. +         }
  1099. +         else {
  1100. +         /* Here, remove the xp node and replace it with the yp node. */
  1101. +            tmp = xp;
  1102. +         /* Pass over any data files that might have been in place. */
  1103. +             while (new_list->next_cp && new_list->next_cp != xp) 
  1104. +                 new_list = new_list->next_cp;
  1105. +             new_list->next_cp = yp;
  1106. +             new_list = new_list->next_cp;
  1107. +             xp = xp->next_cp;
  1108. +             if (yp->next_cp != NULL)
  1109. +                 yp = yp->next_cp;
  1110. +         /* Add tmp to the free_list. */
  1111. +             if (free_head == NULL) {
  1112. +                 free_list = free_head = tmp;
  1113. +             } else {
  1114. +                 free_list->next_cp = tmp;
  1115. +                 tmp->next_cp = NULL;
  1116. +                 free_list = tmp;
  1117. +             }
  1118. +         }
  1119. +     }
  1120. + /* Ok, stick the free list at the end of the curve_points plot list. */
  1121. +     while (new_list->next_cp != NULL)
  1122. +         new_list = new_list->next_cp;
  1123. +     new_list->next_cp = free_head;
  1124. + /* Report the overall graph mins and maxs. */
  1125. +     *x_min = lxmin;
  1126. +     *x_max = lxmax;
  1127. + }
  1128.   
  1129.   #ifdef MSDOS
  1130.   #ifndef __TURBOC__    /* Turbo C already has sleep() */
  1131. Common subdirectories: ./demo and ../gnuplot2.02/demo
  1132. Common subdirectories: ./docs and ../gnuplot2.02/docs
  1133. Only in .: gnuplot
  1134. diff -cr ./gnuplot_x11.c ../gnuplot2.02/gnuplot_x11.c
  1135. *** ./gnuplot_x11.c    Tue Sep 18 14:59:27 1990
  1136. --- ../gnuplot2.02/gnuplot_x11.c    Wed Nov 28 09:34:33 1990
  1137. ***************
  1138. *** 1,5
  1139.   /*-----------------------------------------------------------------------------
  1140. -  *
  1141.    *   gnuplot_x11 - X11 outboard terminal driver for gnuplot 2
  1142.    *
  1143.    *   Requires installation of companion inboard x11 driver in gnuplot/term.c
  1144.  
  1145. --- 1,4 -----
  1146.   /*-----------------------------------------------------------------------------
  1147.    *   gnuplot_x11 - X11 outboard terminal driver for gnuplot 2
  1148.    *
  1149.    *   Requires installation of companion inboard x11 driver in gnuplot/term.c
  1150. ***************
  1151. *** 8,13
  1152.    *      Chris Peterson (MIT) - original Xlib gnuplot support (and Xaw examples)
  1153.    *      Dana Chee (Bellcore)  - mods to original support for gnuplot 2.0
  1154.    *      Arthur Smith (Cornell) - graphical-label-widget idea (xplot)
  1155.    *
  1156.    *   This code is provided as is and with no warranties of any kind.
  1157.    *       
  1158.  
  1159. --- 7,13 -----
  1160.    *      Chris Peterson (MIT) - original Xlib gnuplot support (and Xaw examples)
  1161.    *      Dana Chee (Bellcore)  - mods to original support for gnuplot 2.0
  1162.    *      Arthur Smith (Cornell) - graphical-label-widget idea (xplot)
  1163. +  *      Hendri Hondorp (University of Twente, The Netherlands) - Motif xgnuplot
  1164.    *
  1165.    *   This code is provided as is and with no warranties of any kind.
  1166.    *       
  1167. ***************
  1168. *** 11,18
  1169.    *
  1170.    *   This code is provided as is and with no warranties of any kind.
  1171.    *       
  1172. !  *   Ed Kubaitis
  1173. !  *   Computing Services Office -  University of Illinois, Urbana
  1174.    *---------------------------------------------------------------------------*/
  1175.    
  1176.   #include <stdio.h>
  1177.  
  1178. --- 11,17 -----
  1179.    *
  1180.    *   This code is provided as is and with no warranties of any kind.
  1181.    *       
  1182. !  *   Ed Kubaitis - Computing Services Office -  University of Illinois, Urbana
  1183.    *---------------------------------------------------------------------------*/
  1184.    
  1185.   #include <stdio.h>
  1186. ***************
  1187. *** 16,21
  1188.    *---------------------------------------------------------------------------*/
  1189.    
  1190.   #include <stdio.h>
  1191.   #include <X11/Intrinsic.h>
  1192.   #include <X11/StringDefs.h>
  1193.   #include <Cardinals.h>      /* use -Idir for location on your system */
  1194.  
  1195. --- 15,21 -----
  1196.    *---------------------------------------------------------------------------*/
  1197.    
  1198.   #include <stdio.h>
  1199. + #include <signal.h>
  1200.   #include <X11/Intrinsic.h>
  1201.   #include <X11/StringDefs.h>
  1202.   #include <Label.h>          /* use -Idir for location on your system */
  1203. ***************
  1204. *** 18,24
  1205.   #include <stdio.h>
  1206.   #include <X11/Intrinsic.h>
  1207.   #include <X11/StringDefs.h>
  1208. - #include <Cardinals.h>      /* use -Idir for location on your system */
  1209.   #include <Label.h>          /* use -Idir for location on your system */
  1210.   
  1211.   
  1212.  
  1213. --- 18,23 -----
  1214.   #include <signal.h>
  1215.   #include <X11/Intrinsic.h>
  1216.   #include <X11/StringDefs.h>
  1217.   #include <Label.h>          /* use -Idir for location on your system */
  1218.   #ifdef MOTIF
  1219.   #include <Xm.h>             /* use -Idir for location on your system */
  1220. ***************
  1221. *** 20,25
  1222.   #include <X11/StringDefs.h>
  1223.   #include <Cardinals.h>      /* use -Idir for location on your system */
  1224.   #include <Label.h>          /* use -Idir for location on your system */
  1225.   
  1226.   
  1227.   #define Color (D>1)
  1228.  
  1229. --- 19,32 -----
  1230.   #include <X11/Intrinsic.h>
  1231.   #include <X11/StringDefs.h>
  1232.   #include <Label.h>          /* use -Idir for location on your system */
  1233. + #ifdef MOTIF
  1234. + #include <Xm.h>             /* use -Idir for location on your system */
  1235. + #define LabelWC xmLabelWidgetClass
  1236. + #define LabelBPM XmNbackgroundPixmap
  1237. + #else
  1238. + #define LabelWC labelWidgetClass
  1239. + #define LabelBPM XtNbitmap
  1240. + #endif
  1241.   
  1242.   #define Color (D>1)
  1243.   #define Ncolors 11
  1244. ***************
  1245. *** 21,27
  1246.   #include <Cardinals.h>      /* use -Idir for location on your system */
  1247.   #include <Label.h>          /* use -Idir for location on your system */
  1248.   
  1249.   #define Color (D>1)
  1250.   #define Ncolors 11
  1251.   unsigned long colors[Ncolors];
  1252.  
  1253. --- 28,33 -----
  1254.   #define LabelBPM XtNbitmap
  1255.   #endif
  1256.   
  1257.   #define Color (D>1)
  1258.   #define Ncolors 11
  1259.   unsigned long colors[Ncolors];
  1260. ***************
  1261. *** 27,33
  1262.   unsigned long colors[Ncolors];
  1263.   char color_keys[Ncolors][30] =   { "text", "border", "axis", 
  1264.      "line1", "line2", "line3", "line4", "line5", "line6", "line7", "line8" };
  1265.   char color_values[Ncolors][30] = { "black", "black", "black", 
  1266.      "red",  "green", "blue",  "magenta", "cyan", "sienna", "orange", "coral" };
  1267.   
  1268.  
  1269. --- 33,38 -----
  1270.   unsigned long colors[Ncolors];
  1271.   char color_keys[Ncolors][30] =   { "text", "border", "axis", 
  1272.      "line1", "line2", "line3", "line4", "line5", "line6", "line7", "line8" };
  1273.   char color_values[Ncolors][30] = { "black", "black", "black", 
  1274.      "red",  "green", "blue",  "magenta", "cyan", "sienna", "orange", "coral" };
  1275.   
  1276. ***************
  1277. *** 35,42
  1278.      {0}, {4,2,0}, {1,3,0}, {4,4,0}, {1,5,0}, {4,4,4,1,0}, {4,2,0}, {1,3,0}
  1279.      };
  1280.   
  1281. ! Widget w_top, w_label;
  1282. ! Window win;  Display *dpy;
  1283.   Pixmap pixmap;  GC gc = (GC)NULL;
  1284.   XFontStruct *font;
  1285.   unsigned long fg, bg;
  1286.  
  1287. --- 40,46 -----
  1288.      {0}, {4,2,0}, {1,3,0}, {4,4,0}, {1,5,0}, {4,4,4,1,0}, {4,2,0}, {1,3,0}
  1289.      };
  1290.   
  1291. ! Widget w_top, w_label; Window win; Display *dpy;
  1292.   Pixmap pixmap;  GC gc = (GC)NULL;
  1293.   Dimension W = 640 , H = 450;  int D;
  1294.   Arg args[5];
  1295. ***************
  1296. *** 38,45
  1297.   Widget w_top, w_label;
  1298.   Window win;  Display *dpy;
  1299.   Pixmap pixmap;  GC gc = (GC)NULL;
  1300. - XFontStruct *font;
  1301. - unsigned long fg, bg;
  1302.   Dimension W = 640 , H = 450;  int D;
  1303.   Arg args[5];
  1304.   static void gnuplot(), resize();
  1305.  
  1306. --- 42,47 -----
  1307.   
  1308.   Widget w_top, w_label; Window win; Display *dpy;
  1309.   Pixmap pixmap;  GC gc = (GC)NULL;
  1310.   Dimension W = 640 , H = 450;  int D;
  1311.   Arg args[5];
  1312.   static void gnuplot(), resize();
  1313. ***************
  1314. *** 53,58
  1315.   char buf[Nbuf];
  1316.   String *commands = NULL;
  1317.   
  1318.   /*-----------------------------------------------------------------------------
  1319.    *   main program - fire up application and callbacks
  1320.    *---------------------------------------------------------------------------*/
  1321.  
  1322. --- 55,76 -----
  1323.   char buf[Nbuf];
  1324.   String *commands = NULL;
  1325.   
  1326. + typedef struct {       /* See "X Toolkit Intrinsics Programming Manual"      */
  1327. +   XFontStruct *font;   /* Nye and O'Reilly, O'Reilly & Associates, pp. 80-85 */
  1328. +   unsigned long fg;
  1329. +   unsigned long bg;
  1330. +   } RValues, *RVptr; 
  1331. + RValues rv;
  1332. + XtResource resources[] = {
  1333. +    { XtNfont, XtCFont, XtRFontStruct, sizeof(XFontStruct *), 
  1334. +      XtOffset(RVptr, font), XtRString, "fixed" },
  1335. +    { XtNforeground, XtCForeground, XtRPixel, sizeof(Pixel), 
  1336. +      XtOffset(RVptr, fg), XtRString, XtDefaultForeground },
  1337. +    { XtNbackground, XtCBackground, XtRPixel, sizeof(Pixel), 
  1338. +      XtOffset(RVptr, bg), XtRString, XtDefaultBackground },
  1339. +    };
  1340.   /*-----------------------------------------------------------------------------
  1341.    *   main program - fire up application and callbacks
  1342.    *---------------------------------------------------------------------------*/
  1343. ***************
  1344. *** 59,64
  1345.   
  1346.   main(argc, argv) int argc; char *argv[]; {
  1347.   
  1348.      /* initialize application */
  1349.      w_top = XtInitialize("gnuplot", "Gnuplot", NULL, 0, &argc, argv);
  1350.      XtSetArg(args[0], XtNwidth, W);
  1351.  
  1352. --- 77,85 -----
  1353.   
  1354.   main(argc, argv) int argc; char *argv[]; {
  1355.   
  1356. +    signal(SIGINT, SIG_IGN);
  1357. +    signal(SIGTSTP, SIG_IGN);
  1358.      /* initialize application */
  1359.      w_top = XtInitialize("gnuplot", "Gnuplot", NULL, 0, &argc, argv);
  1360.      XtSetArg(args[0], XtNwidth, W);
  1361. ***************
  1362. *** 63,69
  1363.      w_top = XtInitialize("gnuplot", "Gnuplot", NULL, 0, &argc, argv);
  1364.      XtSetArg(args[0], XtNwidth, W);
  1365.      XtSetArg(args[1], XtNheight, H);
  1366. !    w_label = XtCreateManagedWidget("", labelWidgetClass, w_top, args, TWO);
  1367.      XtRealizeWidget(w_top);
  1368.   
  1369.      /* extract needed information */
  1370.  
  1371. --- 84,90 -----
  1372.      w_top = XtInitialize("gnuplot", "Gnuplot", NULL, 0, &argc, argv);
  1373.      XtSetArg(args[0], XtNwidth, W);
  1374.      XtSetArg(args[1], XtNheight, H);
  1375. !    w_label = XtCreateManagedWidget ("", LabelWC, w_top, args, (Cardinal)2);
  1376.      XtRealizeWidget(w_top);
  1377.   
  1378.      /* extract needed information */
  1379. ***************
  1380. *** 67,73
  1381.      XtRealizeWidget(w_top);
  1382.   
  1383.      /* extract needed information */
  1384. !    dpy = XtDisplay(w_top); win = XtWindow(w_top); D = DisplayPlanes(dpy,0);
  1385.      if (Color) {
  1386.         char option[20], *value; 
  1387.         XColor used, exact;
  1388.  
  1389. --- 88,95 -----
  1390.      XtRealizeWidget(w_top);
  1391.   
  1392.      /* extract needed information */
  1393. !    dpy = XtDisplay(w_top); win = XtWindow(w_label);
  1394. !    D = DisplayPlanes(dpy,DefaultScreen(dpy));
  1395.      if (Color) {
  1396.         char option[20], *value; 
  1397.         XColor used, exact; int n;
  1398. ***************
  1399. *** 70,77
  1400.      dpy = XtDisplay(w_top); win = XtWindow(w_top); D = DisplayPlanes(dpy,0);
  1401.      if (Color) {
  1402.         char option[20], *value; 
  1403. !       XColor used, exact;
  1404. !       int n;
  1405.   
  1406.         for(n=0; n<Ncolors; n++) {
  1407.        strcpy(option, color_keys[n]);
  1408.  
  1409. --- 92,98 -----
  1410.      D = DisplayPlanes(dpy,DefaultScreen(dpy));
  1411.      if (Color) {
  1412.         char option[20], *value; 
  1413. !       XColor used, exact; int n;
  1414.   
  1415.         for(n=0; n<Ncolors; n++) {
  1416.        strcpy(option, color_keys[n]);
  1417. ***************
  1418. *** 87,99
  1419.           }
  1420.        }
  1421.         }
  1422. !    XtSetArg(args[0], XtNfont, &font);
  1423. !    XtSetArg(args[1], XtNforeground, &fg);
  1424. !    XtSetArg(args[2], XtNbackground, &bg);
  1425. !    XtSetArg(args[3], XtNwidth, &W);
  1426. !    XtSetArg(args[4], XtNheight,&H);
  1427. !    XtGetValues(w_label, args, FIVE);
  1428. !    vchar = (font->ascent + font->descent);
  1429.   
  1430.      /* add callbacks on input-from-gnuplot-on-stdin & window-resized */
  1431.      XtAddInput(0, XtInputReadMask, gnuplot, NULL);
  1432.  
  1433. --- 108,118 -----
  1434.           }
  1435.        }
  1436.         }
  1437. !    XtSetArg(args[0], XtNwidth, &W);
  1438. !    XtSetArg(args[1], XtNheight,&H);
  1439. !    XtGetValues(w_label, args, (Cardinal)2);
  1440. !    XtGetApplicationResources(w_top, &rv, resources, XtNumber(resources),NULL,0);
  1441. !    vchar = (rv.font->ascent + rv.font->descent);
  1442.   
  1443.      /* add callbacks on input-from-gnuplot-on-stdin & window-resized */
  1444.      XtAddInput(0, XtInputReadMask, gnuplot, NULL);
  1445. ***************
  1446. *** 113,121
  1447.      /* set scaling factor between internal driver & window geometry */
  1448.      xscale = (double)W / 4096.;  yscale = (double)H / 4096.;  
  1449.   
  1450. -    /* return old pixmap  & GC, if any */
  1451. -    if (gc) { XFreeGC(dpy, gc); XFreePixmap(dpy, pixmap); }
  1452.      /* create new pixmap & GC */
  1453.      pixmap = XCreatePixmap(dpy, DefaultRootWindow(dpy), W, H, D);
  1454.      gc = XCreateGC(dpy, pixmap, 0, NULL);
  1455.  
  1456. --- 132,137 -----
  1457.      /* set scaling factor between internal driver & window geometry */
  1458.      xscale = (double)W / 4096.;  yscale = (double)H / 4096.;  
  1459.   
  1460.      /* create new pixmap & GC */
  1461.      if (gc) { XFreeGC(dpy, gc); XFreePixmap(dpy, pixmap); }
  1462.      pixmap = XCreatePixmap(dpy, RootWindow(dpy,DefaultScreen(dpy)), W, H, D);
  1463. ***************
  1464. *** 117,123
  1465.      if (gc) { XFreeGC(dpy, gc); XFreePixmap(dpy, pixmap); }
  1466.   
  1467.      /* create new pixmap & GC */
  1468. !    pixmap = XCreatePixmap(dpy, DefaultRootWindow(dpy), W, H, D);
  1469.      gc = XCreateGC(dpy, pixmap, 0, NULL);
  1470.      XSetFont(dpy, gc, font->fid);
  1471.   
  1472.  
  1473. --- 133,140 -----
  1474.      xscale = (double)W / 4096.;  yscale = (double)H / 4096.;  
  1475.   
  1476.      /* create new pixmap & GC */
  1477. !    if (gc) { XFreeGC(dpy, gc); XFreePixmap(dpy, pixmap); }
  1478. !    pixmap = XCreatePixmap(dpy, RootWindow(dpy,DefaultScreen(dpy)), W, H, D);
  1479.      gc = XCreateGC(dpy, pixmap, 0, NULL);
  1480.      XSetFont(dpy, gc, rv.font->fid);
  1481.   
  1482. ***************
  1483. *** 119,125
  1484.      /* create new pixmap & GC */
  1485.      pixmap = XCreatePixmap(dpy, DefaultRootWindow(dpy), W, H, D);
  1486.      gc = XCreateGC(dpy, pixmap, 0, NULL);
  1487. !    XSetFont(dpy, gc, font->fid);
  1488.   
  1489.      /* connect new pixmap to label widget */
  1490.      XtSetArg(args[0], XtNbitmap, pixmap);
  1491.  
  1492. --- 136,142 -----
  1493.      if (gc) { XFreeGC(dpy, gc); XFreePixmap(dpy, pixmap); }
  1494.      pixmap = XCreatePixmap(dpy, RootWindow(dpy,DefaultScreen(dpy)), W, H, D);
  1495.      gc = XCreateGC(dpy, pixmap, 0, NULL);
  1496. !    XSetFont(dpy, gc, rv.font->fid);
  1497.   
  1498.      /* erase pixmap */
  1499.   #ifndef MOTIF
  1500. ***************
  1501. *** 121,130
  1502.      gc = XCreateGC(dpy, pixmap, 0, NULL);
  1503.      XSetFont(dpy, gc, font->fid);
  1504.   
  1505. -    /* connect new pixmap to label widget */
  1506. -    XtSetArg(args[0], XtNbitmap, pixmap);
  1507. -    XtSetValues(w_label, args, ONE);
  1508.      /* erase pixmap */
  1509.      if (Color) {
  1510.         XSetForeground(dpy, gc, bg);
  1511.  
  1512. --- 138,143 -----
  1513.      gc = XCreateGC(dpy, pixmap, 0, NULL);
  1514.      XSetFont(dpy, gc, rv.font->fid);
  1515.   
  1516.      /* erase pixmap */
  1517.   #ifndef MOTIF
  1518.      if (Color) { /* Athena needs different erase for color and mono */
  1519. ***************
  1520. *** 126,133
  1521.      XtSetValues(w_label, args, ONE);
  1522.   
  1523.      /* erase pixmap */
  1524. !    if (Color) {
  1525. !       XSetForeground(dpy, gc, bg);
  1526.         XFillRectangle(dpy, pixmap, gc, 0, 0, W, H);
  1527.         XSetForeground(dpy, gc, fg);
  1528.         XSetBackground(dpy, gc, bg);
  1529.  
  1530. --- 139,148 -----
  1531.      XSetFont(dpy, gc, rv.font->fid);
  1532.   
  1533.      /* erase pixmap */
  1534. ! #ifndef MOTIF
  1535. !    if (Color) { /* Athena needs different erase for color and mono */
  1536. ! #endif
  1537. !       XSetForeground(dpy, gc, rv.bg);
  1538.         XFillRectangle(dpy, pixmap, gc, 0, 0, W, H);
  1539.         XSetForeground(dpy, gc, rv.fg);
  1540.         XSetBackground(dpy, gc, rv.bg);
  1541. ***************
  1542. *** 129,136
  1543.      if (Color) {
  1544.         XSetForeground(dpy, gc, bg);
  1545.         XFillRectangle(dpy, pixmap, gc, 0, 0, W, H);
  1546. !       XSetForeground(dpy, gc, fg);
  1547. !       XSetBackground(dpy, gc, bg);
  1548.         }
  1549.      else {
  1550.         XSetFunction(dpy, gc, GXxor);
  1551.  
  1552. --- 144,152 -----
  1553.   #endif
  1554.         XSetForeground(dpy, gc, rv.bg);
  1555.         XFillRectangle(dpy, pixmap, gc, 0, 0, W, H);
  1556. !       XSetForeground(dpy, gc, rv.fg);
  1557. !       XSetBackground(dpy, gc, rv.bg);
  1558. ! #ifndef MOTIF
  1559.         }
  1560.      else {  
  1561.         XSetFunction(dpy, gc, GXxor);
  1562. ***************
  1563. *** 132,138
  1564.         XSetForeground(dpy, gc, fg);
  1565.         XSetBackground(dpy, gc, bg);
  1566.         }
  1567. !    else {
  1568.         XSetFunction(dpy, gc, GXxor);
  1569.         XCopyArea(dpy, pixmap, pixmap, gc, 0, 0, W, H, 0, 0);
  1570.         XSetFunction(dpy, gc, GXcopyInverted);
  1571.  
  1572. --- 148,154 -----
  1573.         XSetBackground(dpy, gc, rv.bg);
  1574.   #ifndef MOTIF
  1575.         }
  1576. !    else {  
  1577.         XSetFunction(dpy, gc, GXxor);
  1578.         XCopyArea(dpy, pixmap, pixmap, gc, 0, 0, W, H, 0, 0);
  1579.         XSetFunction(dpy, gc, GXcopyInverted);
  1580. ***************
  1581. *** 137,142
  1582.         XCopyArea(dpy, pixmap, pixmap, gc, 0, 0, W, H, 0, 0);
  1583.         XSetFunction(dpy, gc, GXcopyInverted);
  1584.         }
  1585.   
  1586.      /* loop over accumulated commands from inboard driver */
  1587.      for (n=0; n<nc; n++) {
  1588.  
  1589. --- 153,159 -----
  1590.         XCopyArea(dpy, pixmap, pixmap, gc, 0, 0, W, H, 0, 0);
  1591.         XSetFunction(dpy, gc, GXcopyInverted);
  1592.         }
  1593. + #endif
  1594.   
  1595.      /* connect new pixmap to label widget */
  1596.      XtSetArg(args[0], LabelBPM, pixmap);
  1597. ***************
  1598. *** 138,143
  1599.         XSetFunction(dpy, gc, GXcopyInverted);
  1600.         }
  1601.   
  1602.      /* loop over accumulated commands from inboard driver */
  1603.      for (n=0; n<nc; n++) {
  1604.         buf = commands[n];
  1605.  
  1606. --- 155,164 -----
  1607.         }
  1608.   #endif
  1609.   
  1610. +    /* connect new pixmap to label widget */
  1611. +    XtSetArg(args[0], LabelBPM, pixmap);
  1612. +    XtSetValues(w_label, args, (Cardinal)1);
  1613.      /* loop over accumulated commands from inboard driver */
  1614.      for (n=0; n<nc; n++) {
  1615.         buf = commands[n];
  1616. ***************
  1617. *** 157,163
  1618.         else if (*buf == 'T') { 
  1619.        sscanf(buf, "T%4d%4d", &x, &y);  
  1620.        str = buf + 9; sl = strlen(str) - 1;
  1621. !      sw = XTextWidth(font, str, sl);
  1622.        switch(jmode) {
  1623.           case LEFT:   sw = 0;     break;
  1624.           case CENTRE: sw = -sw/2; break;
  1625.  
  1626. --- 178,184 -----
  1627.         else if (*buf == 'T') { 
  1628.        sscanf(buf, "T%4d%4d", &x, &y);  
  1629.        str = buf + 9; sl = strlen(str) - 1;
  1630. !      sw = XTextWidth(rv.font, str, sl);
  1631.        switch(jmode) {
  1632.           case LEFT:   sw = 0;     break;
  1633.           case CENTRE: sw = -sw/2; break;
  1634. ***************
  1635. *** 205,210
  1636.   
  1637.   /*-----------------------------------------------------------------------------
  1638.    *   gnuplot - Xt callback on input from gnuplot inboard X11 driver
  1639.    *---------------------------------------------------------------------------*/
  1640.   
  1641.   static void
  1642.  
  1643. --- 226,232 -----
  1644.   
  1645.   /*-----------------------------------------------------------------------------
  1646.    *   gnuplot - Xt callback on input from gnuplot inboard X11 driver
  1647. +  *   resize - Xt callback when window resized
  1648.    *---------------------------------------------------------------------------*/
  1649.   
  1650.   static void
  1651. ***************
  1652. *** 213,220
  1653.      while (fgets(buf, Nbuf, stdin)) {
  1654.        if (*buf == 'G') {                           /* enter graphics mode */
  1655.        if (commands) {
  1656. !         int n;
  1657. !         for (n=0; n<nc; n++) XtFree(commands[n]);
  1658.           XtFree(commands);
  1659.           }
  1660.        commands = NULL; nc = 0;
  1661.  
  1662. --- 235,241 -----
  1663.      while (fgets(buf, Nbuf, stdin)) {
  1664.        if (*buf == 'G') {                           /* enter graphics mode */
  1665.        if (commands) {
  1666. !         int n; for (n=0; n<nc; n++) XtFree(commands[n]);
  1667.           XtFree(commands);
  1668.           }
  1669.        commands = NULL; nc = 0;
  1670. ***************
  1671. *** 228,237
  1672.         }
  1673.      if (feof(stdin) || ferror(stdin)) exit(0);
  1674.      }
  1675. - /*-----------------------------------------------------------------------------
  1676. -  *   resize - Xt callback when window resized
  1677. -  *---------------------------------------------------------------------------*/
  1678.   
  1679.   static void
  1680.   resize(w, cd, e) Widget w; char *cd; XConfigureEvent *e; {
  1681.  
  1682. --- 249,254 -----
  1683.         }
  1684.      if (feof(stdin) || ferror(stdin)) exit(0);
  1685.      }
  1686.   
  1687.   static void
  1688.   resize(w, cd, e) Widget w; char *cd; XConfigureEvent *e; {
  1689.